Fix race condition in gyp/ninja builds.
[chromium-blink-merge.git] / cc / layers / layer_impl.h
blob5e29a1c5458786141971cd7ed359f05d8a0c0875
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_
8 #include <set>
9 #include <string>
11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h"
14 #include "cc/animation/layer_animation_controller.h"
15 #include "cc/animation/layer_animation_value_observer.h"
16 #include "cc/animation/layer_animation_value_provider.h"
17 #include "cc/base/cc_export.h"
18 #include "cc/base/region.h"
19 #include "cc/base/scoped_ptr_vector.h"
20 #include "cc/input/input_handler.h"
21 #include "cc/layers/draw_properties.h"
22 #include "cc/layers/layer_lists.h"
23 #include "cc/layers/layer_position_constraint.h"
24 #include "cc/layers/render_surface_impl.h"
25 #include "cc/output/filter_operations.h"
26 #include "cc/quads/render_pass.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"
38 namespace base {
39 namespace debug {
40 class ConvertableToTraceFormat;
43 class DictionaryValue;
46 namespace cc {
48 class LayerTreeHostImpl;
49 class LayerTreeImpl;
50 class MicroBenchmarkImpl;
51 template <typename LayerType>
52 class OcclusionTracker;
53 class Renderer;
54 class ScrollbarAnimationController;
55 class ScrollbarLayerImplBase;
56 class Tile;
58 struct AppendQuadsData;
60 enum DrawMode {
61 DRAW_MODE_NONE,
62 DRAW_MODE_HARDWARE,
63 DRAW_MODE_SOFTWARE,
64 DRAW_MODE_RESOURCELESS_SOFTWARE
67 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
68 public LayerAnimationValueProvider {
69 public:
70 // Allows for the ownership of the total scroll offset to be delegated outside
71 // of the layer.
72 class ScrollOffsetDelegate {
73 public:
74 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0;
75 virtual gfx::Vector2dF GetTotalScrollOffset() = 0;
76 virtual bool IsExternalFlingActive() const = 0;
79 typedef LayerImplList RenderSurfaceListType;
80 typedef LayerImplList LayerListType;
81 typedef RenderSurfaceImpl RenderSurfaceType;
83 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 };
85 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
86 return make_scoped_ptr(new LayerImpl(tree_impl, id));
89 virtual ~LayerImpl();
91 int id() const { return layer_id_; }
93 // LayerAnimationValueProvider implementation.
94 virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE;
96 // LayerAnimationValueObserver implementation.
97 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
98 virtual void OnOpacityAnimated(float opacity) OVERRIDE;
99 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
100 virtual void OnScrollOffsetAnimated(
101 const gfx::Vector2dF& scroll_offset) OVERRIDE;
102 virtual void OnAnimationWaitingForDeletion() OVERRIDE;
103 virtual bool IsActive() const OVERRIDE;
105 // Tree structure.
106 LayerImpl* parent() { return parent_; }
107 const LayerImpl* parent() const { return parent_; }
108 const OwnedLayerImplList& children() const { return children_; }
109 OwnedLayerImplList& children() { return children_; }
110 LayerImpl* child_at(size_t index) const { return children_[index]; }
111 void AddChild(scoped_ptr<LayerImpl> child);
112 scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child);
113 void SetParent(LayerImpl* parent);
115 // Warning: This does not preserve tree structure invariants.
116 void ClearChildList();
118 bool HasAncestor(const LayerImpl* ancestor) const;
120 void SetScrollParent(LayerImpl* parent);
122 LayerImpl* scroll_parent() { return scroll_parent_; }
123 const LayerImpl* scroll_parent() const { return scroll_parent_; }
125 void SetScrollChildren(std::set<LayerImpl*>* children);
127 std::set<LayerImpl*>* scroll_children() { return scroll_children_.get(); }
128 const std::set<LayerImpl*>* scroll_children() const {
129 return scroll_children_.get();
132 void SetClipParent(LayerImpl* ancestor);
134 LayerImpl* clip_parent() {
135 return clip_parent_;
137 const LayerImpl* clip_parent() const {
138 return clip_parent_;
141 void SetClipChildren(std::set<LayerImpl*>* children);
143 std::set<LayerImpl*>* clip_children() { return clip_children_.get(); }
144 const std::set<LayerImpl*>* clip_children() const {
145 return clip_children_.get();
148 void PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests);
149 // Can only be called when the layer has a copy request.
150 void TakeCopyRequestsAndTransformToTarget(
151 ScopedPtrVector<CopyOutputRequest>* request);
152 bool HasCopyRequest() const { return !copy_requests_.empty(); }
154 void SetMaskLayer(scoped_ptr<LayerImpl> mask_layer);
155 LayerImpl* mask_layer() { return mask_layer_.get(); }
156 const LayerImpl* mask_layer() const { return mask_layer_.get(); }
157 scoped_ptr<LayerImpl> TakeMaskLayer();
159 void SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer);
160 LayerImpl* replica_layer() { return replica_layer_.get(); }
161 const LayerImpl* replica_layer() const { return replica_layer_.get(); }
162 scoped_ptr<LayerImpl> TakeReplicaLayer();
164 bool has_mask() const { return mask_layer_; }
165 bool has_replica() const { return replica_layer_; }
166 bool replica_has_mask() const {
167 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_);
170 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
172 void PopulateSharedQuadState(SharedQuadState* state) const;
173 // WillDraw must be called before AppendQuads. If WillDraw returns false,
174 // AppendQuads and DidDraw will not be called. If WillDraw returns true,
175 // DidDraw is guaranteed to be called before another WillDraw or before
176 // the layer is destroyed. To enforce this, any class that overrides
177 // WillDraw/DidDraw must call the base class version only if WillDraw
178 // returns true.
179 virtual bool WillDraw(DrawMode draw_mode,
180 ResourceProvider* resource_provider);
181 virtual void AppendQuads(RenderPass* render_pass,
182 const OcclusionTracker<LayerImpl>& occlusion_tracker,
183 AppendQuadsData* append_quads_data) {}
184 virtual void DidDraw(ResourceProvider* resource_provider);
186 virtual ResourceProvider::ResourceId ContentsResourceId() const;
188 virtual bool HasDelegatedContent() const;
189 virtual bool HasContributingDelegatedRenderPasses() const;
190 virtual RenderPass::Id FirstContributingRenderPassId() const;
191 virtual RenderPass::Id NextContributingRenderPassId(RenderPass::Id id) const;
193 virtual void UpdateTiles(
194 const OcclusionTracker<LayerImpl>* occlusion_tracker) {}
195 virtual void NotifyTileStateChanged(const Tile* tile) {}
197 virtual ScrollbarLayerImplBase* ToScrollbarLayer();
199 // Returns true if this layer has content to draw.
200 void SetDrawsContent(bool draws_content);
201 bool DrawsContent() const { return draws_content_; }
203 void SetHideLayerAndSubtree(bool hide);
204 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
206 bool force_render_surface() const { return force_render_surface_; }
207 void SetForceRenderSurface(bool force) { force_render_surface_ = force; }
209 void SetTransformOrigin(const gfx::Point3F& transform_origin);
210 gfx::Point3F transform_origin() const { return transform_origin_; }
212 void SetBackgroundColor(SkColor background_color);
213 SkColor background_color() const { return background_color_; }
214 // If contents_opaque(), return an opaque color else return a
215 // non-opaque color. Tries to return background_color(), if possible.
216 SkColor SafeOpaqueBackgroundColor() const;
218 void SetFilters(const FilterOperations& filters);
219 const FilterOperations& filters() const { return filters_; }
220 bool FilterIsAnimating() const;
221 bool FilterIsAnimatingOnImplOnly() const;
223 void SetBackgroundFilters(const FilterOperations& filters);
224 const FilterOperations& background_filters() const {
225 return background_filters_;
228 void SetMasksToBounds(bool masks_to_bounds);
229 bool masks_to_bounds() const { return masks_to_bounds_; }
231 void SetContentsOpaque(bool opaque);
232 bool contents_opaque() const { return contents_opaque_; }
234 void SetOpacity(float opacity);
235 float opacity() const { return opacity_; }
236 bool OpacityIsAnimating() const;
237 bool OpacityIsAnimatingOnImplOnly() const;
239 void SetBlendMode(SkXfermode::Mode);
240 SkXfermode::Mode blend_mode() const { return blend_mode_; }
241 bool uses_default_blend_mode() const {
242 return blend_mode_ == SkXfermode::kSrcOver_Mode;
245 void SetIsRootForIsolatedGroup(bool root);
246 bool is_root_for_isolated_group() const {
247 return is_root_for_isolated_group_;
250 void SetPosition(const gfx::PointF& position);
251 gfx::PointF position() const { return position_; }
253 void SetIsContainerForFixedPositionLayers(bool container) {
254 is_container_for_fixed_position_layers_ = container;
256 // This is a non-trivial function in Layer.
257 bool IsContainerForFixedPositionLayers() const {
258 return is_container_for_fixed_position_layers_;
261 gfx::Vector2dF FixedContainerSizeDelta() const;
263 void SetPositionConstraint(const LayerPositionConstraint& constraint) {
264 position_constraint_ = constraint;
266 const LayerPositionConstraint& position_constraint() const {
267 return position_constraint_;
270 void SetShouldFlattenTransform(bool flatten);
271 bool should_flatten_transform() const { return should_flatten_transform_; }
273 bool Is3dSorted() const { return sorting_context_id_ != 0; }
275 void SetUseParentBackfaceVisibility(bool use) {
276 use_parent_backface_visibility_ = use;
278 bool use_parent_backface_visibility() const {
279 return use_parent_backface_visibility_;
282 bool ShowDebugBorders() const;
284 // These invalidate the host's render surface layer list. The caller
285 // is responsible for calling set_needs_update_draw_properties on the tree
286 // so that its list can be recreated.
287 void CreateRenderSurface();
288 void ClearRenderSurface();
289 void ClearRenderSurfaceLayerList();
291 DrawProperties<LayerImpl>& draw_properties() {
292 return draw_properties_;
294 const DrawProperties<LayerImpl>& draw_properties() const {
295 return draw_properties_;
298 // The following are shortcut accessors to get various information from
299 // draw_properties_
300 const gfx::Transform& draw_transform() const {
301 return draw_properties_.target_space_transform;
303 const gfx::Transform& screen_space_transform() const {
304 return draw_properties_.screen_space_transform;
306 float draw_opacity() const { return draw_properties_.opacity; }
307 bool draw_opacity_is_animating() const {
308 return draw_properties_.opacity_is_animating;
310 bool draw_transform_is_animating() const {
311 return draw_properties_.target_space_transform_is_animating;
313 bool screen_space_transform_is_animating() const {
314 return draw_properties_.screen_space_transform_is_animating;
316 bool screen_space_opacity_is_animating() const {
317 return draw_properties_.screen_space_opacity_is_animating;
319 bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; }
320 bool is_clipped() const { return draw_properties_.is_clipped; }
321 gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
322 gfx::Rect drawable_content_rect() const {
323 return draw_properties_.drawable_content_rect;
325 gfx::Rect visible_content_rect() const {
326 return draw_properties_.visible_content_rect;
328 LayerImpl* render_target() {
329 DCHECK(!draw_properties_.render_target ||
330 draw_properties_.render_target->render_surface());
331 return draw_properties_.render_target;
333 const LayerImpl* render_target() const {
334 DCHECK(!draw_properties_.render_target ||
335 draw_properties_.render_target->render_surface());
336 return draw_properties_.render_target;
338 RenderSurfaceImpl* render_surface() const {
339 return draw_properties_.render_surface.get();
341 int num_unclipped_descendants() const {
342 return draw_properties_.num_unclipped_descendants;
345 // The client should be responsible for setting bounds, content bounds and
346 // contents scale to appropriate values. LayerImpl doesn't calculate any of
347 // them from the other values.
349 void SetBounds(const gfx::Size& bounds);
350 void SetTemporaryImplBounds(const gfx::SizeF& bounds);
351 gfx::Size bounds() const;
352 gfx::Vector2dF BoundsDelta() const {
353 return gfx::Vector2dF(temporary_impl_bounds_.width() - bounds_.width(),
354 temporary_impl_bounds_.height() - bounds_.height());
357 void SetContentBounds(const gfx::Size& content_bounds);
358 gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
360 float contents_scale_x() const { return draw_properties_.contents_scale_x; }
361 float contents_scale_y() const { return draw_properties_.contents_scale_y; }
362 void SetContentsScale(float contents_scale_x, float contents_scale_y);
364 void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate);
365 bool IsExternalFlingActive() const;
367 void SetScrollOffset(const gfx::Vector2d& scroll_offset);
368 void SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset,
369 const gfx::Vector2dF& scroll_delta);
370 gfx::Vector2d scroll_offset() const { return scroll_offset_; }
372 gfx::Vector2d MaxScrollOffset() const;
373 gfx::Vector2dF ClampScrollToMaxScrollOffset();
374 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
375 LayerImpl* scrollbar_clip_layer) const;
376 void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
377 gfx::Vector2dF ScrollDelta() const;
379 gfx::Vector2dF TotalScrollOffset() const;
381 void SetSentScrollDelta(const gfx::Vector2d& sent_scroll_delta);
382 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
384 // Returns the delta of the scroll that was outside of the bounds of the
385 // initial scroll
386 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
388 void SetScrollClipLayer(int scroll_clip_layer_id);
389 LayerImpl* scroll_clip_layer() const { return scroll_clip_layer_; }
390 bool scrollable() const { return !!scroll_clip_layer_; }
392 void set_user_scrollable_horizontal(bool scrollable) {
393 user_scrollable_horizontal_ = scrollable;
395 void set_user_scrollable_vertical(bool scrollable) {
396 user_scrollable_vertical_ = scrollable;
399 void ApplySentScrollDeltasFromAbortedCommit();
400 void ApplyScrollDeltasSinceBeginMainFrame();
402 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) {
403 should_scroll_on_main_thread_ = should_scroll_on_main_thread;
405 bool should_scroll_on_main_thread() const {
406 return should_scroll_on_main_thread_;
409 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
410 have_wheel_event_handlers_ = have_wheel_event_handlers;
412 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
414 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
415 have_scroll_event_handlers_ = have_scroll_event_handlers;
417 bool have_scroll_event_handlers() const {
418 return have_scroll_event_handlers_;
421 void SetNonFastScrollableRegion(const Region& region) {
422 non_fast_scrollable_region_ = region;
424 const Region& non_fast_scrollable_region() const {
425 return non_fast_scrollable_region_;
428 void SetTouchEventHandlerRegion(const Region& region) {
429 touch_event_handler_region_ = region;
431 const Region& touch_event_handler_region() const {
432 return touch_event_handler_region_;
435 void SetDrawCheckerboardForMissingTiles(bool checkerboard) {
436 draw_checkerboard_for_missing_tiles_ = checkerboard;
438 bool draw_checkerboard_for_missing_tiles() const {
439 return draw_checkerboard_for_missing_tiles_;
442 InputHandler::ScrollStatus TryScroll(
443 const gfx::PointF& screen_space_point,
444 InputHandler::ScrollInputType type) const;
446 void SetDoubleSided(bool double_sided);
447 bool double_sided() const { return double_sided_; }
449 void SetTransform(const gfx::Transform& transform);
450 const gfx::Transform& transform() const { return transform_; }
451 bool TransformIsAnimating() const;
452 bool TransformIsAnimatingOnImplOnly() const;
453 void SetTransformAndInvertibility(const gfx::Transform& transform,
454 bool transform_is_invertible);
455 bool transform_is_invertible() const { return transform_is_invertible_; }
457 // Note this rect is in layer space (not content space).
458 void SetUpdateRect(const gfx::RectF& update_rect);
460 const gfx::RectF& update_rect() const { return update_rect_; }
462 void AddDamageRect(const gfx::RectF& damage_rect);
464 const gfx::RectF& damage_rect() const { return damage_rect_; }
466 virtual base::DictionaryValue* LayerTreeAsJson() const;
468 void SetStackingOrderChanged(bool stacking_order_changed);
470 bool LayerPropertyChanged() const { return layer_property_changed_; }
472 void ResetAllChangeTrackingForSubtree();
474 LayerAnimationController* layer_animation_controller() {
475 return layer_animation_controller_.get();
478 const LayerAnimationController* layer_animation_controller() const {
479 return layer_animation_controller_.get();
482 virtual Region VisibleContentOpaqueRegion() const;
484 virtual void DidBecomeActive();
486 virtual void DidBeginTracing();
488 // Release resources held by this layer. Called when the output surface
489 // that rendered this layer was lost or a rendering mode switch has occured.
490 virtual void ReleaseResources();
492 ScrollbarAnimationController* scrollbar_animation_controller() const {
493 return scrollbar_animation_controller_.get();
496 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
497 ScrollbarSet* scrollbars() { return scrollbars_.get(); }
498 void ClearScrollbars();
499 void AddScrollbar(ScrollbarLayerImplBase* layer);
500 void RemoveScrollbar(ScrollbarLayerImplBase* layer);
501 bool HasScrollbar(ScrollbarOrientation orientation) const;
502 void ScrollbarParametersDidChange();
503 int clip_height() {
504 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
507 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
509 virtual skia::RefPtr<SkPicture> GetPicture();
511 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
512 virtual void PushPropertiesTo(LayerImpl* layer);
514 scoped_ptr<base::Value> AsValue() const;
515 virtual size_t GPUMemoryUsageInBytes() const;
517 void SetNeedsPushProperties();
518 void AddDependentNeedsPushProperties();
519 void RemoveDependentNeedsPushProperties();
520 bool parent_should_know_need_push_properties() const {
521 return needs_push_properties() || descendant_needs_push_properties();
524 bool needs_push_properties() const { return needs_push_properties_; }
525 bool descendant_needs_push_properties() const {
526 return num_dependents_need_push_properties_ > 0;
529 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark);
531 virtual void SetDebugInfo(
532 scoped_refptr<base::debug::ConvertableToTraceFormat> other);
534 bool IsDrawnRenderSurfaceLayerListMember() const;
536 void Set3dSortingContextId(int id);
537 int sorting_context_id() { return sorting_context_id_; }
539 protected:
540 LayerImpl(LayerTreeImpl* layer_impl, int id);
542 // Get the color and size of the layer's debug border.
543 virtual void GetDebugBorderProperties(SkColor* color, float* width) const;
545 void AppendDebugBorderQuad(RenderPass* render_pass,
546 const gfx::Size& content_bounds,
547 const SharedQuadState* shared_quad_state,
548 AppendQuadsData* append_quads_data) const;
549 void AppendDebugBorderQuad(RenderPass* render_pass,
550 const gfx::Size& content_bounds,
551 const SharedQuadState* shared_quad_state,
552 AppendQuadsData* append_quads_data,
553 SkColor color,
554 float width) const;
556 virtual void AsValueInto(base::DictionaryValue* dict) const;
558 void NoteLayerPropertyChanged();
559 void NoteLayerPropertyChangedForSubtree();
561 // Note carefully this does not affect the current layer.
562 void NoteLayerPropertyChangedForDescendants();
564 private:
565 void NoteLayerPropertyChangedForDescendantsInternal();
567 virtual const char* LayerTypeAsString() const;
569 // Properties internal to LayerImpl
570 LayerImpl* parent_;
571 OwnedLayerImplList children_;
573 LayerImpl* scroll_parent_;
575 // Storing a pointer to a set rather than a set since this will be rarely
576 // used. If this pointer turns out to be too heavy, we could have this (and
577 // the scroll parent above) be stored in a LayerImpl -> scroll_info
578 // map somewhere.
579 scoped_ptr<std::set<LayerImpl*> > scroll_children_;
581 LayerImpl* clip_parent_;
582 scoped_ptr<std::set<LayerImpl*> > clip_children_;
584 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to
585 // confirm newly assigned layer is still the previous one
586 int mask_layer_id_;
587 scoped_ptr<LayerImpl> mask_layer_;
588 int replica_layer_id_; // ditto
589 scoped_ptr<LayerImpl> replica_layer_;
590 int layer_id_;
591 LayerTreeImpl* layer_tree_impl_;
593 // Properties synchronized from the associated Layer.
594 gfx::Point3F transform_origin_;
595 gfx::Size bounds_;
596 gfx::SizeF temporary_impl_bounds_;
597 gfx::Vector2d scroll_offset_;
598 ScrollOffsetDelegate* scroll_offset_delegate_;
599 LayerImpl* scroll_clip_layer_;
600 bool scrollable_ : 1;
601 bool should_scroll_on_main_thread_ : 1;
602 bool have_wheel_event_handlers_ : 1;
603 bool have_scroll_event_handlers_ : 1;
604 bool user_scrollable_horizontal_ : 1;
605 bool user_scrollable_vertical_ : 1;
606 bool stacking_order_changed_ : 1;
607 // Whether the "back" of this layer should draw.
608 bool double_sided_ : 1;
609 bool should_flatten_transform_ : 1;
611 // Tracks if drawing-related properties have changed since last redraw.
612 bool layer_property_changed_ : 1;
614 bool masks_to_bounds_ : 1;
615 bool contents_opaque_ : 1;
616 bool is_root_for_isolated_group_ : 1;
617 bool use_parent_backface_visibility_ : 1;
618 bool draw_checkerboard_for_missing_tiles_ : 1;
619 bool draws_content_ : 1;
620 bool hide_layer_and_subtree_ : 1;
621 bool force_render_surface_ : 1;
623 // Cache transform_'s invertibility.
624 bool transform_is_invertible_ : 1;
626 // Set for the layer that other layers are fixed to.
627 bool is_container_for_fixed_position_layers_ : 1;
628 Region non_fast_scrollable_region_;
629 Region touch_event_handler_region_;
630 SkColor background_color_;
632 float opacity_;
633 SkXfermode::Mode blend_mode_;
634 gfx::PointF position_;
635 gfx::Transform transform_;
637 LayerPositionConstraint position_constraint_;
639 gfx::Vector2dF scroll_delta_;
640 gfx::Vector2d sent_scroll_delta_;
641 gfx::Vector2dF last_scroll_offset_;
643 // The global depth value of the center of the layer. This value is used
644 // to sort layers from back to front.
645 float draw_depth_;
647 FilterOperations filters_;
648 FilterOperations background_filters_;
650 protected:
651 friend class TreeSynchronizer;
653 // This flag is set when the layer needs to push properties to the active
654 // side.
655 bool needs_push_properties_;
657 // The number of direct children or dependent layers that need to be recursed
658 // to in order for them or a descendent of them to push properties to the
659 // active side.
660 int num_dependents_need_push_properties_;
662 // Layers that share a sorting context id will be sorted together in 3d
663 // space. 0 is a special value that means this layer will not be sorted and
664 // will be drawn in paint order.
665 int sorting_context_id_;
667 DrawMode current_draw_mode_;
669 private:
670 // Rect indicating what was repainted/updated during update.
671 // Note that plugin layers bypass this and leave it empty.
672 // Uses layer (not content) space.
673 gfx::RectF update_rect_;
675 // This rect is in layer space.
676 gfx::RectF damage_rect_;
678 // Manages animations for this layer.
679 scoped_refptr<LayerAnimationController> layer_animation_controller_;
681 // Manages scrollbars for this layer
682 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
684 scoped_ptr<ScrollbarSet> scrollbars_;
686 ScopedPtrVector<CopyOutputRequest> copy_requests_;
688 // Group of properties that need to be computed based on the layer tree
689 // hierarchy before layers can be drawn.
690 DrawProperties<LayerImpl> draw_properties_;
692 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_;
694 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
697 } // namespace cc
699 #endif // CC_LAYERS_LAYER_IMPL_H_