OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <unordered_map> | 13 #include <unordered_map> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "cc/base/filter_operations.h" | 20 #include "cc/base/filter_operations.h" |
21 #include "cc/base/region.h" | 21 #include "cc/base/region.h" |
22 #include "cc/benchmarks/micro_benchmark.h" | 22 #include "cc/benchmarks/micro_benchmark.h" |
23 #include "cc/cc_export.h" | 23 #include "cc/cc_export.h" |
24 #include "cc/input/input_handler.h" | 24 #include "cc/input/input_handler.h" |
| 25 #include "cc/input/scroll_boundary_behavior.h" |
25 #include "cc/layers/layer_collections.h" | 26 #include "cc/layers/layer_collections.h" |
26 #include "cc/layers/layer_position_constraint.h" | 27 #include "cc/layers/layer_position_constraint.h" |
27 #include "cc/layers/paint_properties.h" | 28 #include "cc/layers/paint_properties.h" |
28 #include "cc/paint/paint_record.h" | 29 #include "cc/paint/paint_record.h" |
29 #include "cc/trees/element_id.h" | 30 #include "cc/trees/element_id.h" |
30 #include "cc/trees/mutator_host_client.h" | 31 #include "cc/trees/mutator_host_client.h" |
31 #include "cc/trees/property_tree.h" | 32 #include "cc/trees/property_tree.h" |
32 #include "cc/trees/target_property.h" | 33 #include "cc/trees/target_property.h" |
33 #include "third_party/skia/include/core/SkColor.h" | 34 #include "third_party/skia/include/core/SkColor.h" |
34 #include "ui/gfx/geometry/point3_f.h" | 35 #include "ui/gfx/geometry/point3_f.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void SetSafeOpaqueBackgroundColor(SkColor background_color); | 106 void SetSafeOpaqueBackgroundColor(SkColor background_color); |
106 // If contents_opaque(), return an opaque color else return a | 107 // If contents_opaque(), return an opaque color else return a |
107 // non-opaque color. Tries to return background_color(), if possible. | 108 // non-opaque color. Tries to return background_color(), if possible. |
108 SkColor SafeOpaqueBackgroundColor() const; | 109 SkColor SafeOpaqueBackgroundColor() const; |
109 | 110 |
110 // A layer's bounds are in logical, non-page-scaled pixels (however, the | 111 // A layer's bounds are in logical, non-page-scaled pixels (however, the |
111 // root layer's bounds are in physical pixels). | 112 // root layer's bounds are in physical pixels). |
112 void SetBounds(const gfx::Size& bounds); | 113 void SetBounds(const gfx::Size& bounds); |
113 gfx::Size bounds() const { return inputs_.bounds; } | 114 gfx::Size bounds() const { return inputs_.bounds; } |
114 | 115 |
| 116 void SetScrollBoundaryBehavior(ScrollBoundaryBehavior behavior); |
| 117 ScrollBoundaryBehavior scrollBoundaryBehavior() const { |
| 118 return inputs_.scroll_boundary_behavior; |
| 119 } |
| 120 |
115 void SetMasksToBounds(bool masks_to_bounds); | 121 void SetMasksToBounds(bool masks_to_bounds); |
116 bool masks_to_bounds() const { return inputs_.masks_to_bounds; } | 122 bool masks_to_bounds() const { return inputs_.masks_to_bounds; } |
117 | 123 |
118 void SetMaskLayer(Layer* mask_layer); | 124 void SetMaskLayer(Layer* mask_layer); |
119 Layer* mask_layer() { return inputs_.mask_layer.get(); } | 125 Layer* mask_layer() { return inputs_.mask_layer.get(); } |
120 const Layer* mask_layer() const { return inputs_.mask_layer.get(); } | 126 const Layer* mask_layer() const { return inputs_.mask_layer.get(); } |
121 | 127 |
122 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); | 128 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); |
123 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } | 129 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } |
124 | 130 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 Layer* clip_parent; | 608 Layer* clip_parent; |
603 | 609 |
604 bool has_will_change_transform_hint : 1; | 610 bool has_will_change_transform_hint : 1; |
605 | 611 |
606 bool hide_layer_and_subtree : 1; | 612 bool hide_layer_and_subtree : 1; |
607 | 613 |
608 // The following elements can not and are not serialized. | 614 // The following elements can not and are not serialized. |
609 LayerClient* client; | 615 LayerClient* client; |
610 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; | 616 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; |
611 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; | 617 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
| 618 |
| 619 ScrollBoundaryBehavior scroll_boundary_behavior; |
612 }; | 620 }; |
613 | 621 |
614 Layer* parent_; | 622 Layer* parent_; |
615 | 623 |
616 // Layer instances have a weak pointer to their LayerTreeHost. | 624 // Layer instances have a weak pointer to their LayerTreeHost. |
617 // This pointer value is nil when a Layer is not in a tree and is | 625 // This pointer value is nil when a Layer is not in a tree and is |
618 // updated via SetLayerTreeHost() if a layer moves between trees. | 626 // updated via SetLayerTreeHost() if a layer moves between trees. |
619 LayerTreeHost* layer_tree_host_; | 627 LayerTreeHost* layer_tree_host_; |
620 | 628 |
621 Inputs inputs_; | 629 Inputs inputs_; |
(...skipping 26 matching lines...) Expand all Loading... |
648 // These all act like draw properties, so don't need push properties. | 656 // These all act like draw properties, so don't need push properties. |
649 gfx::Rect visible_layer_rect_; | 657 gfx::Rect visible_layer_rect_; |
650 size_t num_unclipped_descendants_; | 658 size_t num_unclipped_descendants_; |
651 | 659 |
652 DISALLOW_COPY_AND_ASSIGN(Layer); | 660 DISALLOW_COPY_AND_ASSIGN(Layer); |
653 }; | 661 }; |
654 | 662 |
655 } // namespace cc | 663 } // namespace cc |
656 | 664 |
657 #endif // CC_LAYERS_LAYER_H_ | 665 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |