blob: 3fc7ea9e1373a7f457a8da4c5d2d9a9d153dbfcf [file] [log] [blame]
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +00001/*
2 * Copyright (C) 2009 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 COMPUTER, 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
vangelis@chromium.org1bbe6132010-11-30 20:41:59 +000029#include "ChromeClient.h"
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000030#include "RenderLayer.h"
simon.fraser@apple.com994de4f2009-06-30 19:53:41 +000031#include "RenderLayerBacking.h"
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000032
33namespace WebCore {
34
35#define PROFILE_LAYER_REBUILD 0
36
37class GraphicsLayer;
simon.fraser@apple.combda41842010-07-13 00:40:47 +000038class RenderEmbeddedObject;
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +000039class RenderPart;
jamesr@google.com0abe0062012-02-18 00:23:16 +000040class ScrollingCoordinator;
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +000041#if ENABLE(VIDEO)
42class RenderVideo;
43#endif
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000044
simon.fraser@apple.com762661b2010-01-28 18:07:14 +000045enum CompositingUpdateType {
46 CompositingUpdateAfterLayoutOrStyleChange,
jamesr@google.comef5cfe22011-09-23 21:51:58 +000047 CompositingUpdateOnHitTest,
simon.fraser@apple.com762661b2010-01-28 18:07:14 +000048 CompositingUpdateOnScroll
49};
50
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000051// RenderLayerCompositor manages the hierarchy of
52// composited RenderLayers. It determines which RenderLayers
53// become compositing, and creates and maintains a hierarchy of
54// GraphicsLayers based on the RenderLayer painting order.
55//
56// There is one RenderLayerCompositor per RenderView.
57
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +000058class RenderLayerCompositor : public GraphicsLayerClient {
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000059public:
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000060 RenderLayerCompositor(RenderView*);
61 ~RenderLayerCompositor();
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +000062
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000063 // Return true if this RenderView is in "compositing mode" (i.e. has one or more
64 // composited RenderLayers)
65 bool inCompositingMode() const { return m_compositing; }
66 // This will make a compositing layer at the root automatically, and hook up to
67 // the native view/window system.
68 void enableCompositingMode(bool enable = true);
cmarrin@apple.com89072a02009-06-25 22:03:59 +000069
70 // Returns true if the accelerated compositing is enabled
cmarrin@apple.comd2851822009-06-25 22:35:21 +000071 bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; }
vangelis@chromium.org1bbe6132010-11-30 20:41:59 +000072
73 bool canRender3DTransforms() const;
74
cmarrin@apple.comf2dff332009-11-18 19:23:44 +000075 // Copy the accelerated compositing related flags from Settings
76 void cacheAcceleratedCompositingFlags();
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000077
simon.fraser@apple.com8717fee2009-07-31 23:03:25 +000078 // Called when the layer hierarchy needs to be updated (compositing layers have been
simon.fraser@apple.com02f40492009-07-07 17:15:16 +000079 // created, destroyed or re-parented).
80 void setCompositingLayersNeedRebuild(bool needRebuild = true);
81 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRebuild; }
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000082
simon.fraser@apple.com02f40492009-07-07 17:15:16 +000083 // Controls whether or not to consult geometry when deciding which layers need
84 // to be composited. Defaults to true.
85 void setCompositingConsultsOverlap(bool b) { m_compositingConsultsOverlap = b; }
86 bool compositingConsultsOverlap() const { return m_compositingConsultsOverlap; }
87
simon.fraser@apple.com73e897b2011-01-14 23:45:17 +000088 // GraphicsLayers buffer state, which gets pushed to the underlying platform layers
89 // at specific times.
90 void scheduleLayerFlush();
simon.fraser@apple.comd73911e2011-07-22 01:02:35 +000091 void flushPendingLayerChanges(bool isFlushRoot = true);
simon.fraser@apple.comc961f412011-01-20 03:20:47 +000092
93 // flushPendingLayerChanges() flushes the entire GraphicsLayer tree, which can cross frame boundaries.
94 // This call returns the rootmost compositor that is being flushed (including self).
95 RenderLayerCompositor* enclosingCompositorFlushingLayers() const;
simon.fraser@apple.com53dd08d2011-07-16 01:30:13 +000096
97 // Called when the GraphicsLayer for the given RenderLayer has flushed changes inside of flushPendingLayerChanges().
98 void didFlushChangesForLayer(RenderLayer*);
cmarrin@apple.com20dc4892009-04-03 19:29:22 +000099
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000100 // Rebuild the tree of compositing layers
simon.fraser@apple.com762661b2010-01-28 18:07:14 +0000101 void updateCompositingLayers(CompositingUpdateType = CompositingUpdateAfterLayoutOrStyleChange, RenderLayer* updateRoot = 0);
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000102 // This is only used when state changes and we do not exepect a style update or layout to happen soon (e.g. when
103 // we discover that an iframe is overlapped during painting).
104 void scheduleCompositingLayerUpdate();
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000105
simon.fraser@apple.com3bc08f12009-04-07 22:06:19 +0000106 // Update the compositing state of the given layer. Returns true if that state changed.
107 enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChangeWillRepaintLater };
108 bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = CompositingChangeRepaintNow);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000109
simon.fraser@apple.comb2fc99c2009-06-22 22:45:24 +0000110 // Update the geometry for compositing children of compositingAncestor.
simon.fraser@apple.com994de4f2009-06-30 19:53:41 +0000111 void updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer* layer, RenderLayerBacking::UpdateDepth);
simon.fraser@apple.comb2fc99c2009-06-22 22:45:24 +0000112
simon.fraser@apple.com699dc0b2009-04-07 17:45:00 +0000113 // Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
114 bool clippedByAncestor(RenderLayer*) const;
115 // Whether layer's backing needs a graphics layer to clip z-order children of the given layer.
116 bool clipsCompositingDescendants(const RenderLayer*) const;
117
118 // Whether the given layer needs an extra 'contents' layer.
119 bool needsContentsCompositingLayer(const RenderLayer*) const;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000120 // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer.
121 // If layerBoundingBox is not 0, on return it contains the bounding box of this layer only.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000122 IntRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer);
simon.fraser@apple.com3bc08f12009-04-07 22:06:19 +0000123
124 // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
125 void repaintOnCompositingChange(RenderLayer*);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000126
127 // Notify us that a layer has been added or removed
128 void layerWasAdded(RenderLayer* parent, RenderLayer* child);
129 void layerWillBeRemoved(RenderLayer* parent, RenderLayer* child);
130
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000131 // Get the nearest ancestor layer that has overflow or clip, but is not a stacking context
132 RenderLayer* enclosingNonStackingClippingLayer(const RenderLayer* layer) const;
133
134 // Repaint parts of all composited layers that intersect the given absolute rectangle.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000135 void repaintCompositedLayersAbsoluteRect(const IntRect&);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000136
137 RenderLayer* rootRenderLayer() const;
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000138 GraphicsLayer* rootGraphicsLayer() const;
enne@google.come5eee182011-11-04 16:41:19 +0000139 GraphicsLayer* scrollLayer() const;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000140
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000141 enum RootLayerAttachment {
142 RootLayerUnattached,
143 RootLayerAttachedViaChromeClient,
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000144 RootLayerAttachedViaEnclosingFrame
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000145 };
146
147 RootLayerAttachment rootLayerAttachment() const { return m_rootLayerAttachment; }
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000148 void updateRootLayerAttachment();
149 void updateRootLayerPosition();
150
simon.fraser@apple.comc152ae62009-02-03 20:14:37 +0000151 void didMoveOnscreen();
152 void willMoveOffscreen();
simon.fraser@apple.com7ec01842011-07-06 20:15:07 +0000153
154 void clearBackingForAllLayers();
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +0000155
simon.fraser@apple.com47560da2011-10-21 03:02:05 +0000156 void layerBecameComposited(const RenderLayer*) { ++m_compositedLayerCount; }
157 void layerBecameNonComposited(const RenderLayer*)
158 {
159 ASSERT(m_compositedLayerCount > 0);
160 --m_compositedLayerCount;
161 }
162
simon.fraser@apple.com107a40f2010-12-15 01:52:31 +0000163 void didStartAcceleratedAnimation(CSSPropertyID);
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000164
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +0000165#if ENABLE(VIDEO)
166 // Use by RenderVideo to ask if it should try to use accelerated compositing.
167 bool canAccelerateVideoRendering(RenderVideo*) const;
168#endif
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000169
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000170 // Walk the tree looking for layers with 3d transforms. Useful in case you need
171 // to know if there is non-affine content, e.g. for drawing into an image.
172 bool has3DContent() const;
simon.fraser@apple.comad796c52010-04-27 19:26:38 +0000173
simon.fraser@apple.com8a7f8012010-11-08 19:47:51 +0000174 // Most platforms connect compositing layer trees between iframes and their parent document.
175 // Some (currently just Mac) allow iframes to do their own compositing.
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000176 static bool allowsIndependentlyCompositedFrames(const FrameView*);
177 bool shouldPropagateCompositingToEnclosingFrame() const;
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000178
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000179 static RenderLayerCompositor* frameContentsCompositor(RenderPart*);
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000180 // Return true if the layers changed.
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000181 static bool parentFrameContentLayers(RenderPart*);
simon.fraser@apple.combe8126e2010-05-11 05:08:18 +0000182
simon.fraser@apple.come38ba062010-05-13 23:14:46 +0000183 // Update the geometry of the layers used for clipping and scrolling in frames.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000184 void frameViewDidChangeLocation(const IntPoint& contentsOffset);
jamesr@google.come53ce642011-04-14 06:51:50 +0000185 void frameViewDidChangeSize();
andersca@apple.com99039b22012-01-31 02:58:27 +0000186 void frameViewDidScroll();
cmarrin@apple.com10c77cf2010-05-05 01:50:03 +0000187
commit-queue@webkit.org4eab00b2011-03-21 20:01:57 +0000188 String layerTreeAsText(bool showDebugInfo = false);
simon.fraser@apple.com0a00f372010-09-17 19:00:03 +0000189
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000190 // These are named to avoid conflicts with the functions in GraphicsLayerClient
191 // These return the actual internal variables.
192 bool compositorShowDebugBorders() const { return m_showDebugBorders; }
193 bool compositorShowRepaintCounter() const { return m_showRepaintCounter; }
194
aroben@apple.com631cb902011-08-15 13:43:29 +0000195 virtual float deviceScaleFactor() const;
simon.fraser@apple.com53dd08d2011-07-16 01:30:13 +0000196 virtual float pageScaleFactor() const;
197 virtual void didCommitChangesForLayer(const GraphicsLayer*) const;
198
simon.fraser@apple.com1eae7d22011-07-17 02:34:10 +0000199 bool keepLayersPixelAligned() const;
simon.fraser@apple.com5cce05c2012-03-23 21:40:21 +0000200 bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
simon.fraser@apple.com1eae7d22011-07-17 02:34:10 +0000201
aroben@apple.com631cb902011-08-15 13:43:29 +0000202 void deviceOrPageScaleFactorChanged();
cmarrin@apple.com09f22bf2011-01-12 22:27:27 +0000203
jamesr@google.come53ce642011-04-14 06:51:50 +0000204 GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
205 GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
206 GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
andersca@apple.com134cfff2012-01-13 00:30:55 +0000207#if ENABLE(RUBBER_BANDING)
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000208 GraphicsLayer* layerForOverhangAreas() const { return m_layerForOverhangAreas.get(); }
209#endif
jamesr@google.come53ce642011-04-14 06:51:50 +0000210
andersca@apple.com4a0973b2012-02-14 02:36:00 +0000211 void documentBackgroundColorDidChange();
212
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000213private:
enne@google.comd77b4332012-03-06 05:13:00 +0000214 class OverlapMap;
215
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000216 // GraphicsLayerClient Implementation
217 virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
simon.fraser@apple.com73e897b2011-01-14 23:45:17 +0000218 virtual void notifySyncRequired(const GraphicsLayer*) { scheduleLayerFlush(); }
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000219 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&);
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000220
simon.fraser@apple.comcc7fbbc2012-01-24 18:54:43 +0000221 virtual bool showDebugBorders(const GraphicsLayer*) const;
222 virtual bool showRepaintCounter(const GraphicsLayer*) const;
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000223
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000224 // Whether the given RL needs a compositing layer.
225 bool needsToBeComposited(const RenderLayer*) const;
226 // Whether the layer has an intrinsic need for compositing layer.
227 bool requiresCompositingLayer(const RenderLayer*) const;
simon.fraser@apple.comd6bec432010-04-01 23:42:04 +0000228 // Whether the layer could ever be composited.
229 bool canBeComposited(const RenderLayer*) const;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000230
simon.fraser@apple.comb2fc99c2009-06-22 22:45:24 +0000231 // Make or destroy the backing for this layer; returns true if backing changed.
232 bool updateBacking(RenderLayer*, CompositingChangeRepaint shouldRepaint);
233
simon.fraser@apple.com7ec01842011-07-06 20:15:07 +0000234 void clearBackingForLayerIncludingDescendants(RenderLayer*);
235
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000236 // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000237 void recursiveRepaintLayerRect(RenderLayer*, const IntRect&);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000238
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000239 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed);
enne@google.com7cbb9be2011-06-21 23:52:04 +0000240 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*);
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000241
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000242 void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*);
243
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000244 // Returns true if any layer's compositing changed
245 void computeCompositingRequirements(RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged);
simon.fraser@apple.com90c94a12009-11-30 03:21:55 +0000246
247 // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer.
commit-queue@webkit.org67011892011-12-20 18:12:34 +0000248 void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000249
simon.fraser@apple.com90c94a12009-11-30 03:21:55 +0000250 // Recurses down the tree, updating layer geometry only.
251 void updateLayerTreeGeometry(RenderLayer*);
252
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000253 // Hook compositing layers together
254 void setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer);
255 void removeCompositedChildren(RenderLayer*);
256
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000257 bool layerHas3DContent(const RenderLayer*) const;
simon.fraser@apple.com5c27afa2011-06-11 00:22:29 +0000258 bool hasNonIdentity3DTransform(RenderObject*) const;
simon.fraser@apple.com47560da2011-10-21 03:02:05 +0000259
260 bool hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const;
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000261
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000262 void ensureRootLayer();
263 void destroyRootLayer();
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000264
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000265 void attachRootLayer(RootLayerAttachment);
266 void detachRootLayer();
cmarrin@apple.com89072a02009-06-25 22:03:59 +0000267
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000268 void rootLayerAttachmentChanged();
jamesr@google.come53ce642011-04-14 06:51:50 +0000269
270 void updateOverflowControlsLayers();
271
simon.fraser@apple.comfb20cde2010-05-13 03:27:47 +0000272 void notifyIFramesOfCompositingChange();
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000273
simon.fraser@apple.comd73911e2011-07-22 01:02:35 +0000274 bool isFlushingLayers() const { return m_flushingLayers; }
275
jamesr@google.com0abe0062012-02-18 00:23:16 +0000276 ScrollingCoordinator* scrollingCoordinator() const;
277
simon.fraser@apple.com6b59a902009-03-17 20:01:31 +0000278 // Whether a running transition or animation enforces the need for a compositing layer.
simon.fraser@apple.com0ac1f062009-06-27 06:22:30 +0000279 bool requiresCompositingForAnimation(RenderObject*) const;
280 bool requiresCompositingForTransform(RenderObject*) const;
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +0000281 bool requiresCompositingForVideo(RenderObject*) const;
cmarrin@apple.com4e7728f2009-08-27 23:55:44 +0000282 bool requiresCompositingForCanvas(RenderObject*) const;
simon.fraser@apple.comd6aff5e2010-01-12 00:15:06 +0000283 bool requiresCompositingForPlugin(RenderObject*) const;
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000284 bool requiresCompositingForFrame(RenderObject*) const;
simon.fraser@apple.com9d9e2982009-08-18 03:57:08 +0000285 bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const;
noam.rosenthal@nokia.come7d126c2012-01-06 23:13:02 +0000286 bool requiresCompositingForFilters(RenderObject*) const;
enne@google.com10778632011-08-11 19:44:45 +0000287 bool requiresCompositingForScrollableFrame() const;
vangelis@chromium.orge910d232011-10-27 20:28:40 +0000288 bool requiresCompositingForPosition(RenderObject*, const RenderLayer*) const;
simon.fraser@apple.com6b59a902009-03-17 20:01:31 +0000289
simon.fraser@apple.com31b329f2010-07-26 17:48:13 +0000290 bool requiresScrollLayer(RootLayerAttachment) const;
jamesr@google.come53ce642011-04-14 06:51:50 +0000291 bool requiresHorizontalScrollbarLayer() const;
292 bool requiresVerticalScrollbarLayer() const;
293 bool requiresScrollCornerLayer() const;
andersca@apple.com134cfff2012-01-13 00:30:55 +0000294#if ENABLE(RUBBER_BANDING)
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000295 bool requiresOverhangAreasLayer() const;
andersca@apple.comb2abfa62012-02-08 20:24:57 +0000296 bool requiresContentShadowLayer() const;
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000297#endif
jamesr@google.come53ce642011-04-14 06:51:50 +0000298
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000299private:
300 RenderView* m_renderView;
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000301 OwnPtr<GraphicsLayer> m_rootContentLayer;
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000302 Timer<RenderLayerCompositor> m_updateCompositingLayersTimer;
303
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000304 bool m_hasAcceleratedCompositing;
vangelis@chromium.org1bbe6132010-11-30 20:41:59 +0000305 ChromeClient::CompositingTriggerFlags m_compositingTriggers;
306
simon.fraser@apple.com47560da2011-10-21 03:02:05 +0000307 int m_compositedLayerCount;
cmarrin@apple.comf2dff332009-11-18 19:23:44 +0000308 bool m_showDebugBorders;
309 bool m_showRepaintCounter;
simon.fraser@apple.com5cce05c2012-03-23 21:40:21 +0000310 bool m_acceleratedDrawingEnabled;
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000311 bool m_compositingConsultsOverlap;
simon.fraser@apple.combda41842010-07-13 00:40:47 +0000312
313 // When true, we have to wait until layout has happened before we can decide whether to enter compositing mode,
314 // because only then do we know the final size of plugins and iframes.
315 // FIXME: once set, this is never cleared.
316 mutable bool m_compositingDependsOnGeometry;
317
vangelis@chromium.orge910d232011-10-27 20:28:40 +0000318 mutable bool m_compositingNeedsUpdate;
319
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000320 bool m_compositing;
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000321 bool m_compositingLayersNeedRebuild;
simon.fraser@apple.comc961f412011-01-20 03:20:47 +0000322 bool m_flushingLayers;
commit-queue@webkit.orga8f8e9e2011-03-16 23:37:48 +0000323 bool m_forceCompositingMode;
simon.fraser@apple.combda41842010-07-13 00:40:47 +0000324
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000325 RootLayerAttachment m_rootLayerAttachment;
cmarrin@apple.com10c77cf2010-05-05 01:50:03 +0000326
327 // Enclosing clipping layer for iframe content
simon.fraser@apple.come38ba062010-05-13 23:14:46 +0000328 OwnPtr<GraphicsLayer> m_clipLayer;
329 OwnPtr<GraphicsLayer> m_scrollLayer;
jamesr@google.come53ce642011-04-14 06:51:50 +0000330
331 // Enclosing layer for overflow controls and the clipping layer
332 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
333
334 // Layers for overflow controls
335 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
336 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
337 OwnPtr<GraphicsLayer> m_layerForScrollCorner;
andersca@apple.com134cfff2012-01-13 00:30:55 +0000338#if ENABLE(RUBBER_BANDING)
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000339 OwnPtr<GraphicsLayer> m_layerForOverhangAreas;
andersca@apple.comb2abfa62012-02-08 20:24:57 +0000340 OwnPtr<GraphicsLayer> m_contentShadowLayer;
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000341#endif
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000342#if PROFILE_LAYER_REBUILD
343 int m_rootLayerUpdateCount;
344#endif
345};
346
347
348} // namespace WebCore
349
350#endif // RenderLayerCompositor_h