Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / cc / layers / layer_impl.h
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.
4
5 #ifndef CC_LAYERS_LAYER_IMPL_H_
6 #define CC_LAYERS_LAYER_IMPL_H_
7
8 #include <set>
9 #include <string>
10
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"
39
40 namespace base {
41 namespace debug {
42 class ConvertableToTraceFormat;
43 class TracedValue;
44 }
45
46 class DictionaryValue;
47 }
48
49 namespace cc {
50
51 class LayerTreeHostImpl;
52 class LayerTreeImpl;
53 class MicroBenchmarkImpl;
54 class Occlusion;
55 template <typename LayerType>
56 class OcclusionTracker;
57 class RenderPass;
58 class RenderPassId;
59 class Renderer;
60 class ScrollbarAnimationController;
61 class ScrollbarLayerImplBase;
62 class SimpleEnclosedRegion;
63 class Tile;
64
65 struct AppendQuadsData;
66
67 enum DrawMode {
68   DRAW_MODE_NONE,
69   DRAW_MODE_HARDWARE,
70   DRAW_MODE_SOFTWARE,
71   DRAW_MODE_RESOURCELESS_SOFTWARE
72 };
73
74 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
75                             public LayerAnimationValueProvider,
76                             public AnimationDelegate {
77  public:
78   // Allows for the ownership of the total scroll offset to be delegated outside
79   // of the layer.
80   class ScrollOffsetDelegate {
81    public:
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;
86   };
87
88   typedef LayerImplList RenderSurfaceListType;
89   typedef LayerImplList LayerListType;
90   typedef RenderSurfaceImpl RenderSurfaceType;
91
92   enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 };
93
94   static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
95     return make_scoped_ptr(new LayerImpl(tree_impl, id));
96   }
97
98   ~LayerImpl() override;
99
100   int id() const { return layer_id_; }
101
102   // LayerAnimationValueProvider implementation.
103   gfx::ScrollOffset ScrollOffsetForAnimation() const override;
104
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;
112
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,
119                                int group) override;
120
121   // Tree structure.
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);
130
131   // Warning: This does not preserve tree structure invariants.
132   void ClearChildList();
133
134   bool HasAncestor(const LayerImpl* ancestor) const;
135
136   void SetScrollParent(LayerImpl* parent);
137
138   LayerImpl* scroll_parent() { return scroll_parent_; }
139   const LayerImpl* scroll_parent() const { return scroll_parent_; }
140
141   void SetScrollChildren(std::set<LayerImpl*>* children);
142
143   std::set<LayerImpl*>* scroll_children() { return scroll_children_.get(); }
144   const std::set<LayerImpl*>* scroll_children() const {
145     return scroll_children_.get();
146   }
147
148   void SetNumDescendantsThatDrawContent(int num_descendants);
149   void SetClipParent(LayerImpl* ancestor);
150
151   LayerImpl* clip_parent() {
152     return clip_parent_;
153   }
154   const LayerImpl* clip_parent() const {
155     return clip_parent_;
156   }
157
158   void SetClipChildren(std::set<LayerImpl*>* children);
159
160   std::set<LayerImpl*>* clip_children() { return clip_children_.get(); }
161   const std::set<LayerImpl*>* clip_children() const {
162     return clip_children_.get();
163   }
164
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(); }
170
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();
175
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();
180
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_);
185   }
186
187   LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
188
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
195   // returns true.
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);
202
203   virtual void GetContentsResourceId(ResourceProvider::ResourceId* resource_id,
204                                      gfx::Size* resource_size) const;
205
206   virtual bool HasDelegatedContent() const;
207   virtual bool HasContributingDelegatedRenderPasses() const;
208   virtual RenderPassId FirstContributingRenderPassId() const;
209   virtual RenderPassId NextContributingRenderPassId(RenderPassId id) const;
210
211   virtual void UpdateTiles(const Occlusion& occlusion_in_layer_space,
212                            bool resourceless_software_draw) {}
213   virtual void NotifyTileStateChanged(const Tile* tile) {}
214
215   virtual ScrollbarLayerImplBase* ToScrollbarLayer();
216
217   // Returns true if this layer has content to draw.
218   void SetDrawsContent(bool draws_content);
219   bool DrawsContent() const { return draws_content_; }
220
221   int NumDescendantsThatDrawContent() const;
222   void SetHideLayerAndSubtree(bool hide);
223   bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
224
225   bool force_render_surface() const { return force_render_surface_; }
226   void SetForceRenderSurface(bool force) { force_render_surface_ = force; }
227
228   void SetTransformOrigin(const gfx::Point3F& transform_origin);
229   gfx::Point3F transform_origin() const { return transform_origin_; }
230
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;
236
237   void SetFilters(const FilterOperations& filters);
238   const FilterOperations& filters() const { return filters_; }
239   bool FilterIsAnimating() const;
240   bool FilterIsAnimatingOnImplOnly() const;
241
242   void SetBackgroundFilters(const FilterOperations& filters);
243   const FilterOperations& background_filters() const {
244     return background_filters_;
245   }
246
247   void SetMasksToBounds(bool masks_to_bounds);
248   bool masks_to_bounds() const { return masks_to_bounds_; }
249
250   void SetContentsOpaque(bool opaque);
251   bool contents_opaque() const { return contents_opaque_; }
252
253   void SetOpacity(float opacity);
254   float opacity() const { return opacity_; }
255   bool OpacityIsAnimating() const;
256   bool OpacityIsAnimatingOnImplOnly() const;
257
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;
262   }
263
264   void SetIsRootForIsolatedGroup(bool root);
265   bool is_root_for_isolated_group() const {
266     return is_root_for_isolated_group_;
267   }
268
269   void SetPosition(const gfx::PointF& position);
270   gfx::PointF position() const { return position_; }
271
272   void SetIsContainerForFixedPositionLayers(bool container) {
273     is_container_for_fixed_position_layers_ = container;
274   }
275   // This is a non-trivial function in Layer.
276   bool IsContainerForFixedPositionLayers() const {
277     return is_container_for_fixed_position_layers_;
278   }
279
280   gfx::Vector2dF FixedContainerSizeDelta() const;
281
282   void SetPositionConstraint(const LayerPositionConstraint& constraint) {
283     position_constraint_ = constraint;
284   }
285   const LayerPositionConstraint& position_constraint() const {
286     return position_constraint_;
287   }
288
289   void SetShouldFlattenTransform(bool flatten);
290   bool should_flatten_transform() const { return should_flatten_transform_; }
291
292   bool Is3dSorted() const { return sorting_context_id_ != 0; }
293
294   void SetUseParentBackfaceVisibility(bool use) {
295     use_parent_backface_visibility_ = use;
296   }
297   bool use_parent_backface_visibility() const {
298     return use_parent_backface_visibility_;
299   }
300
301   bool ShowDebugBorders() const;
302
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();
309
310   DrawProperties<LayerImpl>& draw_properties() {
311     return draw_properties_;
312   }
313   const DrawProperties<LayerImpl>& draw_properties() const {
314     return draw_properties_;
315   }
316
317   // The following are shortcut accessors to get various information from
318   // draw_properties_
319   const gfx::Transform& draw_transform() const {
320     return draw_properties_.target_space_transform;
321   }
322   const gfx::Transform& screen_space_transform() const {
323     return draw_properties_.screen_space_transform;
324   }
325   float draw_opacity() const { return draw_properties_.opacity; }
326   bool draw_opacity_is_animating() const {
327     return draw_properties_.opacity_is_animating;
328   }
329   bool draw_transform_is_animating() const {
330     return draw_properties_.target_space_transform_is_animating;
331   }
332   bool screen_space_transform_is_animating() const {
333     return draw_properties_.screen_space_transform_is_animating;
334   }
335   bool screen_space_opacity_is_animating() const {
336     return draw_properties_.screen_space_opacity_is_animating;
337   }
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;
343   }
344   gfx::Rect visible_content_rect() const {
345     return draw_properties_.visible_content_rect;
346   }
347   LayerImpl* render_target() {
348     DCHECK(!draw_properties_.render_target ||
349            draw_properties_.render_target->render_surface());
350     return draw_properties_.render_target;
351   }
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;
356   }
357   RenderSurfaceImpl* render_surface() const {
358     return draw_properties_.render_surface.get();
359   }
360   int num_unclipped_descendants() const {
361     return draw_properties_.num_unclipped_descendants;
362   }
363
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.
367
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_; }
375
376   void SetContentBounds(const gfx::Size& content_bounds);
377   gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
378
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);
382
383   void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate);
384   void DidScroll();
385   bool IsExternalFlingActive() const;
386
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_; }
391
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;
399
400   gfx::ScrollOffset TotalScrollOffset() const;
401
402   void SetSentScrollDelta(const gfx::Vector2dF& sent_scroll_delta);
403   gfx::Vector2dF sent_scroll_delta() const { return sent_scroll_delta_; }
404
405   // Returns the delta of the scroll that was outside of the bounds of the
406   // initial scroll
407   gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
408
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_; }
412
413   void set_user_scrollable_horizontal(bool scrollable) {
414     user_scrollable_horizontal_ = scrollable;
415   }
416   bool user_scrollable_horizontal() const {
417     return user_scrollable_horizontal_;
418   }
419   void set_user_scrollable_vertical(bool scrollable) {
420     user_scrollable_vertical_ = scrollable;
421   }
422   bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
423
424   bool user_scrollable(ScrollbarOrientation orientation) const;
425
426   void ApplySentScrollDeltasFromAbortedCommit();
427   void ApplyScrollDeltasSinceBeginMainFrame();
428
429   void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) {
430     should_scroll_on_main_thread_ = should_scroll_on_main_thread;
431   }
432   bool should_scroll_on_main_thread() const {
433     return should_scroll_on_main_thread_;
434   }
435
436   void SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
437     have_wheel_event_handlers_ = have_wheel_event_handlers;
438   }
439   bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
440
441   void SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
442     have_scroll_event_handlers_ = have_scroll_event_handlers;
443   }
444   bool have_scroll_event_handlers() const {
445     return have_scroll_event_handlers_;
446   }
447
448   void SetNonFastScrollableRegion(const Region& region) {
449     non_fast_scrollable_region_ = region;
450   }
451   const Region& non_fast_scrollable_region() const {
452     return non_fast_scrollable_region_;
453   }
454
455   void SetTouchEventHandlerRegion(const Region& region) {
456     touch_event_handler_region_ = region;
457   }
458   const Region& touch_event_handler_region() const {
459     return touch_event_handler_region_;
460   }
461
462   void SetDrawCheckerboardForMissingTiles(bool checkerboard) {
463     draw_checkerboard_for_missing_tiles_ = checkerboard;
464   }
465   bool draw_checkerboard_for_missing_tiles() const {
466     return draw_checkerboard_for_missing_tiles_;
467   }
468
469   InputHandler::ScrollStatus TryScroll(
470       const gfx::PointF& screen_space_point,
471       InputHandler::ScrollInputType type) const;
472
473   void SetDoubleSided(bool double_sided);
474   bool double_sided() const { return double_sided_; }
475
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_; }
483
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_; }
487
488   void AddDamageRect(const gfx::RectF& damage_rect);
489
490   const gfx::RectF& damage_rect() const { return damage_rect_; }
491
492   virtual base::DictionaryValue* LayerTreeAsJson() const;
493
494   void SetStackingOrderChanged(bool stacking_order_changed);
495
496   bool LayerPropertyChanged() const { return layer_property_changed_; }
497
498   void ResetAllChangeTrackingForSubtree();
499
500   LayerAnimationController* layer_animation_controller() {
501     return layer_animation_controller_.get();
502   }
503
504   const LayerAnimationController* layer_animation_controller() const {
505     return layer_animation_controller_.get();
506   }
507
508   virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const;
509
510   virtual void DidBecomeActive();
511
512   virtual void DidBeginTracing();
513
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();
517
518   ScrollbarAnimationController* scrollbar_animation_controller() const {
519     return scrollbar_animation_controller_.get();
520   }
521
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);
529   int clip_height() {
530     return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
531   }
532
533   gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
534
535   virtual skia::RefPtr<SkPicture> GetPicture();
536
537   virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
538   virtual void PushPropertiesTo(LayerImpl* layer);
539
540   virtual void GetAllTilesForTracing(std::set<const Tile*>* tiles) const;
541   virtual void AsValueInto(base::debug::TracedValue* dict) const;
542
543   virtual size_t GPUMemoryUsageInBytes() const;
544
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();
550   }
551
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;
555   }
556
557   virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark);
558
559   virtual void SetDebugInfo(
560       scoped_refptr<base::debug::ConvertableToTraceFormat> other);
561
562   bool IsDrawnRenderSurfaceLayerListMember() const;
563
564   void Set3dSortingContextId(int id);
565   int sorting_context_id() { return sorting_context_id_; }
566
567  protected:
568   LayerImpl(LayerTreeImpl* layer_impl, int id);
569
570   // Get the color and size of the layer's debug border.
571   virtual void GetDebugBorderProperties(SkColor* color, float* width) const;
572
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,
581                              SkColor color,
582                              float width) const;
583
584   void NoteLayerPropertyChanged();
585   void NoteLayerPropertyChangedForSubtree();
586
587   // Note carefully this does not affect the current layer.
588   void NoteLayerPropertyChangedForDescendants();
589
590  private:
591   void NoteLayerPropertyChangedForDescendantsInternal();
592
593   virtual const char* LayerTypeAsString() const;
594
595   // Properties internal to LayerImpl
596   LayerImpl* parent_;
597   OwnedLayerImplList children_;
598
599   LayerImpl* scroll_parent_;
600
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
604   // map somewhere.
605   scoped_ptr<std::set<LayerImpl*>> scroll_children_;
606
607   LayerImpl* clip_parent_;
608   scoped_ptr<std::set<LayerImpl*>> clip_children_;
609
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
612   int mask_layer_id_;
613   scoped_ptr<LayerImpl> mask_layer_;
614   int replica_layer_id_;  // ditto
615   scoped_ptr<LayerImpl> replica_layer_;
616   int layer_id_;
617   LayerTreeImpl* layer_tree_impl_;
618
619   // Properties synchronized from the associated Layer.
620   gfx::Point3F transform_origin_;
621   gfx::Size bounds_;
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;
636
637   // Tracks if drawing-related properties have changed since last redraw.
638   bool layer_property_changed_ : 1;
639
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;
648
649   // Cache transform_'s invertibility.
650   bool transform_is_invertible_ : 1;
651
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_;
657
658   float opacity_;
659   SkXfermode::Mode blend_mode_;
660   gfx::PointF position_;
661   gfx::Transform transform_;
662
663   LayerPositionConstraint position_constraint_;
664
665   gfx::Vector2dF scroll_delta_;
666   gfx::Vector2dF sent_scroll_delta_;
667   gfx::ScrollOffset last_scroll_offset_;
668
669   int num_descendants_that_draw_content_;
670
671   // The global depth value of the center of the layer. This value is used
672   // to sort layers from back to front.
673   float draw_depth_;
674
675   FilterOperations filters_;
676   FilterOperations background_filters_;
677
678  protected:
679   friend class TreeSynchronizer;
680
681   // This flag is set when the layer needs to push properties to the active
682   // side.
683   bool needs_push_properties_;
684
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
687   // active side.
688   int num_dependents_need_push_properties_;
689
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_;
694
695   DrawMode current_draw_mode_;
696
697  private:
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_;
702
703   // This rect is in layer space.
704   gfx::RectF damage_rect_;
705
706   // Manages animations for this layer.
707   scoped_refptr<LayerAnimationController> layer_animation_controller_;
708
709   // Manages scrollbars for this layer
710   scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
711
712   scoped_ptr<ScrollbarSet> scrollbars_;
713
714   ScopedPtrVector<CopyOutputRequest> copy_requests_;
715
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_;
719
720   scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_;
721
722   DISALLOW_COPY_AND_ASSIGN(LayerImpl);
723 };
724
725 }  // namespace cc
726
727 #endif  // CC_LAYERS_LAYER_IMPL_H_