Home | History | Annotate | Download | only in layers
      1 // Copyright 2010 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CC_LAYERS_LAYER_H_
      6 #define CC_LAYERS_LAYER_H_
      7 
      8 #include <set>
      9 #include <string>
     10 
     11 #include "base/callback.h"
     12 #include "base/memory/ref_counted.h"
     13 #include "base/observer_list.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/debug/micro_benchmark.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/paint_properties.h"
     25 #include "cc/layers/render_surface.h"
     26 #include "cc/output/filter_operations.h"
     27 #include "skia/ext/refptr.h"
     28 #include "third_party/skia/include/core/SkColor.h"
     29 #include "third_party/skia/include/core/SkImageFilter.h"
     30 #include "third_party/skia/include/core/SkPicture.h"
     31 #include "third_party/skia/include/core/SkXfermode.h"
     32 #include "ui/gfx/point3_f.h"
     33 #include "ui/gfx/rect.h"
     34 #include "ui/gfx/rect_f.h"
     35 #include "ui/gfx/transform.h"
     36 
     37 namespace gfx {
     38 class BoxF;
     39 }
     40 
     41 namespace base {
     42 namespace debug {
     43 class ConvertableToTraceFormat;
     44 }
     45 }
     46 
     47 namespace cc {
     48 
     49 class Animation;
     50 class AnimationDelegate;
     51 struct AnimationEvent;
     52 class CopyOutputRequest;
     53 class LayerAnimationDelegate;
     54 class LayerAnimationEventObserver;
     55 class LayerClient;
     56 class LayerImpl;
     57 class LayerTreeHost;
     58 class LayerTreeImpl;
     59 class PriorityCalculator;
     60 class RenderingStatsInstrumentation;
     61 class ResourceUpdateQueue;
     62 class ScrollbarLayerInterface;
     63 struct AnimationEvent;
     64 template <typename LayerType>
     65 class OcclusionTracker;
     66 
     67 // Base class for composited layers. Special layer types are derived from
     68 // this class.
     69 class CC_EXPORT Layer : public base::RefCounted<Layer>,
     70                         public LayerAnimationValueObserver,
     71                         public LayerAnimationValueProvider {
     72  public:
     73   typedef RenderSurfaceLayerList RenderSurfaceListType;
     74   typedef LayerList LayerListType;
     75   typedef RenderSurface RenderSurfaceType;
     76 
     77   enum LayerIdLabels {
     78     INVALID_ID = -1,
     79   };
     80 
     81   static scoped_refptr<Layer> Create();
     82 
     83   int id() const { return layer_id_; }
     84 
     85   Layer* RootLayer();
     86   Layer* parent() { return parent_; }
     87   const Layer* parent() const { return parent_; }
     88   void AddChild(scoped_refptr<Layer> child);
     89   void InsertChild(scoped_refptr<Layer> child, size_t index);
     90   void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer);
     91   void RemoveFromParent();
     92   void RemoveAllChildren();
     93   void SetChildren(const LayerList& children);
     94   bool HasAncestor(const Layer* ancestor) const;
     95 
     96   const LayerList& children() const { return children_; }
     97   Layer* child_at(size_t index) { return children_[index].get(); }
     98 
     99   // This requests the layer and its subtree be rendered and given to the
    100   // callback. If the copy is unable to be produced (the layer is destroyed
    101   // first), then the callback is called with a NULL/empty result.
    102   void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request);
    103   bool HasCopyRequest() const {
    104     return !copy_requests_.empty();
    105   }
    106 
    107   virtual void SetBackgroundColor(SkColor background_color);
    108   SkColor background_color() const { return background_color_; }
    109   // If contents_opaque(), return an opaque color else return a
    110   // non-opaque color.  Tries to return background_color(), if possible.
    111   SkColor SafeOpaqueBackgroundColor() const;
    112 
    113   // A layer's bounds are in logical, non-page-scaled pixels (however, the
    114   // root layer's bounds are in physical pixels).
    115   void SetBounds(const gfx::Size& bounds);
    116   gfx::Size bounds() const { return bounds_; }
    117 
    118   void SetMasksToBounds(bool masks_to_bounds);
    119   bool masks_to_bounds() const { return masks_to_bounds_; }
    120 
    121   void SetMaskLayer(Layer* mask_layer);
    122   Layer* mask_layer() { return mask_layer_.get(); }
    123   const Layer* mask_layer() const { return mask_layer_.get(); }
    124 
    125   virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect);
    126   void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::RectF(bounds())); }
    127 
    128   void SetOpacity(float opacity);
    129   float opacity() const { return opacity_; }
    130   bool OpacityIsAnimating() const;
    131   virtual bool OpacityCanAnimateOnImplThread() const;
    132 
    133   void SetBlendMode(SkXfermode::Mode blend_mode);
    134   SkXfermode::Mode blend_mode() const { return blend_mode_; }
    135 
    136   bool uses_default_blend_mode() const {
    137     return blend_mode_ == SkXfermode::kSrcOver_Mode;
    138   }
    139 
    140   // A layer is root for an isolated group when it and all its descendants are
    141   // drawn over a black and fully transparent background, creating an isolated
    142   // group. It should be used along with SetBlendMode(), in order to restrict
    143   // layers within the group to blend with layers outside this group.
    144   void SetIsRootForIsolatedGroup(bool root);
    145   bool is_root_for_isolated_group() const {
    146     return is_root_for_isolated_group_;
    147   }
    148 
    149   void SetFilters(const FilterOperations& filters);
    150   const FilterOperations& filters() const { return filters_; }
    151   bool FilterIsAnimating() const;
    152 
    153   // Background filters are filters applied to what is behind this layer, when
    154   // they are viewed through non-opaque regions in this layer. They are used
    155   // through the WebLayer interface, and are not exposed to HTML.
    156   void SetBackgroundFilters(const FilterOperations& filters);
    157   const FilterOperations& background_filters() const {
    158     return background_filters_;
    159   }
    160 
    161   virtual void SetContentsOpaque(bool opaque);
    162   bool contents_opaque() const { return contents_opaque_; }
    163 
    164   void SetPosition(const gfx::PointF& position);
    165   gfx::PointF position() const { return position_; }
    166 
    167   void SetIsContainerForFixedPositionLayers(bool container);
    168   bool IsContainerForFixedPositionLayers() const;
    169 
    170   void SetPositionConstraint(const LayerPositionConstraint& constraint);
    171   const LayerPositionConstraint& position_constraint() const {
    172     return position_constraint_;
    173   }
    174 
    175   void SetTransform(const gfx::Transform& transform);
    176   const gfx::Transform& transform() const { return transform_; }
    177   bool TransformIsAnimating() const;
    178   bool transform_is_invertible() const { return transform_is_invertible_; }
    179 
    180   void SetTransformOrigin(const gfx::Point3F&);
    181   gfx::Point3F transform_origin() { return transform_origin_; }
    182 
    183   void SetScrollParent(Layer* parent);
    184 
    185   Layer* scroll_parent() { return scroll_parent_; }
    186   const Layer* scroll_parent() const { return scroll_parent_; }
    187 
    188   void AddScrollChild(Layer* child);
    189   void RemoveScrollChild(Layer* child);
    190 
    191   std::set<Layer*>* scroll_children() { return scroll_children_.get(); }
    192   const std::set<Layer*>* scroll_children() const {
    193     return scroll_children_.get();
    194   }
    195 
    196   void SetClipParent(Layer* ancestor);
    197 
    198   Layer* clip_parent() { return clip_parent_; }
    199   const Layer* clip_parent() const {
    200     return clip_parent_;
    201   }
    202 
    203   void AddClipChild(Layer* child);
    204   void RemoveClipChild(Layer* child);
    205 
    206   std::set<Layer*>* clip_children() { return clip_children_.get(); }
    207   const std::set<Layer*>* clip_children() const {
    208     return clip_children_.get();
    209   }
    210 
    211   DrawProperties<Layer>& draw_properties() { return draw_properties_; }
    212   const DrawProperties<Layer>& draw_properties() const {
    213     return draw_properties_;
    214   }
    215 
    216   // The following are shortcut accessors to get various information from
    217   // draw_properties_
    218   const gfx::Transform& draw_transform() const {
    219     return draw_properties_.target_space_transform;
    220   }
    221   const gfx::Transform& screen_space_transform() const {
    222     return draw_properties_.screen_space_transform;
    223   }
    224   float draw_opacity() const { return draw_properties_.opacity; }
    225   bool draw_opacity_is_animating() const {
    226     return draw_properties_.opacity_is_animating;
    227   }
    228   bool draw_transform_is_animating() const {
    229     return draw_properties_.target_space_transform_is_animating;
    230   }
    231   bool screen_space_transform_is_animating() const {
    232     return draw_properties_.screen_space_transform_is_animating;
    233   }
    234   bool screen_space_opacity_is_animating() const {
    235     return draw_properties_.screen_space_opacity_is_animating;
    236   }
    237   bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; }
    238   bool is_clipped() const { return draw_properties_.is_clipped; }
    239   gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
    240   gfx::Rect drawable_content_rect() const {
    241     return draw_properties_.drawable_content_rect;
    242   }
    243   gfx::Rect visible_content_rect() const {
    244     return draw_properties_.visible_content_rect;
    245   }
    246   Layer* render_target() {
    247     DCHECK(!draw_properties_.render_target ||
    248            draw_properties_.render_target->render_surface());
    249     return draw_properties_.render_target;
    250   }
    251   const Layer* render_target() const {
    252     DCHECK(!draw_properties_.render_target ||
    253            draw_properties_.render_target->render_surface());
    254     return draw_properties_.render_target;
    255   }
    256   RenderSurface* render_surface() const {
    257     return draw_properties_.render_surface.get();
    258   }
    259   int num_unclipped_descendants() const {
    260     return draw_properties_.num_unclipped_descendants;
    261   }
    262 
    263   void SetScrollOffset(gfx::Vector2d scroll_offset);
    264   gfx::Vector2d scroll_offset() const { return scroll_offset_; }
    265   void SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset);
    266 
    267   void SetScrollClipLayerId(int clip_layer_id);
    268   bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; }
    269 
    270   void SetUserScrollable(bool horizontal, bool vertical);
    271   bool user_scrollable_horizontal() const {
    272     return user_scrollable_horizontal_;
    273   }
    274   bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
    275 
    276   void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread);
    277   bool should_scroll_on_main_thread() const {
    278     return should_scroll_on_main_thread_;
    279   }
    280 
    281   void SetHaveWheelEventHandlers(bool have_wheel_event_handlers);
    282   bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
    283 
    284   void SetHaveScrollEventHandlers(bool have_scroll_event_handlers);
    285   bool have_scroll_event_handlers() const {
    286     return have_scroll_event_handlers_;
    287   }
    288 
    289   void SetNonFastScrollableRegion(const Region& non_fast_scrollable_region);
    290   const Region& non_fast_scrollable_region() const {
    291     return non_fast_scrollable_region_;
    292   }
    293 
    294   void SetTouchEventHandlerRegion(const Region& touch_event_handler_region);
    295   const Region& touch_event_handler_region() const {
    296     return touch_event_handler_region_;
    297   }
    298 
    299   void set_did_scroll_callback(const base::Closure& callback) {
    300     did_scroll_callback_ = callback;
    301   }
    302 
    303   void SetDrawCheckerboardForMissingTiles(bool checkerboard);
    304   bool draw_checkerboard_for_missing_tiles() const {
    305     return draw_checkerboard_for_missing_tiles_;
    306   }
    307 
    308   void SetForceRenderSurface(bool force_render_surface);
    309   bool force_render_surface() const { return force_render_surface_; }
    310 
    311   gfx::Vector2d ScrollDelta() const { return gfx::Vector2d(); }
    312   gfx::Vector2dF TotalScrollOffset() const {
    313     // Floating point to match the LayerImpl version.
    314     return scroll_offset() + ScrollDelta();
    315   }
    316 
    317   void SetDoubleSided(bool double_sided);
    318   bool double_sided() const { return double_sided_; }
    319 
    320   void SetShouldFlattenTransform(bool flatten);
    321   bool should_flatten_transform() const { return should_flatten_transform_; }
    322 
    323   bool Is3dSorted() const { return sorting_context_id_ != 0; }
    324 
    325   void set_use_parent_backface_visibility(bool use) {
    326     use_parent_backface_visibility_ = use;
    327   }
    328   bool use_parent_backface_visibility() const {
    329     return use_parent_backface_visibility_;
    330   }
    331 
    332   virtual void SetLayerTreeHost(LayerTreeHost* host);
    333 
    334   bool HasDelegatedContent() const { return false; }
    335   bool HasContributingDelegatedRenderPasses() const { return false; }
    336 
    337   void SetIsDrawable(bool is_drawable);
    338 
    339   void SetHideLayerAndSubtree(bool hide);
    340   bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
    341 
    342   void SetReplicaLayer(Layer* layer);
    343   Layer* replica_layer() { return replica_layer_.get(); }
    344   const Layer* replica_layer() const { return replica_layer_.get(); }
    345 
    346   bool has_mask() const { return !!mask_layer_.get(); }
    347   bool has_replica() const { return !!replica_layer_.get(); }
    348   bool replica_has_mask() const {
    349     return replica_layer_.get() &&
    350            (mask_layer_.get() || replica_layer_->mask_layer_.get());
    351   }
    352 
    353   // These methods typically need to be overwritten by derived classes.
    354   virtual bool DrawsContent() const;
    355   virtual void SavePaintProperties();
    356   // Returns true iff any resources were updated that need to be committed.
    357   virtual bool Update(ResourceUpdateQueue* queue,
    358                       const OcclusionTracker<Layer>* occlusion);
    359   virtual bool NeedMoreUpdates();
    360   virtual void SetIsMask(bool is_mask) {}
    361   virtual void ReduceMemoryUsage() {}
    362   virtual void OnOutputSurfaceCreated() {}
    363   virtual bool IsSuitableForGpuRasterization() const;
    364 
    365   virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo();
    366 
    367   void SetLayerClient(LayerClient* client) { client_ = client; }
    368 
    369   virtual void PushPropertiesTo(LayerImpl* layer);
    370 
    371   void CreateRenderSurface();
    372   void ClearRenderSurface();
    373   void ClearRenderSurfaceLayerList();
    374 
    375   // The contents scale converts from logical, non-page-scaled pixels to target
    376   // pixels. The contents scale is 1 for the root layer as it is already in
    377   // physical pixels. By default contents scale is forced to be 1 except for
    378   // subclasses of ContentsScalingLayer.
    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   gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
    382 
    383   virtual void CalculateContentsScale(float ideal_contents_scale,
    384                                       float device_scale_factor,
    385                                       float page_scale_factor,
    386                                       float maximum_animation_contents_scale,
    387                                       bool animating_transform_to_screen,
    388                                       float* contents_scale_x,
    389                                       float* contents_scale_y,
    390                                       gfx::Size* content_bounds);
    391 
    392   LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
    393   const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
    394 
    395   // Set the priority of all desired textures in this layer.
    396   virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) {}
    397 
    398   bool AddAnimation(scoped_ptr<Animation> animation);
    399   void PauseAnimation(int animation_id, double time_offset);
    400   void RemoveAnimation(int animation_id);
    401 
    402   LayerAnimationController* layer_animation_controller() {
    403     return layer_animation_controller_.get();
    404   }
    405   void SetLayerAnimationControllerForTest(
    406       scoped_refptr<LayerAnimationController> controller);
    407 
    408   void set_layer_animation_delegate(AnimationDelegate* delegate) {
    409     layer_animation_controller_->set_layer_animation_delegate(delegate);
    410   }
    411 
    412   bool HasActiveAnimation() const;
    413 
    414   void AddLayerAnimationEventObserver(
    415       LayerAnimationEventObserver* animation_observer);
    416   void RemoveLayerAnimationEventObserver(
    417       LayerAnimationEventObserver* animation_observer);
    418 
    419   virtual Region VisibleContentOpaqueRegion() const;
    420 
    421   virtual ScrollbarLayerInterface* ToScrollbarLayer();
    422 
    423   gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
    424 
    425   virtual skia::RefPtr<SkPicture> GetPicture() const;
    426 
    427   // Constructs a LayerImpl of the correct runtime type for this Layer type.
    428   virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
    429 
    430   bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); }
    431   void ResetNeedsDisplayForTesting() { update_rect_ = gfx::RectF(); }
    432 
    433   RenderingStatsInstrumentation* rendering_stats_instrumentation() const;
    434 
    435   const PaintProperties& paint_properties() const {
    436     return paint_properties_;
    437   }
    438 
    439   // The scale at which contents should be rastered, to match the scale at
    440   // which they will drawn to the screen. This scale is a component of the
    441   // contents scale but does not include page/device scale factors.
    442   // TODO(danakj): This goes away when TiledLayer goes away.
    443   void set_raster_scale(float scale) { raster_scale_ = scale; }
    444   float raster_scale() const { return raster_scale_; }
    445   bool raster_scale_is_unknown() const { return raster_scale_ == 0.f; }
    446 
    447   virtual bool SupportsLCDText() const;
    448 
    449   void SetNeedsPushProperties();
    450   bool needs_push_properties() const { return needs_push_properties_; }
    451   bool descendant_needs_push_properties() const {
    452     return num_dependents_need_push_properties_ > 0;
    453   }
    454   void reset_needs_push_properties_for_testing() {
    455     needs_push_properties_ = false;
    456   }
    457 
    458   virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
    459 
    460   void Set3dSortingContextId(int id);
    461   int sorting_context_id() const { return sorting_context_id_; }
    462 
    463  protected:
    464   friend class LayerImpl;
    465   friend class TreeSynchronizer;
    466   virtual ~Layer();
    467 
    468   Layer();
    469 
    470   // These SetNeeds functions are in order of severity of update:
    471   //
    472   // Called when this layer has been modified in some way, but isn't sure
    473   // that it needs a commit yet.  It needs CalcDrawProperties and UpdateLayers
    474   // before it knows whether or not a commit is required.
    475   void SetNeedsUpdate();
    476   // Called when a property has been modified in a way that the layer
    477   // knows immediately that a commit is required.  This implies SetNeedsUpdate
    478   // as well as SetNeedsPushProperties to push that property.
    479   void SetNeedsCommit();
    480   // Called when there's been a change in layer structure.  Implies both
    481   // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties.
    482   void SetNeedsFullTreeSync();
    483 
    484   // Called when the next commit should wait until the pending tree is activated
    485   // before finishing the commit and unblocking the main thread. Used to ensure
    486   // unused resources on the impl thread are returned before commit completes.
    487   void SetNextCommitWaitsForActivation();
    488 
    489   void AddDependentNeedsPushProperties();
    490   void RemoveDependentNeedsPushProperties();
    491   bool parent_should_know_need_push_properties() const {
    492     return needs_push_properties() || descendant_needs_push_properties();
    493   }
    494 
    495   bool IsPropertyChangeAllowed() const;
    496 
    497   void reset_raster_scale_to_unknown() { raster_scale_ = 0.f; }
    498 
    499   // This flag is set when the layer needs to push properties to the impl
    500   // side.
    501   bool needs_push_properties_;
    502 
    503   // The number of direct children or dependent layers that need to be recursed
    504   // to in order for them or a descendent of them to push properties to the impl
    505   // side.
    506   int num_dependents_need_push_properties_;
    507 
    508   // Tracks whether this layer may have changed stacking order with its
    509   // siblings.
    510   bool stacking_order_changed_;
    511 
    512   // The update rect is the region of the compositor resource that was
    513   // actually updated by the compositor. For layers that may do updating
    514   // outside the compositor's control (i.e. plugin layers), this information
    515   // is not available and the update rect will remain empty.
    516   // Note this rect is in layer space (not content space).
    517   gfx::RectF update_rect_;
    518 
    519   scoped_refptr<Layer> mask_layer_;
    520 
    521   int layer_id_;
    522 
    523   // When true, the layer is about to perform an update. Any commit requests
    524   // will be handled implicitly after the update completes.
    525   bool ignore_set_needs_commit_;
    526 
    527   // Layers that share a sorting context id will be sorted together in 3d
    528   // space.  0 is a special value that means this layer will not be sorted and
    529   // will be drawn in paint order.
    530   int sorting_context_id_;
    531 
    532  private:
    533   friend class base::RefCounted<Layer>;
    534 
    535   void SetParent(Layer* layer);
    536   bool DescendantIsFixedToContainerLayer() const;
    537 
    538   // Returns the index of the child or -1 if not found.
    539   int IndexOfChild(const Layer* reference);
    540 
    541   // This should only be called from RemoveFromParent().
    542   void RemoveChildOrDependent(Layer* child);
    543 
    544   // LayerAnimationValueProvider implementation.
    545   virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE;
    546 
    547   // LayerAnimationValueObserver implementation.
    548   virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
    549   virtual void OnOpacityAnimated(float opacity) OVERRIDE;
    550   virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
    551   virtual void OnScrollOffsetAnimated(
    552       const gfx::Vector2dF& scroll_offset) OVERRIDE;
    553   virtual void OnAnimationWaitingForDeletion() OVERRIDE;
    554   virtual bool IsActive() const OVERRIDE;
    555 
    556   // If this layer has a scroll parent, it removes |this| from its list of
    557   // scroll children.
    558   void RemoveFromScrollTree();
    559 
    560   // If this layer has a clip parent, it removes |this| from its list of clip
    561   // children.
    562   void RemoveFromClipTree();
    563 
    564   LayerList children_;
    565   Layer* parent_;
    566 
    567   // Layer instances have a weak pointer to their LayerTreeHost.
    568   // This pointer value is nil when a Layer is not in a tree and is
    569   // updated via SetLayerTreeHost() if a layer moves between trees.
    570   LayerTreeHost* layer_tree_host_;
    571 
    572   scoped_refptr<LayerAnimationController> layer_animation_controller_;
    573 
    574   // Layer properties.
    575   gfx::Size bounds_;
    576 
    577   gfx::Vector2d scroll_offset_;
    578   // This variable indicates which ancestor layer (if any) whose size,
    579   // transformed relative to this layer, defines the maximum scroll offset for
    580   // this layer.
    581   int scroll_clip_layer_id_;
    582   bool should_scroll_on_main_thread_ : 1;
    583   bool have_wheel_event_handlers_ : 1;
    584   bool have_scroll_event_handlers_ : 1;
    585   bool user_scrollable_horizontal_ : 1;
    586   bool user_scrollable_vertical_ : 1;
    587   bool is_root_for_isolated_group_ : 1;
    588   bool is_container_for_fixed_position_layers_ : 1;
    589   bool is_drawable_ : 1;
    590   bool hide_layer_and_subtree_ : 1;
    591   bool masks_to_bounds_ : 1;
    592   bool contents_opaque_ : 1;
    593   bool double_sided_ : 1;
    594   bool should_flatten_transform_ : 1;
    595   bool use_parent_backface_visibility_ : 1;
    596   bool draw_checkerboard_for_missing_tiles_ : 1;
    597   bool force_render_surface_ : 1;
    598   bool transform_is_invertible_ : 1;
    599   Region non_fast_scrollable_region_;
    600   Region touch_event_handler_region_;
    601   gfx::PointF position_;
    602   SkColor background_color_;
    603   float opacity_;
    604   SkXfermode::Mode blend_mode_;
    605   FilterOperations filters_;
    606   FilterOperations background_filters_;
    607   LayerPositionConstraint position_constraint_;
    608   Layer* scroll_parent_;
    609   scoped_ptr<std::set<Layer*> > scroll_children_;
    610 
    611   Layer* clip_parent_;
    612   scoped_ptr<std::set<Layer*> > clip_children_;
    613 
    614   gfx::Transform transform_;
    615   gfx::Point3F transform_origin_;
    616 
    617   // Replica layer used for reflections.
    618   scoped_refptr<Layer> replica_layer_;
    619 
    620   // Transient properties.
    621   float raster_scale_;
    622 
    623   LayerClient* client_;
    624 
    625   ScopedPtrVector<CopyOutputRequest> copy_requests_;
    626 
    627   base::Closure did_scroll_callback_;
    628 
    629   DrawProperties<Layer> draw_properties_;
    630 
    631   PaintProperties paint_properties_;
    632 
    633   DISALLOW_COPY_AND_ASSIGN(Layer);
    634 };
    635 
    636 }  // namespace cc
    637 
    638 #endif  // CC_LAYERS_LAYER_H_
    639