Chromium Code Reviews| Index: cc/layers/layer_impl.cc |
| diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
| index ea79a82eda68aa97735c5f61fe7e944ba7773a77..c17873affbb22815e0bbe7aab721831034c7594c 100644 |
| --- a/cc/layers/layer_impl.cc |
| +++ b/cc/layers/layer_impl.cc |
| @@ -382,7 +382,7 @@ gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { |
| if (!scroll_clip_layer) |
| return gfx::Vector2dF(); |
| - return scroll_clip_layer->bounds_delta(); |
| + return scroll_clip_layer->ViewportBoundsDelta(); |
| } |
| std::unique_ptr<base::DictionaryValue> LayerImpl::LayerTreeAsJson() { |
| @@ -506,14 +506,15 @@ bool LayerImpl::IsActive() const { |
| } |
| gfx::Size LayerImpl::bounds() const { |
| - gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); |
| - return gfx::Size(bounds_.width() + delta.x(), |
| - bounds_.height() + delta.y()); |
| + auto viewport_bounds_delta = gfx::ToCeiledVector2d(ViewportBoundsDelta()); |
| + return gfx::Size(bounds_.width() + viewport_bounds_delta.x(), |
| + bounds_.height() + viewport_bounds_delta.y()); |
| } |
| gfx::SizeF LayerImpl::BoundsForScrolling() const { |
| - return gfx::SizeF(bounds_.width() + bounds_delta_.x(), |
| - bounds_.height() + bounds_delta_.y()); |
| + auto viewport_bounds_delta = ViewportBoundsDelta(); |
| + return gfx::SizeF(bounds_.width() + viewport_bounds_delta.x(), |
| + bounds_.height() + viewport_bounds_delta.y()); |
| } |
| void LayerImpl::SetBounds(const gfx::Size& bounds) { |
| @@ -527,12 +528,11 @@ void LayerImpl::SetBounds(const gfx::Size& bounds) { |
| NoteLayerPropertyChanged(); |
| } |
| -void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
| +void LayerImpl::SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
| DCHECK(IsActive()); |
| - if (bounds_delta_ == bounds_delta) |
| - return; |
| - bounds_delta_ = bounds_delta; |
| + if (bounds_delta == ViewportBoundsDelta()) |
|
enne (OOO)
2017/04/24 18:05:08
This is premature optimization, but I think this c
pdr.
2017/04/24 20:06:49
I wanted to preserve the behavior that DidUpdateSc
|
| + return; |
| PropertyTrees* property_trees = GetPropertyTrees(); |
| if (this == layer_tree_impl()->InnerViewportContainerLayer()) |
| @@ -541,6 +541,8 @@ void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
| property_trees->SetOuterViewportContainerBoundsDelta(bounds_delta); |
| else if (this == layer_tree_impl()->InnerViewportScrollLayer()) |
| property_trees->SetInnerViewportScrollBoundsDelta(bounds_delta); |
| + else |
| + DCHECK(false); |
|
ajuma
2017/04/24 17:37:09
NOTREACHED()
pdr.
2017/04/24 20:06:49
Done
|
| layer_tree_impl()->DidUpdateScrollState(id()); |
| @@ -560,6 +562,16 @@ void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
| } |
| } |
| +gfx::Vector2dF LayerImpl::ViewportBoundsDelta() const { |
| + if (this == layer_tree_impl()->InnerViewportContainerLayer()) |
| + return GetPropertyTrees()->inner_viewport_container_bounds_delta(); |
| + else if (this == layer_tree_impl()->OuterViewportContainerLayer()) |
| + return GetPropertyTrees()->outer_viewport_container_bounds_delta(); |
| + else if (this == layer_tree_impl()->InnerViewportScrollLayer()) |
| + return GetPropertyTrees()->inner_viewport_scroll_bounds_delta(); |
| + return gfx::Vector2dF(); |
| +} |
| + |
| ScrollbarLayerImplBase* LayerImpl::ToScrollbarLayer() { |
| return nullptr; |
| } |