Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 DRAW_MODE_NONE, | 73 DRAW_MODE_NONE, |
| 74 DRAW_MODE_HARDWARE, | 74 DRAW_MODE_HARDWARE, |
| 75 DRAW_MODE_SOFTWARE, | 75 DRAW_MODE_SOFTWARE, |
| 76 DRAW_MODE_RESOURCELESS_SOFTWARE | 76 DRAW_MODE_RESOURCELESS_SOFTWARE |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, | 79 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
| 80 public LayerAnimationValueProvider, | 80 public LayerAnimationValueProvider, |
| 81 public AnimationDelegate { | 81 public AnimationDelegate { |
| 82 public: | 82 public: |
| 83 // Allows for the ownership of the total scroll offset to be delegated outside | 83 // An embedder will use ExternalScrollOffsetListener to know when the |
| 84 // of the layer. | 84 // LayerImpl's scroll offset has changed. ExternalScrollOffsetListener |
| 85 class ScrollOffsetDelegate { | 85 // carries information of whether external fling is active. |
| 86 class ExternalScrollOffsetListener { | |
|
aelias_OOO_until_Jul13
2015/04/06 19:47:49
What do you think about going further and get rid
hush (inactive)
2015/04/06 23:08:03
yes. I added DidUpdateScrollOffset and IsExternalF
| |
| 86 public: | 87 public: |
| 87 virtual void SetCurrentScrollOffset(const gfx::ScrollOffset& new_value) = 0; | |
| 88 virtual gfx::ScrollOffset GetCurrentScrollOffset() = 0; | |
| 89 virtual bool IsExternalFlingActive() const = 0; | 88 virtual bool IsExternalFlingActive() const = 0; |
| 90 virtual void Update() const = 0; | 89 // Tells the embedder to update because the LayerImpl has changed its scroll |
| 90 // offset. | |
| 91 virtual void DidUpdateScrollOffset() const = 0; | |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 typedef SyncedProperty<AdditionGroup<gfx::ScrollOffset>> SyncedScrollOffset; | 94 typedef SyncedProperty<AdditionGroup<gfx::ScrollOffset>> SyncedScrollOffset; |
| 94 typedef LayerImplList RenderSurfaceListType; | 95 typedef LayerImplList RenderSurfaceListType; |
| 95 typedef LayerImplList LayerListType; | 96 typedef LayerImplList LayerListType; |
| 96 typedef RenderSurfaceImpl RenderSurfaceType; | 97 typedef RenderSurfaceImpl RenderSurfaceType; |
| 97 | 98 |
| 98 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; | 99 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; |
| 99 | 100 |
| 100 static scoped_ptr<LayerImpl> Create( | 101 static scoped_ptr<LayerImpl> Create( |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta); | 384 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta); |
| 384 gfx::Vector2dF bounds_delta() const { return bounds_delta_; } | 385 gfx::Vector2dF bounds_delta() const { return bounds_delta_; } |
| 385 | 386 |
| 386 void SetContentBounds(const gfx::Size& content_bounds); | 387 void SetContentBounds(const gfx::Size& content_bounds); |
| 387 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } | 388 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
| 388 | 389 |
| 389 float contents_scale_x() const { return draw_properties_.contents_scale_x; } | 390 float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
| 390 float contents_scale_y() const { return draw_properties_.contents_scale_y; } | 391 float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
| 391 void SetContentsScale(float contents_scale_x, float contents_scale_y); | 392 void SetContentsScale(float contents_scale_x, float contents_scale_y); |
| 392 | 393 |
| 393 void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate); | 394 void SetExternalScrollOffsetListener(ExternalScrollOffsetListener* listener); |
| 394 void RefreshFromScrollDelegate(); | |
| 395 bool IsExternalFlingActive() const; | 395 bool IsExternalFlingActive() const; |
| 396 | 396 |
| 397 // Visible for testing. | |
|
aelias_OOO_until_Jul13
2015/04/06 19:47:49
It's not clear what methods below this comment ref
hush (inactive)
2015/04/06 23:08:03
Removed the comment.
| |
| 397 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); | 398 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); |
| 398 void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset); | 399 void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset); |
| 399 // This method is similar to PushScrollOffsetFromMainThread but will cause the | 400 // This method is similar to PushScrollOffsetFromMainThread but will cause the |
| 400 // scroll offset given to clobber any scroll changes on the active tree in the | 401 // scroll offset given to clobber any scroll changes on the active tree in the |
| 401 // time until this value is pushed to the active tree. | 402 // time until this value is pushed to the active tree. |
| 402 void PushScrollOffsetFromMainThreadAndClobberActiveValue( | 403 void PushScrollOffsetFromMainThreadAndClobberActiveValue( |
| 403 const gfx::ScrollOffset& scroll_offset); | 404 const gfx::ScrollOffset& scroll_offset); |
| 404 gfx::ScrollOffset PullDeltaForMainThread(); | 405 gfx::ScrollOffset PullDeltaForMainThread(); |
| 405 gfx::ScrollOffset CurrentScrollOffset() const; | 406 gfx::ScrollOffset CurrentScrollOffset() const; |
| 406 gfx::ScrollOffset BaseScrollOffset() const; | 407 gfx::ScrollOffset BaseScrollOffset() const; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 int layer_id_; | 666 int layer_id_; |
| 666 LayerTreeImpl* layer_tree_impl_; | 667 LayerTreeImpl* layer_tree_impl_; |
| 667 | 668 |
| 668 // Properties dynamically changeable on active tree. | 669 // Properties dynamically changeable on active tree. |
| 669 scoped_refptr<SyncedScrollOffset> scroll_offset_; | 670 scoped_refptr<SyncedScrollOffset> scroll_offset_; |
| 670 gfx::Vector2dF bounds_delta_; | 671 gfx::Vector2dF bounds_delta_; |
| 671 | 672 |
| 672 // Properties synchronized from the associated Layer. | 673 // Properties synchronized from the associated Layer. |
| 673 gfx::Point3F transform_origin_; | 674 gfx::Point3F transform_origin_; |
| 674 gfx::Size bounds_; | 675 gfx::Size bounds_; |
| 675 ScrollOffsetDelegate* scroll_offset_delegate_; | 676 ExternalScrollOffsetListener* scroll_offset_listener_; |
| 676 LayerImpl* scroll_clip_layer_; | 677 LayerImpl* scroll_clip_layer_; |
| 677 bool scrollable_ : 1; | 678 bool scrollable_ : 1; |
| 678 bool should_scroll_on_main_thread_ : 1; | 679 bool should_scroll_on_main_thread_ : 1; |
| 679 bool have_wheel_event_handlers_ : 1; | 680 bool have_wheel_event_handlers_ : 1; |
| 680 bool have_scroll_event_handlers_ : 1; | 681 bool have_scroll_event_handlers_ : 1; |
| 681 | 682 |
| 682 static_assert(SCROLL_BLOCKS_ON_MAX < (1 << 3), "ScrollBlocksOn too big"); | 683 static_assert(SCROLL_BLOCKS_ON_MAX < (1 << 3), "ScrollBlocksOn too big"); |
| 683 ScrollBlocksOn scroll_blocks_on_ : 3; | 684 ScrollBlocksOn scroll_blocks_on_ : 3; |
| 684 | 685 |
| 685 bool user_scrollable_horizontal_ : 1; | 686 bool user_scrollable_horizontal_ : 1; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 | 775 |
| 775 std::vector<FrameTimingRequest> frame_timing_requests_; | 776 std::vector<FrameTimingRequest> frame_timing_requests_; |
| 776 bool frame_timing_requests_dirty_; | 777 bool frame_timing_requests_dirty_; |
| 777 | 778 |
| 778 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 779 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 779 }; | 780 }; |
| 780 | 781 |
| 781 } // namespace cc | 782 } // namespace cc |
| 782 | 783 |
| 783 #endif // CC_LAYERS_LAYER_IMPL_H_ | 784 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |