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/input/scrollbar.h"
23 #include "cc/layers/draw_properties.h"
24 #include "cc/layers/layer_lists.h"
25 #include "cc/layers/layer_position_constraint.h"
26 #include "cc/layers/render_surface_impl.h"
27 #include "cc/output/filter_operations.h"
28 #include "cc/quads/shared_quad_state.h"
29 #include "cc/resources/resource_provider.h"
30 #include "skia/ext/refptr.h"
31 #include "third_party/skia/include/core/SkColor.h"
32 #include "third_party/skia/include/core/SkImageFilter.h"
33 #include "third_party/skia/include/core/SkPicture.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"
42 class ConvertableToTraceFormat;
46 class DictionaryValue;
51 class LayerTreeHostImpl;
53 class MicroBenchmarkImpl;
55 template <typename LayerType>
56 class OcclusionTracker;
60 class ScrollbarAnimationController;
61 class ScrollbarLayerImplBase;
62 class SimpleEnclosedRegion;
65 struct AppendQuadsData;
71 DRAW_MODE_RESOURCELESS_SOFTWARE
74 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
75 public LayerAnimationValueProvider,
76 public AnimationDelegate {
78 // Allows for the ownership of the total scroll offset to be delegated outside
80 class ScrollOffsetDelegate {
82 virtual void SetTotalScrollOffset(const gfx::ScrollOffset& new_value) = 0;
83 virtual gfx::ScrollOffset GetTotalScrollOffset() = 0;
84 virtual bool IsExternalFlingActive() const = 0;
85 virtual void Update() const = 0;
88 typedef LayerImplList RenderSurfaceListType;
89 typedef LayerImplList LayerListType;
90 typedef RenderSurfaceImpl RenderSurfaceType;
92 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 };
94 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
95 return make_scoped_ptr(new LayerImpl(tree_impl, id));
98 ~LayerImpl() override;
100 int id() const { return layer_id_; }
102 // LayerAnimationValueProvider implementation.
103 gfx::ScrollOffset ScrollOffsetForAnimation() const override;
105 // LayerAnimationValueObserver implementation.
106 void OnFilterAnimated(const FilterOperations& filters) override;
107 void OnOpacityAnimated(float opacity) override;
108 void OnTransformAnimated(const gfx::Transform& transform) override;
109 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override;
110 void OnAnimationWaitingForDeletion() override;
111 bool IsActive() const override;
113 // AnimationDelegate implementation.
114 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
115 Animation::TargetProperty target_property,
116 int group) override{};
117 void NotifyAnimationFinished(base::TimeTicks monotonic_time,
118 Animation::TargetProperty target_property,
122 LayerImpl* parent() { return parent_; }
123 const LayerImpl* parent() const { return parent_; }
124 const OwnedLayerImplList& children() const { return children_; }
125 OwnedLayerImplList& children() { return children_; }
126 LayerImpl* child_at(size_t index) const { return children_[index]; }
127 void AddChild(scoped_ptr<LayerImpl> child);
128 scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child);
129 void SetParent(LayerImpl* parent);
131 // Warning: This does not preserve tree structure invariants.
132 void ClearChildList();
134 bool HasAncestor(const LayerImpl* ancestor) const;
136 void SetScrollParent(LayerImpl* parent);
138 LayerImpl* scroll_parent() { return scroll_parent_; }
139 const LayerImpl* scroll_parent() const { return scroll_parent_; }
141 void SetScrollChildren(std::set<LayerImpl*>* children);
143 std::set<LayerImpl*>* scroll_children() { return scroll_children_.get(); }
144 const std::set<LayerImpl*>* scroll_children() const {
145 return scroll_children_.get();
148 void SetNumDescendantsThatDrawContent(int num_descendants);
149 void SetClipParent(LayerImpl* ancestor);
151 LayerImpl* clip_parent() {
154 const LayerImpl* clip_parent() const {
158 void SetClipChildren(std::set<LayerImpl*>* children);
160 std::set<LayerImpl*>* clip_children() { return clip_children_.get(); }
161 const std::set<LayerImpl*>* clip_children() const {
162 return clip_children_.get();
165 void PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests);
166 // Can only be called when the layer has a copy request.
167 void TakeCopyRequestsAndTransformToTarget(
168 ScopedPtrVector<CopyOutputRequest>* request);
169 bool HasCopyRequest() const { return !copy_requests_.empty(); }
171 void SetMaskLayer(scoped_ptr<LayerImpl> mask_layer);
172 LayerImpl* mask_layer() { return mask_layer_.get(); }
173 const LayerImpl* mask_layer() const { return mask_layer_.get(); }
174 scoped_ptr<LayerImpl> TakeMaskLayer();
176 void SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer);
177 LayerImpl* replica_layer() { return replica_layer_.get(); }
178 const LayerImpl* replica_layer() const { return replica_layer_.get(); }
179 scoped_ptr<LayerImpl> TakeReplicaLayer();
181 bool has_mask() const { return mask_layer_; }
182 bool has_replica() const { return replica_layer_; }
183 bool replica_has_mask() const {
184 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_);
187 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
189 void PopulateSharedQuadState(SharedQuadState* state) const;
190 // WillDraw must be called before AppendQuads. If WillDraw returns false,
191 // AppendQuads and DidDraw will not be called. If WillDraw returns true,
192 // DidDraw is guaranteed to be called before another WillDraw or before
193 // the layer is destroyed. To enforce this, any class that overrides
194 // WillDraw/DidDraw must call the base class version only if WillDraw
196 virtual bool WillDraw(DrawMode draw_mode,
197 ResourceProvider* resource_provider);
198 virtual void AppendQuads(RenderPass* render_pass,
199 const Occlusion& occlusion_in_content_space,
200 AppendQuadsData* append_quads_data) {}
201 virtual void DidDraw(ResourceProvider* resource_provider);
203 virtual void GetContentsResourceId(ResourceProvider::ResourceId* resource_id,
204 gfx::Size* resource_size) const;
206 virtual bool HasDelegatedContent() const;
207 virtual bool HasContributingDelegatedRenderPasses() const;
208 virtual RenderPassId FirstContributingRenderPassId() const;
209 virtual RenderPassId NextContributingRenderPassId(RenderPassId id) const;
211 virtual void UpdateTiles(const Occlusion& occlusion_in_layer_space,
212 bool resourceless_software_draw) {}
213 virtual void NotifyTileStateChanged(const Tile* tile) {}
215 virtual ScrollbarLayerImplBase* ToScrollbarLayer();
217 // Returns true if this layer has content to draw.
218 void SetDrawsContent(bool draws_content);
219 bool DrawsContent() const { return draws_content_; }
221 int NumDescendantsThatDrawContent() const;
222 void SetHideLayerAndSubtree(bool hide);
223 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
225 bool force_render_surface() const { return force_render_surface_; }
226 void SetForceRenderSurface(bool force) { force_render_surface_ = force; }
228 void SetTransformOrigin(const gfx::Point3F& transform_origin);
229 gfx::Point3F transform_origin() const { return transform_origin_; }
231 void SetBackgroundColor(SkColor background_color);
232 SkColor background_color() const { return background_color_; }
233 // If contents_opaque(), return an opaque color else return a
234 // non-opaque color. Tries to return background_color(), if possible.
235 SkColor SafeOpaqueBackgroundColor() const;
237 void SetFilters(const FilterOperations& filters);
238 const FilterOperations& filters() const { return filters_; }
239 bool FilterIsAnimating() const;
240 bool FilterIsAnimatingOnImplOnly() const;
242 void SetBackgroundFilters(const FilterOperations& filters);
243 const FilterOperations& background_filters() const {
244 return background_filters_;
247 void SetMasksToBounds(bool masks_to_bounds);
248 bool masks_to_bounds() const { return masks_to_bounds_; }
250 void SetContentsOpaque(bool opaque);
251 bool contents_opaque() const { return contents_opaque_; }
253 void SetOpacity(float opacity);
254 float opacity() const { return opacity_; }
255 bool OpacityIsAnimating() const;
256 bool OpacityIsAnimatingOnImplOnly() const;
258 void SetBlendMode(SkXfermode::Mode);
259 SkXfermode::Mode blend_mode() const { return blend_mode_; }
260 bool uses_default_blend_mode() const {
261 return blend_mode_ == SkXfermode::kSrcOver_Mode;
264 void SetIsRootForIsolatedGroup(bool root);
265 bool is_root_for_isolated_group() const {
266 return is_root_for_isolated_group_;
269 void SetPosition(const gfx::PointF& position);
270 gfx::PointF position() const { return position_; }
272 void SetIsContainerForFixedPositionLayers(bool container) {
273 is_container_for_fixed_position_layers_ = container;
275 // This is a non-trivial function in Layer.
276 bool IsContainerForFixedPositionLayers() const {
277 return is_container_for_fixed_position_layers_;
280 gfx::Vector2dF FixedContainerSizeDelta() const;
282 void SetPositionConstraint(const LayerPositionConstraint& constraint) {
283 position_constraint_ = constraint;
285 const LayerPositionConstraint& position_constraint() const {
286 return position_constraint_;
289 void SetShouldFlattenTransform(bool flatten);
290 bool should_flatten_transform() const { return should_flatten_transform_; }
292 bool Is3dSorted() const { return sorting_context_id_ != 0; }
294 void SetUseParentBackfaceVisibility(bool use) {
295 use_parent_backface_visibility_ = use;
297 bool use_parent_backface_visibility() const {
298 return use_parent_backface_visibility_;
301 bool ShowDebugBorders() const;
303 // These invalidate the host's render surface layer list. The caller
304 // is responsible for calling set_needs_update_draw_properties on the tree
305 // so that its list can be recreated.
306 void CreateRenderSurface();
307 void ClearRenderSurface();
308 void ClearRenderSurfaceLayerList();
310 DrawProperties<LayerImpl>& draw_properties() {
311 return draw_properties_;
313 const DrawProperties<LayerImpl>& draw_properties() const {
314 return draw_properties_;
317 // The following are shortcut accessors to get various information from
319 const gfx::Transform& draw_transform() const {
320 return draw_properties_.target_space_transform;
322 const gfx::Transform& screen_space_transform() const {
323 return draw_properties_.screen_space_transform;
325 float draw_opacity() const { return draw_properties_.opacity; }
326 bool draw_opacity_is_animating() const {
327 return draw_properties_.opacity_is_animating;
329 bool draw_transform_is_animating() const {
330 return draw_properties_.target_space_transform_is_animating;
332 bool screen_space_transform_is_animating() const {
333 return draw_properties_.screen_space_transform_is_animating;
335 bool screen_space_opacity_is_animating() const {
336 return draw_properties_.screen_space_opacity_is_animating;
338 bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; }
339 bool is_clipped() const { return draw_properties_.is_clipped; }
340 gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
341 gfx::Rect drawable_content_rect() const {
342 return draw_properties_.drawable_content_rect;
344 gfx::Rect visible_content_rect() const {
345 return draw_properties_.visible_content_rect;
347 LayerImpl* render_target() {
348 DCHECK(!draw_properties_.render_target ||
349 draw_properties_.render_target->render_surface());
350 return draw_properties_.render_target;
352 const LayerImpl* render_target() const {
353 DCHECK(!draw_properties_.render_target ||
354 draw_properties_.render_target->render_surface());
355 return draw_properties_.render_target;
357 RenderSurfaceImpl* render_surface() const {
358 return draw_properties_.render_surface.get();
360 int num_unclipped_descendants() const {
361 return draw_properties_.num_unclipped_descendants;
364 // The client should be responsible for setting bounds, content bounds and
365 // contents scale to appropriate values. LayerImpl doesn't calculate any of
366 // them from the other values.
368 void SetBounds(const gfx::Size& bounds);
369 gfx::Size bounds() const;
370 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions
371 // of pixels) due to use of single precision float.
372 gfx::SizeF BoundsForScrolling() const;
373 void SetBoundsDelta(const gfx::Vector2dF& bounds_delta);
374 gfx::Vector2dF bounds_delta() const { return bounds_delta_; }
376 void SetContentBounds(const gfx::Size& content_bounds);
377 gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
379 float contents_scale_x() const { return draw_properties_.contents_scale_x; }
380 float contents_scale_y() const { return draw_properties_.contents_scale_y; }
381 void SetContentsScale(float contents_scale_x, float contents_scale_y);
383 void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate);
385 bool IsExternalFlingActive() const;
387 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset);
388 void SetScrollOffsetAndDelta(const gfx::ScrollOffset& scroll_offset,
389 const gfx::Vector2dF& scroll_delta);
390 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; }
392 gfx::ScrollOffset MaxScrollOffset() const;
393 gfx::Vector2dF ClampScrollToMaxScrollOffset();
394 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
395 LayerImpl* scrollbar_clip_layer,
396 bool on_resize) const;
397 void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
398 gfx::Vector2dF ScrollDelta() const;
400 gfx::ScrollOffset TotalScrollOffset() const;
402 void SetSentScrollDelta(const gfx::Vector2dF& sent_scroll_delta);
403 gfx::Vector2dF sent_scroll_delta() const { return sent_scroll_delta_; }
405 // Returns the delta of the scroll that was outside of the bounds of the
407 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
409 void SetScrollClipLayer(int scroll_clip_layer_id);
410 LayerImpl* scroll_clip_layer() const { return scroll_clip_layer_; }
411 bool scrollable() const { return !!scroll_clip_layer_; }
413 void set_user_scrollable_horizontal(bool scrollable) {
414 user_scrollable_horizontal_ = scrollable;
416 bool user_scrollable_horizontal() const {
417 return user_scrollable_horizontal_;
419 void set_user_scrollable_vertical(bool scrollable) {
420 user_scrollable_vertical_ = scrollable;
422 bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
424 bool user_scrollable(ScrollbarOrientation orientation) const;
426 void ApplySentScrollDeltasFromAbortedCommit();
427 void ApplyScrollDeltasSinceBeginMainFrame();
429 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) {
430 should_scroll_on_main_thread_ = should_scroll_on_main_thread;
432 bool should_scroll_on_main_thread() const {
433 return should_scroll_on_main_thread_;
436 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
437 have_wheel_event_handlers_ = have_wheel_event_handlers;
439 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
441 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
442 have_scroll_event_handlers_ = have_scroll_event_handlers;
444 bool have_scroll_event_handlers() const {
445 return have_scroll_event_handlers_;
448 void SetNonFastScrollableRegion(const Region& region) {
449 non_fast_scrollable_region_ = region;
451 const Region& non_fast_scrollable_region() const {
452 return non_fast_scrollable_region_;
455 void SetTouchEventHandlerRegion(const Region& region) {
456 touch_event_handler_region_ = region;
458 const Region& touch_event_handler_region() const {
459 return touch_event_handler_region_;
462 void SetDrawCheckerboardForMissingTiles(bool checkerboard) {
463 draw_checkerboard_for_missing_tiles_ = checkerboard;
465 bool draw_checkerboard_for_missing_tiles() const {
466 return draw_checkerboard_for_missing_tiles_;
469 InputHandler::ScrollStatus TryScroll(
470 const gfx::PointF& screen_space_point,
471 InputHandler::ScrollInputType type) const;
473 void SetDoubleSided(bool double_sided);
474 bool double_sided() const { return double_sided_; }
476 void SetTransform(const gfx::Transform& transform);
477 const gfx::Transform& transform() const { return transform_; }
478 bool TransformIsAnimating() const;
479 bool TransformIsAnimatingOnImplOnly() const;
480 void SetTransformAndInvertibility(const gfx::Transform& transform,
481 bool transform_is_invertible);
482 bool transform_is_invertible() const { return transform_is_invertible_; }
484 // Note this rect is in layer space (not content space).
485 void SetUpdateRect(const gfx::Rect& update_rect);
486 gfx::Rect update_rect() const { return update_rect_; }
488 void AddDamageRect(const gfx::RectF& damage_rect);
490 const gfx::RectF& damage_rect() const { return damage_rect_; }
492 virtual base::DictionaryValue* LayerTreeAsJson() const;
494 void SetStackingOrderChanged(bool stacking_order_changed);
496 bool LayerPropertyChanged() const { return layer_property_changed_; }
498 void ResetAllChangeTrackingForSubtree();
500 LayerAnimationController* layer_animation_controller() {
501 return layer_animation_controller_.get();
504 const LayerAnimationController* layer_animation_controller() const {
505 return layer_animation_controller_.get();
508 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const;
510 virtual void DidBecomeActive();
512 virtual void DidBeginTracing();
514 // Release resources held by this layer. Called when the output surface
515 // that rendered this layer was lost or a rendering mode switch has occured.
516 virtual void ReleaseResources();
518 ScrollbarAnimationController* scrollbar_animation_controller() const {
519 return scrollbar_animation_controller_.get();
522 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
523 ScrollbarSet* scrollbars() { return scrollbars_.get(); }
524 void ClearScrollbars();
525 void AddScrollbar(ScrollbarLayerImplBase* layer);
526 void RemoveScrollbar(ScrollbarLayerImplBase* layer);
527 bool HasScrollbar(ScrollbarOrientation orientation) const;
528 void ScrollbarParametersDidChange(bool on_resize);
530 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
533 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
535 virtual skia::RefPtr<SkPicture> GetPicture();
537 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
538 virtual void PushPropertiesTo(LayerImpl* layer);
540 virtual void GetAllTilesForTracing(std::set<const Tile*>* tiles) const;
541 virtual void AsValueInto(base::debug::TracedValue* dict) const;
543 virtual size_t GPUMemoryUsageInBytes() const;
545 void SetNeedsPushProperties();
546 void AddDependentNeedsPushProperties();
547 void RemoveDependentNeedsPushProperties();
548 bool parent_should_know_need_push_properties() const {
549 return needs_push_properties() || descendant_needs_push_properties();
552 bool needs_push_properties() const { return needs_push_properties_; }
553 bool descendant_needs_push_properties() const {
554 return num_dependents_need_push_properties_ > 0;
557 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark);
559 virtual void SetDebugInfo(
560 scoped_refptr<base::debug::ConvertableToTraceFormat> other);
562 bool IsDrawnRenderSurfaceLayerListMember() const;
564 void Set3dSortingContextId(int id);
565 int sorting_context_id() { return sorting_context_id_; }
568 LayerImpl(LayerTreeImpl* layer_impl, int id);
570 // Get the color and size of the layer's debug border.
571 virtual void GetDebugBorderProperties(SkColor* color, float* width) const;
573 void AppendDebugBorderQuad(RenderPass* render_pass,
574 const gfx::Size& content_bounds,
575 const SharedQuadState* shared_quad_state,
576 AppendQuadsData* append_quads_data) const;
577 void AppendDebugBorderQuad(RenderPass* render_pass,
578 const gfx::Size& content_bounds,
579 const SharedQuadState* shared_quad_state,
580 AppendQuadsData* append_quads_data,
584 void NoteLayerPropertyChanged();
585 void NoteLayerPropertyChangedForSubtree();
587 // Note carefully this does not affect the current layer.
588 void NoteLayerPropertyChangedForDescendants();
591 void NoteLayerPropertyChangedForDescendantsInternal();
593 virtual const char* LayerTypeAsString() const;
595 // Properties internal to LayerImpl
597 OwnedLayerImplList children_;
599 LayerImpl* scroll_parent_;
601 // Storing a pointer to a set rather than a set since this will be rarely
602 // used. If this pointer turns out to be too heavy, we could have this (and
603 // the scroll parent above) be stored in a LayerImpl -> scroll_info
605 scoped_ptr<std::set<LayerImpl*>> scroll_children_;
607 LayerImpl* clip_parent_;
608 scoped_ptr<std::set<LayerImpl*>> clip_children_;
610 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to
611 // confirm newly assigned layer is still the previous one
613 scoped_ptr<LayerImpl> mask_layer_;
614 int replica_layer_id_; // ditto
615 scoped_ptr<LayerImpl> replica_layer_;
617 LayerTreeImpl* layer_tree_impl_;
619 // Properties synchronized from the associated Layer.
620 gfx::Point3F transform_origin_;
622 gfx::Vector2dF bounds_delta_;
623 gfx::ScrollOffset scroll_offset_;
624 ScrollOffsetDelegate* scroll_offset_delegate_;
625 LayerImpl* scroll_clip_layer_;
626 bool scrollable_ : 1;
627 bool should_scroll_on_main_thread_ : 1;
628 bool have_wheel_event_handlers_ : 1;
629 bool have_scroll_event_handlers_ : 1;
630 bool user_scrollable_horizontal_ : 1;
631 bool user_scrollable_vertical_ : 1;
632 bool stacking_order_changed_ : 1;
633 // Whether the "back" of this layer should draw.
634 bool double_sided_ : 1;
635 bool should_flatten_transform_ : 1;
637 // Tracks if drawing-related properties have changed since last redraw.
638 bool layer_property_changed_ : 1;
640 bool masks_to_bounds_ : 1;
641 bool contents_opaque_ : 1;
642 bool is_root_for_isolated_group_ : 1;
643 bool use_parent_backface_visibility_ : 1;
644 bool draw_checkerboard_for_missing_tiles_ : 1;
645 bool draws_content_ : 1;
646 bool hide_layer_and_subtree_ : 1;
647 bool force_render_surface_ : 1;
649 // Cache transform_'s invertibility.
650 bool transform_is_invertible_ : 1;
652 // Set for the layer that other layers are fixed to.
653 bool is_container_for_fixed_position_layers_ : 1;
654 Region non_fast_scrollable_region_;
655 Region touch_event_handler_region_;
656 SkColor background_color_;
659 SkXfermode::Mode blend_mode_;
660 gfx::PointF position_;
661 gfx::Transform transform_;
663 LayerPositionConstraint position_constraint_;
665 gfx::Vector2dF scroll_delta_;
666 gfx::Vector2dF sent_scroll_delta_;
667 gfx::ScrollOffset last_scroll_offset_;
669 int num_descendants_that_draw_content_;
671 // The global depth value of the center of the layer. This value is used
672 // to sort layers from back to front.
675 FilterOperations filters_;
676 FilterOperations background_filters_;
679 friend class TreeSynchronizer;
681 // This flag is set when the layer needs to push properties to the active
683 bool needs_push_properties_;
685 // The number of direct children or dependent layers that need to be recursed
686 // to in order for them or a descendent of them to push properties to the
688 int num_dependents_need_push_properties_;
690 // Layers that share a sorting context id will be sorted together in 3d
691 // space. 0 is a special value that means this layer will not be sorted and
692 // will be drawn in paint order.
693 int sorting_context_id_;
695 DrawMode current_draw_mode_;
698 // Rect indicating what was repainted/updated during update.
699 // Note that plugin layers bypass this and leave it empty.
700 // Uses layer (not content) space.
701 gfx::Rect update_rect_;
703 // This rect is in layer space.
704 gfx::RectF damage_rect_;
706 // Manages animations for this layer.
707 scoped_refptr<LayerAnimationController> layer_animation_controller_;
709 // Manages scrollbars for this layer
710 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
712 scoped_ptr<ScrollbarSet> scrollbars_;
714 ScopedPtrVector<CopyOutputRequest> copy_requests_;
716 // Group of properties that need to be computed based on the layer tree
717 // hierarchy before layers can be drawn.
718 DrawProperties<LayerImpl> draw_properties_;
720 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_;
722 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
727 #endif // CC_LAYERS_LAYER_IMPL_H_