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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 enum DrawMode { | 58 enum DrawMode { |
59 DRAW_MODE_NONE, | 59 DRAW_MODE_NONE, |
60 DRAW_MODE_HARDWARE, | 60 DRAW_MODE_HARDWARE, |
61 DRAW_MODE_SOFTWARE, | 61 DRAW_MODE_SOFTWARE, |
62 DRAW_MODE_RESOURCELESS_SOFTWARE | 62 DRAW_MODE_RESOURCELESS_SOFTWARE |
63 }; | 63 }; |
64 | 64 |
65 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, | 65 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
66 public LayerAnimationValueProvider { | 66 public LayerAnimationValueProvider { |
67 public: | 67 public: |
| 68 // Allows for the ownership of the total scroll offset to be delegated outside |
| 69 // of the layer. |
| 70 class ScrollOffsetDelegate { |
| 71 public: |
| 72 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0; |
| 73 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; |
| 74 virtual bool IsExternalFlingActive() const = 0; |
| 75 }; |
| 76 |
68 typedef LayerImplList RenderSurfaceListType; | 77 typedef LayerImplList RenderSurfaceListType; |
69 typedef LayerImplList LayerListType; | 78 typedef LayerImplList LayerListType; |
70 typedef RenderSurfaceImpl RenderSurfaceType; | 79 typedef RenderSurfaceImpl RenderSurfaceType; |
71 | 80 |
72 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; | 81 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; |
73 | 82 |
74 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 83 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
75 return make_scoped_ptr(new LayerImpl(tree_impl, id)); | 84 return make_scoped_ptr(new LayerImpl(tree_impl, id)); |
76 } | 85 } |
77 | 86 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 363 |
355 virtual void CalculateContentsScale(float ideal_contents_scale, | 364 virtual void CalculateContentsScale(float ideal_contents_scale, |
356 float device_scale_factor, | 365 float device_scale_factor, |
357 float page_scale_factor, | 366 float page_scale_factor, |
358 float maximum_animation_contents_scale, | 367 float maximum_animation_contents_scale, |
359 bool animating_transform_to_screen, | 368 bool animating_transform_to_screen, |
360 float* contents_scale_x, | 369 float* contents_scale_x, |
361 float* contents_scale_y, | 370 float* contents_scale_y, |
362 gfx::Size* content_bounds); | 371 gfx::Size* content_bounds); |
363 | 372 |
364 void SetScrollOffsetDelegate( | 373 void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate); |
365 LayerScrollOffsetDelegate* scroll_offset_delegate); | |
366 bool IsExternalFlingActive() const; | 374 bool IsExternalFlingActive() const; |
367 | 375 |
368 void SetScrollOffset(const gfx::Vector2d& scroll_offset); | 376 void SetScrollOffset(const gfx::Vector2d& scroll_offset); |
369 void SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset, | 377 void SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset, |
370 const gfx::Vector2dF& scroll_delta); | 378 const gfx::Vector2dF& scroll_delta); |
371 gfx::Vector2d scroll_offset() const { return scroll_offset_; } | 379 gfx::Vector2d scroll_offset() const { return scroll_offset_; } |
372 | 380 |
373 gfx::Vector2d MaxScrollOffset() const; | 381 gfx::Vector2d MaxScrollOffset() const; |
374 gfx::Vector2dF ClampScrollToMaxScrollOffset(); | 382 gfx::Vector2dF ClampScrollToMaxScrollOffset(); |
375 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, | 383 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 scoped_ptr<LayerImpl> replica_layer_; | 595 scoped_ptr<LayerImpl> replica_layer_; |
588 int layer_id_; | 596 int layer_id_; |
589 LayerTreeImpl* layer_tree_impl_; | 597 LayerTreeImpl* layer_tree_impl_; |
590 | 598 |
591 // Properties synchronized from the associated Layer. | 599 // Properties synchronized from the associated Layer. |
592 gfx::PointF anchor_point_; | 600 gfx::PointF anchor_point_; |
593 float anchor_point_z_; | 601 float anchor_point_z_; |
594 gfx::Size bounds_; | 602 gfx::Size bounds_; |
595 gfx::SizeF temporary_impl_bounds_; | 603 gfx::SizeF temporary_impl_bounds_; |
596 gfx::Vector2d scroll_offset_; | 604 gfx::Vector2d scroll_offset_; |
597 LayerScrollOffsetDelegate* scroll_offset_delegate_; | 605 ScrollOffsetDelegate* scroll_offset_delegate_; |
598 LayerImpl* scroll_clip_layer_; | 606 LayerImpl* scroll_clip_layer_; |
599 bool scrollable_ : 1; | 607 bool scrollable_ : 1; |
600 bool should_scroll_on_main_thread_ : 1; | 608 bool should_scroll_on_main_thread_ : 1; |
601 bool have_wheel_event_handlers_ : 1; | 609 bool have_wheel_event_handlers_ : 1; |
602 bool have_scroll_event_handlers_ : 1; | 610 bool have_scroll_event_handlers_ : 1; |
603 bool user_scrollable_horizontal_ : 1; | 611 bool user_scrollable_horizontal_ : 1; |
604 bool user_scrollable_vertical_ : 1; | 612 bool user_scrollable_vertical_ : 1; |
605 bool stacking_order_changed_ : 1; | 613 bool stacking_order_changed_ : 1; |
606 // Whether the "back" of this layer should draw. | 614 // Whether the "back" of this layer should draw. |
607 bool double_sided_ : 1; | 615 bool double_sided_ : 1; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 DrawProperties<LayerImpl> draw_properties_; | 693 DrawProperties<LayerImpl> draw_properties_; |
686 | 694 |
687 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; | 695 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; |
688 | 696 |
689 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 697 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
690 }; | 698 }; |
691 | 699 |
692 } // namespace cc | 700 } // namespace cc |
693 | 701 |
694 #endif // CC_LAYERS_LAYER_IMPL_H_ | 702 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |