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

Side by Side Diff: cc/layers/layer_impl.h

Issue 1736073002: cc: Move SyncedScrollOffset to scroll tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add gyp dependency 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_LAYERS_LAYER_IMPL_H_ 5 #ifndef CC_LAYERS_LAYER_IMPL_H_
6 #define CC_LAYERS_LAYER_IMPL_H_ 6 #define CC_LAYERS_LAYER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 void SetBounds(const gfx::Size& bounds); 452 void SetBounds(const gfx::Size& bounds);
453 gfx::Size bounds() const; 453 gfx::Size bounds() const;
454 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions 454 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions
455 // of pixels) due to use of single precision float. 455 // of pixels) due to use of single precision float.
456 gfx::SizeF BoundsForScrolling() const; 456 gfx::SizeF BoundsForScrolling() const;
457 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta); 457 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta);
458 gfx::Vector2dF bounds_delta() const { return bounds_delta_; } 458 gfx::Vector2dF bounds_delta() const { return bounds_delta_; }
459 459
460 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); 460 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset);
461 // must only be called by tests when updating scroll offset of a single layer,
462 // the standard process to update scroll offsets is
463 // ScrollTree::UpdateScrollOffsetMap()
461 void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset); 464 void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset);
462 // This method is similar to PushScrollOffsetFromMainThread but will cause the 465
463 // scroll offset given to clobber any scroll changes on the active tree in the
464 // time until this value is pushed to the active tree.
465 void PushScrollOffsetFromMainThreadAndClobberActiveValue(
466 const gfx::ScrollOffset& scroll_offset);
467 gfx::ScrollOffset PullDeltaForMainThread();
468 gfx::ScrollOffset CurrentScrollOffset() const; 466 gfx::ScrollOffset CurrentScrollOffset() const;
469 gfx::ScrollOffset BaseScrollOffset() const; 467 gfx::ScrollOffset BaseScrollOffset() const;
470 gfx::Vector2dF ScrollDelta() const; 468 gfx::Vector2dF ScrollDelta() const;
471 void SetScrollDelta(const gfx::Vector2dF& delta); 469 void SetScrollDelta(const gfx::Vector2dF& delta);
470 // This is a mirror function of Layer::scroll_offset, which is supposed to be
471 // called only by PropertyTreeBuilder
472 gfx::ScrollOffset scroll_offset() const {
473 return synced_scroll_offset()->PendingBase();
474 }
472 475
473 gfx::ScrollOffset MaxScrollOffset() const; 476 gfx::ScrollOffset MaxScrollOffset() const;
474 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const; 477 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const;
475 gfx::Vector2dF ClampScrollToMaxScrollOffset(); 478 gfx::Vector2dF ClampScrollToMaxScrollOffset();
476 void SetScrollCompensationAdjustment(const gfx::Vector2dF& scroll_offset) { 479 void SetScrollCompensationAdjustment(const gfx::Vector2dF& scroll_offset) {
477 scroll_compensation_adjustment_ = scroll_offset; 480 scroll_compensation_adjustment_ = scroll_offset;
478 } 481 }
479 gfx::Vector2dF ScrollCompensationAdjustment() const { 482 gfx::Vector2dF ScrollCompensationAdjustment() const {
480 return scroll_compensation_adjustment_; 483 return scroll_compensation_adjustment_;
481 } 484 }
(...skipping 13 matching lines...) Expand all
495 bool user_scrollable_horizontal() const { 498 bool user_scrollable_horizontal() const {
496 return user_scrollable_horizontal_; 499 return user_scrollable_horizontal_;
497 } 500 }
498 void set_user_scrollable_vertical(bool scrollable) { 501 void set_user_scrollable_vertical(bool scrollable) {
499 user_scrollable_vertical_ = scrollable; 502 user_scrollable_vertical_ = scrollable;
500 } 503 }
501 bool user_scrollable_vertical() const { return user_scrollable_vertical_; } 504 bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
502 505
503 bool user_scrollable(ScrollbarOrientation orientation) const; 506 bool user_scrollable(ScrollbarOrientation orientation) const;
504 507
505 void ApplySentScrollDeltasFromAbortedCommit();
506
507 void set_main_thread_scrolling_reasons( 508 void set_main_thread_scrolling_reasons(
508 uint32_t main_thread_scrolling_reasons) { 509 uint32_t main_thread_scrolling_reasons) {
509 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons; 510 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons;
510 } 511 }
511 uint32_t main_thread_scrolling_reasons() const { 512 uint32_t main_thread_scrolling_reasons() const {
512 return main_thread_scrolling_reasons_; 513 return main_thread_scrolling_reasons_;
513 } 514 }
514 bool should_scroll_on_main_thread() const { 515 bool should_scroll_on_main_thread() const {
515 return !!main_thread_scrolling_reasons_; 516 return !!main_thread_scrolling_reasons_;
516 } 517 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 void Set3dSortingContextId(int id); 628 void Set3dSortingContextId(int id);
628 int sorting_context_id() { return sorting_context_id_; } 629 int sorting_context_id() { return sorting_context_id_; }
629 630
630 void SetFrameTimingRequests( 631 void SetFrameTimingRequests(
631 const std::vector<FrameTimingRequest>& frame_timing_requests); 632 const std::vector<FrameTimingRequest>& frame_timing_requests);
632 const std::vector<FrameTimingRequest>& frame_timing_requests() const { 633 const std::vector<FrameTimingRequest>& frame_timing_requests() const {
633 return frame_timing_requests_; 634 return frame_timing_requests_;
634 } 635 }
635 void GatherFrameTimingRequestIds(std::vector<int64_t>* request_ids); 636 void GatherFrameTimingRequestIds(std::vector<int64_t>* request_ids);
636 637
637 SyncedScrollOffset* synced_scroll_offset() { return scroll_offset_.get(); } 638 const SyncedScrollOffset* synced_scroll_offset() const;
639 SyncedScrollOffset* synced_scroll_offset();
638 640
639 // Get the correct invalidation region instead of conservative Rect 641 // Get the correct invalidation region instead of conservative Rect
640 // for layers that provide it. 642 // for layers that provide it.
641 virtual Region GetInvalidationRegion(); 643 virtual Region GetInvalidationRegion();
642 644
643 virtual gfx::Rect GetEnclosingRectInTargetSpace() const; 645 virtual gfx::Rect GetEnclosingRectInTargetSpace() const;
644 646
645 void set_visited(bool visited) { visited_ = visited; } 647 void set_visited(bool visited) { visited_ = visited; }
646 648
647 bool visited() { return visited_; } 649 bool visited() { return visited_; }
(...skipping 29 matching lines...) Expand all
677 679
678 bool was_ever_ready_since_last_transform_animation() const { 680 bool was_ever_ready_since_last_transform_animation() const {
679 return was_ever_ready_since_last_transform_animation_; 681 return was_ever_ready_since_last_transform_animation_;
680 } 682 }
681 683
682 void set_was_ever_ready_since_last_transform_animation(bool was_ready) { 684 void set_was_ever_ready_since_last_transform_animation(bool was_ready) {
683 was_ever_ready_since_last_transform_animation_ = was_ready; 685 was_ever_ready_since_last_transform_animation_ = was_ready;
684 } 686 }
685 687
686 void NoteLayerPropertyChanged(); 688 void NoteLayerPropertyChanged();
689 void DidUpdateScrollOffset();
687 690
688 void PushLayerPropertyChangedForSubtree(); 691 void PushLayerPropertyChangedForSubtree();
689 692
690 protected: 693 protected:
691 LayerImpl(LayerTreeImpl* layer_impl, 694 LayerImpl(LayerTreeImpl* layer_impl,
692 int id, 695 int id,
693 scoped_refptr<SyncedScrollOffset> scroll_offset); 696 scoped_refptr<SyncedScrollOffset> scroll_offset);
694 LayerImpl(LayerTreeImpl* layer_impl, int id); 697 LayerImpl(LayerTreeImpl* layer_impl, int id);
695 698
696 // Get the color and size of the layer's debug border. 699 // Get the color and size of the layer's debug border.
(...skipping 13 matching lines...) Expand all
710 void NoteLayerPropertyChangedForSubtree(); 713 void NoteLayerPropertyChangedForSubtree();
711 714
712 // Note carefully this does not affect the current layer. 715 // Note carefully this does not affect the current layer.
713 void NoteLayerPropertyChangedForDescendants(); 716 void NoteLayerPropertyChangedForDescendants();
714 717
715 gfx::Rect GetScaledEnclosingRectInTargetSpace(float scale) const; 718 gfx::Rect GetScaledEnclosingRectInTargetSpace(float scale) const;
716 719
717 private: 720 private:
718 void ValidateQuadResourcesInternal(DrawQuad* quad) const; 721 void ValidateQuadResourcesInternal(DrawQuad* quad) const;
719 722
720 void PushScrollOffset(const gfx::ScrollOffset* scroll_offset);
721 void DidUpdateScrollOffset();
722 void NoteLayerPropertyChangedForDescendantsInternal(); 723 void NoteLayerPropertyChangedForDescendantsInternal();
723 void PushLayerPropertyChangedForSubtreeInternal(); 724 void PushLayerPropertyChangedForSubtreeInternal();
724 725
725 virtual const char* LayerTypeAsString() const; 726 virtual const char* LayerTypeAsString() const;
726 727
727 // Properties internal to LayerImpl 728 // Properties internal to LayerImpl
728 LayerImpl* parent_; 729 LayerImpl* parent_;
729 OwnedLayerImplList children_; 730 OwnedLayerImplList children_;
730 731
731 LayerImpl* scroll_parent_; 732 LayerImpl* scroll_parent_;
732 733
733 // Storing a pointer to a set rather than a set since this will be rarely 734 // Storing a pointer to a set rather than a set since this will be rarely
734 // used. If this pointer turns out to be too heavy, we could have this (and 735 // used. If this pointer turns out to be too heavy, we could have this (and
735 // the scroll parent above) be stored in a LayerImpl -> scroll_info 736 // the scroll parent above) be stored in a LayerImpl -> scroll_info
736 // map somewhere. 737 // map somewhere.
737 scoped_ptr<std::set<LayerImpl*>> scroll_children_; 738 scoped_ptr<std::set<LayerImpl*>> scroll_children_;
738 739
739 LayerImpl* clip_parent_; 740 LayerImpl* clip_parent_;
740 scoped_ptr<std::set<LayerImpl*>> clip_children_; 741 scoped_ptr<std::set<LayerImpl*>> clip_children_;
741 742
742 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to 743 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to
743 // confirm newly assigned layer is still the previous one 744 // confirm newly assigned layer is still the previous one
744 int mask_layer_id_; 745 int mask_layer_id_;
745 scoped_ptr<LayerImpl> mask_layer_; 746 scoped_ptr<LayerImpl> mask_layer_;
746 int replica_layer_id_; // ditto 747 int replica_layer_id_; // ditto
747 scoped_ptr<LayerImpl> replica_layer_; 748 scoped_ptr<LayerImpl> replica_layer_;
748 int layer_id_; 749 int layer_id_;
749 LayerTreeImpl* layer_tree_impl_; 750 LayerTreeImpl* layer_tree_impl_;
750 751
751 // Properties dynamically changeable on active tree.
752 scoped_refptr<SyncedScrollOffset> scroll_offset_;
753 gfx::Vector2dF bounds_delta_; 752 gfx::Vector2dF bounds_delta_;
754 753
755 // Properties synchronized from the associated Layer. 754 // Properties synchronized from the associated Layer.
756 gfx::Point3F transform_origin_; 755 gfx::Point3F transform_origin_;
757 gfx::Size bounds_; 756 gfx::Size bounds_;
758 int scroll_clip_layer_id_; 757 int scroll_clip_layer_id_;
759 758
760 gfx::Vector2dF offset_to_transform_parent_; 759 gfx::Vector2dF offset_to_transform_parent_;
761 uint32_t main_thread_scrolling_reasons_; 760 uint32_t main_thread_scrolling_reasons_;
762 761
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // If true, the layer or one of its descendants has a touch handler. 876 // If true, the layer or one of its descendants has a touch handler.
878 bool layer_or_descendant_has_touch_handler_; 877 bool layer_or_descendant_has_touch_handler_;
879 bool sorted_for_recursion_; 878 bool sorted_for_recursion_;
880 879
881 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 880 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
882 }; 881 };
883 882
884 } // namespace cc 883 } // namespace cc
885 884
886 #endif // CC_LAYERS_LAYER_IMPL_H_ 885 #endif // CC_LAYERS_LAYER_IMPL_H_
OLDNEW
« cc/base/synced_property.h ('K') | « cc/layers/layer.cc ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698