Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / cc / layers / layer.h
blobb4794d21fc6fdda38f230653ed7578119356a5a0
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.
5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/observer_list.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/debug/frame_timing_request.h"
22 #include "cc/debug/micro_benchmark.h"
23 #include "cc/layers/layer_lists.h"
24 #include "cc/layers/layer_position_constraint.h"
25 #include "cc/layers/paint_properties.h"
26 #include "cc/layers/scroll_blocks_on.h"
27 #include "cc/output/filter_operations.h"
28 #include "cc/trees/property_tree.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 "third_party/skia/include/core/SkXfermode.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"
40 namespace gfx {
41 class BoxF;
44 namespace base {
45 namespace trace_event {
46 class ConvertableToTraceFormat;
50 namespace cc {
52 class Animation;
53 class AnimationDelegate;
54 struct AnimationEvent;
55 class CopyOutputRequest;
56 class LayerAnimationEventObserver;
57 class LayerClient;
58 class LayerImpl;
59 class LayerSettings;
60 class LayerTreeHost;
61 class LayerTreeHostCommon;
62 class LayerTreeImpl;
63 class LayerTreeSettings;
64 class RenderingStatsInstrumentation;
65 class ResourceUpdateQueue;
66 class ScrollbarLayerInterface;
67 class SimpleEnclosedRegion;
68 struct AnimationEvent;
70 // Base class for composited layers. Special layer types are derived from
71 // this class.
72 class CC_EXPORT Layer : public base::RefCounted<Layer>,
73 public LayerAnimationValueObserver,
74 public LayerAnimationValueProvider {
75 public:
76 typedef LayerList LayerListType;
78 enum LayerIdLabels {
79 INVALID_ID = -1,
82 static scoped_refptr<Layer> Create(const LayerSettings& settings);
84 int id() const { return layer_id_; }
86 Layer* RootLayer();
87 Layer* parent() { return parent_; }
88 const Layer* parent() const { return parent_; }
89 void AddChild(scoped_refptr<Layer> child);
90 void InsertChild(scoped_refptr<Layer> child, size_t index);
91 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer);
92 void RemoveFromParent();
93 void RemoveAllChildren();
94 void SetChildren(const LayerList& children);
95 bool HasAncestor(const Layer* ancestor) const;
97 const LayerList& children() const { return children_; }
98 Layer* child_at(size_t index) { return children_[index].get(); }
100 // This requests the layer and its subtree be rendered and given to the
101 // callback. If the copy is unable to be produced (the layer is destroyed
102 // first), then the callback is called with a nullptr/empty result. If the
103 // request's source property is set, any prior uncommitted requests having the
104 // same source will be aborted.
105 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request);
106 bool HasCopyRequest() const {
107 return !copy_requests_.empty();
110 virtual void SetBackgroundColor(SkColor background_color);
111 SkColor background_color() const { return background_color_; }
112 // If contents_opaque(), return an opaque color else return a
113 // non-opaque color. Tries to return background_color(), if possible.
114 SkColor SafeOpaqueBackgroundColor() const;
116 // A layer's bounds are in logical, non-page-scaled pixels (however, the
117 // root layer's bounds are in physical pixels).
118 void SetBounds(const gfx::Size& bounds);
119 gfx::Size bounds() const { return bounds_; }
121 void SetMasksToBounds(bool masks_to_bounds);
122 bool masks_to_bounds() const { return masks_to_bounds_; }
124 void SetMaskLayer(Layer* mask_layer);
125 Layer* mask_layer() { return mask_layer_.get(); }
126 const Layer* mask_layer() const { return mask_layer_.get(); }
128 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect);
129 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); }
131 void SetOpacity(float opacity);
132 float opacity() const { return opacity_; }
133 bool OpacityIsAnimating() const;
134 bool HasPotentiallyRunningOpacityAnimation() const;
135 virtual bool OpacityCanAnimateOnImplThread() const;
137 void SetBlendMode(SkXfermode::Mode blend_mode);
138 SkXfermode::Mode blend_mode() const { return blend_mode_; }
140 void set_draw_blend_mode(SkXfermode::Mode blend_mode) {
141 if (draw_blend_mode_ == blend_mode)
142 return;
143 draw_blend_mode_ = blend_mode;
144 SetNeedsPushProperties();
146 SkXfermode::Mode draw_blend_mode() const { return draw_blend_mode_; }
148 bool uses_default_blend_mode() const {
149 return blend_mode_ == SkXfermode::kSrcOver_Mode;
152 // A layer is root for an isolated group when it and all its descendants are
153 // drawn over a black and fully transparent background, creating an isolated
154 // group. It should be used along with SetBlendMode(), in order to restrict
155 // layers within the group to blend with layers outside this group.
156 void SetIsRootForIsolatedGroup(bool root);
157 bool is_root_for_isolated_group() const {
158 return is_root_for_isolated_group_;
161 void SetFilters(const FilterOperations& filters);
162 const FilterOperations& filters() const { return filters_; }
163 bool FilterIsAnimating() const;
164 bool HasPotentiallyRunningFilterAnimation() const;
166 // Background filters are filters applied to what is behind this layer, when
167 // they are viewed through non-opaque regions in this layer. They are used
168 // through the WebLayer interface, and are not exposed to HTML.
169 void SetBackgroundFilters(const FilterOperations& filters);
170 const FilterOperations& background_filters() const {
171 return background_filters_;
174 virtual void SetContentsOpaque(bool opaque);
175 bool contents_opaque() const { return contents_opaque_; }
177 void SetPosition(const gfx::PointF& position);
178 gfx::PointF position() const { return position_; }
180 // A layer that is a container for fixed position layers cannot be both
181 // scrollable and have a non-identity transform.
182 void SetIsContainerForFixedPositionLayers(bool container);
183 bool IsContainerForFixedPositionLayers() const;
185 gfx::Vector2dF FixedContainerSizeDelta() const {
186 return gfx::Vector2dF();
189 void SetPositionConstraint(const LayerPositionConstraint& constraint);
190 const LayerPositionConstraint& position_constraint() const {
191 return position_constraint_;
194 void SetTransform(const gfx::Transform& transform);
195 const gfx::Transform& transform() const { return transform_; }
196 bool TransformIsAnimating() const;
197 bool HasPotentiallyRunningTransformAnimation() const;
198 bool HasOnlyTranslationTransforms() const;
199 bool AnimationsPreserveAxisAlignment() const;
200 bool transform_is_invertible() const { return transform_is_invertible_; }
202 bool MaximumTargetScale(float* max_scale) const;
203 bool AnimationStartScale(float* start_scale) const;
205 void SetTransformOrigin(const gfx::Point3F&);
206 gfx::Point3F transform_origin() const { return transform_origin_; }
208 bool HasAnyAnimationTargetingProperty(
209 Animation::TargetProperty property) const;
211 bool ScrollOffsetAnimationWasInterrupted() const;
213 void SetScrollParent(Layer* parent);
215 Layer* scroll_parent() { return scroll_parent_; }
216 const Layer* scroll_parent() const { return scroll_parent_; }
218 void AddScrollChild(Layer* child);
219 void RemoveScrollChild(Layer* child);
221 std::set<Layer*>* scroll_children() { return scroll_children_.get(); }
222 const std::set<Layer*>* scroll_children() const {
223 return scroll_children_.get();
226 void SetClipParent(Layer* ancestor);
228 Layer* clip_parent() { return clip_parent_; }
229 const Layer* clip_parent() const {
230 return clip_parent_;
233 void AddClipChild(Layer* child);
234 void RemoveClipChild(Layer* child);
236 std::set<Layer*>* clip_children() { return clip_children_.get(); }
237 const std::set<Layer*>* clip_children() const {
238 return clip_children_.get();
241 // TODO(enne): Fix style here (and everywhere) once LayerImpl does the same.
242 gfx::Transform draw_transform() const;
243 gfx::Transform screen_space_transform() const;
245 void set_num_unclipped_descendants(size_t descendants) {
246 num_unclipped_descendants_ = descendants;
248 size_t num_unclipped_descendants() const {
249 return num_unclipped_descendants_;
252 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset);
253 void SetScrollCompensationAdjustment(
254 const gfx::Vector2dF& scroll_compensation_adjustment);
255 gfx::Vector2dF ScrollCompensationAdjustment() const;
257 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; }
258 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset);
260 void SetScrollClipLayerId(int clip_layer_id);
261 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; }
263 void SetUserScrollable(bool horizontal, bool vertical);
264 bool user_scrollable_horizontal() const {
265 return user_scrollable_horizontal_;
267 bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
269 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread);
270 bool should_scroll_on_main_thread() const {
271 return should_scroll_on_main_thread_;
274 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers);
275 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
277 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers);
278 bool have_scroll_event_handlers() const {
279 return have_scroll_event_handlers_;
282 void SetNonFastScrollableRegion(const Region& non_fast_scrollable_region);
283 const Region& non_fast_scrollable_region() const {
284 return non_fast_scrollable_region_;
287 void SetTouchEventHandlerRegion(const Region& touch_event_handler_region);
288 const Region& touch_event_handler_region() const {
289 return touch_event_handler_region_;
292 void SetScrollBlocksOn(ScrollBlocksOn scroll_blocks_on);
293 ScrollBlocksOn scroll_blocks_on() const { return scroll_blocks_on_; }
295 void set_did_scroll_callback(const base::Closure& callback) {
296 did_scroll_callback_ = callback;
299 void SetForceRenderSurface(bool force_render_surface);
300 bool force_render_surface() const { return force_render_surface_; }
302 gfx::Vector2dF ScrollDelta() const { return gfx::Vector2dF(); }
303 gfx::ScrollOffset CurrentScrollOffset() const { return scroll_offset_; }
305 void SetDoubleSided(bool double_sided);
306 bool double_sided() const { return double_sided_; }
308 void SetShouldFlattenTransform(bool flatten);
309 bool should_flatten_transform() const { return should_flatten_transform_; }
311 bool Is3dSorted() const { return sorting_context_id_ != 0; }
313 void set_use_parent_backface_visibility(bool use) {
314 use_parent_backface_visibility_ = use;
316 bool use_parent_backface_visibility() const {
317 return use_parent_backface_visibility_;
320 virtual void SetLayerTreeHost(LayerTreeHost* host);
322 virtual bool HasDelegatedContent() const;
323 bool HasContributingDelegatedRenderPasses() const { return false; }
325 void SetIsDrawable(bool is_drawable);
327 void SetHideLayerAndSubtree(bool hide);
328 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
330 void SetReplicaLayer(Layer* layer);
331 Layer* replica_layer() { return replica_layer_.get(); }
332 const Layer* replica_layer() const { return replica_layer_.get(); }
334 bool has_mask() const { return !!mask_layer_.get(); }
335 bool has_replica() const { return !!replica_layer_.get(); }
336 bool replica_has_mask() const {
337 return replica_layer_.get() &&
338 (mask_layer_.get() || replica_layer_->mask_layer_.get());
341 int NumDescendantsThatDrawContent() const;
343 // This is only virtual for tests.
344 // TODO(awoloszyn): Remove this once we no longer need it for tests
345 virtual bool DrawsContent() const;
347 // This methods typically need to be overwritten by derived classes.
348 virtual void SavePaintProperties();
349 // Returns true iff anything was updated that needs to be committed.
350 virtual bool Update();
351 virtual void SetIsMask(bool is_mask) {}
352 virtual bool IsSuitableForGpuRasterization() const;
354 virtual scoped_refptr<base::trace_event::ConvertableToTraceFormat>
355 TakeDebugInfo();
357 void SetLayerClient(LayerClient* client) { client_ = client; }
359 virtual void PushPropertiesTo(LayerImpl* layer);
361 LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
362 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
364 bool AddAnimation(scoped_ptr<Animation> animation);
365 void PauseAnimation(int animation_id, double time_offset);
366 void RemoveAnimation(int animation_id);
367 void RemoveAnimation(int animation_id, Animation::TargetProperty property);
368 LayerAnimationController* layer_animation_controller() const {
369 return layer_animation_controller_.get();
371 void SetLayerAnimationControllerForTest(
372 scoped_refptr<LayerAnimationController> controller);
374 void set_layer_animation_delegate(AnimationDelegate* delegate) {
375 DCHECK(layer_animation_controller_);
376 layer_animation_controller_->set_layer_animation_delegate(delegate);
379 bool HasActiveAnimation() const;
380 void RegisterForAnimations(AnimationRegistrar* registrar);
382 void AddLayerAnimationEventObserver(
383 LayerAnimationEventObserver* animation_observer);
384 void RemoveLayerAnimationEventObserver(
385 LayerAnimationEventObserver* animation_observer);
387 virtual ScrollbarLayerInterface* ToScrollbarLayer();
389 virtual skia::RefPtr<SkPicture> GetPicture() const;
391 // Constructs a LayerImpl of the correct runtime type for this Layer type.
392 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
394 bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); }
395 void ResetNeedsDisplayForTesting() { update_rect_ = gfx::Rect(); }
397 RenderingStatsInstrumentation* rendering_stats_instrumentation() const;
399 const PaintProperties& paint_properties() const {
400 return paint_properties_;
403 void SetNeedsPushProperties();
404 bool needs_push_properties() const { return needs_push_properties_; }
405 bool descendant_needs_push_properties() const {
406 return num_dependents_need_push_properties_ > 0;
408 void reset_needs_push_properties_for_testing() {
409 needs_push_properties_ = false;
412 virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
414 void Set3dSortingContextId(int id);
415 int sorting_context_id() const { return sorting_context_id_; }
417 void set_property_tree_sequence_number(int sequence_number) {
418 property_tree_sequence_number_ = sequence_number;
421 void SetTransformTreeIndex(int index);
422 int transform_tree_index() const;
424 void SetClipTreeIndex(int index);
425 int clip_tree_index() const;
427 void SetEffectTreeIndex(int index);
428 int effect_tree_index() const;
430 void set_offset_to_transform_parent(gfx::Vector2dF offset) {
431 if (offset_to_transform_parent_ == offset)
432 return;
433 offset_to_transform_parent_ = offset;
434 SetNeedsPushProperties();
436 gfx::Vector2dF offset_to_transform_parent() const {
437 return offset_to_transform_parent_;
440 // TODO(enne): Once LayerImpl only uses property trees, remove these
441 // functions.
442 const gfx::Rect& visible_rect_from_property_trees() const {
443 return visible_layer_rect();
445 void set_visible_rect_from_property_trees(const gfx::Rect& rect) {
446 set_visible_layer_rect(rect);
448 const gfx::Rect& clip_rect_in_target_space_from_property_trees() const {
449 return clip_rect();
451 void set_clip_rect_in_target_space_from_property_trees(
452 const gfx::Rect& rect) {
453 set_clip_rect(rect);
455 // TODO(enne): This needs a different name. It is a calculated value
456 // from the property tree builder and not a synonym for "should
457 // flatten transform".
458 void set_should_flatten_transform_from_property_tree(bool should_flatten) {
459 if (should_flatten_transform_from_property_tree_ == should_flatten)
460 return;
461 should_flatten_transform_from_property_tree_ = should_flatten;
462 SetNeedsPushProperties();
464 bool should_flatten_transform_from_property_tree() const {
465 return should_flatten_transform_from_property_tree_;
468 const gfx::Rect& visible_layer_rect() const { return visible_layer_rect_; }
469 void set_visible_layer_rect(const gfx::Rect& rect) {
470 visible_layer_rect_ = rect;
473 const gfx::Rect& clip_rect() const { return clip_rect_; }
474 void set_clip_rect(const gfx::Rect& rect) { clip_rect_ = rect; }
476 void set_is_clipped(bool is_clipped) {
477 if (is_clipped_ == is_clipped)
478 return;
479 is_clipped_ = is_clipped;
480 SetNeedsPushProperties();
482 bool is_clipped() const { return is_clipped_; }
484 bool has_render_surface() const {
485 return has_render_surface_;
488 // Sets new frame timing requests for this layer.
489 void SetFrameTimingRequests(const std::vector<FrameTimingRequest>& requests);
491 // Accessor for unit tests
492 const std::vector<FrameTimingRequest>& FrameTimingRequests() const {
493 return frame_timing_requests_;
496 void DidBeginTracing();
497 void set_num_layer_or_descendant_with_copy_request(
498 int num_layer_or_descendants_with_copy_request) {
499 num_layer_or_descendants_with_copy_request_ =
500 num_layer_or_descendants_with_copy_request;
502 int num_layer_or_descendants_with_copy_request() {
503 return num_layer_or_descendants_with_copy_request_;
506 void set_visited(bool visited);
507 bool visited();
508 void set_layer_or_descendant_is_drawn(bool layer_or_descendant_is_drawn);
509 bool layer_or_descendant_is_drawn();
510 void set_sorted_for_recursion(bool sorted_for_recursion);
511 bool sorted_for_recursion();
513 protected:
514 friend class LayerImpl;
515 friend class TreeSynchronizer;
516 ~Layer() override;
518 explicit Layer(const LayerSettings& settings);
520 // These SetNeeds functions are in order of severity of update:
522 // Called when this layer has been modified in some way, but isn't sure
523 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers
524 // before it knows whether or not a commit is required.
525 void SetNeedsUpdate();
526 // Called when a property has been modified in a way that the layer
527 // knows immediately that a commit is required. This implies SetNeedsUpdate
528 // as well as SetNeedsPushProperties to push that property.
529 void SetNeedsCommit();
530 // This is identical to SetNeedsCommit, but the former requests a rebuild of
531 // the property trees.
532 void SetNeedsCommitNoRebuild();
533 // Called when there's been a change in layer structure. Implies both
534 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties.
535 void SetNeedsFullTreeSync();
537 // Called when the next commit should wait until the pending tree is activated
538 // before finishing the commit and unblocking the main thread. Used to ensure
539 // unused resources on the impl thread are returned before commit completes.
540 void SetNextCommitWaitsForActivation();
542 // Will recalculate whether the layer draws content and set draws_content_
543 // appropriately.
544 void UpdateDrawsContent(bool has_drawable_content);
545 virtual bool HasDrawableContent() const;
547 // Called when the layer's number of drawable descendants changes.
548 void AddDrawableDescendants(int num);
550 void AddDependentNeedsPushProperties();
551 void RemoveDependentNeedsPushProperties();
552 bool parent_should_know_need_push_properties() const {
553 return needs_push_properties() || descendant_needs_push_properties();
556 bool IsPropertyChangeAllowed() const;
558 // This flag is set when the layer needs to push properties to the impl
559 // side.
560 bool needs_push_properties_;
562 // The number of direct children or dependent layers that need to be recursed
563 // to in order for them or a descendent of them to push properties to the impl
564 // side.
565 int num_dependents_need_push_properties_;
567 // Tracks whether this layer may have changed stacking order with its
568 // siblings.
569 bool stacking_order_changed_;
571 // The update rect is the region of the compositor resource that was
572 // actually updated by the compositor. For layers that may do updating
573 // outside the compositor's control (i.e. plugin layers), this information
574 // is not available and the update rect will remain empty.
575 // Note this rect is in layer space (not content space).
576 gfx::Rect update_rect_;
578 scoped_refptr<Layer> mask_layer_;
580 int layer_id_;
582 // When true, the layer is about to perform an update. Any commit requests
583 // will be handled implicitly after the update completes.
584 bool ignore_set_needs_commit_;
586 // Layers that share a sorting context id will be sorted together in 3d
587 // space. 0 is a special value that means this layer will not be sorted and
588 // will be drawn in paint order.
589 int sorting_context_id_;
591 private:
592 friend class base::RefCounted<Layer>;
593 friend class LayerTreeHostCommon;
594 void SetParent(Layer* layer);
595 bool DescendantIsFixedToContainerLayer() const;
597 // This should only be called during BeginMainFrame since it does not
598 // trigger a Commit.
599 void SetHasRenderSurface(bool has_render_surface);
601 // This should only be called from RemoveFromParent().
602 void RemoveChildOrDependent(Layer* child);
604 // LayerAnimationValueProvider implementation.
605 gfx::ScrollOffset ScrollOffsetForAnimation() const override;
607 // LayerAnimationValueObserver implementation.
608 void OnFilterAnimated(const FilterOperations& filters) override;
609 void OnOpacityAnimated(float opacity) override;
610 void OnTransformAnimated(const gfx::Transform& transform) override;
611 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override;
612 void OnAnimationWaitingForDeletion() override;
613 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating) override;
614 bool IsActive() const override;
616 // If this layer has a scroll parent, it removes |this| from its list of
617 // scroll children.
618 void RemoveFromScrollTree();
620 // If this layer has a clip parent, it removes |this| from its list of clip
621 // children.
622 void RemoveFromClipTree();
624 // When we detach or attach layer to new LayerTreeHost, all property trees'
625 // indices becomes invalid.
626 void InvalidatePropertyTreesIndices();
628 void UpdateNumCopyRequestsForSubtree(bool add);
630 LayerList children_;
631 Layer* parent_;
633 // Layer instances have a weak pointer to their LayerTreeHost.
634 // This pointer value is nil when a Layer is not in a tree and is
635 // updated via SetLayerTreeHost() if a layer moves between trees.
636 LayerTreeHost* layer_tree_host_;
638 scoped_refptr<LayerAnimationController> layer_animation_controller_;
640 // Layer properties.
641 gfx::Size bounds_;
643 gfx::ScrollOffset scroll_offset_;
644 gfx::Vector2dF scroll_compensation_adjustment_;
645 // This variable indicates which ancestor layer (if any) whose size,
646 // transformed relative to this layer, defines the maximum scroll offset for
647 // this layer.
648 int scroll_clip_layer_id_;
649 int num_descendants_that_draw_content_;
650 int transform_tree_index_;
651 int effect_tree_index_;
652 int clip_tree_index_;
653 int property_tree_sequence_number_;
654 int num_layer_or_descendants_with_copy_request_;
655 gfx::Vector2dF offset_to_transform_parent_;
656 bool should_flatten_transform_from_property_tree_ : 1;
657 bool is_clipped_ : 1;
658 bool should_scroll_on_main_thread_ : 1;
659 bool have_wheel_event_handlers_ : 1;
660 bool have_scroll_event_handlers_ : 1;
661 bool user_scrollable_horizontal_ : 1;
662 bool user_scrollable_vertical_ : 1;
663 bool is_root_for_isolated_group_ : 1;
664 bool is_container_for_fixed_position_layers_ : 1;
665 bool is_drawable_ : 1;
666 bool draws_content_ : 1;
667 bool hide_layer_and_subtree_ : 1;
668 bool masks_to_bounds_ : 1;
669 bool contents_opaque_ : 1;
670 bool double_sided_ : 1;
671 bool should_flatten_transform_ : 1;
672 bool use_parent_backface_visibility_ : 1;
673 bool force_render_surface_ : 1;
674 bool transform_is_invertible_ : 1;
675 bool has_render_surface_ : 1;
676 ScrollBlocksOn scroll_blocks_on_ : 3;
677 Region non_fast_scrollable_region_;
678 Region touch_event_handler_region_;
679 gfx::PointF position_;
680 SkColor background_color_;
681 float opacity_;
682 SkXfermode::Mode blend_mode_;
683 // draw_blend_mode may be different than blend_mode_,
684 // when a RenderSurface re-parents the layer's blend_mode.
685 SkXfermode::Mode draw_blend_mode_;
686 FilterOperations filters_;
687 FilterOperations background_filters_;
688 LayerPositionConstraint position_constraint_;
689 Layer* scroll_parent_;
690 scoped_ptr<std::set<Layer*>> scroll_children_;
692 // The following three variables are tracker variables. They are bools
693 // wrapped inside an integer variable. If true, their value equals the
694 // LayerTreeHost's meta_information_sequence_number. This wrapping of bools
695 // inside ints is done to avoid a layer tree treewalk to reset their values.
696 int layer_or_descendant_is_drawn_tracker_;
697 int sorted_for_recursion_tracker_;
698 int visited_tracker_;
700 Layer* clip_parent_;
701 scoped_ptr<std::set<Layer*>> clip_children_;
703 gfx::Transform transform_;
704 gfx::Point3F transform_origin_;
706 // Replica layer used for reflections.
707 scoped_refptr<Layer> replica_layer_;
709 LayerClient* client_;
711 ScopedPtrVector<CopyOutputRequest> copy_requests_;
713 base::Closure did_scroll_callback_;
715 PaintProperties paint_properties_;
717 // These all act like draw properties, so don't need push properties.
718 gfx::Rect visible_layer_rect_;
719 gfx::Rect clip_rect_;
720 size_t num_unclipped_descendants_;
722 std::vector<FrameTimingRequest> frame_timing_requests_;
723 bool frame_timing_requests_dirty_;
725 DISALLOW_COPY_AND_ASSIGN(Layer);
728 } // namespace cc
730 #endif // CC_LAYERS_LAYER_H_