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/touch_action_region.h" | 28 #include "cc/layers/touch_action_region.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void SetSafeOpaqueBackgroundColor(SkColor background_color); | 108 void SetSafeOpaqueBackgroundColor(SkColor background_color); |
108 // If contents_opaque(), return an opaque color else return a | 109 // If contents_opaque(), return an opaque color else return a |
109 // non-opaque color. Tries to return background_color(), if possible. | 110 // non-opaque color. Tries to return background_color(), if possible. |
110 SkColor SafeOpaqueBackgroundColor() const; | 111 SkColor SafeOpaqueBackgroundColor() const; |
111 | 112 |
112 // A layer's bounds are in logical, non-page-scaled pixels (however, the | 113 // A layer's bounds are in logical, non-page-scaled pixels (however, the |
113 // root layer's bounds are in physical pixels). | 114 // root layer's bounds are in physical pixels). |
114 void SetBounds(const gfx::Size& bounds); | 115 void SetBounds(const gfx::Size& bounds); |
115 gfx::Size bounds() const { return inputs_.bounds; } | 116 gfx::Size bounds() const { return inputs_.bounds; } |
116 | 117 |
| 118 void SetScrollBoundaryBehavior(const ScrollBoundaryBehavior& behavior); |
| 119 ScrollBoundaryBehavior scroll_boundary_behavior() const { |
| 120 return inputs_.scroll_boundary_behavior; |
| 121 } |
| 122 |
117 void SetMasksToBounds(bool masks_to_bounds); | 123 void SetMasksToBounds(bool masks_to_bounds); |
118 bool masks_to_bounds() const { return inputs_.masks_to_bounds; } | 124 bool masks_to_bounds() const { return inputs_.masks_to_bounds; } |
119 | 125 |
120 void SetMaskLayer(Layer* mask_layer); | 126 void SetMaskLayer(Layer* mask_layer); |
121 Layer* mask_layer() { return inputs_.mask_layer.get(); } | 127 Layer* mask_layer() { return inputs_.mask_layer.get(); } |
122 const Layer* mask_layer() const { return inputs_.mask_layer.get(); } | 128 const Layer* mask_layer() const { return inputs_.mask_layer.get(); } |
123 | 129 |
124 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); | 130 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); |
125 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } | 131 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } |
126 | 132 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 Layer* clip_parent; | 605 Layer* clip_parent; |
600 | 606 |
601 bool has_will_change_transform_hint : 1; | 607 bool has_will_change_transform_hint : 1; |
602 | 608 |
603 bool hide_layer_and_subtree : 1; | 609 bool hide_layer_and_subtree : 1; |
604 | 610 |
605 // The following elements can not and are not serialized. | 611 // The following elements can not and are not serialized. |
606 LayerClient* client; | 612 LayerClient* client; |
607 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; | 613 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; |
608 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; | 614 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
| 615 |
| 616 ScrollBoundaryBehavior scroll_boundary_behavior; |
609 }; | 617 }; |
610 | 618 |
611 Layer* parent_; | 619 Layer* parent_; |
612 | 620 |
613 // Layer instances have a weak pointer to their LayerTreeHost. | 621 // Layer instances have a weak pointer to their LayerTreeHost. |
614 // This pointer value is nil when a Layer is not in a tree and is | 622 // This pointer value is nil when a Layer is not in a tree and is |
615 // updated via SetLayerTreeHost() if a layer moves between trees. | 623 // updated via SetLayerTreeHost() if a layer moves between trees. |
616 LayerTreeHost* layer_tree_host_; | 624 LayerTreeHost* layer_tree_host_; |
617 | 625 |
618 Inputs inputs_; | 626 Inputs inputs_; |
(...skipping 25 matching lines...) Expand all Loading... |
644 // These all act like draw properties, so don't need push properties. | 652 // These all act like draw properties, so don't need push properties. |
645 gfx::Rect visible_layer_rect_; | 653 gfx::Rect visible_layer_rect_; |
646 size_t num_unclipped_descendants_; | 654 size_t num_unclipped_descendants_; |
647 | 655 |
648 DISALLOW_COPY_AND_ASSIGN(Layer); | 656 DISALLOW_COPY_AND_ASSIGN(Layer); |
649 }; | 657 }; |
650 | 658 |
651 } // namespace cc | 659 } // namespace cc |
652 | 660 |
653 #endif // CC_LAYERS_LAYER_H_ | 661 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |