| 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 | |
| 84 // of the layer. | |
| 85 class ScrollOffsetDelegate { | |
| 86 public: | |
| 87 virtual void SetCurrentScrollOffset(const gfx::ScrollOffset& new_value) = 0; | |
| 88 virtual gfx::ScrollOffset GetCurrentScrollOffset() = 0; | |
| 89 virtual bool IsExternalFlingActive() const = 0; | |
| 90 virtual void Update() const = 0; | |
| 91 }; | |
| 92 | |
| 93 typedef SyncedProperty<AdditionGroup<gfx::ScrollOffset>> SyncedScrollOffset; | 83 typedef SyncedProperty<AdditionGroup<gfx::ScrollOffset>> SyncedScrollOffset; |
| 94 typedef LayerImplList RenderSurfaceListType; | 84 typedef LayerImplList RenderSurfaceListType; |
| 95 typedef LayerImplList LayerListType; | 85 typedef LayerImplList LayerListType; |
| 96 typedef RenderSurfaceImpl RenderSurfaceType; | 86 typedef RenderSurfaceImpl RenderSurfaceType; |
| 97 | 87 |
| 98 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; | 88 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; |
| 99 | 89 |
| 100 static scoped_ptr<LayerImpl> Create( | 90 static scoped_ptr<LayerImpl> Create( |
| 101 LayerTreeImpl* tree_impl, | 91 LayerTreeImpl* tree_impl, |
| 102 int id, | 92 int id, |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta); | 373 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta); |
| 384 gfx::Vector2dF bounds_delta() const { return bounds_delta_; } | 374 gfx::Vector2dF bounds_delta() const { return bounds_delta_; } |
| 385 | 375 |
| 386 void SetContentBounds(const gfx::Size& content_bounds); | 376 void SetContentBounds(const gfx::Size& content_bounds); |
| 387 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } | 377 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
| 388 | 378 |
| 389 float contents_scale_x() const { return draw_properties_.contents_scale_x; } | 379 float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
| 390 float contents_scale_y() const { return draw_properties_.contents_scale_y; } | 380 float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
| 391 void SetContentsScale(float contents_scale_x, float contents_scale_y); | 381 void SetContentsScale(float contents_scale_x, float contents_scale_y); |
| 392 | 382 |
| 393 void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate); | |
| 394 void RefreshFromScrollDelegate(); | |
| 395 bool IsExternalFlingActive() const; | 383 bool IsExternalFlingActive() const; |
| 396 | 384 |
| 397 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); | 385 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); |
| 398 void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset); | 386 void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset); |
| 399 // This method is similar to PushScrollOffsetFromMainThread but will cause the | 387 // 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 | 388 // 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. | 389 // time until this value is pushed to the active tree. |
| 402 void PushScrollOffsetFromMainThreadAndClobberActiveValue( | 390 void PushScrollOffsetFromMainThreadAndClobberActiveValue( |
| 403 const gfx::ScrollOffset& scroll_offset); | 391 const gfx::ScrollOffset& scroll_offset); |
| 404 gfx::ScrollOffset PullDeltaForMainThread(); | 392 gfx::ScrollOffset PullDeltaForMainThread(); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 int layer_id_; | 653 int layer_id_; |
| 666 LayerTreeImpl* layer_tree_impl_; | 654 LayerTreeImpl* layer_tree_impl_; |
| 667 | 655 |
| 668 // Properties dynamically changeable on active tree. | 656 // Properties dynamically changeable on active tree. |
| 669 scoped_refptr<SyncedScrollOffset> scroll_offset_; | 657 scoped_refptr<SyncedScrollOffset> scroll_offset_; |
| 670 gfx::Vector2dF bounds_delta_; | 658 gfx::Vector2dF bounds_delta_; |
| 671 | 659 |
| 672 // Properties synchronized from the associated Layer. | 660 // Properties synchronized from the associated Layer. |
| 673 gfx::Point3F transform_origin_; | 661 gfx::Point3F transform_origin_; |
| 674 gfx::Size bounds_; | 662 gfx::Size bounds_; |
| 675 ScrollOffsetDelegate* scroll_offset_delegate_; | |
| 676 LayerImpl* scroll_clip_layer_; | 663 LayerImpl* scroll_clip_layer_; |
| 677 bool scrollable_ : 1; | 664 bool scrollable_ : 1; |
| 678 bool should_scroll_on_main_thread_ : 1; | 665 bool should_scroll_on_main_thread_ : 1; |
| 679 bool have_wheel_event_handlers_ : 1; | 666 bool have_wheel_event_handlers_ : 1; |
| 680 bool have_scroll_event_handlers_ : 1; | 667 bool have_scroll_event_handlers_ : 1; |
| 681 | 668 |
| 682 static_assert(SCROLL_BLOCKS_ON_MAX < (1 << 3), "ScrollBlocksOn too big"); | 669 static_assert(SCROLL_BLOCKS_ON_MAX < (1 << 3), "ScrollBlocksOn too big"); |
| 683 ScrollBlocksOn scroll_blocks_on_ : 3; | 670 ScrollBlocksOn scroll_blocks_on_ : 3; |
| 684 | 671 |
| 685 bool user_scrollable_horizontal_ : 1; | 672 bool user_scrollable_horizontal_ : 1; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 | 761 |
| 775 std::vector<FrameTimingRequest> frame_timing_requests_; | 762 std::vector<FrameTimingRequest> frame_timing_requests_; |
| 776 bool frame_timing_requests_dirty_; | 763 bool frame_timing_requests_dirty_; |
| 777 | 764 |
| 778 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 765 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 779 }; | 766 }; |
| 780 | 767 |
| 781 } // namespace cc | 768 } // namespace cc |
| 782 | 769 |
| 783 #endif // CC_LAYERS_LAYER_IMPL_H_ | 770 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |