summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 02:09:42 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 02:09:42 +0000
commita131f5300cacb9d6b24c8e2ef9955c2e06666713 (patch)
treeac7d9a17768fe2def84061df3cf6010bfd09c84e /content/browser
parentbb7db6ba5e1d1ad25a22adcb74e02c2a6c50b2bc (diff)
downloadchromium_src-a131f5300cacb9d6b24c8e2ef9955c2e06666713.zip
chromium_src-a131f5300cacb9d6b24c8e2ef9955c2e06666713.tar.gz
chromium_src-a131f5300cacb9d6b24c8e2ef9955c2e06666713.tar.bz2
Fix virtual keyboard.
Virtual keyboard starts with a height of 0, which makes us wait for a frame at that size which will never come. RWHI will skip the resizes for this, hence will not throttle the next (correct) size, which will come in but then be discarded. Make sure not to create a resize lock for empty sizes. BUG=374196 Review URL: https://codereview.chromium.org/284413002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/compositor/delegated_frame_host.cc22
-rw-r--r--content/browser/compositor/delegated_frame_host.h4
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc20
3 files changed, 28 insertions, 18 deletions
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index 229d190..a7207ea 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -25,7 +25,17 @@ namespace content {
// DelegatedFrameHostClient
bool DelegatedFrameHostClient::ShouldCreateResizeLock() {
+ // On Windows and Linux, holding pointer moves will not help throttling
+ // resizes.
+ // TODO(piman): on Windows we need to block (nested message loop?) the
+ // WM_SIZE event. On Linux we need to throttle at the WM level using
+ // _NET_WM_SYNC_REQUEST.
+ // TODO(ccameron): Mac browser window resizing is incompletely implemented.
+#if !defined(OS_CHROMEOS)
+ return false;
+#else
return GetDelegatedFrameHost()->ShouldCreateResizeLock();
+#endif
}
void DelegatedFrameHostClient::RequestCopyOfOutput(
@@ -82,15 +92,6 @@ void DelegatedFrameHost::MaybeCreateResizeLock() {
}
bool DelegatedFrameHost::ShouldCreateResizeLock() {
- // On Windows and Linux, holding pointer moves will not help throttling
- // resizes.
- // TODO(piman): on Windows we need to block (nested message loop?) the
- // WM_SIZE event. On Linux we need to throttle at the WM level using
- // _NET_WM_SYNC_REQUEST.
- // TODO(ccameron): Mac browser window resizing is incompletely implemented.
-#if !defined(OS_CHROMEOS)
- return false;
-#else
RenderWidgetHostImpl* host = client_->GetHost();
if (resize_lock_)
@@ -100,7 +101,7 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() {
return false;
gfx::Size desired_size = client_->DesiredFrameSize();
- if (desired_size == current_frame_size_in_dip_)
+ if (desired_size == current_frame_size_in_dip_ || desired_size.IsEmpty())
return false;
ui::Compositor* compositor = client_->GetCompositor();
@@ -108,7 +109,6 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() {
return false;
return true;
-#endif
}
void DelegatedFrameHost::RequestCopyOfOutput(
diff --git a/content/browser/compositor/delegated_frame_host.h b/content/browser/compositor/delegated_frame_host.h
index 6cf8026..f4f0b3f 100644
--- a/content/browser/compositor/delegated_frame_host.h
+++ b/content/browser/compositor/delegated_frame_host.h
@@ -109,12 +109,10 @@ class CONTENT_EXPORT DelegatedFrameHost
cc::DelegatedFrameProvider* FrameProviderForTesting() const {
return frame_provider_.get();
}
- gfx::Size CurrentFrameSizeInDIPForTesting() const {
- return current_frame_size_in_dip_;
- }
void OnCompositingDidCommitForTesting(ui::Compositor* compositor) {
OnCompositingDidCommit(compositor);
}
+ bool ShouldCreateResizeLockForTesting() { return ShouldCreateResizeLock(); }
private:
friend class DelegatedFrameHostClient;
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index fc2ee89..09b7893 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -169,9 +169,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura {
}
virtual bool ShouldCreateResizeLock() OVERRIDE {
- gfx::Size desired_size = window()->bounds().size();
- return desired_size !=
- GetDelegatedFrameHost()->CurrentFrameSizeInDIPForTesting();
+ return GetDelegatedFrameHost()->ShouldCreateResizeLockForTesting();
}
virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request)
@@ -988,7 +986,6 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) {
// Lock the compositor. Now we should drop frames.
view_rect = gfx::Rect(150, 150);
view_->SetSize(view_rect.size());
- view_->GetDelegatedFrameHost()->MaybeCreateResizeLock();
// This frame is dropped.
gfx::Rect dropped_damage_rect_1(10, 20, 30, 40);
@@ -1025,6 +1022,21 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) {
view_->RunOnCompositingDidCommit();
+ // Resize to something empty.
+ view_rect = gfx::Rect(100, 0);
+ view_->SetSize(view_rect.size());
+
+ // We're never expecting empty frames, resize to something non-empty.
+ view_rect = gfx::Rect(100, 100);
+ view_->SetSize(view_rect.size());
+
+ // This frame should not be dropped.
+ EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect));
+ view_->OnSwapCompositorFrame(
+ 0, MakeDelegatedFrame(1.f, view_rect.size(), view_rect));
+ testing::Mock::VerifyAndClearExpectations(&observer);
+ view_->RunOnCompositingDidCommit();
+
view_->window_->RemoveObserver(&observer);
}