| 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 Layer* clip_parent; | 604 Layer* clip_parent; |
| 599 | 605 |
| 600 bool has_will_change_transform_hint : 1; | 606 bool has_will_change_transform_hint : 1; |
| 601 | 607 |
| 602 bool hide_layer_and_subtree : 1; | 608 bool hide_layer_and_subtree : 1; |
| 603 | 609 |
| 604 // The following elements can not and are not serialized. | 610 // The following elements can not and are not serialized. |
| 605 LayerClient* client; | 611 LayerClient* client; |
| 606 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; | 612 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; |
| 607 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; | 613 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
| 614 |
| 615 ScrollBoundaryBehavior scroll_boundary_behavior; |
| 608 }; | 616 }; |
| 609 | 617 |
| 610 Layer* parent_; | 618 Layer* parent_; |
| 611 | 619 |
| 612 // Layer instances have a weak pointer to their LayerTreeHost. | 620 // Layer instances have a weak pointer to their LayerTreeHost. |
| 613 // This pointer value is nil when a Layer is not in a tree and is | 621 // This pointer value is nil when a Layer is not in a tree and is |
| 614 // updated via SetLayerTreeHost() if a layer moves between trees. | 622 // updated via SetLayerTreeHost() if a layer moves between trees. |
| 615 LayerTreeHost* layer_tree_host_; | 623 LayerTreeHost* layer_tree_host_; |
| 616 | 624 |
| 617 Inputs inputs_; | 625 Inputs inputs_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 643 // These all act like draw properties, so don't need push properties. | 651 // These all act like draw properties, so don't need push properties. |
| 644 gfx::Rect visible_layer_rect_; | 652 gfx::Rect visible_layer_rect_; |
| 645 size_t num_unclipped_descendants_; | 653 size_t num_unclipped_descendants_; |
| 646 | 654 |
| 647 DISALLOW_COPY_AND_ASSIGN(Layer); | 655 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 648 }; | 656 }; |
| 649 | 657 |
| 650 } // namespace cc | 658 } // namespace cc |
| 651 | 659 |
| 652 #endif // CC_LAYERS_LAYER_H_ | 660 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |