summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 04:48:44 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 04:48:44 +0000
commit59adb11526935835e809cc1d3c990a10985a0023 (patch)
tree325241a0fc219cf5d1c0864e651d6f3018039a55
parent0847ada9dc32754f004601f574d9d8d46a24c5f3 (diff)
downloadchromium_src-59adb11526935835e809cc1d3c990a10985a0023.zip
chromium_src-59adb11526935835e809cc1d3c990a10985a0023.tar.gz
chromium_src-59adb11526935835e809cc1d3c990a10985a0023.tar.bz2
Damage root layer when viewport or top controls changes.
http://crrev.com/192706 broke top controls hiding because this situation doesn't cause any damage, meaning no renderer frames are sent. Fix it by causing full root layer damage whenever one of the inputs to VisibleViewportSize changes. NOTRY=true BUG=229138 Review URL: https://chromiumcodereview.appspot.com/13817003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193011 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/input/top_controls_manager.cc9
-rw-r--r--cc/input/top_controls_manager_client.h5
-rw-r--r--cc/input/top_controls_manager_unittest.cc7
-rw-r--r--cc/trees/layer_tree_host_impl.cc13
-rw-r--r--cc/trees/layer_tree_host_impl.h6
-rw-r--r--cc/trees/layer_tree_host_perftest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_delegated.cc5
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc4
-rw-r--r--cc/trees/layer_tree_impl.cc2
9 files changed, 24 insertions, 29 deletions
diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
index 343dd3c..971ba0c 100644
--- a/cc/input/top_controls_manager.cc
+++ b/cc/input/top_controls_manager.cc
@@ -78,7 +78,7 @@ void TopControlsManager::UpdateTopControlsState(bool enable_hiding,
} else {
controls_top_offset_ = final_controls_position;
}
- client_->setNeedsRedraw();
+ client_->DidChangeTopControlsPosition();
}
}
@@ -126,12 +126,11 @@ void TopControlsManager::SetControlsTopOffset(float controls_top_offset) {
controls_top_offset_ = controls_top_offset;
- client_->setNeedsRedraw();
- client_->setActiveTreeNeedsUpdateDrawProperties();
+ client_->DidChangeTopControlsPosition();
}
gfx::Vector2dF TopControlsManager::Animate(base::TimeTicks monotonic_time) {
- if (!top_controls_animation_ || !client_->haveRootScrollLayer())
+ if (!top_controls_animation_ || !client_->HaveRootScrollLayer())
return gfx::Vector2dF();
double time = (monotonic_time - base::TimeTicks()).InMillisecondsF();
@@ -191,7 +190,7 @@ void TopControlsManager::StartAnimationIfNecessary() {
if (show_controls != NO_ANIMATION &&
(!top_controls_animation_ || animation_direction_ != show_controls)) {
SetupAnimation(show_controls);
- client_->setNeedsRedraw();
+ client_->DidChangeTopControlsPosition();
}
}
}
diff --git a/cc/input/top_controls_manager_client.h b/cc/input/top_controls_manager_client.h
index b90de7c8..5fed3bf 100644
--- a/cc/input/top_controls_manager_client.h
+++ b/cc/input/top_controls_manager_client.h
@@ -11,9 +11,8 @@ class LayerTreeImpl;
class CC_EXPORT TopControlsManagerClient {
public:
- virtual void setNeedsRedraw() = 0;
- virtual void setActiveTreeNeedsUpdateDrawProperties() = 0;
- virtual bool haveRootScrollLayer() const = 0;
+ virtual void DidChangeTopControlsPosition() = 0;
+ virtual bool HaveRootScrollLayer() const = 0;
protected:
virtual ~TopControlsManagerClient() {}
diff --git a/cc/input/top_controls_manager_unittest.cc b/cc/input/top_controls_manager_unittest.cc
index b3bc722c..4fb1bef 100644
--- a/cc/input/top_controls_manager_unittest.cc
+++ b/cc/input/top_controls_manager_unittest.cc
@@ -34,15 +34,12 @@ class MockTopControlsManagerClient : public TopControlsManagerClient {
virtual ~MockTopControlsManagerClient() {}
- virtual void setNeedsRedraw() OVERRIDE {
+ virtual void DidChangeTopControlsPosition() OVERRIDE {
redraw_needed_ = true;
- }
-
- virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE {
update_draw_properties_needed_ = true;
}
- virtual bool haveRootScrollLayer() const OVERRIDE {
+ virtual bool HaveRootScrollLayer() const OVERRIDE {
return true;
}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 7152fcb..4eeaf46 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1160,7 +1160,7 @@ void LayerTreeHostImpl::Readback(void* pixels,
renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport);
}
-bool LayerTreeHostImpl::haveRootScrollLayer() const {
+bool LayerTreeHostImpl::HaveRootScrollLayer() const {
return !!RootScrollLayer();
}
@@ -1383,6 +1383,7 @@ void LayerTreeHostImpl::SetViewportSize(gfx::Size layout_viewport_size,
renderer_->ViewportChanged();
client_->OnCanDrawStateChanged(CanDraw());
+ SetFullRootLayerDamage();
}
static void AdjustScrollsForPageScaleChange(LayerImpl* layer_impl,
@@ -1408,6 +1409,7 @@ void LayerTreeHostImpl::SetOverdrawBottomHeight(float overdraw_bottom_height) {
overdraw_bottom_height_ = overdraw_bottom_height;
UpdateMaxScrollOffset();
+ SetFullRootLayerDamage();
}
void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) {
@@ -1416,18 +1418,17 @@ void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) {
device_scale_factor_ = device_scale_factor;
UpdateMaxScrollOffset();
+ SetFullRootLayerDamage();
}
void LayerTreeHostImpl::UpdateMaxScrollOffset() {
active_tree_->UpdateMaxScrollOffset();
}
-void LayerTreeHostImpl::setActiveTreeNeedsUpdateDrawProperties() {
- active_tree_->set_needs_update_draw_properties();
-}
-
-void LayerTreeHostImpl::setNeedsRedraw() {
+void LayerTreeHostImpl::DidChangeTopControlsPosition() {
client_->SetNeedsRedrawOnImplThread();
+ active_tree_->set_needs_update_draw_properties();
+ SetFullRootLayerDamage();
}
bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 0730c73..4ad081a 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -114,9 +114,8 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE;
// TopControlsManagerClient implementation.
- virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
- virtual void setNeedsRedraw() OVERRIDE;
- virtual bool haveRootScrollLayer() const OVERRIDE;
+ virtual void DidChangeTopControlsPosition() OVERRIDE;
+ virtual bool HaveRootScrollLayer() const OVERRIDE;
void StartScrollbarAnimation(base::TimeTicks now);
@@ -233,6 +232,7 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
bool visible() const { return visible_; }
void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
+ void SetNeedsRedraw() { client_->SetNeedsRedrawOnImplThread(); }
size_t memory_allocation_limit_bytes() const {
return managed_memory_policy_.bytes_limit_when_visible;
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc
index 8f247e8..ff4b8ca 100644
--- a/cc/trees/layer_tree_host_perftest.cc
+++ b/cc/trees/layer_tree_host_perftest.cc
@@ -49,7 +49,7 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
return;
}
}
- impl->setNeedsRedraw();
+ impl->SetNeedsRedraw();
if (full_damage_each_frame_)
impl->SetFullRootLayerDamage();
}
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 380113a..a44509c 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -262,9 +262,8 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
switch (host_impl->active_tree()->source_frame_number()) {
case 0:
- // Before the layer has a frame to display it should not
- // be visible at all, and not damage anything.
- EXPECT_EQ(gfx::RectF(0.f, 0.f, 0.f, 0.f).ToString(),
+ // First frame is damaged because of viewport resize.
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 10.f, 10.f).ToString(),
damage_rect.ToString());
break;
case 1:
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index fbe6c9a..76a369b 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -496,7 +496,7 @@ class ImplSidePaintingScrollTest : public LayerTreeHostScrollTest {
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
// Manual vsync tick.
if (impl->pending_tree())
- impl->setNeedsRedraw();
+ impl->SetNeedsRedraw();
}
};
@@ -541,7 +541,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest {
// We force a second draw here of the first commit before activating
// the second commit.
if (impl->active_tree()->source_frame_number() == 0)
- impl->setNeedsRedraw();
+ impl->SetNeedsRedraw();
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index fa4584c..95308cb 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -508,7 +508,7 @@ void LayerTreeImpl::SetNeedsCommit() {
}
void LayerTreeImpl::SetNeedsRedraw() {
- layer_tree_host_impl_->setNeedsRedraw();
+ layer_tree_host_impl_->SetNeedsRedraw();
}
const LayerTreeDebugState& LayerTreeImpl::debug_state() const {