Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1505)

Unified Diff: cc/layers/layer_impl.cc

Issue 2840433002: Move LayerImpl's bounds_delta to property trees (Closed)
Patch Set: Document ViewportBoundsDelta better Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698