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

Unified Diff: cc/layers/layer_impl.cc

Issue 1805343006: cc: Impl thread scroll on ScrollNode instead of LayerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve comments Created 4 years, 9 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 6cdc4234b68b3099a485fda32f3511fa46ee71cc..dbfd5fcb073c070060c15b15243b050bc23141a1 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -207,7 +207,9 @@ void LayerImpl::DistributeScroll(ScrollState* scroll_state) {
void LayerImpl::ApplyScroll(ScrollState* scroll_state) {
DCHECK(scroll_state);
- layer_tree_impl()->ApplyScroll(this, scroll_state);
+ ScrollNode* node = layer_tree_impl()->property_trees()->scroll_tree.Node(
+ scroll_tree_index());
+ layer_tree_impl()->ApplyScroll(node, scroll_state);
}
void LayerImpl::SetNumDescendantsThatDrawContent(int num_descendants) {
@@ -427,20 +429,9 @@ void LayerImpl::GetContentsResourceId(ResourceId* resource_id,
}
gfx::Vector2dF LayerImpl::ScrollBy(const gfx::Vector2dF& scroll) {
- gfx::ScrollOffset adjusted_scroll(scroll);
- if (!user_scrollable_horizontal_)
- adjusted_scroll.set_x(0);
- if (!user_scrollable_vertical_)
- adjusted_scroll.set_y(0);
- DCHECK(scrollable());
- gfx::ScrollOffset old_offset = CurrentScrollOffset();
- gfx::ScrollOffset new_offset =
- ClampScrollOffsetToLimits(old_offset + adjusted_scroll);
- SetCurrentScrollOffset(new_offset);
-
- gfx::ScrollOffset unscrolled =
- old_offset + gfx::ScrollOffset(scroll) - new_offset;
- return gfx::Vector2dF(unscrolled.x(), unscrolled.y());
+ ScrollTree& scroll_tree = layer_tree_impl()->property_trees()->scroll_tree;
+ ScrollNode* scroll_node = scroll_tree.Node(scroll_tree_index());
+ return scroll_tree.ScrollBy(scroll_node, scroll, layer_tree_impl());
}
void LayerImpl::SetScrollClipLayer(int scroll_clip_layer_id) {
@@ -460,6 +451,14 @@ bool LayerImpl::scrollable() const {
return scroll_clip_layer_id_ != Layer::INVALID_ID;
}
+void LayerImpl::set_user_scrollable_horizontal(bool scrollable) {
+ user_scrollable_horizontal_ = scrollable;
+}
+
+void LayerImpl::set_user_scrollable_vertical(bool scrollable) {
+ user_scrollable_vertical_ = scrollable;
+}
+
bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const {
return (orientation == HORIZONTAL) ? user_scrollable_horizontal_
: user_scrollable_vertical_;
« 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