layer_impl.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. // Copyright 2011 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef CC_LAYERS_LAYER_IMPL_H_
  5. #define CC_LAYERS_LAYER_IMPL_H_
  6. #include <stddef.h>
  7. #include <stdint.h>
  8. #include <map>
  9. #include <memory>
  10. #include <set>
  11. #include <string>
  12. #include <vector>
  13. #include "base/check.h"
  14. #include "base/containers/flat_set.h"
  15. #include "base/memory/ptr_util.h"
  16. #include "base/memory/raw_ptr.h"
  17. #include "cc/base/region.h"
  18. #include "cc/base/synced_property.h"
  19. #include "cc/cc_export.h"
  20. #include "cc/debug/layer_tree_debug_state.h"
  21. #include "cc/input/input_handler.h"
  22. #include "cc/layers/draw_mode.h"
  23. #include "cc/layers/draw_properties.h"
  24. #include "cc/layers/layer_collections.h"
  25. #include "cc/layers/performance_properties.h"
  26. #include "cc/layers/render_surface_impl.h"
  27. #include "cc/layers/touch_action_region.h"
  28. #include "cc/paint/element_id.h"
  29. #include "cc/tiles/tile_priority.h"
  30. #include "cc/trees/target_property.h"
  31. #include "components/viz/common/quads/shared_quad_state.h"
  32. #include "components/viz/common/surfaces/region_capture_bounds.h"
  33. #include "third_party/skia/include/core/SkColor.h"
  34. #include "ui/gfx/display_color_spaces.h"
  35. #include "ui/gfx/geometry/point3_f.h"
  36. #include "ui/gfx/geometry/point_f.h"
  37. #include "ui/gfx/geometry/rect.h"
  38. #include "ui/gfx/geometry/rect_f.h"
  39. #include "ui/gfx/geometry/transform.h"
  40. #include "ui/gfx/geometry/vector2d_f.h"
  41. namespace viz {
  42. class ClientResourceProvider;
  43. class CompositorRenderPass;
  44. }
  45. namespace cc {
  46. class AppendQuadsData;
  47. struct LayerDebugInfo;
  48. class LayerTreeImpl;
  49. class MicroBenchmarkImpl;
  50. class PrioritizedTile;
  51. class SimpleEnclosedRegion;
  52. class Tile;
  53. enum ViewportLayerType {
  54. NOT_VIEWPORT_LAYER,
  55. INNER_VIEWPORT_CONTAINER,
  56. OUTER_VIEWPORT_CONTAINER,
  57. INNER_VIEWPORT_SCROLL,
  58. OUTER_VIEWPORT_SCROLL,
  59. LAST_VIEWPORT_LAYER_TYPE = OUTER_VIEWPORT_SCROLL,
  60. };
  61. class CC_EXPORT LayerImpl {
  62. public:
  63. static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
  64. return base::WrapUnique(new LayerImpl(tree_impl, id));
  65. }
  66. LayerImpl(const LayerImpl&) = delete;
  67. virtual ~LayerImpl();
  68. LayerImpl& operator=(const LayerImpl&) = delete;
  69. int id() const { return layer_id_; }
  70. // Whether this layer is on the active tree, return false if it's on the
  71. // pending tree.
  72. bool IsActive() const;
  73. void SetHasTransformNode(bool val) { has_transform_node_ = val; }
  74. bool has_transform_node() const { return has_transform_node_; }
  75. void set_property_tree_sequence_number(int sequence_number) {}
  76. void SetTransformTreeIndex(int index);
  77. int transform_tree_index() const { return transform_tree_index_; }
  78. void SetClipTreeIndex(int index);
  79. int clip_tree_index() const { return clip_tree_index_; }
  80. void SetEffectTreeIndex(int index);
  81. int effect_tree_index() const { return effect_tree_index_; }
  82. int render_target_effect_tree_index() const;
  83. void SetScrollTreeIndex(int index);
  84. int scroll_tree_index() const { return scroll_tree_index_; }
  85. void SetOffsetToTransformParent(const gfx::Vector2dF& offset) {
  86. offset_to_transform_parent_ = offset;
  87. }
  88. gfx::Vector2dF offset_to_transform_parent() const {
  89. return offset_to_transform_parent_;
  90. }
  91. bool is_clipped() const { return draw_properties_.is_clipped; }
  92. LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
  93. void PopulateSharedQuadState(viz::SharedQuadState* state,
  94. bool contents_opaque) const;
  95. // If using these two, you need to override GetEnclosingRectInTargetSpace() to
  96. // use GetScaledEnclosingRectInTargetSpace(). To do otherwise may result in
  97. // inconsistent values, and drawing/clipping problems.
  98. void PopulateScaledSharedQuadState(viz::SharedQuadState* state,
  99. float layer_to_content_scale,
  100. bool contents_opaque) const;
  101. void PopulateScaledSharedQuadStateWithContentRects(
  102. viz::SharedQuadState* state,
  103. float layer_to_content_scale,
  104. const gfx::Rect& content_rect,
  105. const gfx::Rect& content_visible_rect,
  106. bool contents_opaque) const;
  107. // WillDraw must be called before AppendQuads. If WillDraw returns false,
  108. // AppendQuads and DidDraw will not be called. If WillDraw returns true,
  109. // DidDraw is guaranteed to be called before another WillDraw or before
  110. // the layer is destroyed.
  111. virtual bool WillDraw(DrawMode draw_mode,
  112. viz::ClientResourceProvider* resource_provider);
  113. virtual void AppendQuads(viz::CompositorRenderPass* render_pass,
  114. AppendQuadsData* append_quads_data) {}
  115. virtual void DidDraw(viz::ClientResourceProvider* resource_provider);
  116. // Verify that the resource ids in the quad are valid.
  117. void ValidateQuadResources(viz::DrawQuad* quad) const {
  118. #if DCHECK_IS_ON()
  119. ValidateQuadResourcesInternal(quad);
  120. #endif
  121. }
  122. virtual void GetContentsResourceId(viz::ResourceId* resource_id,
  123. gfx::Size* resource_size,
  124. gfx::SizeF* resource_uv_size) const;
  125. virtual void NotifyTileStateChanged(const Tile* tile) {}
  126. virtual bool IsScrollbarLayer() const;
  127. bool IsScrollerOrScrollbar() const;
  128. // Returns true if this layer has content to draw.
  129. void SetDrawsContent(bool draws_content);
  130. bool draws_content() const { return draws_content_; }
  131. // Make the layer hit testable.
  132. void SetHitTestable(bool should_hit_test);
  133. bool HitTestable() const;
  134. void SetBackgroundColor(SkColor4f background_color);
  135. SkColor4f background_color() const { return background_color_; }
  136. void SetSafeOpaqueBackgroundColor(SkColor4f background_color);
  137. SkColor4f safe_opaque_background_color() const {
  138. // Layer::SafeOpaqueBackgroundColor() should ensure this.
  139. DCHECK_EQ(contents_opaque(), safe_opaque_background_color_.isOpaque());
  140. return safe_opaque_background_color_;
  141. }
  142. // See Layer::SetContentsOpaque() and SetContentsOpaqueForText() for the
  143. // relationship between the two flags.
  144. void SetContentsOpaque(bool opaque);
  145. bool contents_opaque() const { return contents_opaque_; }
  146. void SetContentsOpaqueForText(bool opaque);
  147. bool contents_opaque_for_text() const { return contents_opaque_for_text_; }
  148. float Opacity() const;
  149. // Stable identifier for clients. See comment in cc/trees/element_id.h.
  150. void SetElementId(ElementId element_id);
  151. ElementId element_id() const { return element_id_; }
  152. bool IsAffectedByPageScale() const;
  153. bool Is3dSorted() const { return GetSortingContextId() != 0; }
  154. void SetShouldCheckBackfaceVisibility(bool should_check_backface_visibility) {
  155. should_check_backface_visibility_ = should_check_backface_visibility;
  156. }
  157. bool should_check_backface_visibility() const {
  158. return should_check_backface_visibility_;
  159. }
  160. bool ShowDebugBorders(DebugBorderType type) const;
  161. // The render surface which this layer draws into. This can be either owned by
  162. // the same layer or an ancestor of this layer.
  163. RenderSurfaceImpl* render_target();
  164. const RenderSurfaceImpl* render_target() const;
  165. DrawProperties& draw_properties() { return draw_properties_; }
  166. const DrawProperties& draw_properties() const { return draw_properties_; }
  167. gfx::Transform DrawTransform() const;
  168. gfx::Transform ScreenSpaceTransform() const;
  169. PerformanceProperties<LayerImpl>& performance_properties() {
  170. return performance_properties_;
  171. }
  172. // Setter for draw_properties_.
  173. void set_visible_layer_rect(const gfx::Rect& visible_rect) {
  174. draw_properties_.visible_layer_rect = visible_rect;
  175. }
  176. void set_clip_rect(const gfx::Rect& clip_rect) {
  177. draw_properties_.clip_rect = clip_rect;
  178. }
  179. // The following are shortcut accessors to get various information from
  180. // draw_properties_
  181. float draw_opacity() const { return draw_properties_.opacity; }
  182. bool screen_space_transform_is_animating() const {
  183. return draw_properties_.screen_space_transform_is_animating;
  184. }
  185. gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
  186. gfx::Rect visible_drawable_content_rect() const {
  187. return draw_properties_.visible_drawable_content_rect;
  188. }
  189. gfx::Rect visible_layer_rect() const {
  190. return draw_properties_.visible_layer_rect;
  191. }
  192. // The client should be responsible for setting bounds, content bounds and
  193. // contents scale to appropriate values. LayerImpl doesn't calculate any of
  194. // them from the other values.
  195. void SetBounds(const gfx::Size& bounds);
  196. gfx::Size bounds() const;
  197. void set_is_inner_viewport_scroll_layer() {
  198. is_inner_viewport_scroll_layer_ = true;
  199. }
  200. void SetCurrentScrollOffset(const gfx::PointF& scroll_offset);
  201. // Returns the delta of the scroll that was outside of the bounds of the
  202. // initial scroll
  203. gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
  204. // Called during a commit or activation, after the property trees are pushed.
  205. // It detects changes of scrollable status and scroll container size in the
  206. // scroll property, and invalidate scrollbar geometries etc. for the changes.
  207. void UpdateScrollable();
  208. // Some properties on the LayerImpl are rarely set, and so are bundled
  209. // under a single unique_ptr.
  210. struct RareProperties {
  211. // The bounds of elements marked for potential region capture, stored in
  212. // the coordinate space of this layer.
  213. viz::RegionCaptureBounds capture_bounds;
  214. Region non_fast_scrollable_region;
  215. Region wheel_event_handler_region;
  216. };
  217. RareProperties& EnsureRareProperties() {
  218. if (!rare_properties_)
  219. rare_properties_ = std::make_unique<RareProperties>();
  220. return *rare_properties_;
  221. }
  222. void ResetRareProperties() { rare_properties_.reset(); }
  223. void SetNonFastScrollableRegion(const Region& region) {
  224. if (rare_properties_ || !region.IsEmpty())
  225. EnsureRareProperties().non_fast_scrollable_region = region;
  226. }
  227. const Region& non_fast_scrollable_region() const {
  228. return rare_properties_ ? rare_properties_->non_fast_scrollable_region
  229. : Region::Empty();
  230. }
  231. void SetTouchActionRegion(TouchActionRegion);
  232. const TouchActionRegion& touch_action_region() const {
  233. return touch_action_region_;
  234. }
  235. const Region& GetAllTouchActionRegions() const;
  236. bool has_touch_action_regions() const {
  237. return !touch_action_region_.IsEmpty();
  238. }
  239. void SetCaptureBounds(viz::RegionCaptureBounds bounds);
  240. const viz::RegionCaptureBounds* capture_bounds() const {
  241. return rare_properties_ ? &rare_properties_->capture_bounds : nullptr;
  242. }
  243. // Set or get the region that contains wheel event handler.
  244. // The |wheel_event_handler_region| specify the area where wheel event handler
  245. // could block impl scrolling.
  246. void SetWheelEventHandlerRegion(const Region& wheel_event_handler_region) {
  247. if (rare_properties_ || !wheel_event_handler_region.IsEmpty()) {
  248. EnsureRareProperties().wheel_event_handler_region =
  249. wheel_event_handler_region;
  250. }
  251. }
  252. const Region& wheel_event_handler_region() const {
  253. return rare_properties_ ? rare_properties_->wheel_event_handler_region
  254. : Region::Empty();
  255. }
  256. // The main thread may commit multiple times before the impl thread actually
  257. // draws, so we need to accumulate (i.e. union) any update changes that have
  258. // occurred on the main thread until we draw.
  259. // Note this rect is in layer space (not content space).
  260. void UnionUpdateRect(const gfx::Rect& update_rect);
  261. const gfx::Rect& update_rect() const { return update_rect_; }
  262. // Denotes an area that is damaged and needs redraw. This is in the layer's
  263. // space. By default returns empty rect, but can be overridden by subclasses
  264. // as appropriate.
  265. virtual gfx::Rect GetDamageRect() const;
  266. // This includes |layer_property_changed_not_from_property_trees_| and
  267. // property_trees changes.
  268. bool LayerPropertyChanged() const;
  269. bool LayerPropertyChangedFromPropertyTrees() const;
  270. // Only checks |layer_property_changed_not_from_property_trees_|. Used in
  271. // damage_tracker to determine if there is a contributing content damage not
  272. // from property_trees changes in animaiton.
  273. bool LayerPropertyChangedNotFromPropertyTrees() const;
  274. virtual void ResetChangeTracking();
  275. virtual SimpleEnclosedRegion VisibleOpaqueRegion() const;
  276. virtual void DidBecomeActive() {}
  277. virtual void DidBeginTracing();
  278. // Release resources held by this layer. Called when the output surface
  279. // that rendered this layer was lost.
  280. virtual void ReleaseResources();
  281. // Releases resources in response to memory pressure. The default
  282. // implementation just calls ReleaseResources() and subclasses will override
  283. // if that's not appropriate.
  284. virtual void OnPurgeMemory();
  285. // Release tile resources held by this layer. Called when a rendering mode
  286. // switch has occurred and tiles are no longer valid.
  287. virtual void ReleaseTileResources();
  288. // Recreate tile resources held by this layer after they were released by a
  289. // ReleaseTileResources call.
  290. virtual void RecreateTileResources();
  291. virtual std::unique_ptr<LayerImpl> CreateLayerImpl(
  292. LayerTreeImpl* tree_impl) const;
  293. virtual void PushPropertiesTo(LayerImpl* layer);
  294. // Internal to property tree construction (which only happens in tests on a
  295. // LayerImpl tree. See Layer::IsSnappedToPixelGridInTarget() for explanation,
  296. // as this mirrors that method.
  297. virtual bool IsSnappedToPixelGridInTarget();
  298. virtual void GetAllPrioritizedTilesForTracing(
  299. std::vector<PrioritizedTile>* prioritized_tiles) const;
  300. virtual void AsValueInto(base::trace_event::TracedValue* dict) const;
  301. std::string ToString() const;
  302. virtual size_t GPUMemoryUsageInBytes() const;
  303. // Mark a layer on pending tree that needs to push its properties to the
  304. // active tree. These properties should not be changed during pending tree
  305. // lifetime, and only changed by being pushed from the main thread. There are
  306. // two cases where this function needs to be called: when main thread layer
  307. // has properties that need to be pushed, or when a new LayerImpl is created
  308. // on pending tree when syncing layers from main thread.
  309. void SetNeedsPushProperties();
  310. virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark);
  311. void UpdateDebugInfo(LayerDebugInfo* debug_info);
  312. void set_contributes_to_drawn_render_surface(bool is_member) {
  313. contributes_to_drawn_render_surface_ = is_member;
  314. }
  315. bool contributes_to_drawn_render_surface() const {
  316. return contributes_to_drawn_render_surface_;
  317. }
  318. void set_may_contain_video(bool yes) { may_contain_video_ = yes; }
  319. bool may_contain_video() const { return may_contain_video_; }
  320. // Layers that share a sorting context id will be sorted together in 3d
  321. // space. 0 is a special value that means this layer will not be sorted and
  322. // will be drawn in paint order.
  323. int GetSortingContextId() const;
  324. // Get the correct invalidation region instead of conservative Rect
  325. // for layers that provide it.
  326. virtual Region GetInvalidationRegionForDebugging();
  327. // Returns the visible rect that is used by damage tracker. This damage rect
  328. // is computed as an eclosing rect of actual content size x transform to
  329. // target space, which can be different from visible_drawing_content_rect. For
  330. // example, the actual tile size of picture layer in the target surface can be
  331. // bigger when e.g. the layer's raster scale is different from the scale of
  332. // the layer's draw transform.
  333. // If you override this, and are making use of
  334. // PopulateScaledSharedQuadState(), make sure you call
  335. // GetScaledEnclosingVisibleRectInTargetSpace(). See comment for
  336. // PopulateScaledSharedQuadState().
  337. virtual gfx::Rect GetEnclosingVisibleRectInTargetSpace() const;
  338. // Returns the visible bounds of this layer in target space when scaled by
  339. // |scale|. This function scales in the same way as
  340. // PopulateScaledSharedQuadStateQuadState(). See
  341. // PopulateScaledSharedQuadStateQuadState() for more details.
  342. gfx::Rect GetScaledEnclosingVisibleRectInTargetSpace(float scale) const;
  343. // GetIdealContentsScale() returns the ideal 2D scale, clamped to not exceed
  344. // GetPreferredRasterScale().
  345. // GetIdealContentsScaleKey() returns the maximum component, a fallback to
  346. // uniform scale for callers that don't support 2d scales yet.
  347. // TODO(crbug.com/1196414): Remove GetIdealContentsScaleKey() in favor of
  348. // GetIdealContentsScale().
  349. gfx::Vector2dF GetIdealContentsScale() const;
  350. float GetIdealContentsScaleKey() const;
  351. void NoteLayerPropertyChanged();
  352. void NoteLayerPropertyChangedFromPropertyTrees();
  353. ElementListType GetElementTypeForAnimation() const;
  354. void set_needs_show_scrollbars(bool yes) { needs_show_scrollbars_ = yes; }
  355. bool needs_show_scrollbars() { return needs_show_scrollbars_; }
  356. void set_raster_even_if_not_drawn(bool yes) {
  357. raster_even_if_not_drawn_ = yes;
  358. }
  359. bool raster_even_if_not_drawn() const { return raster_even_if_not_drawn_; }
  360. void EnsureValidPropertyTreeIndices() const;
  361. // TODO(sunxd): Remove this function and replace it with visitor pattern.
  362. virtual bool is_surface_layer() const;
  363. int CalculateJitter();
  364. std::string DebugName() const;
  365. virtual gfx::ContentColorUsage GetContentColorUsage() const;
  366. virtual void NotifyKnownResourceIdsBeforeAppendQuads(
  367. const base::flat_set<viz::SharedElementResourceId>& known_resource_ids) {}
  368. protected:
  369. // When |will_always_push_properties| is true, the layer will not itself set
  370. // its SetNeedsPushProperties() state, as it expects to be always pushed to
  371. // the active tree regardless.
  372. LayerImpl(LayerTreeImpl* layer_impl,
  373. int id,
  374. bool will_always_push_properties = false);
  375. // Get the color and size of the layer's debug border.
  376. virtual void GetDebugBorderProperties(SkColor4f* color, float* width) const;
  377. void AppendDebugBorderQuad(viz::CompositorRenderPass* render_pass,
  378. const gfx::Rect& quad_rect,
  379. const viz::SharedQuadState* shared_quad_state,
  380. AppendQuadsData* append_quads_data) const;
  381. void AppendDebugBorderQuad(viz::CompositorRenderPass* render_pass,
  382. const gfx::Rect& quad_rect,
  383. const viz::SharedQuadState* shared_quad_state,
  384. AppendQuadsData* append_quads_data,
  385. SkColor4f color,
  386. float width) const;
  387. static float GetPreferredRasterScale(
  388. gfx::Vector2dF raster_space_scale_factor);
  389. private:
  390. void ValidateQuadResourcesInternal(viz::DrawQuad* quad) const;
  391. gfx::Transform GetScaledDrawTransform(float layer_to_content_scale) const;
  392. virtual const char* LayerTypeAsString() const;
  393. const int layer_id_;
  394. const raw_ptr<LayerTreeImpl> layer_tree_impl_;
  395. const bool will_always_push_properties_ : 1;
  396. // Properties synchronized from the associated Layer.
  397. gfx::Size bounds_;
  398. gfx::Vector2dF offset_to_transform_parent_;
  399. // These fields are copies of |container_bounds|, |bounds| and |scrollable|
  400. // fields in the associated ScrollNode, and are updated in UpdateScrollable().
  401. // The copy is for change detection only.
  402. // TODO(wangxianzhu): Actually we only need scroll_container_bounds_ in
  403. // pre-CompositeAfterPaint where the scroll node is associated with the
  404. // scrolling contents layer, and only need scroll_contents_bounds_ in
  405. // CompositeAfterPaint where the scroll node is associated with the scroll
  406. // container layer. Remove scroll_container_bounds_ when we launch CAP.
  407. gfx::Size scroll_container_bounds_;
  408. gfx::Size scroll_contents_bounds_;
  409. bool scrollable_ : 1;
  410. // Tracks if drawing-related properties have changed since last redraw.
  411. // TODO(wutao): We want to distinquish the sources of change so that we can
  412. // reuse the cache of render pass. For example, we can reuse the cache when
  413. // transform and opacity changing on a surface during animation. Currently
  414. // |layer_property_changed_from_property_trees_| does not mean the layer is
  415. // damaged from animation. We need better mechanism to explicitly capture
  416. // damage from animations. http://crbug.com/755828.
  417. bool layer_property_changed_not_from_property_trees_ : 1;
  418. bool layer_property_changed_from_property_trees_ : 1;
  419. bool may_contain_video_ : 1;
  420. bool contents_opaque_ : 1;
  421. bool contents_opaque_for_text_ : 1;
  422. bool should_check_backface_visibility_ : 1;
  423. bool draws_content_ : 1;
  424. bool contributes_to_drawn_render_surface_ : 1;
  425. // Tracks if this layer should participate in hit testing.
  426. bool hit_testable_ : 1;
  427. bool is_inner_viewport_scroll_layer_ : 1;
  428. TouchActionRegion touch_action_region_;
  429. SkColor4f background_color_;
  430. SkColor4f safe_opaque_background_color_;
  431. int transform_tree_index_;
  432. int effect_tree_index_;
  433. int clip_tree_index_;
  434. int scroll_tree_index_;
  435. std::unique_ptr<RareProperties> rare_properties_;
  436. protected:
  437. friend class TreeSynchronizer;
  438. DrawMode current_draw_mode_;
  439. EffectTree& GetEffectTree() const;
  440. PropertyTrees* GetPropertyTrees() const;
  441. ClipTree& GetClipTree() const;
  442. ScrollTree& GetScrollTree() const;
  443. TransformTree& GetTransformTree() const;
  444. private:
  445. ElementId element_id_;
  446. // Rect indicating what was repainted/updated during update.
  447. // Note that plugin layers bypass this and leave it empty.
  448. // This is in the layer's space.
  449. gfx::Rect update_rect_;
  450. // Group of properties that need to be computed based on the layer tree
  451. // hierarchy before layers can be drawn.
  452. DrawProperties draw_properties_;
  453. PerformanceProperties<LayerImpl> performance_properties_;
  454. std::unique_ptr<LayerDebugInfo> debug_info_;
  455. // Cache of all regions represented by any touch action from
  456. // |touch_action_region_|.
  457. mutable std::unique_ptr<Region> all_touch_action_regions_;
  458. bool needs_push_properties_ : 1;
  459. // The needs_show_scrollbars_ bit tracks a pending request to show the overlay
  460. // scrollbars. It's set by UpdateScrollable() on the scroll layer (not the
  461. // scrollbar layers) and consumed by LayerTreeImpl::PushPropertiesTo() and
  462. // LayerTreeImpl::HandleScrollbarShowRequests().
  463. bool needs_show_scrollbars_ : 1;
  464. // This is set for layers that have a property because of which they are not
  465. // drawn (singular transforms), but they can become visible soon (the property
  466. // is being animated). For this reason, while these layers are not drawn, they
  467. // are still rasterized.
  468. bool raster_even_if_not_drawn_ : 1;
  469. bool has_transform_node_ : 1;
  470. };
  471. } // namespace cc
  472. #endif // CC_LAYERS_LAYER_IMPL_H_