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

Unified Diff: cc/trees/property_tree.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
« cc/layers/layer_impl.cc ('K') | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index c3514e15f98361c270b1d7d68cda89b77c0840d4..d58f9e1591cefa6466e5ce178fed8da90e6b2e1e 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "cc/base/math_util.h"
#include "cc/input/main_thread_scrolling_reason.h"
+#include "cc/input/scroll_state.h"
#include "cc/layers/layer_impl.h"
#include "cc/proto/gfx_conversions.h"
#include "cc/proto/property_tree.pb.h"
@@ -1657,6 +1658,54 @@ const gfx::ScrollOffset ScrollTree::GetScrollOffsetDeltaForTesting(
return gfx::ScrollOffset();
}
+void ScrollTree::DistributeScroll(ScrollNode* scroll_node,
+ ScrollState* scroll_state) {
+ DCHECK(scroll_node && scroll_state);
+ if (scroll_state->FullyConsumed())
+ return;
+ scroll_state->DistributeToScrollChainDescendant();
+
+ // If the scroll doesn't propagate, and we're currently scrolling
+ // a layer other than this one, prevent the scroll from
ajuma 2016/03/16 21:49:24 "a node"
sunxd 2016/03/16 23:30:23 Done.
+ // propagating to this layer.
ajuma 2016/03/16 21:49:24 "this node"
sunxd 2016/03/16 23:30:23 Done.
+ if (!scroll_state->should_propagate() &&
+ scroll_state->delta_consumed_for_scroll_sequence() &&
+ scroll_state->current_native_scrolling_node()->id != scroll_node->id) {
+ return;
+ }
+
+ scroll_state->layer_tree_impl()->ApplyScroll(scroll_node, scroll_state);
+}
+
+gfx::Vector2dF ScrollTree::ScrollBy(ScrollNode* scroll_node,
+ const gfx::Vector2dF& scroll,
+ LayerTreeImpl* layer_tree_impl) {
+ gfx::ScrollOffset adjusted_scroll(scroll);
+ if (!scroll_node->data.user_scrollable_horizontal)
+ adjusted_scroll.set_x(0);
+ if (!scroll_node->data.user_scrollable_vertical)
+ adjusted_scroll.set_y(0);
+ DCHECK(scroll_node->data.scrollable);
+ gfx::ScrollOffset old_offset = current_scroll_offset(scroll_node->owner_id);
+ gfx::ScrollOffset new_offset =
+ ClampScrollOffsetToLimits(old_offset + adjusted_scroll, scroll_node);
+ if (SetScrollOffset(scroll_node->owner_id, new_offset))
+ layer_tree_impl->DidUpdateScrollOffset(scroll_node->owner_id,
+ scroll_node->data.transform_id);
+
+ gfx::ScrollOffset unscrolled =
+ old_offset + gfx::ScrollOffset(scroll) - new_offset;
+ return gfx::Vector2dF(unscrolled.x(), unscrolled.y());
+}
+
+gfx::ScrollOffset ScrollTree::ClampScrollOffsetToLimits(
+ gfx::ScrollOffset offset,
+ ScrollNode* scroll_node) const {
+ offset.SetToMin(MaxScrollOffset(scroll_node->id));
+ offset.SetToMax(gfx::ScrollOffset());
+ return offset;
+}
+
PropertyTrees::PropertyTrees()
: needs_rebuild(true),
non_root_surfaces_enabled(true),
« cc/layers/layer_impl.cc ('K') | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698