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
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/observer_list.h"
15 #include "cc/animation/layer_animation_controller.h"
16 #include "cc/animation/layer_animation_value_observer.h"
17 #include "cc/animation/layer_animation_value_provider.h"
18 #include "cc/base/cc_export.h"
19 #include "cc/base/region.h"
20 #include "cc/base/scoped_ptr_vector.h"
21 #include "cc/debug/frame_timing_request.h"
22 #include "cc/debug/micro_benchmark.h"
23 #include "cc/layers/layer_lists.h"
24 #include "cc/layers/layer_position_constraint.h"
25 #include "cc/layers/paint_properties.h"
26 #include "cc/layers/scroll_blocks_on.h"
27 #include "cc/output/filter_operations.h"
28 #include "cc/trees/property_tree.h"
29 #include "skia/ext/refptr.h"
30 #include "third_party/skia/include/core/SkColor.h"
31 #include "third_party/skia/include/core/SkImageFilter.h"
32 #include "third_party/skia/include/core/SkPicture.h"
33 #include "third_party/skia/include/core/SkXfermode.h"
34 #include "ui/gfx/geometry/point3_f.h"
35 #include "ui/gfx/geometry/rect.h"
36 #include "ui/gfx/geometry/rect_f.h"
37 #include "ui/gfx/geometry/scroll_offset.h"
38 #include "ui/gfx/transform.h"
45 namespace trace_event
{
46 class ConvertableToTraceFormat
;
53 class AnimationDelegate
;
54 struct AnimationEvent
;
55 class CopyOutputRequest
;
56 class LayerAnimationEventObserver
;
61 class LayerTreeHostCommon
;
63 class LayerTreeSettings
;
64 class RenderingStatsInstrumentation
;
65 class ResourceUpdateQueue
;
66 class ScrollbarLayerInterface
;
67 class SimpleEnclosedRegion
;
68 struct AnimationEvent
;
70 // Base class for composited layers. Special layer types are derived from
72 class CC_EXPORT Layer
: public base::RefCounted
<Layer
>,
73 public LayerAnimationValueObserver
,
74 public LayerAnimationValueProvider
{
76 typedef LayerList LayerListType
;
82 static scoped_refptr
<Layer
> Create(const LayerSettings
& settings
);
84 int id() const { return layer_id_
; }
87 Layer
* parent() { return parent_
; }
88 const Layer
* parent() const { return parent_
; }
89 void AddChild(scoped_refptr
<Layer
> child
);
90 void InsertChild(scoped_refptr
<Layer
> child
, size_t index
);
91 void ReplaceChild(Layer
* reference
, scoped_refptr
<Layer
> new_layer
);
92 void RemoveFromParent();
93 void RemoveAllChildren();
94 void SetChildren(const LayerList
& children
);
95 bool HasAncestor(const Layer
* ancestor
) const;
97 const LayerList
& children() const { return children_
; }
98 Layer
* child_at(size_t index
) { return children_
[index
].get(); }
100 // This requests the layer and its subtree be rendered and given to the
101 // callback. If the copy is unable to be produced (the layer is destroyed
102 // first), then the callback is called with a nullptr/empty result. If the
103 // request's source property is set, any prior uncommitted requests having the
104 // same source will be aborted.
105 void RequestCopyOfOutput(scoped_ptr
<CopyOutputRequest
> request
);
106 bool HasCopyRequest() const {
107 return !copy_requests_
.empty();
110 virtual void SetBackgroundColor(SkColor background_color
);
111 SkColor
background_color() const { return background_color_
; }
112 // If contents_opaque(), return an opaque color else return a
113 // non-opaque color. Tries to return background_color(), if possible.
114 SkColor
SafeOpaqueBackgroundColor() const;
116 // A layer's bounds are in logical, non-page-scaled pixels (however, the
117 // root layer's bounds are in physical pixels).
118 void SetBounds(const gfx::Size
& bounds
);
119 gfx::Size
bounds() const { return bounds_
; }
121 void SetMasksToBounds(bool masks_to_bounds
);
122 bool masks_to_bounds() const { return masks_to_bounds_
; }
124 void SetMaskLayer(Layer
* mask_layer
);
125 Layer
* mask_layer() { return mask_layer_
.get(); }
126 const Layer
* mask_layer() const { return mask_layer_
.get(); }
128 virtual void SetNeedsDisplayRect(const gfx::Rect
& dirty_rect
);
129 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); }
131 void SetOpacity(float opacity
);
132 float opacity() const { return opacity_
; }
133 bool OpacityIsAnimating() const;
134 bool HasPotentiallyRunningOpacityAnimation() const;
135 virtual bool OpacityCanAnimateOnImplThread() const;
137 void SetBlendMode(SkXfermode::Mode blend_mode
);
138 SkXfermode::Mode
blend_mode() const { return blend_mode_
; }
140 void set_draw_blend_mode(SkXfermode::Mode blend_mode
) {
141 if (draw_blend_mode_
== blend_mode
)
143 draw_blend_mode_
= blend_mode
;
144 SetNeedsPushProperties();
146 SkXfermode::Mode
draw_blend_mode() const { return draw_blend_mode_
; }
148 bool uses_default_blend_mode() const {
149 return blend_mode_
== SkXfermode::kSrcOver_Mode
;
152 // A layer is root for an isolated group when it and all its descendants are
153 // drawn over a black and fully transparent background, creating an isolated
154 // group. It should be used along with SetBlendMode(), in order to restrict
155 // layers within the group to blend with layers outside this group.
156 void SetIsRootForIsolatedGroup(bool root
);
157 bool is_root_for_isolated_group() const {
158 return is_root_for_isolated_group_
;
161 void SetFilters(const FilterOperations
& filters
);
162 const FilterOperations
& filters() const { return filters_
; }
163 bool FilterIsAnimating() const;
164 bool HasPotentiallyRunningFilterAnimation() const;
166 // Background filters are filters applied to what is behind this layer, when
167 // they are viewed through non-opaque regions in this layer. They are used
168 // through the WebLayer interface, and are not exposed to HTML.
169 void SetBackgroundFilters(const FilterOperations
& filters
);
170 const FilterOperations
& background_filters() const {
171 return background_filters_
;
174 virtual void SetContentsOpaque(bool opaque
);
175 bool contents_opaque() const { return contents_opaque_
; }
177 void SetPosition(const gfx::PointF
& position
);
178 gfx::PointF
position() const { return position_
; }
180 // A layer that is a container for fixed position layers cannot be both
181 // scrollable and have a non-identity transform.
182 void SetIsContainerForFixedPositionLayers(bool container
);
183 bool IsContainerForFixedPositionLayers() const;
185 gfx::Vector2dF
FixedContainerSizeDelta() const {
186 return gfx::Vector2dF();
189 void SetPositionConstraint(const LayerPositionConstraint
& constraint
);
190 const LayerPositionConstraint
& position_constraint() const {
191 return position_constraint_
;
194 void SetTransform(const gfx::Transform
& transform
);
195 const gfx::Transform
& transform() const { return transform_
; }
196 bool TransformIsAnimating() const;
197 bool HasPotentiallyRunningTransformAnimation() const;
198 bool HasOnlyTranslationTransforms() const;
199 bool AnimationsPreserveAxisAlignment() const;
200 bool transform_is_invertible() const { return transform_is_invertible_
; }
202 bool MaximumTargetScale(float* max_scale
) const;
203 bool AnimationStartScale(float* start_scale
) const;
205 void SetTransformOrigin(const gfx::Point3F
&);
206 gfx::Point3F
transform_origin() const { return transform_origin_
; }
208 bool HasAnyAnimationTargetingProperty(
209 Animation::TargetProperty property
) const;
211 bool ScrollOffsetAnimationWasInterrupted() const;
213 void SetScrollParent(Layer
* parent
);
215 Layer
* scroll_parent() { return scroll_parent_
; }
216 const Layer
* scroll_parent() const { return scroll_parent_
; }
218 void AddScrollChild(Layer
* child
);
219 void RemoveScrollChild(Layer
* child
);
221 std::set
<Layer
*>* scroll_children() { return scroll_children_
.get(); }
222 const std::set
<Layer
*>* scroll_children() const {
223 return scroll_children_
.get();
226 void SetClipParent(Layer
* ancestor
);
228 Layer
* clip_parent() { return clip_parent_
; }
229 const Layer
* clip_parent() const {
233 void AddClipChild(Layer
* child
);
234 void RemoveClipChild(Layer
* child
);
236 std::set
<Layer
*>* clip_children() { return clip_children_
.get(); }
237 const std::set
<Layer
*>* clip_children() const {
238 return clip_children_
.get();
241 // TODO(enne): Fix style here (and everywhere) once LayerImpl does the same.
242 gfx::Transform
draw_transform() const;
243 gfx::Transform
screen_space_transform() const;
245 void set_num_unclipped_descendants(size_t descendants
) {
246 num_unclipped_descendants_
= descendants
;
248 size_t num_unclipped_descendants() const {
249 return num_unclipped_descendants_
;
252 void SetScrollOffset(const gfx::ScrollOffset
& scroll_offset
);
253 void SetScrollCompensationAdjustment(
254 const gfx::Vector2dF
& scroll_compensation_adjustment
);
255 gfx::Vector2dF
ScrollCompensationAdjustment() const;
257 gfx::ScrollOffset
scroll_offset() const { return scroll_offset_
; }
258 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset
& scroll_offset
);
260 void SetScrollClipLayerId(int clip_layer_id
);
261 bool scrollable() const { return scroll_clip_layer_id_
!= INVALID_ID
; }
263 void SetUserScrollable(bool horizontal
, bool vertical
);
264 bool user_scrollable_horizontal() const {
265 return user_scrollable_horizontal_
;
267 bool user_scrollable_vertical() const { return user_scrollable_vertical_
; }
269 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread
);
270 bool should_scroll_on_main_thread() const {
271 return should_scroll_on_main_thread_
;
274 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers
);
275 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_
; }
277 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers
);
278 bool have_scroll_event_handlers() const {
279 return have_scroll_event_handlers_
;
282 void SetNonFastScrollableRegion(const Region
& non_fast_scrollable_region
);
283 const Region
& non_fast_scrollable_region() const {
284 return non_fast_scrollable_region_
;
287 void SetTouchEventHandlerRegion(const Region
& touch_event_handler_region
);
288 const Region
& touch_event_handler_region() const {
289 return touch_event_handler_region_
;
292 void SetScrollBlocksOn(ScrollBlocksOn scroll_blocks_on
);
293 ScrollBlocksOn
scroll_blocks_on() const { return scroll_blocks_on_
; }
295 void set_did_scroll_callback(const base::Closure
& callback
) {
296 did_scroll_callback_
= callback
;
299 void SetForceRenderSurface(bool force_render_surface
);
300 bool force_render_surface() const { return force_render_surface_
; }
302 gfx::Vector2dF
ScrollDelta() const { return gfx::Vector2dF(); }
303 gfx::ScrollOffset
CurrentScrollOffset() const { return scroll_offset_
; }
305 void SetDoubleSided(bool double_sided
);
306 bool double_sided() const { return double_sided_
; }
308 void SetShouldFlattenTransform(bool flatten
);
309 bool should_flatten_transform() const { return should_flatten_transform_
; }
311 bool Is3dSorted() const { return sorting_context_id_
!= 0; }
313 void set_use_parent_backface_visibility(bool use
) {
314 use_parent_backface_visibility_
= use
;
316 bool use_parent_backface_visibility() const {
317 return use_parent_backface_visibility_
;
320 virtual void SetLayerTreeHost(LayerTreeHost
* host
);
322 virtual bool HasDelegatedContent() const;
323 bool HasContributingDelegatedRenderPasses() const { return false; }
325 void SetIsDrawable(bool is_drawable
);
327 void SetHideLayerAndSubtree(bool hide
);
328 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_
; }
330 void SetReplicaLayer(Layer
* layer
);
331 Layer
* replica_layer() { return replica_layer_
.get(); }
332 const Layer
* replica_layer() const { return replica_layer_
.get(); }
334 bool has_mask() const { return !!mask_layer_
.get(); }
335 bool has_replica() const { return !!replica_layer_
.get(); }
336 bool replica_has_mask() const {
337 return replica_layer_
.get() &&
338 (mask_layer_
.get() || replica_layer_
->mask_layer_
.get());
341 int NumDescendantsThatDrawContent() const;
343 // This is only virtual for tests.
344 // TODO(awoloszyn): Remove this once we no longer need it for tests
345 virtual bool DrawsContent() const;
347 // This methods typically need to be overwritten by derived classes.
348 virtual void SavePaintProperties();
349 // Returns true iff anything was updated that needs to be committed.
350 virtual bool Update();
351 virtual void SetIsMask(bool is_mask
) {}
352 virtual bool IsSuitableForGpuRasterization() const;
354 virtual scoped_refptr
<base::trace_event::ConvertableToTraceFormat
>
357 void SetLayerClient(LayerClient
* client
) { client_
= client
; }
359 virtual void PushPropertiesTo(LayerImpl
* layer
);
361 LayerTreeHost
* layer_tree_host() { return layer_tree_host_
; }
362 const LayerTreeHost
* layer_tree_host() const { return layer_tree_host_
; }
364 bool AddAnimation(scoped_ptr
<Animation
> animation
);
365 void PauseAnimation(int animation_id
, double time_offset
);
366 void RemoveAnimation(int animation_id
);
367 void RemoveAnimation(int animation_id
, Animation::TargetProperty property
);
368 LayerAnimationController
* layer_animation_controller() const {
369 return layer_animation_controller_
.get();
371 void SetLayerAnimationControllerForTest(
372 scoped_refptr
<LayerAnimationController
> controller
);
374 void set_layer_animation_delegate(AnimationDelegate
* delegate
) {
375 DCHECK(layer_animation_controller_
);
376 layer_animation_controller_
->set_layer_animation_delegate(delegate
);
379 bool HasActiveAnimation() const;
380 void RegisterForAnimations(AnimationRegistrar
* registrar
);
382 void AddLayerAnimationEventObserver(
383 LayerAnimationEventObserver
* animation_observer
);
384 void RemoveLayerAnimationEventObserver(
385 LayerAnimationEventObserver
* animation_observer
);
387 virtual ScrollbarLayerInterface
* ToScrollbarLayer();
389 virtual skia::RefPtr
<SkPicture
> GetPicture() const;
391 // Constructs a LayerImpl of the correct runtime type for this Layer type.
392 virtual scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
);
394 bool NeedsDisplayForTesting() const { return !update_rect_
.IsEmpty(); }
395 void ResetNeedsDisplayForTesting() { update_rect_
= gfx::Rect(); }
397 RenderingStatsInstrumentation
* rendering_stats_instrumentation() const;
399 const PaintProperties
& paint_properties() const {
400 return paint_properties_
;
403 void SetNeedsPushProperties();
404 bool needs_push_properties() const { return needs_push_properties_
; }
405 bool descendant_needs_push_properties() const {
406 return num_dependents_need_push_properties_
> 0;
408 void reset_needs_push_properties_for_testing() {
409 needs_push_properties_
= false;
412 virtual void RunMicroBenchmark(MicroBenchmark
* benchmark
);
414 void Set3dSortingContextId(int id
);
415 int sorting_context_id() const { return sorting_context_id_
; }
417 void set_property_tree_sequence_number(int sequence_number
) {
418 property_tree_sequence_number_
= sequence_number
;
421 void SetTransformTreeIndex(int index
);
422 int transform_tree_index() const;
424 void SetClipTreeIndex(int index
);
425 int clip_tree_index() const;
427 void SetEffectTreeIndex(int index
);
428 int effect_tree_index() const;
430 void set_offset_to_transform_parent(gfx::Vector2dF offset
) {
431 if (offset_to_transform_parent_
== offset
)
433 offset_to_transform_parent_
= offset
;
434 SetNeedsPushProperties();
436 gfx::Vector2dF
offset_to_transform_parent() const {
437 return offset_to_transform_parent_
;
440 // TODO(enne): Once LayerImpl only uses property trees, remove these
442 const gfx::Rect
& visible_rect_from_property_trees() const {
443 return visible_layer_rect();
445 void set_visible_rect_from_property_trees(const gfx::Rect
& rect
) {
446 set_visible_layer_rect(rect
);
448 const gfx::Rect
& clip_rect_in_target_space_from_property_trees() const {
451 void set_clip_rect_in_target_space_from_property_trees(
452 const gfx::Rect
& rect
) {
455 // TODO(enne): This needs a different name. It is a calculated value
456 // from the property tree builder and not a synonym for "should
457 // flatten transform".
458 void set_should_flatten_transform_from_property_tree(bool should_flatten
) {
459 if (should_flatten_transform_from_property_tree_
== should_flatten
)
461 should_flatten_transform_from_property_tree_
= should_flatten
;
462 SetNeedsPushProperties();
464 bool should_flatten_transform_from_property_tree() const {
465 return should_flatten_transform_from_property_tree_
;
468 const gfx::Rect
& visible_layer_rect() const { return visible_layer_rect_
; }
469 void set_visible_layer_rect(const gfx::Rect
& rect
) {
470 visible_layer_rect_
= rect
;
473 const gfx::Rect
& clip_rect() const { return clip_rect_
; }
474 void set_clip_rect(const gfx::Rect
& rect
) { clip_rect_
= rect
; }
476 void set_is_clipped(bool is_clipped
) {
477 if (is_clipped_
== is_clipped
)
479 is_clipped_
= is_clipped
;
480 SetNeedsPushProperties();
482 bool is_clipped() const { return is_clipped_
; }
484 bool has_render_surface() const {
485 return has_render_surface_
;
488 // Sets new frame timing requests for this layer.
489 void SetFrameTimingRequests(const std::vector
<FrameTimingRequest
>& requests
);
491 // Accessor for unit tests
492 const std::vector
<FrameTimingRequest
>& FrameTimingRequests() const {
493 return frame_timing_requests_
;
496 void DidBeginTracing();
497 void set_num_layer_or_descendant_with_copy_request(
498 int num_layer_or_descendants_with_copy_request
) {
499 num_layer_or_descendants_with_copy_request_
=
500 num_layer_or_descendants_with_copy_request
;
502 int num_layer_or_descendants_with_copy_request() {
503 return num_layer_or_descendants_with_copy_request_
;
506 void set_num_children_with_scroll_parent(
507 int num_children_with_scroll_parent
) {
508 num_children_with_scroll_parent_
= num_children_with_scroll_parent
;
511 int num_children_with_scroll_parent() {
512 return num_children_with_scroll_parent_
;
515 void set_visited(bool visited
);
517 void set_layer_or_descendant_is_drawn(bool layer_or_descendant_is_drawn
);
518 bool layer_or_descendant_is_drawn();
519 void set_sorted_for_recursion(bool sorted_for_recursion
);
520 bool sorted_for_recursion();
523 friend class LayerImpl
;
524 friend class TreeSynchronizer
;
527 explicit Layer(const LayerSettings
& settings
);
529 // These SetNeeds functions are in order of severity of update:
531 // Called when this layer has been modified in some way, but isn't sure
532 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers
533 // before it knows whether or not a commit is required.
534 void SetNeedsUpdate();
535 // Called when a property has been modified in a way that the layer
536 // knows immediately that a commit is required. This implies SetNeedsUpdate
537 // as well as SetNeedsPushProperties to push that property.
538 void SetNeedsCommit();
539 // This is identical to SetNeedsCommit, but the former requests a rebuild of
540 // the property trees.
541 void SetNeedsCommitNoRebuild();
542 // Called when there's been a change in layer structure. Implies both
543 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties.
544 void SetNeedsFullTreeSync();
546 // Called when the next commit should wait until the pending tree is activated
547 // before finishing the commit and unblocking the main thread. Used to ensure
548 // unused resources on the impl thread are returned before commit completes.
549 void SetNextCommitWaitsForActivation();
551 // Will recalculate whether the layer draws content and set draws_content_
553 void UpdateDrawsContent(bool has_drawable_content
);
554 virtual bool HasDrawableContent() const;
556 // Called when the layer's number of drawable descendants changes.
557 void AddDrawableDescendants(int num
);
559 void AddDependentNeedsPushProperties();
560 void RemoveDependentNeedsPushProperties();
561 bool parent_should_know_need_push_properties() const {
562 return needs_push_properties() || descendant_needs_push_properties();
565 bool IsPropertyChangeAllowed() const;
567 // This flag is set when the layer needs to push properties to the impl
569 bool needs_push_properties_
;
571 // The number of direct children or dependent layers that need to be recursed
572 // to in order for them or a descendent of them to push properties to the impl
574 int num_dependents_need_push_properties_
;
576 // Tracks whether this layer may have changed stacking order with its
578 bool stacking_order_changed_
;
580 // The update rect is the region of the compositor resource that was
581 // actually updated by the compositor. For layers that may do updating
582 // outside the compositor's control (i.e. plugin layers), this information
583 // is not available and the update rect will remain empty.
584 // Note this rect is in layer space (not content space).
585 gfx::Rect update_rect_
;
587 scoped_refptr
<Layer
> mask_layer_
;
591 // When true, the layer is about to perform an update. Any commit requests
592 // will be handled implicitly after the update completes.
593 bool ignore_set_needs_commit_
;
595 // Layers that share a sorting context id will be sorted together in 3d
596 // space. 0 is a special value that means this layer will not be sorted and
597 // will be drawn in paint order.
598 int sorting_context_id_
;
601 friend class base::RefCounted
<Layer
>;
602 friend class LayerTreeHostCommon
;
603 void SetParent(Layer
* layer
);
604 bool DescendantIsFixedToContainerLayer() const;
606 // This should only be called during BeginMainFrame since it does not
608 void SetHasRenderSurface(bool has_render_surface
);
610 // This should only be called from RemoveFromParent().
611 void RemoveChildOrDependent(Layer
* child
);
613 // LayerAnimationValueProvider implementation.
614 gfx::ScrollOffset
ScrollOffsetForAnimation() const override
;
616 // LayerAnimationValueObserver implementation.
617 void OnFilterAnimated(const FilterOperations
& filters
) override
;
618 void OnOpacityAnimated(float opacity
) override
;
619 void OnTransformAnimated(const gfx::Transform
& transform
) override
;
620 void OnScrollOffsetAnimated(const gfx::ScrollOffset
& scroll_offset
) override
;
621 void OnAnimationWaitingForDeletion() override
;
622 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating
) override
;
623 bool IsActive() const override
;
625 // If this layer has a scroll parent, it removes |this| from its list of
627 void RemoveFromScrollTree();
629 // If this layer has a clip parent, it removes |this| from its list of clip
631 void RemoveFromClipTree();
633 // When we detach or attach layer to new LayerTreeHost, all property trees'
634 // indices becomes invalid.
635 void InvalidatePropertyTreesIndices();
637 void UpdateNumCopyRequestsForSubtree(bool add
);
642 // Layer instances have a weak pointer to their LayerTreeHost.
643 // This pointer value is nil when a Layer is not in a tree and is
644 // updated via SetLayerTreeHost() if a layer moves between trees.
645 LayerTreeHost
* layer_tree_host_
;
647 scoped_refptr
<LayerAnimationController
> layer_animation_controller_
;
652 gfx::ScrollOffset scroll_offset_
;
653 gfx::Vector2dF scroll_compensation_adjustment_
;
654 // This variable indicates which ancestor layer (if any) whose size,
655 // transformed relative to this layer, defines the maximum scroll offset for
657 int scroll_clip_layer_id_
;
658 int num_descendants_that_draw_content_
;
659 int transform_tree_index_
;
660 int effect_tree_index_
;
661 int clip_tree_index_
;
662 int property_tree_sequence_number_
;
663 int num_layer_or_descendants_with_copy_request_
;
664 int num_children_with_scroll_parent_
;
665 gfx::Vector2dF offset_to_transform_parent_
;
666 bool should_flatten_transform_from_property_tree_
: 1;
667 bool is_clipped_
: 1;
668 bool should_scroll_on_main_thread_
: 1;
669 bool have_wheel_event_handlers_
: 1;
670 bool have_scroll_event_handlers_
: 1;
671 bool user_scrollable_horizontal_
: 1;
672 bool user_scrollable_vertical_
: 1;
673 bool is_root_for_isolated_group_
: 1;
674 bool is_container_for_fixed_position_layers_
: 1;
675 bool is_drawable_
: 1;
676 bool draws_content_
: 1;
677 bool hide_layer_and_subtree_
: 1;
678 bool masks_to_bounds_
: 1;
679 bool contents_opaque_
: 1;
680 bool double_sided_
: 1;
681 bool should_flatten_transform_
: 1;
682 bool use_parent_backface_visibility_
: 1;
683 bool force_render_surface_
: 1;
684 bool transform_is_invertible_
: 1;
685 bool has_render_surface_
: 1;
686 ScrollBlocksOn scroll_blocks_on_
: 3;
687 Region non_fast_scrollable_region_
;
688 Region touch_event_handler_region_
;
689 gfx::PointF position_
;
690 SkColor background_color_
;
692 SkXfermode::Mode blend_mode_
;
693 // draw_blend_mode may be different than blend_mode_,
694 // when a RenderSurface re-parents the layer's blend_mode.
695 SkXfermode::Mode draw_blend_mode_
;
696 FilterOperations filters_
;
697 FilterOperations background_filters_
;
698 LayerPositionConstraint position_constraint_
;
699 Layer
* scroll_parent_
;
700 scoped_ptr
<std::set
<Layer
*>> scroll_children_
;
702 // The following three variables are tracker variables. They are bools
703 // wrapped inside an integer variable. If true, their value equals the
704 // LayerTreeHost's meta_information_sequence_number. This wrapping of bools
705 // inside ints is done to avoid a layer tree treewalk to reset their values.
706 int layer_or_descendant_is_drawn_tracker_
;
707 int sorted_for_recursion_tracker_
;
708 int visited_tracker_
;
711 scoped_ptr
<std::set
<Layer
*>> clip_children_
;
713 gfx::Transform transform_
;
714 gfx::Point3F transform_origin_
;
716 // Replica layer used for reflections.
717 scoped_refptr
<Layer
> replica_layer_
;
719 LayerClient
* client_
;
721 ScopedPtrVector
<CopyOutputRequest
> copy_requests_
;
723 base::Closure did_scroll_callback_
;
725 PaintProperties paint_properties_
;
727 // These all act like draw properties, so don't need push properties.
728 gfx::Rect visible_layer_rect_
;
729 gfx::Rect clip_rect_
;
730 size_t num_unclipped_descendants_
;
732 std::vector
<FrameTimingRequest
> frame_timing_requests_
;
733 bool frame_timing_requests_dirty_
;
735 DISALLOW_COPY_AND_ASSIGN(Layer
);
740 #endif // CC_LAYERS_LAYER_H_