blob: 1ddb5e812d3f83bda1e1f573ccfaf072c8f3023b [file] [log] [blame]
[email protected]cd57cc5a2012-10-12 22:43:411// Copyright 2010 The Chromium Authors. All rights reserved.
[email protected]0fb25002012-10-12 07:20:022// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
[email protected]cd57cc5a2012-10-12 22:43:414
[email protected]cc3cfaa2013-03-18 09:05:525#ifndef CC_LAYERS_LAYER_H_
6#define CC_LAYERS_LAYER_H_
[email protected]cd57cc5a2012-10-12 22:43:417
avi02a4d172015-12-21 06:14:368#include <stddef.h>
9#include <stdint.h>
10
[email protected]0e98cdd2013-08-23 00:44:3011#include <set>
[email protected]c8686a02012-11-27 08:29:0012#include <string>
vmpstr3d1d72c2015-01-26 18:27:4013#include <vector>
[email protected]c8686a02012-11-27 08:29:0014
[email protected]18a70192013-04-26 16:18:2515#include "base/callback.h"
avi02a4d172015-12-21 06:14:3616#include "base/macros.h"
[email protected]a8461d82012-10-16 21:11:1417#include "base/memory/ref_counted.h"
[email protected]e10cd022012-12-18 00:32:2618#include "base/observer_list.h"
[email protected]95e4e1a02013-03-18 07:09:0919#include "cc/animation/layer_animation_controller.h"
[email protected]95e4e1a02013-03-18 07:09:0920#include "cc/animation/layer_animation_value_observer.h"
[email protected]b8384e22013-12-03 02:20:4821#include "cc/animation/layer_animation_value_provider.h"
[email protected]681ccff2013-03-18 06:13:5222#include "cc/base/cc_export.h"
23#include "cc/base/region.h"
vmpstr3d1d72c2015-01-26 18:27:4024#include "cc/debug/frame_timing_request.h"
[email protected]666d7cf2013-10-12 01:30:2925#include "cc/debug/micro_benchmark.h"
tdresser81e84c672016-01-18 23:21:2226#include "cc/input/input_handler.h"
[email protected]50761e92013-03-29 20:51:2827#include "cc/layers/layer_lists.h"
[email protected]fe956c9c42013-04-09 04:26:3328#include "cc/layers/layer_position_constraint.h"
[email protected]445881f2013-04-16 01:11:5929#include "cc/layers/paint_properties.h"
rbyers18779d822015-02-05 06:22:0630#include "cc/layers/scroll_blocks_on.h"
[email protected]ae6b1a72013-06-25 18:49:2931#include "cc/output/filter_operations.h"
vollick51ed1a22014-12-17 02:03:0032#include "cc/trees/property_tree.h"
[email protected]1940c4e2012-12-04 05:08:1533#include "skia/ext/refptr.h"
[email protected]ddf9df82012-10-16 06:52:4634#include "third_party/skia/include/core/SkColor.h"
[email protected]1940c4e2012-12-04 05:08:1535#include "third_party/skia/include/core/SkImageFilter.h"
[email protected]f7837a92013-08-21 03:00:0536#include "third_party/skia/include/core/SkPicture.h"
[email protected]7bbeaf4e2013-11-26 10:27:2237#include "third_party/skia/include/core/SkXfermode.h"
heejin.r.chungd28506ba2014-10-23 16:36:2038#include "ui/gfx/geometry/point3_f.h"
39#include "ui/gfx/geometry/rect.h"
40#include "ui/gfx/geometry/rect_f.h"
miletusf57925d2014-10-01 19:38:1341#include "ui/gfx/geometry/scroll_offset.h"
[email protected]c8686a02012-11-27 08:29:0042#include "ui/gfx/transform.h"
[email protected]cd57cc5a2012-10-12 22:43:4143
[email protected]db2586f2013-08-15 22:03:1444namespace gfx {
45class BoxF;
46}
47
[email protected]9f3be432013-12-03 03:53:2248namespace base {
primiano15960432015-02-05 14:20:2649namespace trace_event {
[email protected]9f3be432013-12-03 03:53:2250class ConvertableToTraceFormat;
51}
52}
53
[email protected]cd57cc5a2012-10-12 22:43:4154namespace cc {
55
[email protected]4d0786a2013-01-07 16:21:2056class Animation;
[email protected]3cae03e2013-06-26 22:13:5257class AnimationDelegate;
[email protected]96baf3e2012-10-22 23:09:5558struct AnimationEvent;
[email protected]0e5f7142013-05-24 06:45:3659class CopyOutputRequest;
[email protected]7f5605c2013-04-08 18:08:3560class LayerAnimationEventObserver;
[email protected]ae716ce2013-08-16 13:04:2461class LayerClient;
[email protected]96baf3e2012-10-22 23:09:5562class LayerImpl;
loysoa6edaaff2015-05-25 03:26:4463class LayerSettings;
[email protected]96baf3e2012-10-22 23:09:5564class LayerTreeHost;
awoloszyne83f28c2014-12-22 15:40:0065class LayerTreeHostCommon;
[email protected]8bef40572012-12-11 21:38:0866class LayerTreeImpl;
loyso57197782015-05-28 04:10:1867class LayerTreeSettings;
[email protected]d84116612013-03-29 05:32:4968class RenderingStatsInstrumentation;
[email protected]b4da2032012-10-25 21:22:5569class ResourceUpdateQueue;
[email protected]80413d72013-08-30 20:25:3370class ScrollbarLayerInterface;
[email protected]d5467eb72014-08-22 01:16:4371class SimpleEnclosedRegion;
[email protected]96baf3e2012-10-22 23:09:5572struct AnimationEvent;
[email protected]cd57cc5a2012-10-12 22:43:4173
nyquist353b7d52015-11-06 22:26:5374namespace proto {
75class LayerNode;
nyquistbc1290a2015-11-18 16:09:5676class LayerProperties;
77class LayerUpdate;
nyquist353b7d52015-11-06 22:26:5378} // namespace proto
79
[email protected]cd57cc5a2012-10-12 22:43:4180// Base class for composited layers. Special layer types are derived from
81// this class.
[email protected]de4afb5e2012-12-20 00:11:3482class CC_EXPORT Layer : public base::RefCounted<Layer>,
[email protected]b8384e22013-12-03 02:20:4883 public LayerAnimationValueObserver,
84 public LayerAnimationValueProvider {
[email protected]7aba6662013-03-12 10:17:3485 public:
[email protected]44d8e84c2013-10-19 19:13:2286 typedef LayerList LayerListType;
nyquist353b7d52015-11-06 22:26:5387 typedef base::hash_map<int, scoped_refptr<Layer>> LayerIdMap;
[email protected]44d8e84c2013-10-19 19:13:2288
[email protected]b7c4783f2013-03-15 23:11:4289 enum LayerIdLabels {
[email protected]b7c4783f2013-03-15 23:11:4290 INVALID_ID = -1,
91 };
[email protected]cd57cc5a2012-10-12 22:43:4192
loysoa6edaaff2015-05-25 03:26:4493 static scoped_refptr<Layer> Create(const LayerSettings& settings);
[email protected]cd57cc5a2012-10-12 22:43:4194
[email protected]7aba6662013-03-12 10:17:3495 int id() const { return layer_id_; }
[email protected]cd57cc5a2012-10-12 22:43:4196
[email protected]7aba6662013-03-12 10:17:3497 Layer* RootLayer();
98 Layer* parent() { return parent_; }
99 const Layer* parent() const { return parent_; }
100 void AddChild(scoped_refptr<Layer> child);
101 void InsertChild(scoped_refptr<Layer> child, size_t index);
102 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer);
103 void RemoveFromParent();
104 void RemoveAllChildren();
105 void SetChildren(const LayerList& children);
[email protected]f659521e2013-07-26 00:27:06106 bool HasAncestor(const Layer* ancestor) const;
[email protected]cd57cc5a2012-10-12 22:43:41107
[email protected]7aba6662013-03-12 10:17:34108 const LayerList& children() const { return children_; }
109 Layer* child_at(size_t index) { return children_[index].get(); }
[email protected]cd57cc5a2012-10-12 22:43:41110
[email protected]0e5f7142013-05-24 06:45:36111 // This requests the layer and its subtree be rendered and given to the
112 // callback. If the copy is unable to be produced (the layer is destroyed
miua6ce94ca2015-03-31 20:21:22113 // first), then the callback is called with a nullptr/empty result. If the
114 // request's source property is set, any prior uncommitted requests having the
115 // same source will be aborted.
[email protected]0e5f7142013-05-24 06:45:36116 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request);
117 bool HasCopyRequest() const {
118 return !copy_requests_.empty();
[email protected]18a70192013-04-26 16:18:25119 }
120
[email protected]7aba6662013-03-12 10:17:34121 virtual void SetBackgroundColor(SkColor background_color);
122 SkColor background_color() const { return background_color_; }
[email protected]2c4cbec2013-06-04 21:14:50123 // If contents_opaque(), return an opaque color else return a
124 // non-opaque color. Tries to return background_color(), if possible.
125 SkColor SafeOpaqueBackgroundColor() const;
[email protected]cd57cc5a2012-10-12 22:43:41126
[email protected]7aba6662013-03-12 10:17:34127 // A layer's bounds are in logical, non-page-scaled pixels (however, the
128 // root layer's bounds are in physical pixels).
[email protected]64348ea2014-01-29 22:58:26129 void SetBounds(const gfx::Size& bounds);
[email protected]7aba6662013-03-12 10:17:34130 gfx::Size bounds() const { return bounds_; }
[email protected]cd57cc5a2012-10-12 22:43:41131
[email protected]7aba6662013-03-12 10:17:34132 void SetMasksToBounds(bool masks_to_bounds);
133 bool masks_to_bounds() const { return masks_to_bounds_; }
[email protected]cd57cc5a2012-10-12 22:43:41134
[email protected]7aba6662013-03-12 10:17:34135 void SetMaskLayer(Layer* mask_layer);
136 Layer* mask_layer() { return mask_layer_.get(); }
137 const Layer* mask_layer() const { return mask_layer_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41138
danakj19f0c9e2014-10-11 03:24:42139 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect);
140 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); }
[email protected]cd57cc5a2012-10-12 22:43:41141
[email protected]7aba6662013-03-12 10:17:34142 void SetOpacity(float opacity);
143 float opacity() const { return opacity_; }
jaydasika86654512016-01-27 17:05:07144 float EffectiveOpacity() const;
[email protected]7aba6662013-03-12 10:17:34145 bool OpacityIsAnimating() const;
loysod71ece82015-07-03 13:48:50146 bool HasPotentiallyRunningOpacityAnimation() const;
[email protected]b7c4783f2013-03-15 23:11:42147 virtual bool OpacityCanAnimateOnImplThread() const;
[email protected]cd57cc5a2012-10-12 22:43:41148
[email protected]7bbeaf4e2013-11-26 10:27:22149 void SetBlendMode(SkXfermode::Mode blend_mode);
150 SkXfermode::Mode blend_mode() const { return blend_mode_; }
151
jaydasika92239dc2015-08-15 02:59:26152 void set_draw_blend_mode(SkXfermode::Mode blend_mode) {
153 if (draw_blend_mode_ == blend_mode)
154 return;
155 draw_blend_mode_ = blend_mode;
156 SetNeedsPushProperties();
157 }
158 SkXfermode::Mode draw_blend_mode() const { return draw_blend_mode_; }
159
[email protected]7bbeaf4e2013-11-26 10:27:22160 bool uses_default_blend_mode() const {
161 return blend_mode_ == SkXfermode::kSrcOver_Mode;
162 }
163
164 // A layer is root for an isolated group when it and all its descendants are
165 // drawn over a black and fully transparent background, creating an isolated
166 // group. It should be used along with SetBlendMode(), in order to restrict
167 // layers within the group to blend with layers outside this group.
168 void SetIsRootForIsolatedGroup(bool root);
169 bool is_root_for_isolated_group() const {
170 return is_root_for_isolated_group_;
171 }
172
[email protected]ae6b1a72013-06-25 18:49:29173 void SetFilters(const FilterOperations& filters);
174 const FilterOperations& filters() const { return filters_; }
[email protected]b4c6d812013-10-03 15:48:56175 bool FilterIsAnimating() const;
ajuma315a4782015-07-24 21:16:34176 bool HasPotentiallyRunningFilterAnimation() const;
[email protected]cd57cc5a2012-10-12 22:43:41177
[email protected]7aba6662013-03-12 10:17:34178 // Background filters are filters applied to what is behind this layer, when
179 // they are viewed through non-opaque regions in this layer. They are used
180 // through the WebLayer interface, and are not exposed to HTML.
[email protected]ae6b1a72013-06-25 18:49:29181 void SetBackgroundFilters(const FilterOperations& filters);
182 const FilterOperations& background_filters() const {
[email protected]7aba6662013-03-12 10:17:34183 return background_filters_;
184 }
[email protected]cd57cc5a2012-10-12 22:43:41185
[email protected]7aba6662013-03-12 10:17:34186 virtual void SetContentsOpaque(bool opaque);
187 bool contents_opaque() const { return contents_opaque_; }
[email protected]cd57cc5a2012-10-12 22:43:41188
[email protected]14bc5d682014-01-17 07:26:47189 void SetPosition(const gfx::PointF& position);
[email protected]7aba6662013-03-12 10:17:34190 gfx::PointF position() const { return position_; }
[email protected]cd57cc5a2012-10-12 22:43:41191
ajuma4216ee122015-05-29 13:07:17192 // A layer that is a container for fixed position layers cannot be both
193 // scrollable and have a non-identity transform.
[email protected]7aba6662013-03-12 10:17:34194 void SetIsContainerForFixedPositionLayers(bool container);
[email protected]fe956c9c42013-04-09 04:26:33195 bool IsContainerForFixedPositionLayers() const;
[email protected]cd57cc5a2012-10-12 22:43:41196
miletus624d342e2015-03-13 03:39:44197 gfx::Vector2dF FixedContainerSizeDelta() const {
198 return gfx::Vector2dF();
199 }
200
[email protected]fe956c9c42013-04-09 04:26:33201 void SetPositionConstraint(const LayerPositionConstraint& constraint);
202 const LayerPositionConstraint& position_constraint() const {
203 return position_constraint_;
204 }
[email protected]cd57cc5a2012-10-12 22:43:41205
[email protected]7aba6662013-03-12 10:17:34206 void SetTransform(const gfx::Transform& transform);
207 const gfx::Transform& transform() const { return transform_; }
208 bool TransformIsAnimating() const;
loysod71ece82015-07-03 13:48:50209 bool HasPotentiallyRunningTransformAnimation() const;
ajumab4a846f22015-08-24 19:13:44210 bool HasOnlyTranslationTransforms() const;
awoloszyne83f28c2014-12-22 15:40:00211 bool AnimationsPreserveAxisAlignment() const;
[email protected]08bdf1b2014-04-16 23:23:29212 bool transform_is_invertible() const { return transform_is_invertible_; }
[email protected]cd57cc5a2012-10-12 22:43:41213
ajumab4a846f22015-08-24 19:13:44214 bool MaximumTargetScale(float* max_scale) const;
215 bool AnimationStartScale(float* start_scale) const;
216
[email protected]a2566412014-06-05 03:14:20217 void SetTransformOrigin(const gfx::Point3F&);
vollick51ed1a22014-12-17 02:03:00218 gfx::Point3F transform_origin() const { return transform_origin_; }
[email protected]a2566412014-06-05 03:14:20219
ajumacaaa9b32015-08-04 15:55:29220 bool HasAnyAnimationTargetingProperty(
221 Animation::TargetProperty property) const;
222
loysod71ece82015-07-03 13:48:50223 bool ScrollOffsetAnimationWasInterrupted() const;
224
[email protected]0e98cdd2013-08-23 00:44:30225 void SetScrollParent(Layer* parent);
226
227 Layer* scroll_parent() { return scroll_parent_; }
228 const Layer* scroll_parent() const { return scroll_parent_; }
229
230 void AddScrollChild(Layer* child);
231 void RemoveScrollChild(Layer* child);
232
233 std::set<Layer*>* scroll_children() { return scroll_children_.get(); }
234 const std::set<Layer*>* scroll_children() const {
235 return scroll_children_.get();
236 }
237
238 void SetClipParent(Layer* ancestor);
239
240 Layer* clip_parent() { return clip_parent_; }
241 const Layer* clip_parent() const {
242 return clip_parent_;
243 }
244
245 void AddClipChild(Layer* child);
246 void RemoveClipChild(Layer* child);
247
248 std::set<Layer*>* clip_children() { return clip_children_.get(); }
249 const std::set<Layer*>* clip_children() const {
250 return clip_children_.get();
251 }
252
ennec95e6622015-08-28 23:23:19253 // TODO(enne): Fix style here (and everywhere) once LayerImpl does the same.
254 gfx::Transform draw_transform() const;
255 gfx::Transform screen_space_transform() const;
[email protected]d76806f82012-12-05 21:41:50256
ennec95e6622015-08-28 23:23:19257 void set_num_unclipped_descendants(size_t descendants) {
258 num_unclipped_descendants_ = descendants;
[email protected]7aba6662013-03-12 10:17:34259 }
vmpstr762e70d2015-06-10 02:12:57260 size_t num_unclipped_descendants() const {
ennec95e6622015-08-28 23:23:19261 return num_unclipped_descendants_;
[email protected]420fdf6e2013-08-26 20:36:38262 }
[email protected]cd57cc5a2012-10-12 22:43:41263
miletusf57925d2014-10-01 19:38:13264 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset);
miletusff93ab72015-01-30 04:30:44265 void SetScrollCompensationAdjustment(
266 const gfx::Vector2dF& scroll_compensation_adjustment);
267 gfx::Vector2dF ScrollCompensationAdjustment() const;
miletus2c78036b2015-01-29 20:52:37268
miletusf57925d2014-10-01 19:38:13269 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; }
270 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset);
[email protected]cd57cc5a2012-10-12 22:43:41271
[email protected]adeda572014-01-31 00:49:47272 void SetScrollClipLayerId(int clip_layer_id);
273 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; }
[email protected]cd57cc5a2012-10-12 22:43:41274
[email protected]59a7d552013-10-22 03:36:43275 void SetUserScrollable(bool horizontal, bool vertical);
276 bool user_scrollable_horizontal() const {
277 return user_scrollable_horizontal_;
278 }
279 bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
280
danakj35904762016-01-21 20:49:40281 void AddMainThreadScrollingReasons(uint32_t main_thread_scrolling_reasons);
tdresser81e84c672016-01-18 23:21:22282 void ClearMainThreadScrollingReasons();
[email protected]7aba6662013-03-12 10:17:34283 bool should_scroll_on_main_thread() const {
tdresser81e84c672016-01-18 23:21:22284 return !!main_thread_scrolling_reasons_;
[email protected]7aba6662013-03-12 10:17:34285 }
[email protected]cd57cc5a2012-10-12 22:43:41286
[email protected]7aba6662013-03-12 10:17:34287 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers);
288 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
[email protected]cd57cc5a2012-10-12 22:43:41289
[email protected]f998c532014-03-31 20:02:51290 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers);
291 bool have_scroll_event_handlers() const {
292 return have_scroll_event_handlers_;
293 }
294
[email protected]7aba6662013-03-12 10:17:34295 void SetNonFastScrollableRegion(const Region& non_fast_scrollable_region);
296 const Region& non_fast_scrollable_region() const {
297 return non_fast_scrollable_region_;
298 }
[email protected]cd57cc5a2012-10-12 22:43:41299
[email protected]7aba6662013-03-12 10:17:34300 void SetTouchEventHandlerRegion(const Region& touch_event_handler_region);
301 const Region& touch_event_handler_region() const {
302 return touch_event_handler_region_;
303 }
[email protected]23d56be2012-11-08 00:33:34304
rbyers18779d822015-02-05 06:22:06305 void SetScrollBlocksOn(ScrollBlocksOn scroll_blocks_on);
306 ScrollBlocksOn scroll_blocks_on() const { return scroll_blocks_on_; }
307
[email protected]28096ed2013-07-01 07:38:58308 void set_did_scroll_callback(const base::Closure& callback) {
309 did_scroll_callback_ = callback;
[email protected]7aba6662013-03-12 10:17:34310 }
[email protected]cd57cc5a2012-10-12 22:43:41311
[email protected]7aba6662013-03-12 10:17:34312 void SetForceRenderSurface(bool force_render_surface);
313 bool force_render_surface() const { return force_render_surface_; }
[email protected]cd57cc5a2012-10-12 22:43:41314
miletusf57925d2014-10-01 19:38:13315 gfx::Vector2dF ScrollDelta() const { return gfx::Vector2dF(); }
aeliasd0070ba2015-01-31 13:44:49316 gfx::ScrollOffset CurrentScrollOffset() const { return scroll_offset_; }
[email protected]cd57cc5a2012-10-12 22:43:41317
[email protected]7aba6662013-03-12 10:17:34318 void SetDoubleSided(bool double_sided);
319 bool double_sided() const { return double_sided_; }
[email protected]cd57cc5a2012-10-12 22:43:41320
[email protected]56fffdd2014-02-11 19:50:57321 void SetShouldFlattenTransform(bool flatten);
322 bool should_flatten_transform() const { return should_flatten_transform_; }
323
[email protected]a9d4d4f2014-06-19 06:49:28324 bool Is3dSorted() const { return sorting_context_id_ != 0; }
[email protected]cd57cc5a2012-10-12 22:43:41325
[email protected]7aba6662013-03-12 10:17:34326 void set_use_parent_backface_visibility(bool use) {
327 use_parent_backface_visibility_ = use;
328 }
329 bool use_parent_backface_visibility() const {
330 return use_parent_backface_visibility_;
331 }
[email protected]cd57cc5a2012-10-12 22:43:41332
[email protected]7aba6662013-03-12 10:17:34333 virtual void SetLayerTreeHost(LayerTreeHost* host);
[email protected]cd57cc5a2012-10-12 22:43:41334
[email protected]ad63b2f2014-08-11 17:39:54335 virtual bool HasDelegatedContent() const;
[email protected]7aba6662013-03-12 10:17:34336 bool HasContributingDelegatedRenderPasses() const { return false; }
[email protected]cd57cc5a2012-10-12 22:43:41337
[email protected]7aba6662013-03-12 10:17:34338 void SetIsDrawable(bool is_drawable);
[email protected]cd57cc5a2012-10-12 22:43:41339
[email protected]c0ae06c12013-06-24 18:32:19340 void SetHideLayerAndSubtree(bool hide);
341 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
342
[email protected]7aba6662013-03-12 10:17:34343 void SetReplicaLayer(Layer* layer);
344 Layer* replica_layer() { return replica_layer_.get(); }
345 const Layer* replica_layer() const { return replica_layer_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41346
[email protected]22898ed2013-06-01 04:52:30347 bool has_mask() const { return !!mask_layer_.get(); }
348 bool has_replica() const { return !!replica_layer_.get(); }
[email protected]7aba6662013-03-12 10:17:34349 bool replica_has_mask() const {
[email protected]22898ed2013-06-01 04:52:30350 return replica_layer_.get() &&
351 (mask_layer_.get() || replica_layer_->mask_layer_.get());
[email protected]7aba6662013-03-12 10:17:34352 }
[email protected]cd57cc5a2012-10-12 22:43:41353
[email protected]ad63b2f2014-08-11 17:39:54354 int NumDescendantsThatDrawContent() const;
355
356 // This is only virtual for tests.
357 // TODO(awoloszyn): Remove this once we no longer need it for tests
[email protected]7aba6662013-03-12 10:17:34358 virtual bool DrawsContent() const;
[email protected]ad63b2f2014-08-11 17:39:54359
360 // This methods typically need to be overwritten by derived classes.
chrishtrbb9af002015-12-09 02:00:11361 // TODO(chrishtr): Blink no longer resizes anything during paint. We can
362 // remove this.
[email protected]445881f2013-04-16 01:11:59363 virtual void SavePaintProperties();
danakj5f46636a2015-06-19 00:01:40364 // Returns true iff anything was updated that needs to be committed.
365 virtual bool Update();
[email protected]7aba6662013-03-12 10:17:34366 virtual void SetIsMask(bool is_mask) {}
[email protected]a6c1b232014-05-05 23:53:08367 virtual bool IsSuitableForGpuRasterization() const;
[email protected]cd57cc5a2012-10-12 22:43:41368
ssid911e40e2015-02-09 17:55:20369 virtual scoped_refptr<base::trace_event::ConvertableToTraceFormat>
370 TakeDebugInfo();
[email protected]ae716ce2013-08-16 13:04:24371
372 void SetLayerClient(LayerClient* client) { client_ = client; }
373
[email protected]7aba6662013-03-12 10:17:34374 virtual void PushPropertiesTo(LayerImpl* layer);
375
nyquist353b7d52015-11-06 22:26:53376 // Sets the type proto::LayerType that should be used for serialization
377 // of the current layer by calling LayerNode::set_type(proto::LayerType).
378 // TODO(nyquist): Start using a forward declared enum class when
379 // https://github.com/google/protobuf/issues/67 has been fixed and rolled in.
380 // This function would preferably instead return a proto::LayerType, but
381 // since that is an enum (the protobuf library does not generate enum
382 // classes), it can't be forward declared. We don't want to include
383 // //cc/proto/layer.pb.h in this header file, as it requires that all
384 // dependent targets would have to be given the config for how to include it.
385 virtual void SetTypeForProtoSerialization(proto::LayerNode* proto) const;
386
387 // Recursively iterate over this layer and all children and write the
388 // hierarchical structure to the given LayerNode proto. In addition to the
389 // structure itself, the Layer id and type is also written to facilitate
390 // construction of the correct layer on the client.
391 void ToLayerNodeProto(proto::LayerNode* proto) const;
392
393 // Recursively iterate over the given LayerNode proto and read the structure
394 // into this node and its children. The |layer_map| should be used to look
395 // for previously existing Layers, since they should be re-used between each
396 // hierarchy update.
397 void FromLayerNodeProto(const proto::LayerNode& proto,
398 const LayerIdMap& layer_map);
399
nyquistbc1290a2015-11-18 16:09:56400 // This method is similar to PushPropertiesTo, but instead of pushing to
401 // a LayerImpl, it pushes the properties to proto::LayerProperties. It adds
402 // this layer to the proto::LayerUpdate if it or any of its descendants
403 // have changed properties. If this layer contains changed properties, the
404 // properties themselves will also be pushed the proto::LayerProperties.
405 // Similarly to PushPropertiesTo, this method also resets
406 // |needs_push_properties_| and |num_dependents_need_push_properties_|.
407 // Returns whether any of the descendants have changed properties.
408 bool ToLayerPropertiesProto(proto::LayerUpdate* layer_update);
409
410 // Read all property values from the given LayerProperties object and update
411 // the current layer. The values for |needs_push_properties_| and
412 // |num_dependents_need_push_properties_| are always updated, but the rest
413 // of |proto| is only read if |needs_push_properties_| is set.
414 void FromLayerPropertiesProto(const proto::LayerProperties& proto);
415
[email protected]3698e792013-08-24 00:21:16416 LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
417 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
[email protected]cd57cc5a2012-10-12 22:43:41418
[email protected]7aba6662013-03-12 10:17:34419 bool AddAnimation(scoped_ptr<Animation> animation);
420 void PauseAnimation(int animation_id, double time_offset);
421 void RemoveAnimation(int animation_id);
noelae22bfd2015-12-23 11:37:55422 void AbortAnimation(int animation_id);
loysod71ece82015-07-03 13:48:50423 LayerAnimationController* layer_animation_controller() const {
[email protected]7aba6662013-03-12 10:17:34424 return layer_animation_controller_.get();
425 }
[email protected]7f5605c2013-04-08 18:08:35426 void SetLayerAnimationControllerForTest(
[email protected]7aba6662013-03-12 10:17:34427 scoped_refptr<LayerAnimationController> controller);
[email protected]cd57cc5a2012-10-12 22:43:41428
[email protected]3cae03e2013-06-26 22:13:52429 void set_layer_animation_delegate(AnimationDelegate* delegate) {
loyso57197782015-05-28 04:10:18430 DCHECK(layer_animation_controller_);
[email protected]7f5605c2013-04-08 18:08:35431 layer_animation_controller_->set_layer_animation_delegate(delegate);
[email protected]7aba6662013-03-12 10:17:34432 }
[email protected]cd57cc5a2012-10-12 22:43:41433
[email protected]7aba6662013-03-12 10:17:34434 bool HasActiveAnimation() const;
loyso57197782015-05-28 04:10:18435 void RegisterForAnimations(AnimationRegistrar* registrar);
[email protected]cd57cc5a2012-10-12 22:43:41436
[email protected]7aba6662013-03-12 10:17:34437 void AddLayerAnimationEventObserver(
438 LayerAnimationEventObserver* animation_observer);
439 void RemoveLayerAnimationEventObserver(
440 LayerAnimationEventObserver* animation_observer);
[email protected]cd57cc5a2012-10-12 22:43:41441
[email protected]80413d72013-08-30 20:25:33442 virtual ScrollbarLayerInterface* ToScrollbarLayer();
[email protected]cd57cc5a2012-10-12 22:43:41443
[email protected]f7837a92013-08-21 03:00:05444 virtual skia::RefPtr<SkPicture> GetPicture() const;
445
[email protected]7aba6662013-03-12 10:17:34446 // Constructs a LayerImpl of the correct runtime type for this Layer type.
447 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
[email protected]aedf4e52013-01-09 23:24:44448
[email protected]44604642013-08-01 01:14:09449 bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); }
danakj19f0c9e2014-10-11 03:24:42450 void ResetNeedsDisplayForTesting() { update_rect_ = gfx::Rect(); }
[email protected]48871fc2013-01-23 07:36:51451
[email protected]d84116612013-03-29 05:32:49452 RenderingStatsInstrumentation* rendering_stats_instrumentation() const;
453
[email protected]445881f2013-04-16 01:11:59454 const PaintProperties& paint_properties() const {
455 return paint_properties_;
456 }
457
[email protected]7a5a9322014-02-25 12:54:57458 void SetNeedsPushProperties();
[email protected]f4e25f92013-07-13 20:54:53459 bool needs_push_properties() const { return needs_push_properties_; }
460 bool descendant_needs_push_properties() const {
461 return num_dependents_need_push_properties_ > 0;
462 }
[email protected]7a5a9322014-02-25 12:54:57463 void reset_needs_push_properties_for_testing() {
464 needs_push_properties_ = false;
465 }
[email protected]f4e25f92013-07-13 20:54:53466
[email protected]666d7cf2013-10-12 01:30:29467 virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
468
[email protected]a9d4d4f2014-06-19 06:49:28469 void Set3dSortingContextId(int id);
470 int sorting_context_id() const { return sorting_context_id_; }
471
vollick692444f2015-05-20 15:39:14472 void set_property_tree_sequence_number(int sequence_number) {
473 property_tree_sequence_number_ = sequence_number;
ennee95b1542015-04-20 20:35:50474 }
nyquistb36e0d5d2016-01-27 00:17:35475 int property_tree_sequence_number() { return property_tree_sequence_number_; }
vollick692444f2015-05-20 15:39:14476
477 void SetTransformTreeIndex(int index);
478 int transform_tree_index() const;
479
480 void SetClipTreeIndex(int index);
481 int clip_tree_index() const;
482
weiliangc6a52f302015-08-18 16:29:35483 void SetEffectTreeIndex(int index);
484 int effect_tree_index() const;
vollick51ed1a22014-12-17 02:03:00485
486 void set_offset_to_transform_parent(gfx::Vector2dF offset) {
ennee95b1542015-04-20 20:35:50487 if (offset_to_transform_parent_ == offset)
488 return;
vollick51ed1a22014-12-17 02:03:00489 offset_to_transform_parent_ = offset;
ennee95b1542015-04-20 20:35:50490 SetNeedsPushProperties();
vollick51ed1a22014-12-17 02:03:00491 }
492 gfx::Vector2dF offset_to_transform_parent() const {
493 return offset_to_transform_parent_;
494 }
495
ennec95e6622015-08-28 23:23:19496 // TODO(enne): Once LayerImpl only uses property trees, remove these
497 // functions.
vollick51ed1a22014-12-17 02:03:00498 const gfx::Rect& visible_rect_from_property_trees() const {
ennec95e6622015-08-28 23:23:19499 return visible_layer_rect();
vollick51ed1a22014-12-17 02:03:00500 }
501 void set_visible_rect_from_property_trees(const gfx::Rect& rect) {
ennec95e6622015-08-28 23:23:19502 set_visible_layer_rect(rect);
vollick51ed1a22014-12-17 02:03:00503 }
jaydasika5c41bb92015-08-10 21:47:55504 const gfx::Rect& clip_rect_in_target_space_from_property_trees() const {
ennec95e6622015-08-28 23:23:19505 return clip_rect();
jaydasika5c41bb92015-08-10 21:47:55506 }
507 void set_clip_rect_in_target_space_from_property_trees(
508 const gfx::Rect& rect) {
ennec95e6622015-08-28 23:23:19509 set_clip_rect(rect);
jaydasika5c41bb92015-08-10 21:47:55510 }
ennec95e6622015-08-28 23:23:19511 // TODO(enne): This needs a different name. It is a calculated value
512 // from the property tree builder and not a synonym for "should
513 // flatten transform".
ajumad0d64422015-03-14 04:20:08514 void set_should_flatten_transform_from_property_tree(bool should_flatten) {
ennee95b1542015-04-20 20:35:50515 if (should_flatten_transform_from_property_tree_ == should_flatten)
516 return;
ajumad0d64422015-03-14 04:20:08517 should_flatten_transform_from_property_tree_ = should_flatten;
ennee95b1542015-04-20 20:35:50518 SetNeedsPushProperties();
519 }
520 bool should_flatten_transform_from_property_tree() const {
521 return should_flatten_transform_from_property_tree_;
ajumad0d64422015-03-14 04:20:08522 }
523
ennec95e6622015-08-28 23:23:19524 const gfx::Rect& visible_layer_rect() const { return visible_layer_rect_; }
525 void set_visible_layer_rect(const gfx::Rect& rect) {
526 visible_layer_rect_ = rect;
527 }
528
529 const gfx::Rect& clip_rect() const { return clip_rect_; }
530 void set_clip_rect(const gfx::Rect& rect) { clip_rect_ = rect; }
531
weiliangcc154ce22015-12-09 03:39:26532 // This should only be called during BeginMainFrame since it does not trigger
533 // a Commit. This is called right after property tree being built and should
534 // not trigger property tree rebuild.
535 void SetHasRenderSurface(bool has_render_surface);
vollick51ed1a22014-12-17 02:03:00536 bool has_render_surface() const {
537 return has_render_surface_;
538 }
vollick51ed1a22014-12-17 02:03:00539
vmpstr3d1d72c2015-01-26 18:27:40540 // Sets new frame timing requests for this layer.
541 void SetFrameTimingRequests(const std::vector<FrameTimingRequest>& requests);
542
mpb39c5a2ef2015-04-22 23:46:15543 // Accessor for unit tests
544 const std::vector<FrameTimingRequest>& FrameTimingRequests() const {
545 return frame_timing_requests_;
546 }
547
caseq4a4b5582015-03-17 18:39:35548 void DidBeginTracing();
sunxded58688e2016-01-11 21:01:02549
550 int num_copy_requests_in_target_subtree();
jaydasika3d10aa62015-05-06 17:50:44551
vollick933f496e2015-12-08 04:22:05552 void SetElementId(uint64_t id);
553 uint64_t element_id() const { return element_id_; }
554
555 void SetMutableProperties(uint32_t properties);
556 uint32_t mutable_properties() const { return mutable_properties_; }
557
jaydasika976cd10b2015-05-26 15:45:24558 void set_visited(bool visited);
559 bool visited();
560 void set_layer_or_descendant_is_drawn(bool layer_or_descendant_is_drawn);
561 bool layer_or_descendant_is_drawn();
562 void set_sorted_for_recursion(bool sorted_for_recursion);
563 bool sorted_for_recursion();
jaydasika976cd10b2015-05-26 15:45:24564
skyostile5cd4742015-10-13 12:09:53565 // LayerAnimationValueProvider implementation.
566 gfx::ScrollOffset ScrollOffsetForAnimation() const override;
567
568 // LayerAnimationValueObserver implementation.
569 void OnFilterAnimated(const FilterOperations& filters) override;
570 void OnOpacityAnimated(float opacity) override;
571 void OnTransformAnimated(const gfx::Transform& transform) override;
572 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override;
573 void OnAnimationWaitingForDeletion() override;
574 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating) override;
575 bool IsActive() const override;
576
[email protected]7aba6662013-03-12 10:17:34577 protected:
578 friend class LayerImpl;
579 friend class TreeSynchronizer;
dcheng716bedf2014-10-21 09:51:08580 ~Layer() override;
[email protected]090e1a72013-01-29 07:07:45581
loysoa6edaaff2015-05-25 03:26:44582 explicit Layer(const LayerSettings& settings);
[email protected]cd57cc5a2012-10-12 22:43:41583
[email protected]3519b872013-07-30 07:17:50584 // These SetNeeds functions are in order of severity of update:
585 //
586 // Called when this layer has been modified in some way, but isn't sure
587 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers
588 // before it knows whether or not a commit is required.
589 void SetNeedsUpdate();
590 // Called when a property has been modified in a way that the layer
591 // knows immediately that a commit is required. This implies SetNeedsUpdate
592 // as well as SetNeedsPushProperties to push that property.
[email protected]7aba6662013-03-12 10:17:34593 void SetNeedsCommit();
vollick5057e1e2015-04-17 19:12:32594 // This is identical to SetNeedsCommit, but the former requests a rebuild of
595 // the property trees.
596 void SetNeedsCommitNoRebuild();
[email protected]3519b872013-07-30 07:17:50597 // Called when there's been a change in layer structure. Implies both
598 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties.
[email protected]7aba6662013-03-12 10:17:34599 void SetNeedsFullTreeSync();
[email protected]74b43cc2013-08-30 06:29:27600
601 // Called when the next commit should wait until the pending tree is activated
602 // before finishing the commit and unblocking the main thread. Used to ensure
603 // unused resources on the impl thread are returned before commit completes.
604 void SetNextCommitWaitsForActivation();
[email protected]cd57cc5a2012-10-12 22:43:41605
[email protected]ad63b2f2014-08-11 17:39:54606 // Will recalculate whether the layer draws content and set draws_content_
607 // appropriately.
608 void UpdateDrawsContent(bool has_drawable_content);
609 virtual bool HasDrawableContent() const;
610
611 // Called when the layer's number of drawable descendants changes.
612 void AddDrawableDescendants(int num);
613
[email protected]f4e25f92013-07-13 20:54:53614 void AddDependentNeedsPushProperties();
615 void RemoveDependentNeedsPushProperties();
616 bool parent_should_know_need_push_properties() const {
617 return needs_push_properties() || descendant_needs_push_properties();
618 }
619
[email protected]74b43cc2013-08-30 06:29:27620 bool IsPropertyChangeAllowed() const;
621
nyquistbc1290a2015-11-18 16:09:56622 // Serialize all the necessary properties to be able to reconstruct this Layer
623 // into proto::LayerProperties. This function must not set values for
624 // |needs_push_properties_| or |num_dependents_need_push_properties_| as they
625 // are dealt with at a higher level. This is only called if
626 // |needs_push_properties_| is set. For descendants of Layer, implementations
nyquistb0a49d02015-12-17 03:42:58627 // must first call their parent class. This method is not marked as const
628 // as some implementations need reset member fields, similarly to
629 // PushPropertiesTo().
nyquistbc1290a2015-11-18 16:09:56630 virtual void LayerSpecificPropertiesToProto(proto::LayerProperties* proto);
631
632 // Deserialize all the necessary properties from proto::LayerProperties into
633 // this Layer. This function must not set values for |needs_push_properties_|
634 // or |num_dependents_need_push_properties_| as they are dealt with at a
635 // higher level. This is only called if |needs_push_properties_| is set. For
636 // descendants of Layer, implementations must first call their parent class.
637 virtual void FromLayerSpecificPropertiesProto(
638 const proto::LayerProperties& proto);
639
[email protected]f4e25f92013-07-13 20:54:53640 // This flag is set when the layer needs to push properties to the impl
641 // side.
642 bool needs_push_properties_;
643
644 // The number of direct children or dependent layers that need to be recursed
645 // to in order for them or a descendent of them to push properties to the impl
646 // side.
647 int num_dependents_need_push_properties_;
648
[email protected]7aba6662013-03-12 10:17:34649 // Tracks whether this layer may have changed stacking order with its
650 // siblings.
651 bool stacking_order_changed_;
[email protected]cd57cc5a2012-10-12 22:43:41652
[email protected]7aba6662013-03-12 10:17:34653 // The update rect is the region of the compositor resource that was
654 // actually updated by the compositor. For layers that may do updating
655 // outside the compositor's control (i.e. plugin layers), this information
656 // is not available and the update rect will remain empty.
657 // Note this rect is in layer space (not content space).
danakj19f0c9e2014-10-11 03:24:42658 gfx::Rect update_rect_;
[email protected]cd57cc5a2012-10-12 22:43:41659
[email protected]7aba6662013-03-12 10:17:34660 scoped_refptr<Layer> mask_layer_;
[email protected]cd57cc5a2012-10-12 22:43:41661
[email protected]7aba6662013-03-12 10:17:34662 int layer_id_;
[email protected]cd57cc5a2012-10-12 22:43:41663
[email protected]7aba6662013-03-12 10:17:34664 // When true, the layer is about to perform an update. Any commit requests
[email protected]3519b872013-07-30 07:17:50665 // will be handled implicitly after the update completes.
[email protected]7aba6662013-03-12 10:17:34666 bool ignore_set_needs_commit_;
[email protected]cd57cc5a2012-10-12 22:43:41667
[email protected]a9d4d4f2014-06-19 06:49:28668 // Layers that share a sorting context id will be sorted together in 3d
669 // space. 0 is a special value that means this layer will not be sorted and
670 // will be drawn in paint order.
671 int sorting_context_id_;
672
[email protected]7aba6662013-03-12 10:17:34673 private:
674 friend class base::RefCounted<Layer>;
nyquistb0a49d02015-12-17 03:42:58675 friend class LayerSerializationTest;
awoloszyne83f28c2014-12-22 15:40:00676 friend class LayerTreeHostCommon;
nyquistb0a49d02015-12-17 03:42:58677
[email protected]7aba6662013-03-12 10:17:34678 void SetParent(Layer* layer);
[email protected]7aba6662013-03-12 10:17:34679 bool DescendantIsFixedToContainerLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41680
[email protected]7aba6662013-03-12 10:17:34681 // This should only be called from RemoveFromParent().
682 void RemoveChildOrDependent(Layer* child);
[email protected]cd57cc5a2012-10-12 22:43:41683
vollick66133e82014-09-13 20:36:44684 // If this layer has a scroll parent, it removes |this| from its list of
685 // scroll children.
686 void RemoveFromScrollTree();
687
688 // If this layer has a clip parent, it removes |this| from its list of clip
689 // children.
690 void RemoveFromClipTree();
691
weiliangcc4d2e74d2015-06-09 01:21:35692 // When we detach or attach layer to new LayerTreeHost, all property trees'
693 // indices becomes invalid.
694 void InvalidatePropertyTreesIndices();
695
[email protected]7aba6662013-03-12 10:17:34696 LayerList children_;
697 Layer* parent_;
[email protected]de4afb5e2012-12-20 00:11:34698
[email protected]7aba6662013-03-12 10:17:34699 // Layer instances have a weak pointer to their LayerTreeHost.
700 // This pointer value is nil when a Layer is not in a tree and is
701 // updated via SetLayerTreeHost() if a layer moves between trees.
702 LayerTreeHost* layer_tree_host_;
[email protected]cd57cc5a2012-10-12 22:43:41703
[email protected]7aba6662013-03-12 10:17:34704 scoped_refptr<LayerAnimationController> layer_animation_controller_;
[email protected]de4afb5e2012-12-20 00:11:34705
[email protected]7aba6662013-03-12 10:17:34706 // Layer properties.
707 gfx::Size bounds_;
[email protected]cd57cc5a2012-10-12 22:43:41708
miletusf57925d2014-10-01 19:38:13709 gfx::ScrollOffset scroll_offset_;
miletusff93ab72015-01-30 04:30:44710 gfx::Vector2dF scroll_compensation_adjustment_;
[email protected]adeda572014-01-31 00:49:47711 // This variable indicates which ancestor layer (if any) whose size,
712 // transformed relative to this layer, defines the maximum scroll offset for
713 // this layer.
714 int scroll_clip_layer_id_;
[email protected]ad63b2f2014-08-11 17:39:54715 int num_descendants_that_draw_content_;
vollick51ed1a22014-12-17 02:03:00716 int transform_tree_index_;
weiliangc6a52f302015-08-18 16:29:35717 int effect_tree_index_;
vollick51ed1a22014-12-17 02:03:00718 int clip_tree_index_;
vollick692444f2015-05-20 15:39:14719 int property_tree_sequence_number_;
vollick933f496e2015-12-08 04:22:05720 uint64_t element_id_;
721 uint32_t mutable_properties_;
vollick51ed1a22014-12-17 02:03:00722 gfx::Vector2dF offset_to_transform_parent_;
danakj35904762016-01-21 20:49:40723 uint32_t main_thread_scrolling_reasons_;
ajumad0d64422015-03-14 04:20:08724 bool should_flatten_transform_from_property_tree_ : 1;
[email protected]c55f3fc2013-12-10 05:48:48725 bool have_wheel_event_handlers_ : 1;
[email protected]f998c532014-03-31 20:02:51726 bool have_scroll_event_handlers_ : 1;
[email protected]c55f3fc2013-12-10 05:48:48727 bool user_scrollable_horizontal_ : 1;
728 bool user_scrollable_vertical_ : 1;
729 bool is_root_for_isolated_group_ : 1;
730 bool is_container_for_fixed_position_layers_ : 1;
731 bool is_drawable_ : 1;
[email protected]ad63b2f2014-08-11 17:39:54732 bool draws_content_ : 1;
[email protected]c55f3fc2013-12-10 05:48:48733 bool hide_layer_and_subtree_ : 1;
734 bool masks_to_bounds_ : 1;
735 bool contents_opaque_ : 1;
736 bool double_sided_ : 1;
[email protected]56fffdd2014-02-11 19:50:57737 bool should_flatten_transform_ : 1;
[email protected]c55f3fc2013-12-10 05:48:48738 bool use_parent_backface_visibility_ : 1;
[email protected]c55f3fc2013-12-10 05:48:48739 bool force_render_surface_ : 1;
[email protected]08bdf1b2014-04-16 23:23:29740 bool transform_is_invertible_ : 1;
vollick51ed1a22014-12-17 02:03:00741 bool has_render_surface_ : 1;
rbyers18779d822015-02-05 06:22:06742 ScrollBlocksOn scroll_blocks_on_ : 3;
[email protected]7aba6662013-03-12 10:17:34743 Region non_fast_scrollable_region_;
744 Region touch_event_handler_region_;
745 gfx::PointF position_;
[email protected]7aba6662013-03-12 10:17:34746 SkColor background_color_;
[email protected]7aba6662013-03-12 10:17:34747 float opacity_;
[email protected]7bbeaf4e2013-11-26 10:27:22748 SkXfermode::Mode blend_mode_;
jaydasika92239dc2015-08-15 02:59:26749 // draw_blend_mode may be different than blend_mode_,
750 // when a RenderSurface re-parents the layer's blend_mode.
751 SkXfermode::Mode draw_blend_mode_;
[email protected]ae6b1a72013-06-25 18:49:29752 FilterOperations filters_;
753 FilterOperations background_filters_;
[email protected]fe956c9c42013-04-09 04:26:33754 LayerPositionConstraint position_constraint_;
[email protected]0e98cdd2013-08-23 00:44:30755 Layer* scroll_parent_;
danakj6496cba2014-10-16 01:31:08756 scoped_ptr<std::set<Layer*>> scroll_children_;
[email protected]0e98cdd2013-08-23 00:44:30757
jaydasika976cd10b2015-05-26 15:45:24758 // The following three variables are tracker variables. They are bools
759 // wrapped inside an integer variable. If true, their value equals the
760 // LayerTreeHost's meta_information_sequence_number. This wrapping of bools
761 // inside ints is done to avoid a layer tree treewalk to reset their values.
762 int layer_or_descendant_is_drawn_tracker_;
763 int sorted_for_recursion_tracker_;
764 int visited_tracker_;
765
[email protected]0e98cdd2013-08-23 00:44:30766 Layer* clip_parent_;
danakj6496cba2014-10-16 01:31:08767 scoped_ptr<std::set<Layer*>> clip_children_;
[email protected]cd57cc5a2012-10-12 22:43:41768
[email protected]7aba6662013-03-12 10:17:34769 gfx::Transform transform_;
[email protected]a2566412014-06-05 03:14:20770 gfx::Point3F transform_origin_;
[email protected]cd57cc5a2012-10-12 22:43:41771
[email protected]7aba6662013-03-12 10:17:34772 // Replica layer used for reflections.
773 scoped_refptr<Layer> replica_layer_;
[email protected]cd57cc5a2012-10-12 22:43:41774
[email protected]ae716ce2013-08-16 13:04:24775 LayerClient* client_;
776
vmpstra370ef52015-11-18 10:41:28777 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_;
[email protected]18a70192013-04-26 16:18:25778
[email protected]28096ed2013-07-01 07:38:58779 base::Closure did_scroll_callback_;
[email protected]cd57cc5a2012-10-12 22:43:41780
[email protected]445881f2013-04-16 01:11:59781 PaintProperties paint_properties_;
782
ennec95e6622015-08-28 23:23:19783 // These all act like draw properties, so don't need push properties.
784 gfx::Rect visible_layer_rect_;
785 gfx::Rect clip_rect_;
786 size_t num_unclipped_descendants_;
vmpstr3d1d72c2015-01-26 18:27:40787
788 std::vector<FrameTimingRequest> frame_timing_requests_;
789 bool frame_timing_requests_dirty_;
vmpstr3d1d72c2015-01-26 18:27:40790
[email protected]7aba6662013-03-12 10:17:34791 DISALLOW_COPY_AND_ASSIGN(Layer);
[email protected]cd57cc5a2012-10-12 22:43:41792};
793
[email protected]ddf9df82012-10-16 06:52:46794} // namespace cc
795
[email protected]cc3cfaa2013-03-18 09:05:52796#endif // CC_LAYERS_LAYER_H_