In RenderLayerCompositor, track layer bounds and the haveComputedBounds flag together...
[WebKit-https.git] / Source / WebCore / rendering / RenderLayerCompositor.h
1 /*
2  * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #ifndef RenderLayerCompositor_h
27 #define RenderLayerCompositor_h
28
29 #include "ChromeClient.h"
30 #include "GraphicsLayerClient.h"
31 #include "GraphicsLayerUpdater.h"
32 #include "RenderLayer.h"
33 #include <wtf/HashMap.h>
34
35 namespace WebCore {
36
37 class FixedPositionViewportConstraints;
38 class GraphicsLayer;
39 class GraphicsLayerUpdater;
40 class RenderEmbeddedObject;
41 class RenderNamedFlowFragment;
42 class RenderVideo;
43 class RenderWidget;
44 class ScrollingCoordinator;
45 class StickyPositionViewportConstraints;
46 class TiledBacking;
47
48 typedef unsigned LayerTreeFlags;
49
50 enum CompositingUpdateType {
51     CompositingUpdateAfterStyleChange,
52     CompositingUpdateAfterLayout,
53     CompositingUpdateOnHitTest,
54     CompositingUpdateOnScroll,
55     CompositingUpdateOnCompositedScroll
56 };
57
58 enum {
59     CompositingReasonNone                                   = 0,
60     CompositingReason3DTransform                            = 1 << 0,
61     CompositingReasonVideo                                  = 1 << 1,
62     CompositingReasonCanvas                                 = 1 << 2,
63     CompositingReasonPlugin                                 = 1 << 3,
64     CompositingReasonIFrame                                 = 1 << 4,
65     CompositingReasonBackfaceVisibilityHidden               = 1 << 5,
66     CompositingReasonClipsCompositingDescendants            = 1 << 6,
67     CompositingReasonAnimation                              = 1 << 7,
68     CompositingReasonFilters                                = 1 << 8,
69     CompositingReasonPositionFixed                          = 1 << 9,
70     CompositingReasonPositionSticky                         = 1 << 10,
71     CompositingReasonOverflowScrollingTouch                 = 1 << 11,
72     CompositingReasonStacking                               = 1 << 12,
73     CompositingReasonOverlap                                = 1 << 13,
74     CompositingReasonNegativeZIndexChildren                 = 1 << 14,
75     CompositingReasonTransformWithCompositedDescendants     = 1 << 15,
76     CompositingReasonOpacityWithCompositedDescendants       = 1 << 16,
77     CompositingReasonMaskWithCompositedDescendants          = 1 << 17,
78     CompositingReasonReflectionWithCompositedDescendants    = 1 << 18,
79     CompositingReasonFilterWithCompositedDescendants        = 1 << 19,
80     CompositingReasonBlendingWithCompositedDescendants      = 1 << 20,
81     CompositingReasonPerspective                            = 1 << 21,
82     CompositingReasonPreserve3D                             = 1 << 22,
83     CompositingReasonRoot                                   = 1 << 23,
84     CompositingReasonIsolatesCompositedBlendingDescendants  = 1 << 24,
85 };
86 typedef unsigned CompositingReasons;
87
88 // RenderLayerCompositor manages the hierarchy of
89 // composited RenderLayers. It determines which RenderLayers
90 // become compositing, and creates and maintains a hierarchy of
91 // GraphicsLayers based on the RenderLayer painting order.
92 // 
93 // There is one RenderLayerCompositor per RenderView.
94
95 class RenderLayerCompositor final : public GraphicsLayerClient, public GraphicsLayerUpdaterClient {
96     WTF_MAKE_FAST_ALLOCATED;
97 public:
98     explicit RenderLayerCompositor(RenderView&);
99     virtual ~RenderLayerCompositor();
100
101     // Return true if this RenderView is in "compositing mode" (i.e. has one or more
102     // composited RenderLayers)
103     bool inCompositingMode() const { return m_compositing; }
104     // This will make a compositing layer at the root automatically, and hook up to
105     // the native view/window system.
106     void enableCompositingMode(bool enable = true);
107
108     bool inForcedCompositingMode() const { return m_forceCompositingMode; }
109
110     // Returns true if the accelerated compositing is enabled
111     bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; }
112
113     bool canRender3DTransforms() const;
114
115     // Copy the accelerated compositing related flags from Settings
116     void cacheAcceleratedCompositingFlags();
117
118     // Called when the layer hierarchy needs to be updated (compositing layers have been
119     // created, destroyed or re-parented).
120     void setCompositingLayersNeedRebuild(bool needRebuild = true);
121     bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRebuild; }
122
123     // GraphicsLayers buffer state, which gets pushed to the underlying platform layers
124     // at specific times.
125     void scheduleLayerFlush(bool canThrottle);
126     void flushPendingLayerChanges(bool isFlushRoot = true);
127     
128     // flushPendingLayerChanges() flushes the entire GraphicsLayer tree, which can cross frame boundaries.
129     // This call returns the rootmost compositor that is being flushed (including self).
130     RenderLayerCompositor* enclosingCompositorFlushingLayers() const;
131
132     // Called when the GraphicsLayer for the given RenderLayer has flushed changes inside of flushPendingLayerChanges().
133     void didFlushChangesForLayer(RenderLayer&, const GraphicsLayer*);
134
135     // Called when something outside WebKit affects the visible rect (e.g. delegated scrolling). Might schedule a layer flush.
136     void didChangeVisibleRect();
137     
138     // Rebuild the tree of compositing layers
139     void updateCompositingLayers(CompositingUpdateType, RenderLayer* updateRoot = nullptr);
140     // This is only used when state changes and we do not exepect a style update or layout to happen soon (e.g. when
141     // we discover that an iframe is overlapped during painting).
142     void scheduleCompositingLayerUpdate();
143     // This is used to cancel any pending update timers when the document goes into page cache.
144     void cancelCompositingLayerUpdate();
145
146     // Update the compositing state of the given layer. Returns true if that state changed.
147     enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChangeWillRepaintLater };
148     bool updateLayerCompositingState(RenderLayer&, CompositingChangeRepaint = CompositingChangeRepaintNow);
149
150     // Update the geometry for compositing children of compositingAncestor.
151     void updateCompositingDescendantGeometry(RenderLayer& compositingAncestor, RenderLayer&, bool compositedChildrenOnly);
152     
153     // Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
154     bool clippedByAncestor(RenderLayer&) const;
155     // Whether layer's backing needs a graphics layer to clip z-order children of the given layer.
156     bool clipsCompositingDescendants(const RenderLayer&) const;
157
158     // Whether the given layer needs an extra 'contents' layer.
159     bool needsContentsCompositingLayer(const RenderLayer&) const;
160
161     bool supportsFixedRootBackgroundCompositing() const;
162     bool needsFixedRootBackgroundLayer(const RenderLayer&) const;
163     GraphicsLayer* fixedRootBackgroundLayer() const;
164     
165     // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
166     void repaintOnCompositingChange(RenderLayer&);
167     
168     void repaintInCompositedAncestor(RenderLayer&, const LayoutRect&);
169     
170     // Notify us that a layer has been added or removed
171     void layerWasAdded(RenderLayer& parent, RenderLayer& child);
172     void layerWillBeRemoved(RenderLayer& parent, RenderLayer& child);
173
174     void layerStyleChanged(RenderLayer&, const RenderStyle* oldStyle);
175
176     static bool canCompositeClipPath(const RenderLayer&);
177
178     // Get the nearest ancestor layer that has overflow or clip, but is not a stacking context
179     RenderLayer* enclosingNonStackingClippingLayer(const RenderLayer&) const;
180
181     // Repaint all composited layers.
182     void repaintCompositedLayers();
183
184     // Returns true if the given layer needs it own backing store.
185     bool requiresOwnBackingStore(const RenderLayer&, const RenderLayer* compositingAncestorLayer, const LayoutRect& layerCompositedBoundsInAncestor, const LayoutRect& ancestorCompositedBounds) const;
186
187     WEBCORE_EXPORT RenderLayer& rootRenderLayer() const;
188     GraphicsLayer* rootGraphicsLayer() const;
189     WEBCORE_EXPORT GraphicsLayer* scrollLayer() const;
190     GraphicsLayer* clipLayer() const;
191     GraphicsLayer* rootContentLayer() const;
192
193 #if ENABLE(RUBBER_BANDING)
194     GraphicsLayer* headerLayer() const;
195     GraphicsLayer* footerLayer() const;
196 #endif
197
198     enum RootLayerAttachment {
199         RootLayerUnattached,
200         RootLayerAttachedViaChromeClient,
201         RootLayerAttachedViaEnclosingFrame
202     };
203
204     RootLayerAttachment rootLayerAttachment() const { return m_rootLayerAttachment; }
205     void updateRootLayerAttachment();
206     void updateRootLayerPosition();
207     
208     void setIsInWindow(bool);
209
210     void clearBackingForAllLayers();
211     
212     void layerBecameComposited(const RenderLayer&) { ++m_compositedLayerCount; }
213     void layerBecameNonComposited(const RenderLayer&);
214     
215 #if ENABLE(VIDEO)
216     // Use by RenderVideo to ask if it should try to use accelerated compositing.
217     bool canAccelerateVideoRendering(RenderVideo&) const;
218 #endif
219
220     // Walk the tree looking for layers with 3d transforms. Useful in case you need
221     // to know if there is non-affine content, e.g. for drawing into an image.
222     bool has3DContent() const;
223     
224     // Most platforms connect compositing layer trees between iframes and their parent document.
225     // Some (currently just Mac) allow iframes to do their own compositing.
226     static bool allowsIndependentlyCompositedFrames(const FrameView*);
227     bool shouldPropagateCompositingToEnclosingFrame() const;
228
229     static RenderLayerCompositor* frameContentsCompositor(RenderWidget*);
230     // Return true if the layers changed.
231     static bool parentFrameContentLayers(RenderWidget*);
232
233     // Update the geometry of the layers used for clipping and scrolling in frames.
234     void frameViewDidChangeLocation(const IntPoint& contentsOffset);
235     void frameViewDidChangeSize();
236     void frameViewDidScroll();
237     void frameViewDidAddOrRemoveScrollbars();
238     void frameViewDidLayout();
239     void rootFixedBackgroundsChanged();
240
241     void scrollingLayerDidChange(RenderLayer&);
242     void fixedRootBackgroundLayerChanged();
243
244     String layerTreeAsText(LayerTreeFlags);
245
246     virtual float deviceScaleFactor() const override;
247     virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const override;
248     virtual float pageScaleFactor() const override;
249     virtual float zoomedOutPageScaleFactor() const override;
250
251     virtual void didCommitChangesForLayer(const GraphicsLayer*) const override;
252     virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override;
253
254     void layerTiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/);
255     
256     bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
257
258     void deviceOrPageScaleFactorChanged();
259
260     void windowScreenDidChange(PlatformDisplayID);
261
262     GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
263     GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
264     GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
265 #if ENABLE(RUBBER_BANDING)
266     GraphicsLayer* layerForOverhangAreas() const { return m_layerForOverhangAreas.get(); }
267     GraphicsLayer* layerForContentShadow() const { return m_contentShadowLayer.get(); }
268
269     GraphicsLayer* updateLayerForTopOverhangArea(bool wantsLayer);
270     GraphicsLayer* updateLayerForBottomOverhangArea(bool wantsLayer);
271     GraphicsLayer* updateLayerForHeader(bool wantsLayer);
272     GraphicsLayer* updateLayerForFooter(bool wantsLayer);
273 #endif
274
275     ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const;
276
277     void updateScrollCoordinatedStatus(RenderLayer&);
278     void removeFromScrollCoordinatedLayers(RenderLayer&);
279
280     void willRemoveScrollingLayerWithBacking(RenderLayer&, RenderLayerBacking&);
281     void didAddScrollingLayer(RenderLayer&);
282
283 #if PLATFORM(IOS)
284     void registerAllViewportConstrainedLayers();
285     void unregisterAllViewportConstrainedLayers();
286
287     void registerAllScrollingLayers();
288     void unregisterAllScrollingLayers();
289 #endif
290
291     void resetTrackedRepaintRects();
292     void setTracksRepaints(bool);
293
294     void setShouldReevaluateCompositingAfterLayout() { m_reevaluateCompositingAfterLayout = true; }
295
296     bool viewHasTransparentBackground(Color* backgroundColor = 0) const;
297
298     bool hasNonMainLayersWithTiledBacking() const { return m_layersWithTiledBackingCount; }
299
300     CompositingReasons reasonsForCompositing(const RenderLayer&) const;
301
302     void setLayerFlushThrottlingEnabled(bool);
303     void disableLayerFlushThrottlingTemporarilyForInteraction();
304     
305     void didPaintBacking(RenderLayerBacking*);
306
307     void setRootExtendedBackgroundColor(const Color&);
308     Color rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
309
310 private:
311     class OverlapMap;
312     struct CompositingState;
313     struct OverlapExtent;
314
315     // GraphicsLayerClient implementation
316     virtual void notifyFlushRequired(const GraphicsLayer*) override;
317     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect&) override;
318     virtual void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const override;
319     virtual bool isTrackingRepaints() const override;
320     
321     // GraphicsLayerUpdaterClient implementation
322     virtual void flushLayersSoon(GraphicsLayerUpdater*) override;
323
324     // Whether the given RL needs a compositing layer.
325     bool needsToBeComposited(const RenderLayer&, RenderLayer::ViewportConstrainedNotCompositedReason* = 0) const;
326     // Whether the layer has an intrinsic need for compositing layer.
327     bool requiresCompositingLayer(const RenderLayer&, RenderLayer::ViewportConstrainedNotCompositedReason* = 0) const;
328     // Whether the layer could ever be composited.
329     bool canBeComposited(const RenderLayer&) const;
330
331     // Make or destroy the backing for this layer; returns true if backing changed.
332     bool updateBacking(RenderLayer&, CompositingChangeRepaint shouldRepaint);
333
334     void clearBackingForLayerIncludingDescendants(RenderLayer&);
335     void setIsInWindowForLayerIncludingDescendants(RenderLayer&, bool isInWindow);
336
337     // Repaint this and its child layers.
338     void recursiveRepaintLayer(RenderLayer&);
339
340     void computeExtent(const OverlapMap&, RenderLayer&, OverlapExtent&) const;
341     void addToOverlapMap(OverlapMap&, RenderLayer&, OverlapExtent&);
342     void addToOverlapMapRecursive(OverlapMap&, RenderLayer&, RenderLayer* ancestorLayer = nullptr);
343
344     void updateCompositingLayersTimerFired();
345
346     // Returns true if any layer's compositing changed
347     void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer&, OverlapMap&, CompositingState&, bool& layersChanged, bool& descendantHas3DTransform);
348
349     void computeRegionCompositingRequirements(RenderNamedFlowFragment*, OverlapMap&, CompositingState&, bool& layersChanged, bool& anyDescendantHas3DTransform);
350
351     void computeCompositingRequirementsForNamedFlowFixed(RenderLayer&, OverlapMap&, CompositingState&, bool& layersChanged, bool& anyDescendantHas3DTransform);
352
353     // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer.
354     void rebuildCompositingLayerTree(RenderLayer&, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer, int depth);
355
356     // Recurses down the RenderFlowThread tree, parenting descendant compositing layers and collecting an array of child 
357     // layers for the current compositing layer corresponding to the anonymous region (that belongs to the region's parent).
358     void rebuildRegionCompositingLayerTree(RenderNamedFlowFragment*, Vector<GraphicsLayer*>& childList, int depth);
359
360     void rebuildCompositingLayerTreeForNamedFlowFixed(RenderLayer&, Vector<GraphicsLayer*>& childList, int depth);
361
362     // Recurses down the tree, updating layer geometry only.
363     void updateLayerTreeGeometry(RenderLayer&, int depth);
364     
365     // Hook compositing layers together
366     void setCompositingParent(RenderLayer& childLayer, RenderLayer* parentLayer);
367     void removeCompositedChildren(RenderLayer&);
368
369     bool layerHas3DContent(const RenderLayer&) const;
370     bool isRunningAcceleratedTransformAnimation(RenderLayerModelObject&) const;
371
372     void appendDocumentOverlayLayers(Vector<GraphicsLayer*>&);
373     bool hasAnyAdditionalCompositedLayers(const RenderLayer& rootLayer) const;
374
375     void ensureRootLayer();
376     void destroyRootLayer();
377
378     void attachRootLayer(RootLayerAttachment);
379     void detachRootLayer();
380     
381     void rootLayerAttachmentChanged();
382
383     void updateOverflowControlsLayers();
384
385     void updateScrollLayerPosition();
386
387     FloatPoint positionForClipLayer() const;
388
389     void notifyIFramesOfCompositingChange();
390
391     bool isFlushingLayers() const { return m_flushingLayers; }
392     void updateScrollCoordinatedLayersAfterFlushIncludingSubframes();
393     void updateScrollCoordinatedLayersAfterFlush();
394     
395     Page* page() const;
396     
397     GraphicsLayerFactory* graphicsLayerFactory() const;
398     ScrollingCoordinator* scrollingCoordinator() const;
399
400 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
401     PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
402 #endif
403
404     bool requiresCompositingForAnimation(RenderLayerModelObject&) const;
405     bool requiresCompositingForTransform(RenderLayerModelObject&) const;
406     bool requiresCompositingForBackfaceVisibility(RenderLayerModelObject&) const;
407     bool requiresCompositingForVideo(RenderLayerModelObject&) const;
408     bool requiresCompositingForCanvas(RenderLayerModelObject&) const;
409     bool requiresCompositingForPlugin(RenderLayerModelObject&) const;
410     bool requiresCompositingForFrame(RenderLayerModelObject&) const;
411     bool requiresCompositingForFilters(RenderLayerModelObject&) const;
412     bool requiresCompositingForScrollableFrame() const;
413     bool requiresCompositingForPosition(RenderLayerModelObject&, const RenderLayer&, RenderLayer::ViewportConstrainedNotCompositedReason* = 0) const;
414     bool requiresCompositingForOverflowScrolling(const RenderLayer&) const;
415     bool requiresCompositingForIndirectReason(RenderLayerModelObject&, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const;
416
417 #if PLATFORM(IOS)
418     bool requiresCompositingForScrolling(const RenderLayer&) const;
419
420     void updateCustomLayersAfterFlush();
421
422     ChromeClient* chromeClient() const;
423
424 #endif
425
426     enum ScrollCoordinationReason {
427         FixedOrSticky = 1 << 0,
428         Scrolling = 1 << 1
429     };
430     typedef unsigned ScrollCoordinationReasons;
431
432     void updateScrollCoordinationForThisFrame(ScrollingNodeID);
433     ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, ScrollingNodeID parentNodeID);
434     void updateScrollCoordinatedLayer(RenderLayer&, ScrollCoordinationReasons);
435     void detachScrollCoordinatedLayer(RenderLayer&);
436     void reattachSubframeScrollLayers();
437     
438     FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const;
439     StickyPositionViewportConstraints computeStickyViewportConstraints(RenderLayer&) const;
440
441     bool requiresScrollLayer(RootLayerAttachment) const;
442     bool requiresHorizontalScrollbarLayer() const;
443     bool requiresVerticalScrollbarLayer() const;
444     bool requiresScrollCornerLayer() const;
445 #if ENABLE(RUBBER_BANDING)
446     bool requiresOverhangAreasLayer() const;
447     bool requiresContentShadowLayer() const;
448 #endif
449
450     // True if the FrameView uses a ScrollingCoordinator.
451     bool hasCoordinatedScrolling() const;
452
453     bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const;
454     bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
455     
456     bool shouldCompositeOverflowControls() const;
457
458     void scheduleLayerFlushNow();
459     bool isThrottlingLayerFlushes() const;
460     void startInitialLayerFlushTimerIfNeeded();
461     void startLayerFlushTimerIfNeeded();
462     void layerFlushTimerFired();
463
464     void paintRelatedMilestonesTimerFired();
465
466 #if !LOG_DISABLED
467     const char* logReasonsForCompositing(const RenderLayer&);
468     void logLayerInfo(const RenderLayer&, int depth);
469 #endif
470
471     bool mainFrameBackingIsTiled() const;
472
473 private:
474     RenderView& m_renderView;
475     std::unique_ptr<GraphicsLayer> m_rootContentLayer;
476     Timer m_updateCompositingLayersTimer;
477
478     bool m_hasAcceleratedCompositing;
479     ChromeClient::CompositingTriggerFlags m_compositingTriggers;
480
481     int m_compositedLayerCount;
482     bool m_showDebugBorders;
483     bool m_showRepaintCounter;
484     bool m_acceleratedDrawingEnabled;
485
486     // When true, we have to wait until layout has happened before we can decide whether to enter compositing mode,
487     // because only then do we know the final size of plugins and iframes.
488     mutable bool m_reevaluateCompositingAfterLayout;
489
490     bool m_compositing;
491     bool m_compositingLayersNeedRebuild;
492     bool m_flushingLayers;
493     bool m_shouldFlushOnReattach;
494     bool m_forceCompositingMode;
495     bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions)
496     bool m_subframeScrollLayersNeedReattach;
497
498     bool m_isTrackingRepaints; // Used for testing.
499
500     unsigned m_layersWithTiledBackingCount;
501
502     RootLayerAttachment m_rootLayerAttachment;
503
504     // Enclosing clipping layer for iframe content
505     std::unique_ptr<GraphicsLayer> m_clipLayer;
506     std::unique_ptr<GraphicsLayer> m_scrollLayer;
507
508 #if PLATFORM(IOS)
509     HashSet<RenderLayer*> m_scrollingLayers;
510     HashSet<RenderLayer*> m_scrollingLayersNeedingUpdate;
511 #endif
512     HashSet<RenderLayer*> m_scrollCoordinatedLayers;
513     HashSet<RenderLayer*> m_scrollCoordinatedLayersNeedingUpdate;
514
515     // Enclosing layer for overflow controls and the clipping layer
516     std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer;
517
518     // Layers for overflow controls
519     std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar;
520     std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar;
521     std::unique_ptr<GraphicsLayer> m_layerForScrollCorner;
522 #if ENABLE(RUBBER_BANDING)
523     std::unique_ptr<GraphicsLayer> m_layerForOverhangAreas;
524     std::unique_ptr<GraphicsLayer> m_contentShadowLayer;
525     std::unique_ptr<GraphicsLayer> m_layerForTopOverhangArea;
526     std::unique_ptr<GraphicsLayer> m_layerForBottomOverhangArea;
527     std::unique_ptr<GraphicsLayer> m_layerForHeader;
528     std::unique_ptr<GraphicsLayer> m_layerForFooter;
529 #endif
530
531     std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running.
532
533     Timer m_layerFlushTimer;
534     bool m_layerFlushThrottlingEnabled;
535     bool m_layerFlushThrottlingTemporarilyDisabledForInteraction;
536     bool m_hasPendingLayerFlush;
537
538     Timer m_paintRelatedMilestonesTimer;
539
540 #if !LOG_DISABLED
541     int m_rootLayerUpdateCount;
542     int m_obligateCompositedLayerCount; // count of layer that have to be composited.
543     int m_secondaryCompositedLayerCount; // count of layers that have to be composited because of stacking or overlap.
544     double m_obligatoryBackingStoreBytes;
545     double m_secondaryBackingStoreBytes;
546 #endif
547
548     Color m_rootExtendedBackgroundColor;
549
550     HashMap<ScrollingNodeID, RenderLayer*> m_scrollingNodeToLayerMap;
551 };
552
553
554 } // namespace WebCore
555
556 #endif // RenderLayerCompositor_h