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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 class Animation; | 51 class Animation; |
52 class AnimationDelegate; | 52 class AnimationDelegate; |
53 struct AnimationEvent; | 53 struct AnimationEvent; |
54 class CopyOutputRequest; | 54 class CopyOutputRequest; |
55 class LayerAnimationDelegate; | 55 class LayerAnimationDelegate; |
56 class LayerAnimationEventObserver; | 56 class LayerAnimationEventObserver; |
57 class LayerClient; | 57 class LayerClient; |
58 class LayerImpl; | 58 class LayerImpl; |
59 class LayerTreeHost; | 59 class LayerTreeHost; |
| 60 class LayerTreeHostCommon; |
60 class LayerTreeImpl; | 61 class LayerTreeImpl; |
61 class PriorityCalculator; | 62 class PriorityCalculator; |
62 class RenderingStatsInstrumentation; | 63 class RenderingStatsInstrumentation; |
63 class ResourceUpdateQueue; | 64 class ResourceUpdateQueue; |
64 class ScrollbarLayerInterface; | 65 class ScrollbarLayerInterface; |
65 class SimpleEnclosedRegion; | 66 class SimpleEnclosedRegion; |
66 struct AnimationEvent; | 67 struct AnimationEvent; |
67 template <typename LayerType> | 68 template <typename LayerType> |
68 class OcclusionTracker; | 69 class OcclusionTracker; |
69 | 70 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 bool IsContainerForFixedPositionLayers() const; | 172 bool IsContainerForFixedPositionLayers() const; |
172 | 173 |
173 void SetPositionConstraint(const LayerPositionConstraint& constraint); | 174 void SetPositionConstraint(const LayerPositionConstraint& constraint); |
174 const LayerPositionConstraint& position_constraint() const { | 175 const LayerPositionConstraint& position_constraint() const { |
175 return position_constraint_; | 176 return position_constraint_; |
176 } | 177 } |
177 | 178 |
178 void SetTransform(const gfx::Transform& transform); | 179 void SetTransform(const gfx::Transform& transform); |
179 const gfx::Transform& transform() const { return transform_; } | 180 const gfx::Transform& transform() const { return transform_; } |
180 bool TransformIsAnimating() const; | 181 bool TransformIsAnimating() const; |
| 182 bool AnimationsPreserveAxisAlignment() const; |
181 bool transform_is_invertible() const { return transform_is_invertible_; } | 183 bool transform_is_invertible() const { return transform_is_invertible_; } |
182 | 184 |
183 void SetTransformOrigin(const gfx::Point3F&); | 185 void SetTransformOrigin(const gfx::Point3F&); |
184 gfx::Point3F transform_origin() const { return transform_origin_; } | 186 gfx::Point3F transform_origin() const { return transform_origin_; } |
185 | 187 |
186 void SetScrollParent(Layer* parent); | 188 void SetScrollParent(Layer* parent); |
187 | 189 |
188 Layer* scroll_parent() { return scroll_parent_; } | 190 Layer* scroll_parent() { return scroll_parent_; } |
189 const Layer* scroll_parent() const { return scroll_parent_; } | 191 const Layer* scroll_parent() const { return scroll_parent_; } |
190 | 192 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 Layer* render_target() { | 251 Layer* render_target() { |
250 DCHECK(!draw_properties_.render_target || | 252 DCHECK(!draw_properties_.render_target || |
251 draw_properties_.render_target->render_surface()); | 253 draw_properties_.render_target->render_surface()); |
252 return draw_properties_.render_target; | 254 return draw_properties_.render_target; |
253 } | 255 } |
254 const Layer* render_target() const { | 256 const Layer* render_target() const { |
255 DCHECK(!draw_properties_.render_target || | 257 DCHECK(!draw_properties_.render_target || |
256 draw_properties_.render_target->render_surface()); | 258 draw_properties_.render_target->render_surface()); |
257 return draw_properties_.render_target; | 259 return draw_properties_.render_target; |
258 } | 260 } |
259 RenderSurface* render_surface() const { | |
260 return draw_properties_.render_surface.get(); | |
261 } | |
262 int num_unclipped_descendants() const { | 261 int num_unclipped_descendants() const { |
263 return draw_properties_.num_unclipped_descendants; | 262 return draw_properties_.num_unclipped_descendants; |
264 } | 263 } |
265 | 264 |
| 265 RenderSurface* render_surface() const { return render_surface_.get(); } |
266 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset); | 266 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset); |
267 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } | 267 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } |
268 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset); | 268 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset); |
269 | 269 |
270 void SetScrollClipLayerId(int clip_layer_id); | 270 void SetScrollClipLayerId(int clip_layer_id); |
271 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; } | 271 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; } |
272 | 272 |
273 void SetUserScrollable(bool horizontal, bool vertical); | 273 void SetUserScrollable(bool horizontal, bool vertical); |
274 bool user_scrollable_horizontal() const { | 274 bool user_scrollable_horizontal() const { |
275 return user_scrollable_horizontal_; | 275 return user_scrollable_horizontal_; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 virtual bool IsSuitableForGpuRasterization() const; | 370 virtual bool IsSuitableForGpuRasterization() const; |
371 | 371 |
372 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo(); | 372 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo(); |
373 | 373 |
374 void SetLayerClient(LayerClient* client) { client_ = client; } | 374 void SetLayerClient(LayerClient* client) { client_ = client; } |
375 | 375 |
376 virtual void PushPropertiesTo(LayerImpl* layer); | 376 virtual void PushPropertiesTo(LayerImpl* layer); |
377 | 377 |
378 void CreateRenderSurface(); | 378 void CreateRenderSurface(); |
379 void ClearRenderSurface(); | 379 void ClearRenderSurface(); |
| 380 |
380 void ClearRenderSurfaceLayerList(); | 381 void ClearRenderSurfaceLayerList(); |
381 | 382 |
382 // The contents scale converts from logical, non-page-scaled pixels to target | 383 // The contents scale converts from logical, non-page-scaled pixels to target |
383 // pixels. The contents scale is 1 for the root layer as it is already in | 384 // pixels. The contents scale is 1 for the root layer as it is already in |
384 // physical pixels. By default contents scale is forced to be 1 except for | 385 // physical pixels. By default contents scale is forced to be 1 except for |
385 // subclasses of ContentsScalingLayer. | 386 // subclasses of ContentsScalingLayer. |
386 float contents_scale_x() const { return draw_properties_.contents_scale_x; } | 387 float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
387 float contents_scale_y() const { return draw_properties_.contents_scale_y; } | 388 float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
388 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } | 389 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
389 | 390 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 // TODO(vollick): These values are temporary and will be removed as soon as | 497 // TODO(vollick): These values are temporary and will be removed as soon as |
497 // render surface determinations are moved out of CDP. They only exist because | 498 // render surface determinations are moved out of CDP. They only exist because |
498 // certain logic depends on whether or not a layer would render to a separate | 499 // certain logic depends on whether or not a layer would render to a separate |
499 // surface, but CDP destroys surfaces and targets it doesn't need, so without | 500 // surface, but CDP destroys surfaces and targets it doesn't need, so without |
500 // this boolean, this is impossible to determine after the fact without | 501 // this boolean, this is impossible to determine after the fact without |
501 // wastefully recomputing it. This is public for the time being so that it can | 502 // wastefully recomputing it. This is public for the time being so that it can |
502 // be accessed from CDP. | 503 // be accessed from CDP. |
503 bool has_render_surface() const { | 504 bool has_render_surface() const { |
504 return has_render_surface_; | 505 return has_render_surface_; |
505 } | 506 } |
506 void SetHasRenderSurface(bool has_render_surface) { | |
507 has_render_surface_ = has_render_surface; | |
508 } | |
509 | 507 |
510 protected: | 508 protected: |
511 friend class LayerImpl; | 509 friend class LayerImpl; |
512 friend class TreeSynchronizer; | 510 friend class TreeSynchronizer; |
513 ~Layer() override; | 511 ~Layer() override; |
514 | 512 |
515 Layer(); | 513 Layer(); |
516 | 514 |
517 // These SetNeeds functions are in order of severity of update: | 515 // These SetNeeds functions are in order of severity of update: |
518 // | 516 // |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 // will be handled implicitly after the update completes. | 577 // will be handled implicitly after the update completes. |
580 bool ignore_set_needs_commit_; | 578 bool ignore_set_needs_commit_; |
581 | 579 |
582 // Layers that share a sorting context id will be sorted together in 3d | 580 // Layers that share a sorting context id will be sorted together in 3d |
583 // space. 0 is a special value that means this layer will not be sorted and | 581 // space. 0 is a special value that means this layer will not be sorted and |
584 // will be drawn in paint order. | 582 // will be drawn in paint order. |
585 int sorting_context_id_; | 583 int sorting_context_id_; |
586 | 584 |
587 private: | 585 private: |
588 friend class base::RefCounted<Layer>; | 586 friend class base::RefCounted<Layer>; |
589 | 587 friend class LayerTreeHostCommon; |
590 void SetParent(Layer* layer); | 588 void SetParent(Layer* layer); |
591 bool DescendantIsFixedToContainerLayer() const; | 589 bool DescendantIsFixedToContainerLayer() const; |
592 | 590 |
| 591 // This should only be called during BeginMainFrame since it does not |
| 592 // trigger a Commit. |
| 593 void SetHasRenderSurface(bool has_render_surface); |
| 594 |
593 // Returns the index of the child or -1 if not found. | 595 // Returns the index of the child or -1 if not found. |
594 int IndexOfChild(const Layer* reference); | 596 int IndexOfChild(const Layer* reference); |
595 | 597 |
596 // This should only be called from RemoveFromParent(). | 598 // This should only be called from RemoveFromParent(). |
597 void RemoveChildOrDependent(Layer* child); | 599 void RemoveChildOrDependent(Layer* child); |
598 | 600 |
599 // LayerAnimationValueProvider implementation. | 601 // LayerAnimationValueProvider implementation. |
600 gfx::ScrollOffset ScrollOffsetForAnimation() const override; | 602 gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
601 | 603 |
602 // LayerAnimationValueObserver implementation. | 604 // LayerAnimationValueObserver implementation. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 685 |
684 LayerClient* client_; | 686 LayerClient* client_; |
685 | 687 |
686 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 688 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
687 | 689 |
688 base::Closure did_scroll_callback_; | 690 base::Closure did_scroll_callback_; |
689 | 691 |
690 DrawProperties<Layer> draw_properties_; | 692 DrawProperties<Layer> draw_properties_; |
691 | 693 |
692 PaintProperties paint_properties_; | 694 PaintProperties paint_properties_; |
| 695 // TODO(awoloszyn): This is redundant with has_render_surface_, |
| 696 // and should get removed once it is no longer needed on main thread. |
| 697 scoped_ptr<RenderSurface> render_surface_; |
693 | 698 |
694 gfx::Rect visible_rect_from_property_trees_; | 699 gfx::Rect visible_rect_from_property_trees_; |
695 DISALLOW_COPY_AND_ASSIGN(Layer); | 700 DISALLOW_COPY_AND_ASSIGN(Layer); |
696 }; | 701 }; |
697 | 702 |
698 } // namespace cc | 703 } // namespace cc |
699 | 704 |
700 #endif // CC_LAYERS_LAYER_H_ | 705 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |