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
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_LAYER_IMPL_H_
6 #define CC_LAYERS_LAYER_IMPL_H_
11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h"
14 #include "cc/animation/animation_delegate.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/input/input_handler.h"
22 #include "cc/layers/draw_properties.h"
23 #include "cc/layers/layer_lists.h"
24 #include "cc/layers/layer_position_constraint.h"
25 #include "cc/layers/render_surface_impl.h"
26 #include "cc/output/filter_operations.h"
27 #include "cc/quads/shared_quad_state.h"
28 #include "cc/resources/resource_provider.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 "ui/gfx/point3_f.h"
34 #include "ui/gfx/rect.h"
35 #include "ui/gfx/rect_f.h"
36 #include "ui/gfx/transform.h"
40 class ConvertableToTraceFormat
;
44 class DictionaryValue
;
49 class LayerTreeHostImpl
;
51 class MicroBenchmarkImpl
;
53 template <typename LayerType
>
54 class OcclusionTracker
;
58 class ScrollbarAnimationController
;
59 class ScrollbarLayerImplBase
;
60 class SimpleEnclosedRegion
;
63 struct AppendQuadsData
;
69 DRAW_MODE_RESOURCELESS_SOFTWARE
72 class CC_EXPORT LayerImpl
: public LayerAnimationValueObserver
,
73 public LayerAnimationValueProvider
,
74 public AnimationDelegate
{
76 // Allows for the ownership of the total scroll offset to be delegated outside
78 class ScrollOffsetDelegate
{
80 virtual void SetTotalScrollOffset(const gfx::Vector2dF
& new_value
) = 0;
81 virtual gfx::Vector2dF
GetTotalScrollOffset() = 0;
82 virtual bool IsExternalFlingActive() const = 0;
85 typedef LayerImplList RenderSurfaceListType
;
86 typedef LayerImplList LayerListType
;
87 typedef RenderSurfaceImpl RenderSurfaceType
;
89 enum RenderingContextConstants
{ NO_RENDERING_CONTEXT
= 0 };
91 static scoped_ptr
<LayerImpl
> Create(LayerTreeImpl
* tree_impl
, int id
) {
92 return make_scoped_ptr(new LayerImpl(tree_impl
, id
));
97 int id() const { return layer_id_
; }
99 // LayerAnimationValueProvider implementation.
100 virtual gfx::Vector2dF
ScrollOffsetForAnimation() const OVERRIDE
;
102 // LayerAnimationValueObserver implementation.
103 virtual void OnFilterAnimated(const FilterOperations
& filters
) OVERRIDE
;
104 virtual void OnOpacityAnimated(float opacity
) OVERRIDE
;
105 virtual void OnTransformAnimated(const gfx::Transform
& transform
) OVERRIDE
;
106 virtual void OnScrollOffsetAnimated(
107 const gfx::Vector2dF
& scroll_offset
) OVERRIDE
;
108 virtual void OnAnimationWaitingForDeletion() OVERRIDE
;
109 virtual bool IsActive() const OVERRIDE
;
111 // AnimationDelegate implementation.
112 virtual void NotifyAnimationStarted(
113 base::TimeTicks monotonic_time
,
114 Animation::TargetProperty target_property
) OVERRIDE
{};
115 virtual void NotifyAnimationFinished(
116 base::TimeTicks monotonic_time
,
117 Animation::TargetProperty target_property
) OVERRIDE
;
120 LayerImpl
* parent() { return parent_
; }
121 const LayerImpl
* parent() const { return parent_
; }
122 const OwnedLayerImplList
& children() const { return children_
; }
123 OwnedLayerImplList
& children() { return children_
; }
124 LayerImpl
* child_at(size_t index
) const { return children_
[index
]; }
125 void AddChild(scoped_ptr
<LayerImpl
> child
);
126 scoped_ptr
<LayerImpl
> RemoveChild(LayerImpl
* child
);
127 void SetParent(LayerImpl
* parent
);
129 // Warning: This does not preserve tree structure invariants.
130 void ClearChildList();
132 bool HasAncestor(const LayerImpl
* ancestor
) const;
134 void SetScrollParent(LayerImpl
* parent
);
136 LayerImpl
* scroll_parent() { return scroll_parent_
; }
137 const LayerImpl
* scroll_parent() const { return scroll_parent_
; }
139 void SetScrollChildren(std::set
<LayerImpl
*>* children
);
141 std::set
<LayerImpl
*>* scroll_children() { return scroll_children_
.get(); }
142 const std::set
<LayerImpl
*>* scroll_children() const {
143 return scroll_children_
.get();
146 void SetNumDescendantsThatDrawContent(int num_descendants
);
147 void SetClipParent(LayerImpl
* ancestor
);
149 LayerImpl
* clip_parent() {
152 const LayerImpl
* clip_parent() const {
156 void SetClipChildren(std::set
<LayerImpl
*>* children
);
158 std::set
<LayerImpl
*>* clip_children() { return clip_children_
.get(); }
159 const std::set
<LayerImpl
*>* clip_children() const {
160 return clip_children_
.get();
163 void PassCopyRequests(ScopedPtrVector
<CopyOutputRequest
>* requests
);
164 // Can only be called when the layer has a copy request.
165 void TakeCopyRequestsAndTransformToTarget(
166 ScopedPtrVector
<CopyOutputRequest
>* request
);
167 bool HasCopyRequest() const { return !copy_requests_
.empty(); }
169 void SetMaskLayer(scoped_ptr
<LayerImpl
> mask_layer
);
170 LayerImpl
* mask_layer() { return mask_layer_
.get(); }
171 const LayerImpl
* mask_layer() const { return mask_layer_
.get(); }
172 scoped_ptr
<LayerImpl
> TakeMaskLayer();
174 void SetReplicaLayer(scoped_ptr
<LayerImpl
> replica_layer
);
175 LayerImpl
* replica_layer() { return replica_layer_
.get(); }
176 const LayerImpl
* replica_layer() const { return replica_layer_
.get(); }
177 scoped_ptr
<LayerImpl
> TakeReplicaLayer();
179 bool has_mask() const { return mask_layer_
; }
180 bool has_replica() const { return replica_layer_
; }
181 bool replica_has_mask() const {
182 return replica_layer_
&& (mask_layer_
|| replica_layer_
->mask_layer_
);
185 LayerTreeImpl
* layer_tree_impl() const { return layer_tree_impl_
; }
187 void PopulateSharedQuadState(SharedQuadState
* state
) const;
188 // WillDraw must be called before AppendQuads. If WillDraw returns false,
189 // AppendQuads and DidDraw will not be called. If WillDraw returns true,
190 // DidDraw is guaranteed to be called before another WillDraw or before
191 // the layer is destroyed. To enforce this, any class that overrides
192 // WillDraw/DidDraw must call the base class version only if WillDraw
194 virtual bool WillDraw(DrawMode draw_mode
,
195 ResourceProvider
* resource_provider
);
196 virtual void AppendQuads(RenderPass
* render_pass
,
197 const OcclusionTracker
<LayerImpl
>& occlusion_tracker
,
198 AppendQuadsData
* append_quads_data
) {}
199 virtual void DidDraw(ResourceProvider
* resource_provider
);
201 virtual ResourceProvider::ResourceId
ContentsResourceId() const;
203 virtual bool HasDelegatedContent() const;
204 virtual bool HasContributingDelegatedRenderPasses() const;
205 virtual RenderPassId
FirstContributingRenderPassId() const;
206 virtual RenderPassId
NextContributingRenderPassId(RenderPassId id
) const;
208 virtual void UpdateTiles(const Occlusion
& occlusion_in_layer_space
) {}
209 virtual void NotifyTileStateChanged(const Tile
* tile
) {}
211 virtual ScrollbarLayerImplBase
* ToScrollbarLayer();
213 // Returns true if this layer has content to draw.
214 void SetDrawsContent(bool draws_content
);
215 bool DrawsContent() const { return draws_content_
; }
217 int NumDescendantsThatDrawContent() const;
218 void SetHideLayerAndSubtree(bool hide
);
219 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_
; }
221 bool force_render_surface() const { return force_render_surface_
; }
222 void SetForceRenderSurface(bool force
) { force_render_surface_
= force
; }
224 void SetTransformOrigin(const gfx::Point3F
& transform_origin
);
225 gfx::Point3F
transform_origin() const { return transform_origin_
; }
227 void SetBackgroundColor(SkColor background_color
);
228 SkColor
background_color() const { return background_color_
; }
229 // If contents_opaque(), return an opaque color else return a
230 // non-opaque color. Tries to return background_color(), if possible.
231 SkColor
SafeOpaqueBackgroundColor() const;
233 void SetFilters(const FilterOperations
& filters
);
234 const FilterOperations
& filters() const { return filters_
; }
235 bool FilterIsAnimating() const;
236 bool FilterIsAnimatingOnImplOnly() const;
238 void SetBackgroundFilters(const FilterOperations
& filters
);
239 const FilterOperations
& background_filters() const {
240 return background_filters_
;
243 void SetMasksToBounds(bool masks_to_bounds
);
244 bool masks_to_bounds() const { return masks_to_bounds_
; }
246 void SetContentsOpaque(bool opaque
);
247 bool contents_opaque() const { return contents_opaque_
; }
249 void SetOpacity(float opacity
);
250 float opacity() const { return opacity_
; }
251 bool OpacityIsAnimating() const;
252 bool OpacityIsAnimatingOnImplOnly() const;
254 void SetBlendMode(SkXfermode::Mode
);
255 SkXfermode::Mode
blend_mode() const { return blend_mode_
; }
256 bool uses_default_blend_mode() const {
257 return blend_mode_
== SkXfermode::kSrcOver_Mode
;
260 void SetIsRootForIsolatedGroup(bool root
);
261 bool is_root_for_isolated_group() const {
262 return is_root_for_isolated_group_
;
265 void SetPosition(const gfx::PointF
& position
);
266 gfx::PointF
position() const { return position_
; }
268 void SetIsContainerForFixedPositionLayers(bool container
) {
269 is_container_for_fixed_position_layers_
= container
;
271 // This is a non-trivial function in Layer.
272 bool IsContainerForFixedPositionLayers() const {
273 return is_container_for_fixed_position_layers_
;
276 gfx::Vector2dF
FixedContainerSizeDelta() const;
278 void SetPositionConstraint(const LayerPositionConstraint
& constraint
) {
279 position_constraint_
= constraint
;
281 const LayerPositionConstraint
& position_constraint() const {
282 return position_constraint_
;
285 void SetShouldFlattenTransform(bool flatten
);
286 bool should_flatten_transform() const { return should_flatten_transform_
; }
288 bool Is3dSorted() const { return sorting_context_id_
!= 0; }
290 void SetUseParentBackfaceVisibility(bool use
) {
291 use_parent_backface_visibility_
= use
;
293 bool use_parent_backface_visibility() const {
294 return use_parent_backface_visibility_
;
297 bool ShowDebugBorders() const;
299 // These invalidate the host's render surface layer list. The caller
300 // is responsible for calling set_needs_update_draw_properties on the tree
301 // so that its list can be recreated.
302 void CreateRenderSurface();
303 void ClearRenderSurface();
304 void ClearRenderSurfaceLayerList();
306 DrawProperties
<LayerImpl
>& draw_properties() {
307 return draw_properties_
;
309 const DrawProperties
<LayerImpl
>& draw_properties() const {
310 return draw_properties_
;
313 // The following are shortcut accessors to get various information from
315 const gfx::Transform
& draw_transform() const {
316 return draw_properties_
.target_space_transform
;
318 const gfx::Transform
& screen_space_transform() const {
319 return draw_properties_
.screen_space_transform
;
321 float draw_opacity() const { return draw_properties_
.opacity
; }
322 bool draw_opacity_is_animating() const {
323 return draw_properties_
.opacity_is_animating
;
325 bool draw_transform_is_animating() const {
326 return draw_properties_
.target_space_transform_is_animating
;
328 bool screen_space_transform_is_animating() const {
329 return draw_properties_
.screen_space_transform_is_animating
;
331 bool screen_space_opacity_is_animating() const {
332 return draw_properties_
.screen_space_opacity_is_animating
;
334 bool can_use_lcd_text() const { return draw_properties_
.can_use_lcd_text
; }
335 bool is_clipped() const { return draw_properties_
.is_clipped
; }
336 gfx::Rect
clip_rect() const { return draw_properties_
.clip_rect
; }
337 gfx::Rect
drawable_content_rect() const {
338 return draw_properties_
.drawable_content_rect
;
340 gfx::Rect
visible_content_rect() const {
341 return draw_properties_
.visible_content_rect
;
343 LayerImpl
* render_target() {
344 DCHECK(!draw_properties_
.render_target
||
345 draw_properties_
.render_target
->render_surface());
346 return draw_properties_
.render_target
;
348 const LayerImpl
* render_target() const {
349 DCHECK(!draw_properties_
.render_target
||
350 draw_properties_
.render_target
->render_surface());
351 return draw_properties_
.render_target
;
353 RenderSurfaceImpl
* render_surface() const {
354 return draw_properties_
.render_surface
.get();
356 int num_unclipped_descendants() const {
357 return draw_properties_
.num_unclipped_descendants
;
360 // The client should be responsible for setting bounds, content bounds and
361 // contents scale to appropriate values. LayerImpl doesn't calculate any of
362 // them from the other values.
364 void SetBounds(const gfx::Size
& bounds
);
365 gfx::Size
bounds() const;
366 void SetBoundsDelta(const gfx::Vector2dF
& bounds_delta
);
367 gfx::Vector2dF
bounds_delta() const { return bounds_delta_
; }
369 void SetContentBounds(const gfx::Size
& content_bounds
);
370 gfx::Size
content_bounds() const { return draw_properties_
.content_bounds
; }
372 float contents_scale_x() const { return draw_properties_
.contents_scale_x
; }
373 float contents_scale_y() const { return draw_properties_
.contents_scale_y
; }
374 void SetContentsScale(float contents_scale_x
, float contents_scale_y
);
376 void SetScrollOffsetDelegate(ScrollOffsetDelegate
* scroll_offset_delegate
);
377 bool IsExternalFlingActive() const;
379 void SetScrollOffset(const gfx::Vector2d
& scroll_offset
);
380 void SetScrollOffsetAndDelta(const gfx::Vector2d
& scroll_offset
,
381 const gfx::Vector2dF
& scroll_delta
);
382 gfx::Vector2d
scroll_offset() const { return scroll_offset_
; }
384 gfx::Vector2d
MaxScrollOffset() const;
385 gfx::Vector2dF
ClampScrollToMaxScrollOffset();
386 void SetScrollbarPosition(ScrollbarLayerImplBase
* scrollbar_layer
,
387 LayerImpl
* scrollbar_clip_layer
) const;
388 void SetScrollDelta(const gfx::Vector2dF
& scroll_delta
);
389 gfx::Vector2dF
ScrollDelta() const;
391 gfx::Vector2dF
TotalScrollOffset() const;
393 void SetSentScrollDelta(const gfx::Vector2d
& sent_scroll_delta
);
394 gfx::Vector2d
sent_scroll_delta() const { return sent_scroll_delta_
; }
396 // Returns the delta of the scroll that was outside of the bounds of the
398 gfx::Vector2dF
ScrollBy(const gfx::Vector2dF
& scroll
);
400 void SetScrollClipLayer(int scroll_clip_layer_id
);
401 LayerImpl
* scroll_clip_layer() const { return scroll_clip_layer_
; }
402 bool scrollable() const { return !!scroll_clip_layer_
; }
404 void set_user_scrollable_horizontal(bool scrollable
) {
405 user_scrollable_horizontal_
= scrollable
;
407 void set_user_scrollable_vertical(bool scrollable
) {
408 user_scrollable_vertical_
= scrollable
;
411 void ApplySentScrollDeltasFromAbortedCommit();
412 void ApplyScrollDeltasSinceBeginMainFrame();
414 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread
) {
415 should_scroll_on_main_thread_
= should_scroll_on_main_thread
;
417 bool should_scroll_on_main_thread() const {
418 return should_scroll_on_main_thread_
;
421 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers
) {
422 have_wheel_event_handlers_
= have_wheel_event_handlers
;
424 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_
; }
426 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers
) {
427 have_scroll_event_handlers_
= have_scroll_event_handlers
;
429 bool have_scroll_event_handlers() const {
430 return have_scroll_event_handlers_
;
433 void SetNonFastScrollableRegion(const Region
& region
) {
434 non_fast_scrollable_region_
= region
;
436 const Region
& non_fast_scrollable_region() const {
437 return non_fast_scrollable_region_
;
440 void SetTouchEventHandlerRegion(const Region
& region
) {
441 touch_event_handler_region_
= region
;
443 const Region
& touch_event_handler_region() const {
444 return touch_event_handler_region_
;
447 void SetDrawCheckerboardForMissingTiles(bool checkerboard
) {
448 draw_checkerboard_for_missing_tiles_
= checkerboard
;
450 bool draw_checkerboard_for_missing_tiles() const {
451 return draw_checkerboard_for_missing_tiles_
;
454 InputHandler::ScrollStatus
TryScroll(
455 const gfx::PointF
& screen_space_point
,
456 InputHandler::ScrollInputType type
) const;
458 void SetDoubleSided(bool double_sided
);
459 bool double_sided() const { return double_sided_
; }
461 void SetTransform(const gfx::Transform
& transform
);
462 const gfx::Transform
& transform() const { return transform_
; }
463 bool TransformIsAnimating() const;
464 bool TransformIsAnimatingOnImplOnly() const;
465 void SetTransformAndInvertibility(const gfx::Transform
& transform
,
466 bool transform_is_invertible
);
467 bool transform_is_invertible() const { return transform_is_invertible_
; }
469 // Note this rect is in layer space (not content space).
470 void SetUpdateRect(const gfx::RectF
& update_rect
);
472 const gfx::RectF
& update_rect() const { return update_rect_
; }
474 void AddDamageRect(const gfx::RectF
& damage_rect
);
476 const gfx::RectF
& damage_rect() const { return damage_rect_
; }
478 virtual base::DictionaryValue
* LayerTreeAsJson() const;
480 void SetStackingOrderChanged(bool stacking_order_changed
);
482 bool LayerPropertyChanged() const { return layer_property_changed_
; }
484 void ResetAllChangeTrackingForSubtree();
486 LayerAnimationController
* layer_animation_controller() {
487 return layer_animation_controller_
.get();
490 const LayerAnimationController
* layer_animation_controller() const {
491 return layer_animation_controller_
.get();
494 virtual SimpleEnclosedRegion
VisibleContentOpaqueRegion() const;
496 virtual void DidBecomeActive();
498 virtual void DidBeginTracing();
500 // Release resources held by this layer. Called when the output surface
501 // that rendered this layer was lost or a rendering mode switch has occured.
502 virtual void ReleaseResources();
504 ScrollbarAnimationController
* scrollbar_animation_controller() const {
505 return scrollbar_animation_controller_
.get();
508 typedef std::set
<ScrollbarLayerImplBase
*> ScrollbarSet
;
509 ScrollbarSet
* scrollbars() { return scrollbars_
.get(); }
510 void ClearScrollbars();
511 void AddScrollbar(ScrollbarLayerImplBase
* layer
);
512 void RemoveScrollbar(ScrollbarLayerImplBase
* layer
);
513 bool HasScrollbar(ScrollbarOrientation orientation
) const;
514 void ScrollbarParametersDidChange();
516 return scroll_clip_layer_
? scroll_clip_layer_
->bounds().height() : 0;
519 gfx::Rect
LayerRectToContentRect(const gfx::RectF
& layer_rect
) const;
521 virtual skia::RefPtr
<SkPicture
> GetPicture();
523 virtual scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
);
524 virtual void PushPropertiesTo(LayerImpl
* layer
);
526 virtual void GetAllTilesForTracing(std::set
<const Tile
*>* tiles
) const;
527 virtual void AsValueInto(base::debug::TracedValue
* dict
) const;
529 virtual size_t GPUMemoryUsageInBytes() const;
531 void SetNeedsPushProperties();
532 void AddDependentNeedsPushProperties();
533 void RemoveDependentNeedsPushProperties();
534 bool parent_should_know_need_push_properties() const {
535 return needs_push_properties() || descendant_needs_push_properties();
538 bool needs_push_properties() const { return needs_push_properties_
; }
539 bool descendant_needs_push_properties() const {
540 return num_dependents_need_push_properties_
> 0;
543 virtual void RunMicroBenchmark(MicroBenchmarkImpl
* benchmark
);
545 virtual void SetDebugInfo(
546 scoped_refptr
<base::debug::ConvertableToTraceFormat
> other
);
548 bool IsDrawnRenderSurfaceLayerListMember() const;
550 void Set3dSortingContextId(int id
);
551 int sorting_context_id() { return sorting_context_id_
; }
554 LayerImpl(LayerTreeImpl
* layer_impl
, int id
);
556 // Get the color and size of the layer's debug border.
557 virtual void GetDebugBorderProperties(SkColor
* color
, float* width
) const;
559 void AppendDebugBorderQuad(RenderPass
* render_pass
,
560 const gfx::Size
& content_bounds
,
561 const SharedQuadState
* shared_quad_state
,
562 AppendQuadsData
* append_quads_data
) const;
563 void AppendDebugBorderQuad(RenderPass
* render_pass
,
564 const gfx::Size
& content_bounds
,
565 const SharedQuadState
* shared_quad_state
,
566 AppendQuadsData
* append_quads_data
,
570 void NoteLayerPropertyChanged();
571 void NoteLayerPropertyChangedForSubtree();
573 // Note carefully this does not affect the current layer.
574 void NoteLayerPropertyChangedForDescendants();
577 void NoteLayerPropertyChangedForDescendantsInternal();
579 virtual const char* LayerTypeAsString() const;
581 // Properties internal to LayerImpl
583 OwnedLayerImplList children_
;
585 LayerImpl
* scroll_parent_
;
587 // Storing a pointer to a set rather than a set since this will be rarely
588 // used. If this pointer turns out to be too heavy, we could have this (and
589 // the scroll parent above) be stored in a LayerImpl -> scroll_info
591 scoped_ptr
<std::set
<LayerImpl
*> > scroll_children_
;
593 LayerImpl
* clip_parent_
;
594 scoped_ptr
<std::set
<LayerImpl
*> > clip_children_
;
596 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to
597 // confirm newly assigned layer is still the previous one
599 scoped_ptr
<LayerImpl
> mask_layer_
;
600 int replica_layer_id_
; // ditto
601 scoped_ptr
<LayerImpl
> replica_layer_
;
603 LayerTreeImpl
* layer_tree_impl_
;
605 // Properties synchronized from the associated Layer.
606 gfx::Point3F transform_origin_
;
608 gfx::Vector2dF bounds_delta_
;
609 gfx::Vector2d scroll_offset_
;
610 ScrollOffsetDelegate
* scroll_offset_delegate_
;
611 LayerImpl
* scroll_clip_layer_
;
612 bool scrollable_
: 1;
613 bool should_scroll_on_main_thread_
: 1;
614 bool have_wheel_event_handlers_
: 1;
615 bool have_scroll_event_handlers_
: 1;
616 bool user_scrollable_horizontal_
: 1;
617 bool user_scrollable_vertical_
: 1;
618 bool stacking_order_changed_
: 1;
619 // Whether the "back" of this layer should draw.
620 bool double_sided_
: 1;
621 bool should_flatten_transform_
: 1;
623 // Tracks if drawing-related properties have changed since last redraw.
624 bool layer_property_changed_
: 1;
626 bool masks_to_bounds_
: 1;
627 bool contents_opaque_
: 1;
628 bool is_root_for_isolated_group_
: 1;
629 bool use_parent_backface_visibility_
: 1;
630 bool draw_checkerboard_for_missing_tiles_
: 1;
631 bool draws_content_
: 1;
632 bool hide_layer_and_subtree_
: 1;
633 bool force_render_surface_
: 1;
635 // Cache transform_'s invertibility.
636 bool transform_is_invertible_
: 1;
638 // Set for the layer that other layers are fixed to.
639 bool is_container_for_fixed_position_layers_
: 1;
640 Region non_fast_scrollable_region_
;
641 Region touch_event_handler_region_
;
642 SkColor background_color_
;
645 SkXfermode::Mode blend_mode_
;
646 gfx::PointF position_
;
647 gfx::Transform transform_
;
649 LayerPositionConstraint position_constraint_
;
651 gfx::Vector2dF scroll_delta_
;
652 gfx::Vector2d sent_scroll_delta_
;
653 gfx::Vector2dF last_scroll_offset_
;
655 int num_descendants_that_draw_content_
;
657 // The global depth value of the center of the layer. This value is used
658 // to sort layers from back to front.
661 FilterOperations filters_
;
662 FilterOperations background_filters_
;
665 friend class TreeSynchronizer
;
667 // This flag is set when the layer needs to push properties to the active
669 bool needs_push_properties_
;
671 // The number of direct children or dependent layers that need to be recursed
672 // to in order for them or a descendent of them to push properties to the
674 int num_dependents_need_push_properties_
;
676 // Layers that share a sorting context id will be sorted together in 3d
677 // space. 0 is a special value that means this layer will not be sorted and
678 // will be drawn in paint order.
679 int sorting_context_id_
;
681 DrawMode current_draw_mode_
;
684 // Rect indicating what was repainted/updated during update.
685 // Note that plugin layers bypass this and leave it empty.
686 // Uses layer (not content) space.
687 gfx::RectF update_rect_
;
689 // This rect is in layer space.
690 gfx::RectF damage_rect_
;
692 // Manages animations for this layer.
693 scoped_refptr
<LayerAnimationController
> layer_animation_controller_
;
695 // Manages scrollbars for this layer
696 scoped_ptr
<ScrollbarAnimationController
> scrollbar_animation_controller_
;
698 scoped_ptr
<ScrollbarSet
> scrollbars_
;
700 ScopedPtrVector
<CopyOutputRequest
> copy_requests_
;
702 // Group of properties that need to be computed based on the layer tree
703 // hierarchy before layers can be drawn.
704 DrawProperties
<LayerImpl
> draw_properties_
;
706 scoped_refptr
<base::debug::ConvertableToTraceFormat
> debug_info_
;
708 DISALLOW_COPY_AND_ASSIGN(LayerImpl
);
713 #endif // CC_LAYERS_LAYER_IMPL_H_