Commit a131f530 authored by piman@chromium.org's avatar piman@chromium.org

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
parent bb7db6ba
......@@ -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(
......
......@@ -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;
......
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment