Commit 59adb115 authored by aelias@chromium.org's avatar aelias@chromium.org

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
parent 0847ada9
......@@ -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();
}
}
}
......
......@@ -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() {}
......
......@@ -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;
}
......
......@@ -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() {
......
......@@ -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;
......
......@@ -49,7 +49,7 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
return;
}
}
impl->setNeedsRedraw();
impl->SetNeedsRedraw();
if (full_damage_each_frame_)
impl->SetFullRootLayerDamage();
}
......
......@@ -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:
......
......@@ -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 {
......
......@@ -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 {
......
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