OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_IMPL_H_ | 5 #ifndef CC_LAYERS_LAYER_IMPL_H_ |
6 #define CC_LAYERS_LAYER_IMPL_H_ | 6 #define CC_LAYERS_LAYER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 class Tile; | 63 class Tile; |
64 | 64 |
65 | 65 |
66 enum DrawMode { | 66 enum DrawMode { |
67 DRAW_MODE_NONE, | 67 DRAW_MODE_NONE, |
68 DRAW_MODE_HARDWARE, | 68 DRAW_MODE_HARDWARE, |
69 DRAW_MODE_SOFTWARE, | 69 DRAW_MODE_SOFTWARE, |
70 DRAW_MODE_RESOURCELESS_SOFTWARE | 70 DRAW_MODE_RESOURCELESS_SOFTWARE |
71 }; | 71 }; |
72 | 72 |
73 enum ViewportLayerType { | |
74 NOT_VIEWPORT_LAYER, | |
75 INNER_VIEWPORT_CONTAINER, | |
76 OUTER_VIEWPORT_CONTAINER, | |
77 INNER_VIEWPORT_SCROLL, | |
78 OUTER_VIEWPORT_SCROLL, | |
79 // If values are added or removed, ensure LayerImpl::viewport_layer_type_ is | |
enne (OOO)
2017/05/09 17:08:29
Can you static assert this instead of leaving a co
pdr.
2017/05/09 22:20:07
Done, I went with:
static_assert(OUTER_VIEWPORT_
| |
80 // updated to use more or less bits as needed. | |
81 }; | |
82 | |
73 class CC_EXPORT LayerImpl { | 83 class CC_EXPORT LayerImpl { |
74 public: | 84 public: |
75 static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 85 static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
76 return base::WrapUnique(new LayerImpl(tree_impl, id)); | 86 return base::WrapUnique(new LayerImpl(tree_impl, id)); |
77 } | 87 } |
78 | 88 |
79 virtual ~LayerImpl(); | 89 virtual ~LayerImpl(); |
80 | 90 |
81 int id() const { return layer_id_; } | 91 int id() const { return layer_id_; } |
82 | 92 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 // The client should be responsible for setting bounds, content bounds and | 267 // The client should be responsible for setting bounds, content bounds and |
258 // contents scale to appropriate values. LayerImpl doesn't calculate any of | 268 // contents scale to appropriate values. LayerImpl doesn't calculate any of |
259 // them from the other values. | 269 // them from the other values. |
260 | 270 |
261 void SetBounds(const gfx::Size& bounds); | 271 void SetBounds(const gfx::Size& bounds); |
262 gfx::Size bounds() const; | 272 gfx::Size bounds() const; |
263 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions | 273 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions |
264 // of pixels) due to use of single precision float. | 274 // of pixels) due to use of single precision float. |
265 gfx::SizeF BoundsForScrolling() const; | 275 gfx::SizeF BoundsForScrolling() const; |
266 | 276 |
267 // Viewport bounds delta are used for viewport layers and accounts for changes | 277 // Viewport bounds delta are only used for viewport layers and account for |
268 // in the viewport layers from browser controls and page scale factors. These | 278 // changes in the viewport layers from browser controls and page scale |
269 // deltas are only set on the active tree. | 279 // factors. These deltas are only set on the active tree. |
270 void SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta); | 280 void SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta); |
271 gfx::Vector2dF ViewportBoundsDelta() const; | 281 gfx::Vector2dF ViewportBoundsDelta() const; |
272 | 282 |
283 void SetViewportLayerType(ViewportLayerType type) { | |
284 // Once set as a viewport layer type, the viewport type should not change. | |
enne (OOO)
2017/05/09 17:08:29
Can you leave a "why" here as well? Or a quick poi
pdr.
2017/05/09 22:20:07
This appears to be how the system works (we don't
enne (OOO)
2017/05/09 22:31:52
Hmm ok ok. This is fine as-is.
| |
285 DCHECK(viewport_layer_type() == NOT_VIEWPORT_LAYER || | |
286 viewport_layer_type() == type); | |
287 viewport_layer_type_ = type; | |
288 } | |
289 ViewportLayerType viewport_layer_type() const { | |
290 return static_cast<ViewportLayerType>(viewport_layer_type_); | |
291 } | |
292 | |
273 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); | 293 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); |
274 gfx::ScrollOffset CurrentScrollOffset() const; | 294 gfx::ScrollOffset CurrentScrollOffset() const; |
275 | 295 |
276 gfx::ScrollOffset MaxScrollOffset() const; | 296 gfx::ScrollOffset MaxScrollOffset() const; |
277 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const; | 297 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const; |
278 gfx::Vector2dF ClampScrollToMaxScrollOffset(); | 298 gfx::Vector2dF ClampScrollToMaxScrollOffset(); |
279 | 299 |
280 // Returns the delta of the scroll that was outside of the bounds of the | 300 // Returns the delta of the scroll that was outside of the bounds of the |
281 // initial scroll | 301 // initial scroll |
282 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll); | 302 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 bool use_parent_backface_visibility_ : 1; | 516 bool use_parent_backface_visibility_ : 1; |
497 bool use_local_transform_for_backface_visibility_ : 1; | 517 bool use_local_transform_for_backface_visibility_ : 1; |
498 bool should_check_backface_visibility_ : 1; | 518 bool should_check_backface_visibility_ : 1; |
499 bool draws_content_ : 1; | 519 bool draws_content_ : 1; |
500 bool contributes_to_drawn_render_surface_ : 1; | 520 bool contributes_to_drawn_render_surface_ : 1; |
501 | 521 |
502 // This is true if and only if the layer was ever ready since it last animated | 522 // This is true if and only if the layer was ever ready since it last animated |
503 // (all content was complete). | 523 // (all content was complete). |
504 bool was_ever_ready_since_last_transform_animation_ : 1; | 524 bool was_ever_ready_since_last_transform_animation_ : 1; |
505 | 525 |
526 unsigned viewport_layer_type_ : 3; // ViewportLayerType | |
enne (OOO)
2017/05/09 17:08:29
s/unsigned/uint8_t/
pdr.
2017/05/09 22:20:07
Done
| |
527 | |
506 Region non_fast_scrollable_region_; | 528 Region non_fast_scrollable_region_; |
507 Region touch_event_handler_region_; | 529 Region touch_event_handler_region_; |
508 SkColor background_color_; | 530 SkColor background_color_; |
509 SkColor safe_opaque_background_color_; | 531 SkColor safe_opaque_background_color_; |
510 | 532 |
511 gfx::PointF position_; | 533 gfx::PointF position_; |
512 | 534 |
513 gfx::Rect clip_rect_in_target_space_; | 535 gfx::Rect clip_rect_in_target_space_; |
514 int transform_tree_index_; | 536 int transform_tree_index_; |
515 int effect_tree_index_; | 537 int effect_tree_index_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 bool needs_show_scrollbars_ : 1; | 580 bool needs_show_scrollbars_ : 1; |
559 | 581 |
560 bool raster_even_if_not_in_rsll_ : 1; | 582 bool raster_even_if_not_in_rsll_ : 1; |
561 | 583 |
562 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 584 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
563 }; | 585 }; |
564 | 586 |
565 } // namespace cc | 587 } // namespace cc |
566 | 588 |
567 #endif // CC_LAYERS_LAYER_IMPL_H_ | 589 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |