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

Unified Diff: cc/trees/property_tree.h

Issue 2194833002: Overscroll and Elasticity for views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-RouteThroughInputHandler
Patch Set: Restore functionality and fix bugs \o/ Created 4 years, 1 month 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/trees/layer_tree_impl.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.h
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index 23ff38a622a723a086a7004f42dcdf40789ec908..6037d189d9850a4859a73a949e323fb55cf06d1c 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -397,6 +397,8 @@ class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> {
class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
public:
+ struct ScrollWithOverscroll;
+
ScrollTree();
~ScrollTree();
@@ -409,8 +411,7 @@ class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
void clear();
- typedef std::unordered_map<int, scoped_refptr<SyncedScrollOffset>>
- ScrollOffsetMap;
+ typedef std::unordered_map<int, ScrollWithOverscroll> ScrollOffsetMap;
gfx::ScrollOffset MaxScrollOffset(int scroll_node_id) const;
void OnScrollOffsetAnimated(int layer_id,
@@ -428,19 +429,26 @@ class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
gfx::Transform ScreenSpaceTransform(int scroll_node_id) const;
const gfx::ScrollOffset current_scroll_offset(int layer_id) const;
+ const gfx::ScrollOffset current_overscroll(int layer_id) const;
void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
int inner_viewport_layer_id);
- void UpdateScrollOffsetMap(ScrollOffsetMap* new_scroll_offset_map,
+ void UpdateScrollOffsetMap(ScrollTree* scroll_tree,
LayerTreeImpl* layer_tree_impl);
- ScrollOffsetMap& scroll_offset_map();
- const ScrollOffsetMap& scroll_offset_map() const;
+ const ScrollOffsetMap& scroll_offset_map_for_test() const;
void ApplySentScrollDeltasFromAbortedCommit();
- bool SetBaseScrollOffset(int layer_id,
- const gfx::ScrollOffset& scroll_offset);
- bool SetScrollOffset(int layer_id, const gfx::ScrollOffset& scroll_offset);
- void SetScrollOffsetClobberActiveValue(int layer_id) {
- synced_scroll_offset(layer_id)->set_clobber_active_value();
+ void SetBaseScrollOffset(int layer_id,
+ const gfx::ScrollOffset& scroll_offset,
+ const gfx::ScrollOffset& overscroll);
+ bool SetScrollOffset(int layer_id,
+ const gfx::ScrollOffset& scroll_offset,
+ const gfx::ScrollOffset& overscroll);
+
+ // TODO(tapted): Remove this overload (used by TreeSynchronizerTest).
+ bool SetScrollOffset(int layer_id, const gfx::ScrollOffset& scroll_offset) {
+ return SetScrollOffset(layer_id, scroll_offset, gfx::ScrollOffset());
}
+
+ void SetScrollOffsetClobberActiveValue(int layer_id);
bool UpdateScrollOffsetBaseForTesting(int layer_id,
const gfx::ScrollOffset& offset);
bool SetScrollOffsetDeltaForTesting(int layer_id,
@@ -460,14 +468,37 @@ class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
int currently_scrolling_node_id_;
ScrollOffsetMap layer_id_to_scroll_offset_map_;
+ ScrollWithOverscroll* GetOrCreate(int layer_id);
+ const ScrollWithOverscroll* GetOrNull(int layer_id) const;
SyncedScrollOffset* synced_scroll_offset(int layer_id);
const SyncedScrollOffset* synced_scroll_offset(int layer_id) const;
+
gfx::ScrollOffset PullDeltaForMainThread(SyncedScrollOffset* scroll_offset);
void UpdateScrollOffsetMapEntry(int key,
ScrollOffsetMap* new_scroll_offset_map,
LayerTreeImpl* layer_tree_impl);
};
+// Required in the header for TreeSynchronizerTest.
+struct ScrollTree::ScrollWithOverscroll {
+ scoped_refptr<SyncedScrollOffset> synced_offset;
+ gfx::ScrollOffset overscroll;
+
+ // Hide the copy constructor to prevent inefficient map iterations, but then
+ // the map needs a move constructor to insert items.
+ ScrollWithOverscroll();
+ ScrollWithOverscroll(const ScrollWithOverscroll& rhs) = delete;
+ ScrollWithOverscroll(ScrollWithOverscroll&& rhs);
+ ~ScrollWithOverscroll();
+
+ bool operator==(const ScrollWithOverscroll& rhs) const {
+ return synced_offset == rhs.synced_offset && overscroll == rhs.overscroll;
+ }
+ bool operator!=(const ScrollWithOverscroll& rhs) const {
+ return !operator==(rhs);
+ }
+};
+
struct AnimationScaleData {
// Variable used to invalidate cached animation scale data when transform tree
// updates.
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698