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 { ...@@ -25,7 +25,17 @@ namespace content {
// DelegatedFrameHostClient // DelegatedFrameHostClient
bool DelegatedFrameHostClient::ShouldCreateResizeLock() { 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(); return GetDelegatedFrameHost()->ShouldCreateResizeLock();
#endif
} }
void DelegatedFrameHostClient::RequestCopyOfOutput( void DelegatedFrameHostClient::RequestCopyOfOutput(
...@@ -82,15 +92,6 @@ void DelegatedFrameHost::MaybeCreateResizeLock() { ...@@ -82,15 +92,6 @@ void DelegatedFrameHost::MaybeCreateResizeLock() {
} }
bool DelegatedFrameHost::ShouldCreateResizeLock() { 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(); RenderWidgetHostImpl* host = client_->GetHost();
if (resize_lock_) if (resize_lock_)
...@@ -100,7 +101,7 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() { ...@@ -100,7 +101,7 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() {
return false; return false;
gfx::Size desired_size = client_->DesiredFrameSize(); 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; return false;
ui::Compositor* compositor = client_->GetCompositor(); ui::Compositor* compositor = client_->GetCompositor();
...@@ -108,7 +109,6 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() { ...@@ -108,7 +109,6 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() {
return false; return false;
return true; return true;
#endif
} }
void DelegatedFrameHost::RequestCopyOfOutput( void DelegatedFrameHost::RequestCopyOfOutput(
......
...@@ -109,12 +109,10 @@ class CONTENT_EXPORT DelegatedFrameHost ...@@ -109,12 +109,10 @@ class CONTENT_EXPORT DelegatedFrameHost
cc::DelegatedFrameProvider* FrameProviderForTesting() const { cc::DelegatedFrameProvider* FrameProviderForTesting() const {
return frame_provider_.get(); return frame_provider_.get();
} }
gfx::Size CurrentFrameSizeInDIPForTesting() const {
return current_frame_size_in_dip_;
}
void OnCompositingDidCommitForTesting(ui::Compositor* compositor) { void OnCompositingDidCommitForTesting(ui::Compositor* compositor) {
OnCompositingDidCommit(compositor); OnCompositingDidCommit(compositor);
} }
bool ShouldCreateResizeLockForTesting() { return ShouldCreateResizeLock(); }
private: private:
friend class DelegatedFrameHostClient; friend class DelegatedFrameHostClient;
......
...@@ -169,9 +169,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { ...@@ -169,9 +169,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura {
} }
virtual bool ShouldCreateResizeLock() OVERRIDE { virtual bool ShouldCreateResizeLock() OVERRIDE {
gfx::Size desired_size = window()->bounds().size(); return GetDelegatedFrameHost()->ShouldCreateResizeLockForTesting();
return desired_size !=
GetDelegatedFrameHost()->CurrentFrameSizeInDIPForTesting();
} }
virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request)
...@@ -988,7 +986,6 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { ...@@ -988,7 +986,6 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) {
// Lock the compositor. Now we should drop frames. // Lock the compositor. Now we should drop frames.
view_rect = gfx::Rect(150, 150); view_rect = gfx::Rect(150, 150);
view_->SetSize(view_rect.size()); view_->SetSize(view_rect.size());
view_->GetDelegatedFrameHost()->MaybeCreateResizeLock();
// This frame is dropped. // This frame is dropped.
gfx::Rect dropped_damage_rect_1(10, 20, 30, 40); gfx::Rect dropped_damage_rect_1(10, 20, 30, 40);
...@@ -1025,6 +1022,21 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { ...@@ -1025,6 +1022,21 @@ TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) {
view_->RunOnCompositingDidCommit(); 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); 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