Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index f1ca86a348d91a36d043cc34624d8584b5eb7e08..3643cfef460a904c3ef67e5ae85ab08430392c39 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() { |
@@ -504,14 +504,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) { |
@@ -525,12 +526,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()) |
+ return; |
PropertyTrees* property_trees = GetPropertyTrees(); |
if (this == layer_tree_impl()->InnerViewportContainerLayer()) |
@@ -539,6 +539,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 |
+ NOTREACHED(); |
layer_tree_impl()->DidUpdateScrollState(id()); |
@@ -558,6 +560,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; |
} |