blob: 5b87e53c4a8578a1c5ad6c7bc2ce0c17b4db45c8 [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
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000035class GraphicsLayer;
simon.fraser@apple.combda41842010-07-13 00:40:47 +000036class RenderEmbeddedObject;
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +000037class RenderPart;
jamesr@google.com0abe0062012-02-18 00:23:16 +000038class ScrollingCoordinator;
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +000039#if ENABLE(VIDEO)
40class RenderVideo;
41#endif
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000042
simon.fraser@apple.com762661b2010-01-28 18:07:14 +000043enum CompositingUpdateType {
simon.fraser@apple.com06a2bbb2012-04-20 21:54:45 +000044 CompositingUpdateAfterStyleChange,
45 CompositingUpdateAfterLayout,
jamesr@google.comef5cfe22011-09-23 21:51:58 +000046 CompositingUpdateOnHitTest,
simon.fraser@apple.com762661b2010-01-28 18:07:14 +000047 CompositingUpdateOnScroll
48};
49
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000050// RenderLayerCompositor manages the hierarchy of
51// composited RenderLayers. It determines which RenderLayers
52// become compositing, and creates and maintains a hierarchy of
53// GraphicsLayers based on the RenderLayer painting order.
54//
55// There is one RenderLayerCompositor per RenderView.
56
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +000057class RenderLayerCompositor : public GraphicsLayerClient {
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000058public:
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000059 RenderLayerCompositor(RenderView*);
60 ~RenderLayerCompositor();
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +000061
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000062 // Return true if this RenderView is in "compositing mode" (i.e. has one or more
63 // composited RenderLayers)
64 bool inCompositingMode() const { return m_compositing; }
65 // This will make a compositing layer at the root automatically, and hook up to
66 // the native view/window system.
67 void enableCompositingMode(bool enable = true);
commit-queue@webkit.org3c453c42012-04-05 16:10:40 +000068
69 bool inForcedCompositingMode() const { return m_forceCompositingMode; }
70
cmarrin@apple.com89072a02009-06-25 22:03:59 +000071 // Returns true if the accelerated compositing is enabled
cmarrin@apple.comd2851822009-06-25 22:35:21 +000072 bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; }
vangelis@chromium.org1bbe6132010-11-30 20:41:59 +000073
74 bool canRender3DTransforms() const;
75
cmarrin@apple.comf2dff332009-11-18 19:23:44 +000076 // Copy the accelerated compositing related flags from Settings
77 void cacheAcceleratedCompositingFlags();
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000078
simon.fraser@apple.com8717fee2009-07-31 23:03:25 +000079 // Called when the layer hierarchy needs to be updated (compositing layers have been
simon.fraser@apple.com02f40492009-07-07 17:15:16 +000080 // created, destroyed or re-parented).
81 void setCompositingLayersNeedRebuild(bool needRebuild = true);
82 bool compositingLayersNeedRebuild() const { return m_compositingLayersNeedRebuild; }
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +000083
simon.fraser@apple.com02f40492009-07-07 17:15:16 +000084 // Controls whether or not to consult geometry when deciding which layers need
85 // to be composited. Defaults to true.
86 void setCompositingConsultsOverlap(bool b) { m_compositingConsultsOverlap = b; }
87 bool compositingConsultsOverlap() const { return m_compositingConsultsOverlap; }
88
simon.fraser@apple.com73e897b2011-01-14 23:45:17 +000089 // GraphicsLayers buffer state, which gets pushed to the underlying platform layers
90 // at specific times.
91 void scheduleLayerFlush();
simon.fraser@apple.comd73911e2011-07-22 01:02:35 +000092 void flushPendingLayerChanges(bool isFlushRoot = true);
simon.fraser@apple.comc961f412011-01-20 03:20:47 +000093
94 // flushPendingLayerChanges() flushes the entire GraphicsLayer tree, which can cross frame boundaries.
95 // This call returns the rootmost compositor that is being flushed (including self).
96 RenderLayerCompositor* enclosingCompositorFlushingLayers() const;
simon.fraser@apple.com53dd08d2011-07-16 01:30:13 +000097
98 // Called when the GraphicsLayer for the given RenderLayer has flushed changes inside of flushPendingLayerChanges().
99 void didFlushChangesForLayer(RenderLayer*);
cmarrin@apple.com20dc4892009-04-03 19:29:22 +0000100
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000101 // Rebuild the tree of compositing layers
simon.fraser@apple.com06a2bbb2012-04-20 21:54:45 +0000102 void updateCompositingLayers(CompositingUpdateType, RenderLayer* updateRoot = 0);
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000103 // This is only used when state changes and we do not exepect a style update or layout to happen soon (e.g. when
104 // we discover that an iframe is overlapped during painting).
105 void scheduleCompositingLayerUpdate();
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000106
simon.fraser@apple.com3bc08f12009-04-07 22:06:19 +0000107 // Update the compositing state of the given layer. Returns true if that state changed.
108 enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChangeWillRepaintLater };
109 bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = CompositingChangeRepaintNow);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000110
simon.fraser@apple.comb2fc99c2009-06-22 22:45:24 +0000111 // Update the geometry for compositing children of compositingAncestor.
simon.fraser@apple.com994de4f2009-06-30 19:53:41 +0000112 void updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer* layer, RenderLayerBacking::UpdateDepth);
simon.fraser@apple.comb2fc99c2009-06-22 22:45:24 +0000113
simon.fraser@apple.com699dc0b2009-04-07 17:45:00 +0000114 // Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
115 bool clippedByAncestor(RenderLayer*) const;
116 // Whether layer's backing needs a graphics layer to clip z-order children of the given layer.
117 bool clipsCompositingDescendants(const RenderLayer*) const;
118
commit-queue@webkit.orgb07824e2012-06-14 17:45:05 +0000119 // Whether the layer is fixed positioned to the view by an ancestor layer.
120 bool fixedPositionedByAncestor(const RenderLayer*) const;
121
simon.fraser@apple.com699dc0b2009-04-07 17:45:00 +0000122 // Whether the given layer needs an extra 'contents' layer.
123 bool needsContentsCompositingLayer(const RenderLayer*) const;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000124 // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer.
125 // If layerBoundingBox is not 0, on return it contains the bounding box of this layer only.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000126 IntRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer);
simon.fraser@apple.com3bc08f12009-04-07 22:06:19 +0000127
128 // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
129 void repaintOnCompositingChange(RenderLayer*);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000130
simon.fraser@apple.com9d127902012-05-29 20:49:15 +0000131 void repaintInCompositedAncestor(RenderLayer*, const LayoutRect&);
132
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000133 // Notify us that a layer has been added or removed
134 void layerWasAdded(RenderLayer* parent, RenderLayer* child);
135 void layerWillBeRemoved(RenderLayer* parent, RenderLayer* child);
136
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000137 // Get the nearest ancestor layer that has overflow or clip, but is not a stacking context
138 RenderLayer* enclosingNonStackingClippingLayer(const RenderLayer* layer) const;
139
140 // Repaint parts of all composited layers that intersect the given absolute rectangle.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000141 void repaintCompositedLayersAbsoluteRect(const IntRect&);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000142
simon.fraser@apple.comb7cec682012-04-16 18:32:13 +0000143 // Returns true if the given layer needs it own backing store.
144 bool requiresOwnBackingStore(const RenderLayer*, const RenderLayer* compositingAncestorLayer) const;
145
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000146 RenderLayer* rootRenderLayer() const;
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000147 GraphicsLayer* rootGraphicsLayer() const;
enne@google.come5eee182011-11-04 16:41:19 +0000148 GraphicsLayer* scrollLayer() const;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000149
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000150 enum RootLayerAttachment {
151 RootLayerUnattached,
152 RootLayerAttachedViaChromeClient,
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000153 RootLayerAttachedViaEnclosingFrame
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000154 };
155
156 RootLayerAttachment rootLayerAttachment() const { return m_rootLayerAttachment; }
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000157 void updateRootLayerAttachment();
158 void updateRootLayerPosition();
159
simon.fraser@apple.comc152ae62009-02-03 20:14:37 +0000160 void didMoveOnscreen();
161 void willMoveOffscreen();
simon.fraser@apple.com7ec01842011-07-06 20:15:07 +0000162
163 void clearBackingForAllLayers();
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +0000164
simon.fraser@apple.com47560da2011-10-21 03:02:05 +0000165 void layerBecameComposited(const RenderLayer*) { ++m_compositedLayerCount; }
166 void layerBecameNonComposited(const RenderLayer*)
167 {
168 ASSERT(m_compositedLayerCount > 0);
169 --m_compositedLayerCount;
170 }
171
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +0000172#if ENABLE(VIDEO)
173 // Use by RenderVideo to ask if it should try to use accelerated compositing.
174 bool canAccelerateVideoRendering(RenderVideo*) const;
175#endif
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000176
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000177 // Walk the tree looking for layers with 3d transforms. Useful in case you need
178 // to know if there is non-affine content, e.g. for drawing into an image.
179 bool has3DContent() const;
simon.fraser@apple.comad796c52010-04-27 19:26:38 +0000180
simon.fraser@apple.com8a7f8012010-11-08 19:47:51 +0000181 // Most platforms connect compositing layer trees between iframes and their parent document.
182 // Some (currently just Mac) allow iframes to do their own compositing.
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000183 static bool allowsIndependentlyCompositedFrames(const FrameView*);
184 bool shouldPropagateCompositingToEnclosingFrame() const;
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000185
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000186 static RenderLayerCompositor* frameContentsCompositor(RenderPart*);
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000187 // Return true if the layers changed.
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000188 static bool parentFrameContentLayers(RenderPart*);
simon.fraser@apple.combe8126e2010-05-11 05:08:18 +0000189
simon.fraser@apple.come38ba062010-05-13 23:14:46 +0000190 // Update the geometry of the layers used for clipping and scrolling in frames.
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000191 void frameViewDidChangeLocation(const IntPoint& contentsOffset);
jamesr@google.come53ce642011-04-14 06:51:50 +0000192 void frameViewDidChangeSize();
andersca@apple.com99039b22012-01-31 02:58:27 +0000193 void frameViewDidScroll();
cmarrin@apple.com10c77cf2010-05-05 01:50:03 +0000194
commit-queue@webkit.org4eab00b2011-03-21 20:01:57 +0000195 String layerTreeAsText(bool showDebugInfo = false);
simon.fraser@apple.com0a00f372010-09-17 19:00:03 +0000196
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000197 // These are named to avoid conflicts with the functions in GraphicsLayerClient
198 // These return the actual internal variables.
199 bool compositorShowDebugBorders() const { return m_showDebugBorders; }
200 bool compositorShowRepaintCounter() const { return m_showRepaintCounter; }
201
aroben@apple.com631cb902011-08-15 13:43:29 +0000202 virtual float deviceScaleFactor() const;
simon.fraser@apple.com53dd08d2011-07-16 01:30:13 +0000203 virtual float pageScaleFactor() const;
204 virtual void didCommitChangesForLayer(const GraphicsLayer*) const;
205
simon.fraser@apple.com1eae7d22011-07-17 02:34:10 +0000206 bool keepLayersPixelAligned() const;
simon.fraser@apple.com5cce05c2012-03-23 21:40:21 +0000207 bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
simon.fraser@apple.com1eae7d22011-07-17 02:34:10 +0000208
aroben@apple.com631cb902011-08-15 13:43:29 +0000209 void deviceOrPageScaleFactorChanged();
cmarrin@apple.com09f22bf2011-01-12 22:27:27 +0000210
jamesr@google.come53ce642011-04-14 06:51:50 +0000211 GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
212 GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
213 GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
andersca@apple.com134cfff2012-01-13 00:30:55 +0000214#if ENABLE(RUBBER_BANDING)
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000215 GraphicsLayer* layerForOverhangAreas() const { return m_layerForOverhangAreas.get(); }
216#endif
jamesr@google.come53ce642011-04-14 06:51:50 +0000217
andersca@apple.com4a0973b2012-02-14 02:36:00 +0000218 void documentBackgroundColorDidChange();
219
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000220private:
enne@google.comd77b4332012-03-06 05:13:00 +0000221 class OverlapMap;
222
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000223 // GraphicsLayerClient Implementation
224 virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
simon.fraser@apple.com73e897b2011-01-14 23:45:17 +0000225 virtual void notifySyncRequired(const GraphicsLayer*) { scheduleLayerFlush(); }
leviw@chromium.orgdac251e2012-02-15 01:20:32 +0000226 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&);
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000227
simon.fraser@apple.comcc7fbbc2012-01-24 18:54:43 +0000228 virtual bool showDebugBorders(const GraphicsLayer*) const;
229 virtual bool showRepaintCounter(const GraphicsLayer*) const;
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000230
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000231 // Whether the given RL needs a compositing layer.
232 bool needsToBeComposited(const RenderLayer*) const;
233 // Whether the layer has an intrinsic need for compositing layer.
234 bool requiresCompositingLayer(const RenderLayer*) const;
simon.fraser@apple.comd6bec432010-04-01 23:42:04 +0000235 // Whether the layer could ever be composited.
236 bool canBeComposited(const RenderLayer*) const;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000237
simon.fraser@apple.comb2fc99c2009-06-22 22:45:24 +0000238 // Make or destroy the backing for this layer; returns true if backing changed.
239 bool updateBacking(RenderLayer*, CompositingChangeRepaint shouldRepaint);
240
simon.fraser@apple.com7ec01842011-07-06 20:15:07 +0000241 void clearBackingForLayerIncludingDescendants(RenderLayer*);
242
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000243 // 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 +0000244 void recursiveRepaintLayerRect(RenderLayer*, const IntRect&);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000245
simon.fraser@apple.comc7744c22012-05-31 23:25:05 +0000246 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed);
247 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancestorLayer = 0);
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000248
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000249 void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*);
250
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000251 // Returns true if any layer's compositing changed
simon.fraser@apple.comf57fac52012-06-05 22:18:31 +0000252 void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged, bool& descendantHas3DTransform);
simon.fraser@apple.com90c94a12009-11-30 03:21:55 +0000253
254 // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer.
simon.fraser@apple.comd6c56022012-04-27 01:40:10 +0000255 void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer, int depth);
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000256
simon.fraser@apple.com90c94a12009-11-30 03:21:55 +0000257 // Recurses down the tree, updating layer geometry only.
simon.fraser@apple.comd6c56022012-04-27 01:40:10 +0000258 void updateLayerTreeGeometry(RenderLayer*, int depth);
simon.fraser@apple.com90c94a12009-11-30 03:21:55 +0000259
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000260 // Hook compositing layers together
261 void setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer);
262 void removeCompositedChildren(RenderLayer*);
263
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000264 bool layerHas3DContent(const RenderLayer*) const;
simon.fraser@apple.comce9b3f02012-05-03 17:50:03 +0000265 bool isRunningAcceleratedTransformAnimation(RenderObject*) const;
266
simon.fraser@apple.com47560da2011-10-21 03:02:05 +0000267 bool hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const;
simon.fraser@apple.com61cf5eb2009-02-13 05:10:12 +0000268
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000269 void ensureRootLayer();
270 void destroyRootLayer();
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000271
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000272 void attachRootLayer(RootLayerAttachment);
273 void detachRootLayer();
cmarrin@apple.com89072a02009-06-25 22:03:59 +0000274
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000275 void rootLayerAttachmentChanged();
jamesr@google.come53ce642011-04-14 06:51:50 +0000276
277 void updateOverflowControlsLayers();
278
simon.fraser@apple.comfb20cde2010-05-13 03:27:47 +0000279 void notifyIFramesOfCompositingChange();
simon.fraser@apple.comc0c558c2010-05-11 05:44:06 +0000280
simon.fraser@apple.comd73911e2011-07-22 01:02:35 +0000281 bool isFlushingLayers() const { return m_flushingLayers; }
282
jamesr@google.com0abe0062012-02-18 00:23:16 +0000283 ScrollingCoordinator* scrollingCoordinator() const;
284
simon.fraser@apple.com6b59a902009-03-17 20:01:31 +0000285 // Whether a running transition or animation enforces the need for a compositing layer.
simon.fraser@apple.com0ac1f062009-06-27 06:22:30 +0000286 bool requiresCompositingForAnimation(RenderObject*) const;
287 bool requiresCompositingForTransform(RenderObject*) const;
simon.fraser@apple.com98df11b2009-06-18 18:52:09 +0000288 bool requiresCompositingForVideo(RenderObject*) const;
cmarrin@apple.com4e7728f2009-08-27 23:55:44 +0000289 bool requiresCompositingForCanvas(RenderObject*) const;
simon.fraser@apple.comd6aff5e2010-01-12 00:15:06 +0000290 bool requiresCompositingForPlugin(RenderObject*) const;
cmarrin@apple.com8f4e0442011-04-11 22:21:11 +0000291 bool requiresCompositingForFrame(RenderObject*) const;
noam.rosenthal@nokia.come7d126c2012-01-06 23:13:02 +0000292 bool requiresCompositingForFilters(RenderObject*) const;
enne@google.com10778632011-08-11 19:44:45 +0000293 bool requiresCompositingForScrollableFrame() const;
vangelis@chromium.orge910d232011-10-27 20:28:40 +0000294 bool requiresCompositingForPosition(RenderObject*, const RenderLayer*) const;
simon.fraser@apple.comf57fac52012-06-05 22:18:31 +0000295 bool requiresCompositingForIndirectReason(RenderObject*, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const;
simon.fraser@apple.com6b59a902009-03-17 20:01:31 +0000296
simon.fraser@apple.com31b329f2010-07-26 17:48:13 +0000297 bool requiresScrollLayer(RootLayerAttachment) const;
jamesr@google.come53ce642011-04-14 06:51:50 +0000298 bool requiresHorizontalScrollbarLayer() const;
299 bool requiresVerticalScrollbarLayer() const;
300 bool requiresScrollCornerLayer() const;
andersca@apple.com134cfff2012-01-13 00:30:55 +0000301#if ENABLE(RUBBER_BANDING)
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000302 bool requiresOverhangAreasLayer() const;
andersca@apple.comb2abfa62012-02-08 20:24:57 +0000303 bool requiresContentShadowLayer() const;
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000304#endif
jamesr@google.come53ce642011-04-14 06:51:50 +0000305
simon.fraser@apple.coma7f01bd2012-04-25 04:30:13 +0000306#if !LOG_DISABLED
307 const char* reasonForCompositing(const RenderLayer*);
simon.fraser@apple.comd6c56022012-04-27 01:40:10 +0000308 void logLayerInfo(const RenderLayer*, int depth);
simon.fraser@apple.coma7f01bd2012-04-25 04:30:13 +0000309#endif
310
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000311private:
312 RenderView* m_renderView;
simon.fraser@apple.com2d3dba22011-07-12 22:21:29 +0000313 OwnPtr<GraphicsLayer> m_rootContentLayer;
simon.fraser@apple.combd174342010-08-25 18:24:17 +0000314 Timer<RenderLayerCompositor> m_updateCompositingLayersTimer;
315
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000316 bool m_hasAcceleratedCompositing;
vangelis@chromium.org1bbe6132010-11-30 20:41:59 +0000317 ChromeClient::CompositingTriggerFlags m_compositingTriggers;
318
simon.fraser@apple.com47560da2011-10-21 03:02:05 +0000319 int m_compositedLayerCount;
cmarrin@apple.comf2dff332009-11-18 19:23:44 +0000320 bool m_showDebugBorders;
321 bool m_showRepaintCounter;
simon.fraser@apple.com5cce05c2012-03-23 21:40:21 +0000322 bool m_acceleratedDrawingEnabled;
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000323 bool m_compositingConsultsOverlap;
simon.fraser@apple.combda41842010-07-13 00:40:47 +0000324
325 // When true, we have to wait until layout has happened before we can decide whether to enter compositing mode,
326 // because only then do we know the final size of plugins and iframes.
simon.fraser@apple.com06a2bbb2012-04-20 21:54:45 +0000327 mutable bool m_reevaluateCompositingAfterLayout;
vangelis@chromium.orge910d232011-10-27 20:28:40 +0000328
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000329 bool m_compositing;
simon.fraser@apple.com02f40492009-07-07 17:15:16 +0000330 bool m_compositingLayersNeedRebuild;
simon.fraser@apple.comc961f412011-01-20 03:20:47 +0000331 bool m_flushingLayers;
commit-queue@webkit.orga8f8e9e2011-03-16 23:37:48 +0000332 bool m_forceCompositingMode;
simon.fraser@apple.combda41842010-07-13 00:40:47 +0000333
simon.fraser@apple.com509623e2010-05-11 05:33:23 +0000334 RootLayerAttachment m_rootLayerAttachment;
cmarrin@apple.com10c77cf2010-05-05 01:50:03 +0000335
336 // Enclosing clipping layer for iframe content
simon.fraser@apple.come38ba062010-05-13 23:14:46 +0000337 OwnPtr<GraphicsLayer> m_clipLayer;
338 OwnPtr<GraphicsLayer> m_scrollLayer;
jamesr@google.come53ce642011-04-14 06:51:50 +0000339
340 // Enclosing layer for overflow controls and the clipping layer
341 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
342
343 // Layers for overflow controls
344 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
345 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
346 OwnPtr<GraphicsLayer> m_layerForScrollCorner;
andersca@apple.com134cfff2012-01-13 00:30:55 +0000347#if ENABLE(RUBBER_BANDING)
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000348 OwnPtr<GraphicsLayer> m_layerForOverhangAreas;
andersca@apple.comb2abfa62012-02-08 20:24:57 +0000349 OwnPtr<GraphicsLayer> m_contentShadowLayer;
commit-queue@webkit.org0a4465d2011-09-15 04:06:49 +0000350#endif
simon.fraser@apple.coma7f01bd2012-04-25 04:30:13 +0000351
352#if !LOG_DISABLED
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000353 int m_rootLayerUpdateCount;
simon.fraser@apple.coma7f01bd2012-04-25 04:30:13 +0000354 int m_obligateCompositedLayerCount; // count of layer that have to be composited.
355 int m_secondaryCompositedLayerCount; // count of layers that have to be composited because of stacking or overlap.
simon.fraser@apple.coma46313b2012-06-28 20:28:42 +0000356 double m_obligatoryBackingStoreBytes;
357 double m_secondaryBackingStoreBytes;
simon.fraser@apple.com6d640a02009-01-31 01:47:49 +0000358#endif
359};
360
361
362} // namespace WebCore
363
364#endif // RenderLayerCompositor_h