Chromium Code Reviews| 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/paint/paint_record.h" | 28 #include "cc/paint/paint_record.h" |
| 28 #include "cc/trees/element_id.h" | 29 #include "cc/trees/element_id.h" |
| 29 #include "cc/trees/mutator_host_client.h" | 30 #include "cc/trees/mutator_host_client.h" |
| 30 #include "cc/trees/property_tree.h" | 31 #include "cc/trees/property_tree.h" |
| 31 #include "cc/trees/target_property.h" | 32 #include "cc/trees/target_property.h" |
| 32 #include "third_party/skia/include/core/SkColor.h" | 33 #include "third_party/skia/include/core/SkColor.h" |
| 33 #include "ui/gfx/geometry/point3_f.h" | 34 #include "ui/gfx/geometry/point3_f.h" |
| 34 #include "ui/gfx/geometry/rect.h" | 35 #include "ui/gfx/geometry/rect.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(ScrollBoundaryBehavior behavior); | |
|
bokan
2017/05/19 19:35:57
pass by const-ref
sunyunjia
2017/05/25 20:07:10
Done.
| |
| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 Layer* clip_parent; | 592 Layer* clip_parent; |
| 587 | 593 |
| 588 bool has_will_change_transform_hint : 1; | 594 bool has_will_change_transform_hint : 1; |
| 589 | 595 |
| 590 bool hide_layer_and_subtree : 1; | 596 bool hide_layer_and_subtree : 1; |
| 591 | 597 |
| 592 // The following elements can not and are not serialized. | 598 // The following elements can not and are not serialized. |
| 593 LayerClient* client; | 599 LayerClient* client; |
| 594 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; | 600 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; |
| 595 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; | 601 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
| 602 | |
| 603 ScrollBoundaryBehavior scroll_boundary_behavior; | |
| 596 }; | 604 }; |
| 597 | 605 |
| 598 Layer* parent_; | 606 Layer* parent_; |
| 599 | 607 |
| 600 // Layer instances have a weak pointer to their LayerTreeHost. | 608 // Layer instances have a weak pointer to their LayerTreeHost. |
| 601 // This pointer value is nil when a Layer is not in a tree and is | 609 // This pointer value is nil when a Layer is not in a tree and is |
| 602 // updated via SetLayerTreeHost() if a layer moves between trees. | 610 // updated via SetLayerTreeHost() if a layer moves between trees. |
| 603 LayerTreeHost* layer_tree_host_; | 611 LayerTreeHost* layer_tree_host_; |
| 604 | 612 |
| 605 Inputs inputs_; | 613 Inputs inputs_; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 630 // These all act like draw properties, so don't need push properties. | 638 // These all act like draw properties, so don't need push properties. |
| 631 gfx::Rect visible_layer_rect_; | 639 gfx::Rect visible_layer_rect_; |
| 632 size_t num_unclipped_descendants_; | 640 size_t num_unclipped_descendants_; |
| 633 | 641 |
| 634 DISALLOW_COPY_AND_ASSIGN(Layer); | 642 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 635 }; | 643 }; |
| 636 | 644 |
| 637 } // namespace cc | 645 } // namespace cc |
| 638 | 646 |
| 639 #endif // CC_LAYERS_LAYER_H_ | 647 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |