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

Unified Diff: cc/layers/layer_impl.cc

Issue 2840433002: Move LayerImpl's bounds_delta to property trees (Closed)
Patch Set: NOTREACHED 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
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index ea79a82eda68aa97735c5f61fe7e944ba7773a77..5459023623ed81306fb2d82c7eb99040a5c5efcd 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())
+ 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
+ NOTREACHED();
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;
}

Powered by Google App Engine
This is Rietveld 408576698