| 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/layers/layer_collections.h" | 25 #include "cc/layers/layer_collections.h" |
| 26 #include "cc/layers/layer_position_constraint.h" | 26 #include "cc/layers/layer_position_constraint.h" |
| 27 #include "cc/layers/snap_point_list.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" |
| 35 #include "ui/gfx/geometry/rect_f.h" | 36 #include "ui/gfx/geometry/rect_f.h" |
| 36 #include "ui/gfx/geometry/scroll_offset.h" | 37 #include "ui/gfx/geometry/scroll_offset.h" |
| (...skipping 70 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 SetScrollSnapOffsets(const SnapPointList& offsets); |
| 119 SnapPointList snap_offsets() { return inputs_.snap_offsets; } |
| 117 void SetMasksToBounds(bool masks_to_bounds); | 120 void SetMasksToBounds(bool masks_to_bounds); |
| 118 bool masks_to_bounds() const { return inputs_.masks_to_bounds; } | 121 bool masks_to_bounds() const { return inputs_.masks_to_bounds; } |
| 119 | 122 |
| 120 void SetMaskLayer(Layer* mask_layer); | 123 void SetMaskLayer(Layer* mask_layer); |
| 121 Layer* mask_layer() { return inputs_.mask_layer.get(); } | 124 Layer* mask_layer() { return inputs_.mask_layer.get(); } |
| 122 const Layer* mask_layer() const { return inputs_.mask_layer.get(); } | 125 const Layer* mask_layer() const { return inputs_.mask_layer.get(); } |
| 123 | 126 |
| 124 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); | 127 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); |
| 125 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } | 128 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } |
| 126 | 129 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 Layer* clip_parent; | 589 Layer* clip_parent; |
| 587 | 590 |
| 588 bool has_will_change_transform_hint : 1; | 591 bool has_will_change_transform_hint : 1; |
| 589 | 592 |
| 590 bool hide_layer_and_subtree : 1; | 593 bool hide_layer_and_subtree : 1; |
| 591 | 594 |
| 592 // The following elements can not and are not serialized. | 595 // The following elements can not and are not serialized. |
| 593 LayerClient* client; | 596 LayerClient* client; |
| 594 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; | 597 base::Callback<void(const gfx::ScrollOffset&)> did_scroll_callback; |
| 595 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; | 598 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
| 599 |
| 600 SnapPointList snap_offsets; |
| 596 }; | 601 }; |
| 597 | 602 |
| 598 Layer* parent_; | 603 Layer* parent_; |
| 599 | 604 |
| 600 // Layer instances have a weak pointer to their LayerTreeHost. | 605 // 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 | 606 // 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. | 607 // updated via SetLayerTreeHost() if a layer moves between trees. |
| 603 LayerTreeHost* layer_tree_host_; | 608 LayerTreeHost* layer_tree_host_; |
| 604 | 609 |
| 605 Inputs inputs_; | 610 Inputs inputs_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 630 // These all act like draw properties, so don't need push properties. | 635 // These all act like draw properties, so don't need push properties. |
| 631 gfx::Rect visible_layer_rect_; | 636 gfx::Rect visible_layer_rect_; |
| 632 size_t num_unclipped_descendants_; | 637 size_t num_unclipped_descendants_; |
| 633 | 638 |
| 634 DISALLOW_COPY_AND_ASSIGN(Layer); | 639 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 635 }; | 640 }; |
| 636 | 641 |
| 637 } // namespace cc | 642 } // namespace cc |
| 638 | 643 |
| 639 #endif // CC_LAYERS_LAYER_H_ | 644 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |