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

Side by Side Diff: cc/trees/property_tree.h

Issue 1680613002: Adding momentum/overscroll to views:: ScrollViews Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Tableview layout. aaaand I think we are done Created 4 years, 4 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TREES_PROPERTY_TREE_H_ 5 #ifndef CC_TREES_PROPERTY_TREE_H_
6 #define CC_TREES_PROPERTY_TREE_H_ 6 #define CC_TREES_PROPERTY_TREE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 std::unordered_multimap<int, std::unique_ptr<CopyOutputRequest>> 346 std::unordered_multimap<int, std::unique_ptr<CopyOutputRequest>>
347 copy_requests_; 347 copy_requests_;
348 348
349 // Unsorted list of all mask, replica, and replica mask layer ids that 349 // Unsorted list of all mask, replica, and replica mask layer ids that
350 // effect nodes refer to. 350 // effect nodes refer to.
351 std::vector<int> mask_replica_layer_ids_; 351 std::vector<int> mask_replica_layer_ids_;
352 }; 352 };
353 353
354 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> { 354 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
355 public: 355 public:
356 struct ScrollWithOverscroll;
357
356 ScrollTree(); 358 ScrollTree();
357 ~ScrollTree(); 359 ~ScrollTree();
358 360
359 ScrollTree& operator=(const ScrollTree& from); 361 ScrollTree& operator=(const ScrollTree& from);
360 bool operator==(const ScrollTree& other) const; 362 bool operator==(const ScrollTree& other) const;
361 363
362 void ToProtobuf(proto::PropertyTree* proto) const; 364 void ToProtobuf(proto::PropertyTree* proto) const;
363 void FromProtobuf(const proto::PropertyTree& proto, 365 void FromProtobuf(const proto::PropertyTree& proto,
364 std::unordered_map<int, int>* node_id_to_index_map); 366 std::unordered_map<int, int>* node_id_to_index_map);
365 367
366 void clear(); 368 void clear();
367 369
368 typedef std::unordered_map<int, scoped_refptr<SyncedScrollOffset>> 370 typedef std::unordered_map<int, ScrollWithOverscroll> ScrollOffsetMap;
369 ScrollOffsetMap;
370 371
371 gfx::ScrollOffset MaxScrollOffset(int scroll_node_id) const; 372 gfx::ScrollOffset MaxScrollOffset(int scroll_node_id) const;
372 gfx::Size scroll_clip_layer_bounds(int scroll_node_id) const; 373 gfx::Size scroll_clip_layer_bounds(int scroll_node_id) const;
373 ScrollNode* CurrentlyScrollingNode(); 374 ScrollNode* CurrentlyScrollingNode();
374 const ScrollNode* CurrentlyScrollingNode() const; 375 const ScrollNode* CurrentlyScrollingNode() const;
375 void set_currently_scrolling_node(int scroll_node_id); 376 void set_currently_scrolling_node(int scroll_node_id);
376 gfx::Transform ScreenSpaceTransform(int scroll_node_id) const; 377 gfx::Transform ScreenSpaceTransform(int scroll_node_id) const;
377 378
378 const gfx::ScrollOffset current_scroll_offset(int layer_id) const; 379 const gfx::ScrollOffset current_scroll_offset(int layer_id) const;
380 const gfx::ScrollOffset current_overscroll(int layer_id) const;
379 void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 381 void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
380 int inner_viewport_layer_id); 382 int inner_viewport_layer_id);
381 void UpdateScrollOffsetMap(ScrollOffsetMap* new_scroll_offset_map, 383 void UpdateScrollOffsetMap(ScrollTree* scroll_tree,
382 LayerTreeImpl* layer_tree_impl); 384 LayerTreeImpl* layer_tree_impl);
383 ScrollOffsetMap& scroll_offset_map(); 385 const ScrollOffsetMap& scroll_offset_map_for_test() const;
384 const ScrollOffsetMap& scroll_offset_map() const;
385 void ApplySentScrollDeltasFromAbortedCommit(); 386 void ApplySentScrollDeltasFromAbortedCommit();
386 bool SetBaseScrollOffset(int layer_id, 387 void SetBaseScrollOffset(int layer_id,
387 const gfx::ScrollOffset& scroll_offset); 388 const gfx::ScrollOffset& scroll_offset,
388 bool SetScrollOffset(int layer_id, const gfx::ScrollOffset& scroll_offset); 389 const gfx::ScrollOffset& overscroll);
389 void SetScrollOffsetClobberActiveValue(int layer_id) { 390 bool SetScrollOffset(int layer_id,
390 synced_scroll_offset(layer_id)->set_clobber_active_value(); 391 const gfx::ScrollOffset& scroll_offset,
392 const gfx::ScrollOffset& overscroll);
393
394 // TODO(tapted): Remove this overload (used by TreeSynchronizerTest).
395 bool SetScrollOffset(int layer_id, const gfx::ScrollOffset& scroll_offset) {
396 return SetScrollOffset(layer_id, scroll_offset, gfx::ScrollOffset());
391 } 397 }
398
399 void SetScrollOffsetClobberActiveValue(int layer_id);
392 bool UpdateScrollOffsetBaseForTesting(int layer_id, 400 bool UpdateScrollOffsetBaseForTesting(int layer_id,
393 const gfx::ScrollOffset& offset); 401 const gfx::ScrollOffset& offset);
394 bool SetScrollOffsetDeltaForTesting(int layer_id, 402 bool SetScrollOffsetDeltaForTesting(int layer_id,
395 const gfx::Vector2dF& delta); 403 const gfx::Vector2dF& delta);
396 const gfx::ScrollOffset GetScrollOffsetBaseForTesting(int layer_id) const; 404 const gfx::ScrollOffset GetScrollOffsetBaseForTesting(int layer_id) const;
397 const gfx::ScrollOffset GetScrollOffsetDeltaForTesting(int layer_id) const; 405 const gfx::ScrollOffset GetScrollOffsetDeltaForTesting(int layer_id) const;
398 void CollectScrollDeltasForTesting(); 406 void CollectScrollDeltasForTesting();
399 407
400 void DistributeScroll(ScrollNode* scroll_node, ScrollState* scroll_state); 408 void DistributeScroll(ScrollNode* scroll_node, ScrollState* scroll_state);
401 gfx::Vector2dF ScrollBy(ScrollNode* scroll_node, 409 gfx::Vector2dF ScrollBy(ScrollNode* scroll_node,
402 const gfx::Vector2dF& scroll, 410 const gfx::Vector2dF& scroll,
403 LayerTreeImpl* layer_tree_impl); 411 LayerTreeImpl* layer_tree_impl);
404 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset, 412 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset,
405 ScrollNode* scroll_node) const; 413 ScrollNode* scroll_node) const;
406 414
407 private: 415 private:
408 int currently_scrolling_node_id_; 416 int currently_scrolling_node_id_;
409 ScrollOffsetMap layer_id_to_scroll_offset_map_; 417 ScrollOffsetMap layer_id_to_scroll_offset_map_;
410 418
419 ScrollWithOverscroll* GetOrCreate(int layer_id);
420 const ScrollWithOverscroll* GetOrNull(int layer_id) const;
411 SyncedScrollOffset* synced_scroll_offset(int layer_id); 421 SyncedScrollOffset* synced_scroll_offset(int layer_id);
412 const SyncedScrollOffset* synced_scroll_offset(int layer_id) const; 422 const SyncedScrollOffset* synced_scroll_offset(int layer_id) const;
423
413 gfx::ScrollOffset PullDeltaForMainThread(SyncedScrollOffset* scroll_offset); 424 gfx::ScrollOffset PullDeltaForMainThread(SyncedScrollOffset* scroll_offset);
414 void UpdateScrollOffsetMapEntry(int key, 425 void UpdateScrollOffsetMapEntry(int key,
415 ScrollOffsetMap* new_scroll_offset_map, 426 ScrollOffsetMap* new_scroll_offset_map,
416 LayerTreeImpl* layer_tree_impl); 427 LayerTreeImpl* layer_tree_impl);
417 }; 428 };
418 429
430 // Required in the header for TreeSynchronizerTest.
431 struct ScrollTree::ScrollWithOverscroll {
432 scoped_refptr<SyncedScrollOffset> synced_offset;
433 gfx::ScrollOffset overscroll;
434
435 // Hide the copy constructor to prevent inefficient map iterations, but then
436 // the map needs a move constructor to insert items.
437 ScrollWithOverscroll();
438 ScrollWithOverscroll(const ScrollWithOverscroll& rhs) = delete;
439 ScrollWithOverscroll(ScrollWithOverscroll&& rhs);
440 ~ScrollWithOverscroll();
441
442 bool operator==(const ScrollWithOverscroll& rhs) const {
443 return synced_offset == rhs.synced_offset && overscroll == rhs.overscroll;
444 }
445 bool operator!=(const ScrollWithOverscroll& rhs) const {
446 return !operator==(rhs);
447 }
448 };
449
419 struct AnimationScaleData { 450 struct AnimationScaleData {
420 // Variable used to invalidate cached animation scale data when transform tree 451 // Variable used to invalidate cached animation scale data when transform tree
421 // updates. 452 // updates.
422 int update_number; 453 int update_number;
423 454
424 // Current animations, considering only scales at keyframes not including the 455 // Current animations, considering only scales at keyframes not including the
425 // starting keyframe of each animation. 456 // starting keyframe of each animation.
426 float local_maximum_animation_target_scale; 457 float local_maximum_animation_target_scale;
427 458
428 // The maximum scale that this node's |local| transform will have during 459 // The maximum scale that this node's |local| transform will have during
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 gfx::Vector2dF inner_viewport_container_bounds_delta_; 583 gfx::Vector2dF inner_viewport_container_bounds_delta_;
553 gfx::Vector2dF outer_viewport_container_bounds_delta_; 584 gfx::Vector2dF outer_viewport_container_bounds_delta_;
554 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; 585 gfx::Vector2dF inner_viewport_scroll_bounds_delta_;
555 586
556 PropertyTreesCachedData cached_data_; 587 PropertyTreesCachedData cached_data_;
557 }; 588 };
558 589
559 } // namespace cc 590 } // namespace cc
560 591
561 #endif // CC_TREES_PROPERTY_TREE_H_ 592 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« 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