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

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: Remove LayerImpl from ScrollAnimated 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
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 6cdc4234b68b3099a485fda32f3511fa46ee71cc..2221f6b2e83e06f22f53f06190a3c90a90f10c76 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,24 @@ bool LayerImpl::scrollable() const {
return scroll_clip_layer_id_ != Layer::INVALID_ID;
}
+void LayerImpl::set_user_scrollable_horizontal(bool scrollable) {
+ user_scrollable_horizontal_ = scrollable;
+ if (!layer_tree_impl_->property_trees()->needs_rebuild && layer_tree_impl_ &&
ajuma 2016/03/16 21:49:24 Horizontal/vertical scrollability should never cha
sunxd 2016/03/16 23:30:23 Done.
+ scroll_tree_index_ != -1)
+ layer_tree_impl_->property_trees()
+ ->scroll_tree.Node(scroll_tree_index_)
+ ->data.user_scrollable_horizontal = scrollable;
+}
+
+void LayerImpl::set_user_scrollable_vertical(bool scrollable) {
+ user_scrollable_vertical_ = scrollable;
+ if (!layer_tree_impl_->property_trees()->needs_rebuild && layer_tree_impl_ &&
+ scroll_tree_index_ != -1)
+ layer_tree_impl_->property_trees()
+ ->scroll_tree.Node(scroll_tree_index_)
+ ->data.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/viewport.cc » ('j') | cc/trees/property_tree.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698