OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 24 matching lines...) Expand all Loading... |
35 * applicable instead of those above. If you wish to allow use of your | 35 * applicable instead of those above. If you wish to allow use of your |
36 * version of this file only under the terms of one of those two | 36 * version of this file only under the terms of one of those two |
37 * licenses (the MPL or the GPL) and not to allow others to use your | 37 * licenses (the MPL or the GPL) and not to allow others to use your |
38 * version of this file under the LGPL, indicate your decision by | 38 * version of this file under the LGPL, indicate your decision by |
39 * deletingthe provisions above and replace them with the notice and | 39 * deletingthe provisions above and replace them with the notice and |
40 * other provisions required by the MPL or the GPL, as the case may be. | 40 * other provisions required by the MPL or the GPL, as the case may be. |
41 * If you do not delete the provisions above, a recipient may use your | 41 * If you do not delete the provisions above, a recipient may use your |
42 * version of this file under any of the LGPL, the MPL or the GPL. | 42 * version of this file under any of the LGPL, the MPL or the GPL. |
43 */ | 43 */ |
44 | 44 |
45 #ifndef RenderLayer_h | 45 #ifndef Layer_h |
46 #define RenderLayer_h | 46 #define Layer_h |
47 | 47 |
48 #include "core/rendering/LayerFragment.h" | 48 #include "core/layout/LayerClipper.h" |
| 49 #include "core/layout/LayerFilterInfo.h" |
| 50 #include "core/layout/LayerFragment.h" |
| 51 #include "core/layout/LayerReflectionInfo.h" |
| 52 #include "core/layout/LayerScrollableArea.h" |
| 53 #include "core/layout/LayerStackingNode.h" |
| 54 #include "core/layout/LayerStackingNodeIterator.h" |
49 #include "core/rendering/RenderBox.h" | 55 #include "core/rendering/RenderBox.h" |
50 #include "core/rendering/RenderLayerClipper.h" | |
51 #include "core/rendering/RenderLayerFilterInfo.h" | |
52 #include "core/rendering/RenderLayerReflectionInfo.h" | |
53 #include "core/rendering/RenderLayerScrollableArea.h" | |
54 #include "core/rendering/RenderLayerStackingNode.h" | |
55 #include "core/rendering/RenderLayerStackingNodeIterator.h" | |
56 #include "platform/graphics/CompositingReasons.h" | 56 #include "platform/graphics/CompositingReasons.h" |
57 #include "public/platform/WebBlendMode.h" | 57 #include "public/platform/WebBlendMode.h" |
58 #include "wtf/OwnPtr.h" | 58 #include "wtf/OwnPtr.h" |
59 | 59 |
60 namespace blink { | 60 namespace blink { |
61 | 61 |
62 class FilterEffectRenderer; | 62 class FilterEffectRenderer; |
63 class FilterOperations; | 63 class FilterOperations; |
64 class HitTestRequest; | 64 class HitTestRequest; |
65 class HitTestResult; | 65 class HitTestResult; |
66 class HitTestingTransformState; | 66 class HitTestingTransformState; |
| 67 class LayerCompositor; |
67 class CompositedLayerMapping; | 68 class CompositedLayerMapping; |
68 class RenderLayerCompositor; | |
69 class RenderStyle; | 69 class RenderStyle; |
70 class TransformationMatrix; | 70 class TransformationMatrix; |
71 | 71 |
72 enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf }; | 72 enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf }; |
73 | 73 |
74 enum CompositingQueryMode { | 74 enum CompositingQueryMode { |
75 CompositingQueriesAreAllowed, | 75 CompositingQueriesAreAllowed, |
76 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases | 76 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases |
77 }; | 77 }; |
78 | 78 |
79 // FIXME: remove this once the compositing query ASSERTS are no longer hit. | 79 // FIXME: remove this once the compositing query ASSERTS are no longer hit. |
80 class DisableCompositingQueryAsserts { | 80 class DisableCompositingQueryAsserts { |
81 WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts); | 81 WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts); |
82 public: | 82 public: |
83 DisableCompositingQueryAsserts(); | 83 DisableCompositingQueryAsserts(); |
84 private: | 84 private: |
85 TemporaryChange<CompositingQueryMode> m_disabler; | 85 TemporaryChange<CompositingQueryMode> m_disabler; |
86 }; | 86 }; |
87 | 87 |
88 class RenderLayer { | 88 class Layer { |
89 WTF_MAKE_NONCOPYABLE(RenderLayer); | 89 WTF_MAKE_NONCOPYABLE(Layer); |
90 public: | 90 public: |
91 RenderLayer(RenderLayerModelObject*, LayerType); | 91 Layer(LayoutLayerModelObject*, LayerType); |
92 ~RenderLayer(); | 92 ~Layer(); |
93 | 93 |
94 String debugName() const; | 94 String debugName() const; |
95 | 95 |
96 RenderLayerModelObject* renderer() const { return m_renderer; } | 96 LayoutLayerModelObject* renderer() const { return m_renderer; } |
97 RenderBox* renderBox() const { return m_renderer && m_renderer->isBox() ? to
RenderBox(m_renderer) : 0; } | 97 RenderBox* renderBox() const { return m_renderer && m_renderer->isBox() ? to
RenderBox(m_renderer) : 0; } |
98 RenderLayer* parent() const { return m_parent; } | 98 Layer* parent() const { return m_parent; } |
99 RenderLayer* previousSibling() const { return m_previous; } | 99 Layer* previousSibling() const { return m_previous; } |
100 RenderLayer* nextSibling() const { return m_next; } | 100 Layer* nextSibling() const { return m_next; } |
101 RenderLayer* firstChild() const { return m_first; } | 101 Layer* firstChild() const { return m_first; } |
102 RenderLayer* lastChild() const { return m_last; } | 102 Layer* lastChild() const { return m_last; } |
103 | 103 |
104 const RenderLayer* compositingContainer() const; | 104 const Layer* compositingContainer() const; |
105 | 105 |
106 void addChild(RenderLayer* newChild, RenderLayer* beforeChild = 0); | 106 void addChild(Layer* newChild, Layer* beforeChild = 0); |
107 RenderLayer* removeChild(RenderLayer*); | 107 Layer* removeChild(Layer*); |
108 | 108 |
109 void removeOnlyThisLayer(); | 109 void removeOnlyThisLayer(); |
110 void insertOnlyThisLayer(); | 110 void insertOnlyThisLayer(); |
111 | 111 |
112 void styleChanged(StyleDifference, const RenderStyle* oldStyle); | 112 void styleChanged(StyleDifference, const RenderStyle* oldStyle); |
113 | 113 |
114 // FIXME: Many people call this function while it has out-of-date informatio
n. | 114 // FIXME: Many people call this function while it has out-of-date informatio
n. |
115 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } | 115 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } |
116 | 116 |
117 void setLayerType(LayerType layerType) { m_layerType = layerType; } | 117 void setLayerType(LayerType layerType) { m_layerType = layerType; } |
118 | 118 |
119 bool isTransparent() const { return renderer()->isTransparent() || renderer(
)->style()->hasBlendMode() || renderer()->hasMask(); } | 119 bool isTransparent() const { return renderer()->isTransparent() || renderer(
)->style()->hasBlendMode() || renderer()->hasMask(); } |
120 | 120 |
121 bool isReflection() const { return renderer()->isReplica(); } | 121 bool isReflection() const { return renderer()->isReplica(); } |
122 RenderLayerReflectionInfo* reflectionInfo() { return m_reflectionInfo.get();
} | 122 LayerReflectionInfo* reflectionInfo() { return m_reflectionInfo.get(); } |
123 const RenderLayerReflectionInfo* reflectionInfo() const { return m_reflectio
nInfo.get(); } | 123 const LayerReflectionInfo* reflectionInfo() const { return m_reflectionInfo.
get(); } |
124 | 124 |
125 const RenderLayer* root() const | 125 const Layer* root() const |
126 { | 126 { |
127 const RenderLayer* curr = this; | 127 const Layer* curr = this; |
128 while (curr->parent()) | 128 while (curr->parent()) |
129 curr = curr->parent(); | 129 curr = curr->parent(); |
130 return curr; | 130 return curr; |
131 } | 131 } |
132 | 132 |
133 const LayoutPoint& location() const { ASSERT(!m_needsPositionUpdate); return
m_location; } | 133 const LayoutPoint& location() const { ASSERT(!m_needsPositionUpdate); return
m_location; } |
134 // FIXME: size() should ASSERT(!m_needsPositionUpdate) as well, but that fai
ls in some tests, | 134 // FIXME: size() should ASSERT(!m_needsPositionUpdate) as well, but that fai
ls in some tests, |
135 // for example, fast/repaint/clipped-relative.html. | 135 // for example, fast/repaint/clipped-relative.html. |
136 const IntSize& size() const { return m_size; } | 136 const IntSize& size() const { return m_size; } |
137 void setSizeHackForLayoutTreeAsText(const IntSize& size) { m_size = size; } | 137 void setSizeHackForLayoutTreeAsText(const IntSize& size) { m_size = size; } |
138 | 138 |
139 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size()));
} | 139 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size()));
} |
140 | 140 |
141 bool isRootLayer() const { return m_isRootLayer; } | 141 bool isRootLayer() const { return m_isRootLayer; } |
142 | 142 |
143 RenderLayerCompositor* compositor() const; | 143 LayerCompositor* compositor() const; |
144 | 144 |
145 // Notification from the renderer that its content changed (e.g. current fra
me of image changed). | 145 // Notification from the renderer that its content changed (e.g. current fra
me of image changed). |
146 // Allows updates of layer content without invalidating paint. | 146 // Allows updates of layer content without invalidating paint. |
147 void contentChanged(ContentChangeType); | 147 void contentChanged(ContentChangeType); |
148 | 148 |
149 void updateLayerPositionsAfterLayout(); | 149 void updateLayerPositionsAfterLayout(); |
150 void updateLayerPositionsAfterOverflowScroll(); | 150 void updateLayerPositionsAfterOverflowScroll(); |
151 | 151 |
152 bool isPaginated() const { return m_isPaginated; } | 152 bool isPaginated() const { return m_isPaginated; } |
153 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination
Layer; } | 153 Layer* enclosingPaginationLayer() const { return m_enclosingPaginationLayer;
} |
154 | 154 |
155 void updateTransformationMatrix(); | 155 void updateTransformationMatrix(); |
156 RenderLayer* renderingContextRoot(); | 156 Layer* renderingContextRoot(); |
157 | 157 |
158 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow
Position; } | 158 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow
Position; } |
159 | 159 |
160 void blockSelectionGapsBoundsChanged(); | 160 void blockSelectionGapsBoundsChanged(); |
161 void addBlockSelectionGapsBounds(const LayoutRect&); | 161 void addBlockSelectionGapsBounds(const LayoutRect&); |
162 void clearBlockSelectionGapsBounds(); | 162 void clearBlockSelectionGapsBounds(); |
163 void invalidatePaintForBlockSelectionGaps(); | 163 void invalidatePaintForBlockSelectionGaps(); |
164 IntRect blockSelectionGapsBounds() const; | 164 IntRect blockSelectionGapsBounds() const; |
165 bool hasBlockSelectionGapBounds() const; | 165 bool hasBlockSelectionGapBounds() const; |
166 | 166 |
167 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } | 167 LayerStackingNode* stackingNode() { return m_stackingNode.get(); } |
168 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } | 168 const LayerStackingNode* stackingNode() const { return m_stackingNode.get();
} |
169 | 169 |
170 bool subtreeIsInvisible() const { return !hasVisibleContent() && !hasVisible
Descendant(); } | 170 bool subtreeIsInvisible() const { return !hasVisibleContent() && !hasVisible
Descendant(); } |
171 | 171 |
172 // FIXME: hasVisibleContent() should call updateDescendantDependentFlags() i
f m_visibleContentStatusDirty. | 172 // FIXME: hasVisibleContent() should call updateDescendantDependentFlags() i
f m_visibleContentStatusDirty. |
173 bool hasVisibleContent() const { ASSERT(!m_visibleContentStatusDirty); retur
n m_hasVisibleContent; } | 173 bool hasVisibleContent() const { ASSERT(!m_visibleContentStatusDirty); retur
n m_hasVisibleContent; } |
174 | 174 |
175 // FIXME: hasVisibleDescendant() should call updateDescendantDependentFlags(
) if m_visibleDescendantStatusDirty. | 175 // FIXME: hasVisibleDescendant() should call updateDescendantDependentFlags(
) if m_visibleDescendantStatusDirty. |
176 bool hasVisibleDescendant() const { ASSERT(!m_visibleDescendantStatusDirty);
return m_hasVisibleDescendant; } | 176 bool hasVisibleDescendant() const { ASSERT(!m_visibleDescendantStatusDirty);
return m_hasVisibleDescendant; } |
177 | 177 |
178 void dirtyVisibleContentStatus(); | 178 void dirtyVisibleContentStatus(); |
179 void potentiallyDirtyVisibleContentStatus(EVisibility); | 179 void potentiallyDirtyVisibleContentStatus(EVisibility); |
180 | 180 |
181 bool hasBoxDecorationsOrBackground() const; | 181 bool hasBoxDecorationsOrBackground() const; |
182 bool hasVisibleBoxDecorations() const; | 182 bool hasVisibleBoxDecorations() const; |
183 // True if this layer container renderers that paint. | 183 // True if this layer container renderers that paint. |
184 bool hasNonEmptyChildRenderers() const; | 184 bool hasNonEmptyChildRenderers() const; |
185 | 185 |
186 // Will ensure that hasNonCompositiedChild are up to date. | 186 // Will ensure that hasNonCompositiedChild are up to date. |
187 void updateScrollingStateAfterCompositingChange(); | 187 void updateScrollingStateAfterCompositingChange(); |
188 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} | 188 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent;
} |
189 bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState
()); return m_hasNonCompositedChild; } | 189 bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState
()); return m_hasNonCompositedChild; } |
190 | 190 |
191 // Gets the nearest enclosing positioned ancestor layer (also includes | 191 // Gets the nearest enclosing positioned ancestor layer (also includes |
192 // the <html> layer and the root layer). | 192 // the <html> layer and the root layer). |
193 RenderLayer* enclosingPositionedAncestor() const; | 193 Layer* enclosingPositionedAncestor() const; |
194 | 194 |
195 bool isPaintInvalidationContainer() const; | 195 bool isPaintInvalidationContainer() const; |
196 | 196 |
197 // Do *not* call this method unless you know what you are dooing. You probab
ly want to call enclosingCompositingLayerForPaintInvalidation() instead. | 197 // Do *not* call this method unless you know what you are dooing. You probab
ly want to call enclosingCompositingLayerForPaintInvalidation() instead. |
198 // If includeSelf is true, may return this. | 198 // If includeSelf is true, may return this. |
199 RenderLayer* enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot) cons
t; | 199 Layer* enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot) const; |
200 | 200 |
201 // Returns the enclosing layer root into which this layer paints, inclusive
of this one. Note that the enclosing layer may or may not have its own | 201 // Returns the enclosing layer root into which this layer paints, inclusive
of this one. Note that the enclosing layer may or may not have its own |
202 // GraphicsLayer backing, but is nevertheless the root for a call to the Ren
derLayer::paint*() methods. | 202 // GraphicsLayer backing, but is nevertheless the root for a call to the Lay
er::paint*() methods. |
203 RenderLayer* enclosingLayerForPaintInvalidation() const; | 203 Layer* enclosingLayerForPaintInvalidation() const; |
204 | 204 |
205 RenderLayer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() con
st; | 205 Layer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const; |
206 | 206 |
207 bool hasAncestorWithFilterOutsets() const; | 207 bool hasAncestorWithFilterOutsets() const; |
208 | 208 |
209 bool canUseConvertToLayerCoords() const | 209 bool canUseConvertToLayerCoords() const |
210 { | 210 { |
211 // These RenderObjects have an impact on their layers without the render
ers knowing about it. | 211 // These RenderObjects have an impact on their layers without the render
ers knowing about it. |
212 return !renderer()->hasColumns() && !renderer()->hasTransformRelatedProp
erty() && !renderer()->isSVGRoot(); | 212 return !renderer()->hasColumns() && !renderer()->hasTransformRelatedProp
erty() && !renderer()->isSVGRoot(); |
213 } | 213 } |
214 | 214 |
215 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co
nst; | 215 void convertToLayerCoords(const Layer* ancestorLayer, LayoutPoint&) const; |
216 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con
st; | 216 void convertToLayerCoords(const Layer* ancestorLayer, LayoutRect&) const; |
217 | 217 |
218 // Does the same as convertToLayerCoords() when not in multicol. For multico
l, however, | 218 // Does the same as convertToLayerCoords() when not in multicol. For multico
l, however, |
219 // convertToLayerCoords() calculates the offset in flow-thread coordinates (
what the layout | 219 // convertToLayerCoords() calculates the offset in flow-thread coordinates (
what the layout |
220 // engine uses internally), while this method calculates the visual coordina
tes; i.e. it figures | 220 // engine uses internally), while this method calculates the visual coordina
tes; i.e. it figures |
221 // out which column the layer starts in and adds in the offset. See | 221 // out which column the layer starts in and adds in the offset. See |
222 // http://www.chromium.org/developers/design-documents/multi-column-layout f
or more info. | 222 // http://www.chromium.org/developers/design-documents/multi-column-layout f
or more info. |
223 LayoutPoint visualOffsetFromAncestor(const RenderLayer* ancestorLayer) const
; | 223 LayoutPoint visualOffsetFromAncestor(const Layer* ancestorLayer) const; |
224 | 224 |
225 // The hitTest() method looks for mouse events by walking layers that inters
ect the point from front to back. | 225 // The hitTest() method looks for mouse events by walking layers that inters
ect the point from front to back. |
226 bool hitTest(const HitTestRequest&, HitTestResult&); | 226 bool hitTest(const HitTestRequest&, HitTestResult&); |
227 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); | 227 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); |
228 | 228 |
229 // Pass offsetFromRoot if known. | 229 // Pass offsetFromRoot if known. |
230 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d
amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0)
const; | 230 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d
amageRect, const Layer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const; |
231 | 231 |
232 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know
n. | 232 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know
n. |
233 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou
tPoint* offsetFromRoot = 0) const; | 233 LayoutRect physicalBoundingBox(const Layer* ancestorLayer, const LayoutPoint
* offsetFromRoot = 0) const; |
234 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R
enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const; | 234 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const L
ayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const; |
235 LayoutRect fragmentsBoundingBox(const RenderLayer* ancestorLayer) const; | 235 LayoutRect fragmentsBoundingBox(const Layer* ancestorLayer) const; |
236 | 236 |
237 LayoutRect boundingBoxForCompositingOverlapTest() const; | 237 LayoutRect boundingBoxForCompositingOverlapTest() const; |
238 | 238 |
239 // If true, this layer's children are included in its bounds for overlap tes
ting. | 239 // If true, this layer's children are included in its bounds for overlap tes
ting. |
240 // We can't rely on the children's positions if this layer has a filter that
could have moved the children's pixels around. | 240 // We can't rely on the children's positions if this layer has a filter that
could have moved the children's pixels around. |
241 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer()
->style()->filter().hasFilterThatMovesPixels(); } | 241 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer()
->style()->filter().hasFilterThatMovesPixels(); } |
242 | 242 |
243 enum CalculateBoundsOptions { | 243 enum CalculateBoundsOptions { |
244 ApplyBoundsChickenEggHacks, | 244 ApplyBoundsChickenEggHacks, |
245 DoNotApplyBoundsChickenEggHacks, | 245 DoNotApplyBoundsChickenEggHacks, |
246 }; | 246 }; |
247 LayoutRect boundingBoxForCompositing(const RenderLayer* ancestorLayer = 0, C
alculateBoundsOptions = DoNotApplyBoundsChickenEggHacks) const; | 247 LayoutRect boundingBoxForCompositing(const Layer* ancestorLayer = 0, Calcula
teBoundsOptions = DoNotApplyBoundsChickenEggHacks) const; |
248 | 248 |
249 LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; } | 249 LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; } |
250 LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; } | 250 LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; } |
251 | 251 |
252 void setStaticInlinePosition(LayoutUnit position) { m_staticInlinePosition =
position; } | 252 void setStaticInlinePosition(LayoutUnit position) { m_staticInlinePosition =
position; } |
253 void setStaticBlockPosition(LayoutUnit position) { m_staticBlockPosition = p
osition; } | 253 void setStaticBlockPosition(LayoutUnit position) { m_staticBlockPosition = p
osition; } |
254 | 254 |
255 LayoutSize subpixelAccumulation() const; | 255 LayoutSize subpixelAccumulation() const; |
256 void setSubpixelAccumulation(const LayoutSize&); | 256 void setSubpixelAccumulation(const LayoutSize&); |
257 | 257 |
(...skipping 17 matching lines...) Expand all Loading... |
275 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } | 275 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } |
276 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } | 276 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } |
277 | 277 |
278 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 | 278 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 |
279 bool shouldPreserve3D() const { return !renderer()->hasReflection() && rende
rer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } | 279 bool shouldPreserve3D() const { return !renderer()->hasReflection() && rende
rer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } |
280 | 280 |
281 void filterNeedsPaintInvalidation(); | 281 void filterNeedsPaintInvalidation(); |
282 bool hasFilter() const { return renderer()->hasFilter(); } | 282 bool hasFilter() const { return renderer()->hasFilter(); } |
283 | 283 |
284 void* operator new(size_t); | 284 void* operator new(size_t); |
285 // Only safe to call from RenderLayerModelObject::destroyLayer() | 285 // Only safe to call from LayoutLayerModelObject::destroyLayer() |
286 void operator delete(void*); | 286 void operator delete(void*); |
287 | 287 |
288 CompositingState compositingState() const; | 288 CompositingState compositingState() const; |
289 | 289 |
290 // This returns true if our document is in a phase of its lifestyle during w
hich | 290 // This returns true if our document is in a phase of its lifestyle during w
hich |
291 // compositing state may legally be read. | 291 // compositing state may legally be read. |
292 bool isAllowedToQueryCompositingState() const; | 292 bool isAllowedToQueryCompositingState() const; |
293 | 293 |
294 // Don't null check this. | 294 // Don't null check this. |
295 CompositedLayerMapping* compositedLayerMapping() const; | 295 CompositedLayerMapping* compositedLayerMapping() const; |
296 GraphicsLayer* graphicsLayerBacking() const; | 296 GraphicsLayer* graphicsLayerBacking() const; |
297 GraphicsLayer* graphicsLayerBackingForScrolling() const; | 297 GraphicsLayer* graphicsLayerBackingForScrolling() const; |
298 // NOTE: If you are using hasCompositedLayerMapping to determine the state o
f compositing for this layer, | 298 // NOTE: If you are using hasCompositedLayerMapping to determine the state o
f compositing for this layer, |
299 // (and not just to do bookkeeping related to the mapping like, say, allocat
ing or deallocating a mapping), | 299 // (and not just to do bookkeeping related to the mapping like, say, allocat
ing or deallocating a mapping), |
300 // then you may have incorrect logic. Use compositingState() instead. | 300 // then you may have incorrect logic. Use compositingState() instead. |
301 // FIXME: This is identical to null checking compositedLayerMapping(), why n
ot just call that? | 301 // FIXME: This is identical to null checking compositedLayerMapping(), why n
ot just call that? |
302 bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get
(); } | 302 bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get
(); } |
303 void ensureCompositedLayerMapping(); | 303 void ensureCompositedLayerMapping(); |
304 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); | 304 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); |
305 CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; } | 305 CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; } |
306 void setGroupedMapping(CompositedLayerMapping* groupedMapping, bool layerBei
ngDestroyed = false); | 306 void setGroupedMapping(CompositedLayerMapping* groupedMapping, bool layerBei
ngDestroyed = false); |
307 | 307 |
308 bool hasCompositedMask() const; | 308 bool hasCompositedMask() const; |
309 bool hasCompositedClippingMask() const; | 309 bool hasCompositedClippingMask() const; |
310 bool needsCompositedScrolling() const { return m_scrollableArea && m_scrolla
bleArea->needsCompositedScrolling(); } | 310 bool needsCompositedScrolling() const { return m_scrollableArea && m_scrolla
bleArea->needsCompositedScrolling(); } |
311 | 311 |
312 // Computes the position of the given render object in the space of |paintIn
validationContainer|. | 312 // Computes the position of the given render object in the space of |paintIn
validationContainer|. |
313 // FIXME: invert the logic to have paint invalidation containers take care o
f painting objects into them, rather than the reverse. | 313 // FIXME: invert the logic to have paint invalidation containers take care o
f painting objects into them, rather than the reverse. |
314 // This will allow us to clean up this static method messiness. | 314 // This will allow us to clean up this static method messiness. |
315 static LayoutPoint positionFromPaintInvalidationBacking(const RenderObject*,
const RenderLayerModelObject* paintInvalidationContainer, const PaintInvalidati
onState* = 0); | 315 static LayoutPoint positionFromPaintInvalidationBacking(const RenderObject*,
const LayoutLayerModelObject* paintInvalidationContainer, const PaintInvalidati
onState* = 0); |
316 | 316 |
317 static void mapPointToPaintBackingCoordinates(const RenderLayerModelObject*
paintInvalidationContainer, FloatPoint&); | 317 static void mapPointToPaintBackingCoordinates(const LayoutLayerModelObject*
paintInvalidationContainer, FloatPoint&); |
318 static void mapRectToPaintBackingCoordinates(const RenderLayerModelObject* p
aintInvalidationContainer, LayoutRect&); | 318 static void mapRectToPaintBackingCoordinates(const LayoutLayerModelObject* p
aintInvalidationContainer, LayoutRect&); |
319 | 319 |
320 // Adjusts the given rect (in the coordinate space of the RenderObject) to t
he coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. | 320 // Adjusts the given rect (in the coordinate space of the RenderObject) to t
he coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. |
321 static void mapRectToPaintInvalidationBacking(const RenderObject*, const Ren
derLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalid
ationState* = 0); | 321 static void mapRectToPaintInvalidationBacking(const RenderObject*, const Lay
outLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalid
ationState* = 0); |
322 | 322 |
323 // Computes the bounding paint invalidation rect for |renderObject|, in the
coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. | 323 // Computes the bounding paint invalidation rect for |renderObject|, in the
coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. |
324 static LayoutRect computePaintInvalidationRect(const RenderObject*, const Re
nderLayer* paintInvalidationContainer, const PaintInvalidationState* = 0); | 324 static LayoutRect computePaintInvalidationRect(const RenderObject*, const La
yer* paintInvalidationContainer, const PaintInvalidationState* = 0); |
325 | 325 |
326 bool paintsWithTransparency(PaintBehavior paintBehavior) const | 326 bool paintsWithTransparency(PaintBehavior paintBehavior) const |
327 { | 327 { |
328 return isTransparent() && ((paintBehavior & PaintBehaviorFlattenComposit
ingLayers) || compositingState() != PaintsIntoOwnBacking); | 328 return isTransparent() && ((paintBehavior & PaintBehaviorFlattenComposit
ingLayers) || compositingState() != PaintsIntoOwnBacking); |
329 } | 329 } |
330 | 330 |
331 bool paintsWithTransform(PaintBehavior) const; | 331 bool paintsWithTransform(PaintBehavior) const; |
332 | 332 |
333 // Returns true if background phase is painted opaque in the given rect. | 333 // Returns true if background phase is painted opaque in the given rect. |
334 // The query rect is given in local coordinates. | 334 // The query rect is given in local coordinates. |
335 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const; | 335 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const; |
336 | 336 |
337 bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayS
crollbars; } | 337 bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayS
crollbars; } |
338 void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDir
tyOverlayScrollbars = dirtyScrollbars; } | 338 void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDir
tyOverlayScrollbars = dirtyScrollbars; } |
339 | 339 |
340 FilterOperations computeFilterOperations(const RenderStyle*); | 340 FilterOperations computeFilterOperations(const RenderStyle*); |
341 bool paintsWithFilters() const; | 341 bool paintsWithFilters() const; |
342 FilterEffectRenderer* filterRenderer() const | 342 FilterEffectRenderer* filterRenderer() const |
343 { | 343 { |
344 RenderLayerFilterInfo* filterInfo = this->filterInfo(); | 344 LayerFilterInfo* filterInfo = this->filterInfo(); |
345 return filterInfo ? filterInfo->renderer() : 0; | 345 return filterInfo ? filterInfo->renderer() : 0; |
346 } | 346 } |
347 | 347 |
348 RenderLayerFilterInfo* filterInfo() const { return hasFilterInfo() ? RenderL
ayerFilterInfo::filterInfoForRenderLayer(this) : 0; } | 348 LayerFilterInfo* filterInfo() const { return hasFilterInfo() ? LayerFilterIn
fo::filterInfoForLayer(this) : 0; } |
349 RenderLayerFilterInfo* ensureFilterInfo() { return RenderLayerFilterInfo::cr
eateFilterInfoForRenderLayerIfNeeded(this); } | 349 LayerFilterInfo* ensureFilterInfo() { return LayerFilterInfo::createFilterIn
foForLayerIfNeeded(this); } |
350 void removeFilterInfoIfNeeded() | 350 void removeFilterInfoIfNeeded() |
351 { | 351 { |
352 if (hasFilterInfo()) | 352 if (hasFilterInfo()) |
353 RenderLayerFilterInfo::removeFilterInfoForRenderLayer(this); | 353 LayerFilterInfo::removeFilterInfoForLayer(this); |
354 } | 354 } |
355 | 355 |
356 bool hasFilterInfo() const { return m_hasFilterInfo; } | 356 bool hasFilterInfo() const { return m_hasFilterInfo; } |
357 void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo;
} | 357 void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo;
} |
358 | 358 |
359 void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
; | 359 void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
; |
360 | 360 |
361 Node* enclosingElement() const; | 361 Node* enclosingElement() const; |
362 | 362 |
363 bool isInTopLayer() const; | 363 bool isInTopLayer() const; |
364 | 364 |
365 bool scrollsWithViewport() const; | 365 bool scrollsWithViewport() const; |
366 bool scrollsWithRespectTo(const RenderLayer*) const; | 366 bool scrollsWithRespectTo(const Layer*) const; |
367 | 367 |
368 void addLayerHitTestRects(LayerHitTestRects&) const; | 368 void addLayerHitTestRects(LayerHitTestRects&) const; |
369 | 369 |
370 // Compute rects only for this layer | 370 // Compute rects only for this layer |
371 void computeSelfHitTestRects(LayerHitTestRects&) const; | 371 void computeSelfHitTestRects(LayerHitTestRects&) const; |
372 | 372 |
373 // FIXME: This should probably return a ScrollableArea but a lot of internal
methods are mistakenly exposed. | 373 // FIXME: This should probably return a ScrollableArea but a lot of internal
methods are mistakenly exposed. |
374 RenderLayerScrollableArea* scrollableArea() const { return m_scrollableArea.
get(); } | 374 LayerScrollableArea* scrollableArea() const { return m_scrollableArea.get();
} |
375 RenderLayerClipper& clipper() { return m_clipper; } | 375 LayerClipper& clipper() { return m_clipper; } |
376 const RenderLayerClipper& clipper() const { return m_clipper; } | 376 const LayerClipper& clipper() const { return m_clipper; } |
377 | 377 |
378 inline bool isPositionedContainer() const | 378 inline bool isPositionedContainer() const |
379 { | 379 { |
380 // FIXME: This is not in sync with containingBlock. | 380 // FIXME: This is not in sync with containingBlock. |
381 // RenderObject::canContainFixedPositionedObject() should probably be us
ed | 381 // RenderObject::canContainFixedPositionedObject() should probably be us
ed |
382 // instead. | 382 // instead. |
383 RenderLayerModelObject* layerRenderer = renderer(); | 383 LayoutLayerModelObject* layerRenderer = renderer(); |
384 return isRootLayer() || layerRenderer->isPositioned() || hasTransformRel
atedProperty(); | 384 return isRootLayer() || layerRenderer->isPositioned() || hasTransformRel
atedProperty(); |
385 } | 385 } |
386 | 386 |
387 bool scrollsOverflow() const; | 387 bool scrollsOverflow() const; |
388 | 388 |
389 CompositingReasons potentialCompositingReasonsFromStyle() const { return m_p
otentialCompositingReasonsFromStyle; } | 389 CompositingReasons potentialCompositingReasonsFromStyle() const { return m_p
otentialCompositingReasonsFromStyle; } |
390 void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { A
SSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m
_potentialCompositingReasonsFromStyle = reasons; } | 390 void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { A
SSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m
_potentialCompositingReasonsFromStyle = reasons; } |
391 | 391 |
392 bool hasStyleDeterminedDirectCompositingReasons() const { return m_potential
CompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReas
ons; } | 392 bool hasStyleDeterminedDirectCompositingReasons() const { return m_potential
CompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReas
ons; } |
393 | 393 |
394 class AncestorDependentCompositingInputs { | 394 class AncestorDependentCompositingInputs { |
395 public: | 395 public: |
396 AncestorDependentCompositingInputs() | 396 AncestorDependentCompositingInputs() |
397 : opacityAncestor(0) | 397 : opacityAncestor(0) |
398 , transformAncestor(0) | 398 , transformAncestor(0) |
399 , filterAncestor(0) | 399 , filterAncestor(0) |
400 , clippingContainer(0) | 400 , clippingContainer(0) |
401 , ancestorScrollingLayer(0) | 401 , ancestorScrollingLayer(0) |
402 , scrollParent(0) | 402 , scrollParent(0) |
403 , clipParent(0) | 403 , clipParent(0) |
404 , hasAncestorWithClipPath(false) | 404 , hasAncestorWithClipPath(false) |
405 { } | 405 { } |
406 | 406 |
407 IntRect clippedAbsoluteBoundingBox; | 407 IntRect clippedAbsoluteBoundingBox; |
408 const RenderLayer* opacityAncestor; | 408 const Layer* opacityAncestor; |
409 const RenderLayer* transformAncestor; | 409 const Layer* transformAncestor; |
410 const RenderLayer* filterAncestor; | 410 const Layer* filterAncestor; |
411 const RenderObject* clippingContainer; | 411 const RenderObject* clippingContainer; |
412 const RenderLayer* ancestorScrollingLayer; | 412 const Layer* ancestorScrollingLayer; |
413 | 413 |
414 // A scroll parent is a compositor concept. It's only needed in blink | 414 // A scroll parent is a compositor concept. It's only needed in blink |
415 // because we need to use it as a promotion trigger. A layer has a | 415 // because we need to use it as a promotion trigger. A layer has a |
416 // scroll parent if neither its compositor scrolling ancestor, nor any | 416 // scroll parent if neither its compositor scrolling ancestor, nor any |
417 // other layer scrolled by this ancestor, is a stacking ancestor of this | 417 // other layer scrolled by this ancestor, is a stacking ancestor of this |
418 // layer. Layers with scroll parents must be scrolled with the main | 418 // layer. Layers with scroll parents must be scrolled with the main |
419 // scrolling layer by the compositor. | 419 // scrolling layer by the compositor. |
420 const RenderLayer* scrollParent; | 420 const Layer* scrollParent; |
421 | 421 |
422 // A clip parent is another compositor concept that has leaked into | 422 // A clip parent is another compositor concept that has leaked into |
423 // blink so that it may be used as a promotion trigger. Layers with clip | 423 // blink so that it may be used as a promotion trigger. Layers with clip |
424 // parents escape the clip of a stacking tree ancestor. The compositor | 424 // parents escape the clip of a stacking tree ancestor. The compositor |
425 // needs to know about clip parents in order to circumvent its normal | 425 // needs to know about clip parents in order to circumvent its normal |
426 // clipping logic. | 426 // clipping logic. |
427 const RenderLayer* clipParent; | 427 const Layer* clipParent; |
428 | 428 |
429 unsigned hasAncestorWithClipPath : 1; | 429 unsigned hasAncestorWithClipPath : 1; |
430 }; | 430 }; |
431 | 431 |
432 class DescendantDependentCompositingInputs { | 432 class DescendantDependentCompositingInputs { |
433 public: | 433 public: |
434 DescendantDependentCompositingInputs() | 434 DescendantDependentCompositingInputs() |
435 : hasDescendantWithClipPath(false) | 435 : hasDescendantWithClipPath(false) |
436 , hasNonIsolatedDescendantWithBlendMode(false) | 436 , hasNonIsolatedDescendantWithBlendMode(false) |
437 { } | 437 { } |
(...skipping 13 matching lines...) Expand all Loading... |
451 } | 451 } |
452 | 452 |
453 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi
tingInputs&); | 453 void updateAncestorDependentCompositingInputs(const AncestorDependentComposi
tingInputs&); |
454 void updateDescendantDependentCompositingInputs(const DescendantDependentCom
positingInputs&); | 454 void updateDescendantDependentCompositingInputs(const DescendantDependentCom
positingInputs&); |
455 void didUpdateCompositingInputs(); | 455 void didUpdateCompositingInputs(); |
456 | 456 |
457 const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs
() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_an
cestorDependentCompositingInputs; } | 457 const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs
() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_an
cestorDependentCompositingInputs; } |
458 const DescendantDependentCompositingInputs& descendantDependentCompositingIn
puts() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); retur
n m_descendantDependentCompositingInputs; } | 458 const DescendantDependentCompositingInputs& descendantDependentCompositingIn
puts() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); retur
n m_descendantDependentCompositingInputs; } |
459 | 459 |
460 IntRect clippedAbsoluteBoundingBox() const { return ancestorDependentComposi
tingInputs().clippedAbsoluteBoundingBox; } | 460 IntRect clippedAbsoluteBoundingBox() const { return ancestorDependentComposi
tingInputs().clippedAbsoluteBoundingBox; } |
461 const RenderLayer* opacityAncestor() const { return ancestorDependentComposi
tingInputs().opacityAncestor; } | 461 const Layer* opacityAncestor() const { return ancestorDependentCompositingIn
puts().opacityAncestor; } |
462 const RenderLayer* transformAncestor() const { return ancestorDependentCompo
sitingInputs().transformAncestor; } | 462 const Layer* transformAncestor() const { return ancestorDependentCompositing
Inputs().transformAncestor; } |
463 const RenderLayer* filterAncestor() const { return ancestorDependentComposit
ingInputs().filterAncestor; } | 463 const Layer* filterAncestor() const { return ancestorDependentCompositingInp
uts().filterAncestor; } |
464 const RenderObject* clippingContainer() const { return ancestorDependentComp
ositingInputs().clippingContainer; } | 464 const RenderObject* clippingContainer() const { return ancestorDependentComp
ositingInputs().clippingContainer; } |
465 const RenderLayer* ancestorScrollingLayer() const { return ancestorDependent
CompositingInputs().ancestorScrollingLayer; } | 465 const Layer* ancestorScrollingLayer() const { return ancestorDependentCompos
itingInputs().ancestorScrollingLayer; } |
466 RenderLayer* scrollParent() const { return const_cast<RenderLayer*>(ancestor
DependentCompositingInputs().scrollParent); } | 466 Layer* scrollParent() const { return const_cast<Layer*>(ancestorDependentCom
positingInputs().scrollParent); } |
467 RenderLayer* clipParent() const { return const_cast<RenderLayer*>(ancestorDe
pendentCompositingInputs().clipParent); } | 467 Layer* clipParent() const { return const_cast<Layer*>(ancestorDependentCompo
sitingInputs().clipParent); } |
468 bool hasAncestorWithClipPath() const { return ancestorDependentCompositingIn
puts().hasAncestorWithClipPath; } | 468 bool hasAncestorWithClipPath() const { return ancestorDependentCompositingIn
puts().hasAncestorWithClipPath; } |
469 bool hasDescendantWithClipPath() const { return descendantDependentCompositi
ngInputs().hasDescendantWithClipPath; } | 469 bool hasDescendantWithClipPath() const { return descendantDependentCompositi
ngInputs().hasDescendantWithClipPath; } |
470 bool hasNonIsolatedDescendantWithBlendMode() const; | 470 bool hasNonIsolatedDescendantWithBlendMode() const; |
471 | 471 |
472 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } | 472 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } |
473 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } | 473 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } |
474 | 474 |
475 CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompo
sitingState()); return m_compositingReasons; } | 475 CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompo
sitingState()); return m_compositingReasons; } |
476 void setCompositingReasons(CompositingReasons, CompositingReasons mask = Com
positingReasonAll); | 476 void setCompositingReasons(CompositingReasons, CompositingReasons mask = Com
positingReasonAll); |
477 | 477 |
478 bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingSt
ate()); return m_hasCompositingDescendant; } | 478 bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingSt
ate()); return m_hasCompositingDescendant; } |
479 void setHasCompositingDescendant(bool); | 479 void setHasCompositingDescendant(bool); |
480 | 480 |
481 bool shouldIsolateCompositedDescendants() const { ASSERT(isAllowedToQueryCom
positingState()); return m_shouldIsolateCompositedDescendants; } | 481 bool shouldIsolateCompositedDescendants() const { ASSERT(isAllowedToQueryCom
positingState()); return m_shouldIsolateCompositedDescendants; } |
482 void setShouldIsolateCompositedDescendants(bool); | 482 void setShouldIsolateCompositedDescendants(bool); |
483 | 483 |
484 void updateDescendantDependentFlags(); | 484 void updateDescendantDependentFlags(); |
485 void updateDescendantDependentFlagsForEntireSubtree(); | 485 void updateDescendantDependentFlagsForEntireSubtree(); |
486 | 486 |
487 void updateOrRemoveFilterEffectRenderer(); | 487 void updateOrRemoveFilterEffectRenderer(); |
488 | 488 |
489 void updateSelfPaintingLayer(); | 489 void updateSelfPaintingLayer(); |
490 | 490 |
491 RenderLayer* enclosingTransformedAncestor() const; | 491 Layer* enclosingTransformedAncestor() const; |
492 LayoutPoint computeOffsetFromTransformedAncestor() const; | 492 LayoutPoint computeOffsetFromTransformedAncestor() const; |
493 | 493 |
494 void didUpdateNeedsCompositedScrolling(); | 494 void didUpdateNeedsCompositedScrolling(); |
495 | 495 |
496 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 496 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
497 | 497 |
498 bool hasSelfPaintingLayerDescendant() const | 498 bool hasSelfPaintingLayerDescendant() const |
499 { | 499 { |
500 if (m_hasSelfPaintingLayerDescendantDirty) | 500 if (m_hasSelfPaintingLayerDescendantDirty) |
501 updateHasSelfPaintingLayerDescendant(); | 501 updateHasSelfPaintingLayerDescendant(); |
502 ASSERT(!m_hasSelfPaintingLayerDescendantDirty); | 502 ASSERT(!m_hasSelfPaintingLayerDescendantDirty); |
503 return m_hasSelfPaintingLayerDescendant; | 503 return m_hasSelfPaintingLayerDescendant; |
504 } | 504 } |
505 LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& pa
intDirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior); | 505 LayoutRect paintingExtent(const Layer* rootLayer, const LayoutRect& paintDir
tyRect, const LayoutSize& subPixelAccumulation, PaintBehavior); |
506 void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const L
ayoutRect& dirtyRect, | 506 void collectFragments(LayerFragments&, const Layer* rootLayer, const LayoutR
ect& dirtyRect, |
507 ClipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSize
Relevancy = IgnoreOverlayScrollbarSize, | 507 ClipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSize
Relevancy = IgnoreOverlayScrollbarSize, |
508 ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offs
etFromRoot = 0, | 508 ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offs
etFromRoot = 0, |
509 const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect*
layerBoundingBox = 0); | 509 const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect*
layerBoundingBox = 0); |
510 | 510 |
511 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende
rBox(renderer())->location() : LayoutPoint(); } | 511 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende
rBox(renderer())->location() : LayoutPoint(); } |
512 | 512 |
513 enum TransparencyClipBoxBehavior { | 513 enum TransparencyClipBoxBehavior { |
514 PaintingTransparencyClipBox, | 514 PaintingTransparencyClipBox, |
515 HitTestingTransparencyClipBox | 515 HitTestingTransparencyClipBox |
516 }; | 516 }; |
517 | 517 |
518 enum TransparencyClipBoxMode { | 518 enum TransparencyClipBoxMode { |
519 DescendantsOfTransparencyClipBox, | 519 DescendantsOfTransparencyClipBox, |
520 RootOfTransparencyClipBox | 520 RootOfTransparencyClipBox |
521 }; | 521 }; |
522 | 522 |
523 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer*
rootLayer, TransparencyClipBoxBehavior transparencyBehavior, | 523 static LayoutRect transparencyClipBox(const Layer*, const Layer* rootLayer,
TransparencyClipBoxBehavior transparencyBehavior, |
524 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccu
mulation, PaintBehavior = 0); | 524 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccu
mulation, PaintBehavior = 0); |
525 | 525 |
526 private: | 526 private: |
527 // Bounding box in the coordinates of this layer. | 527 // Bounding box in the coordinates of this layer. |
528 LayoutRect logicalBoundingBox() const; | 528 LayoutRect logicalBoundingBox() const; |
529 | 529 |
530 bool hasOverflowControls() const; | 530 bool hasOverflowControls() const; |
531 | 531 |
532 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 532 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
533 | 533 |
534 // Returns true if the position changed. | 534 // Returns true if the position changed. |
535 bool updateLayerPosition(); | 535 bool updateLayerPosition(); |
536 | 536 |
537 void updateLayerPositionRecursive(); | 537 void updateLayerPositionRecursive(); |
538 void updateLayerPositionsAfterScrollRecursive(); | 538 void updateLayerPositionsAfterScrollRecursive(); |
539 | 539 |
540 void setNextSibling(RenderLayer* next) { m_next = next; } | 540 void setNextSibling(Layer* next) { m_next = next; } |
541 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } | 541 void setPreviousSibling(Layer* prev) { m_previous = prev; } |
542 void setFirstChild(RenderLayer* first) { m_first = first; } | 542 void setFirstChild(Layer* first) { m_first = first; } |
543 void setLastChild(RenderLayer* last) { m_last = last; } | 543 void setLastChild(Layer* last) { m_last = last; } |
544 | 544 |
545 void updateHasSelfPaintingLayerDescendant() const; | 545 void updateHasSelfPaintingLayerDescendant() const; |
546 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye
r, const HitTestRequest& request, HitTestResult& result, | 546 Layer* hitTestLayer(Layer* rootLayer, Layer* containerLayer, const HitTestRe
quest&, HitTestResult&, |
547 const LayoutRect& hitTestRect, const HitTestLocati
on&, bool appliedTransform, | 547 const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTrans
form, |
548 const HitTestingTransformState* transformState = 0
, double* zOffset = 0); | 548 const HitTestingTransformState* = 0, double* zOffset = 0); |
549 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL
ayer* containerLayer, const HitTestRequest&, HitTestResult&, | 549 Layer* hitTestLayerByApplyingTransform(Layer* rootLayer, Layer* containerLay
er, const HitTestRequest&, HitTestResult&, |
550 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT
ransformState* = 0, double* zOffset = 0, | 550 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT
ransformState* = 0, double* zOffset = 0, |
551 const LayoutPoint& translationOffset = LayoutPoint()); | 551 const LayoutPoint& translationOffset = LayoutPoint()); |
552 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons
t HitTestRequest&, HitTestResult&, | 552 Layer* hitTestChildren(ChildrenIteration, Layer* rootLayer, const HitTestReq
uest&, HitTestResult&, |
553 const LayoutRect& hitTestRect, const HitTestLocatio
n&, | 553 const LayoutRect& hitTestRect, const HitTestLocation&, |
554 const HitTestingTransformState* transformState, dou
ble* zOffsetForDescendants, double* zOffset, | 554 const HitTestingTransformState*, double* zOffsetForDescendants, double*
zOffset, |
555 const HitTestingTransformState* unflattenedTransfor
mState, bool depthSortDescendants); | 555 const HitTestingTransformState* unflattenedTransformState, bool depthSor
tDescendants); |
556 RenderLayer* hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer
* rootLayer, const HitTestRequest& request, HitTestResult& result, | 556 Layer* hitTestPaginatedChildLayer(Layer* childLayer, Layer* rootLayer, const
HitTestRequest&, HitTestResult&, |
557 const LayoutRect& hitTestRect, const
HitTestLocation&, | 557 const LayoutRect& hitTestRect, const HitTestLocation&, |
558 const HitTestingTransformState* tran
sformState, double* zOffset); | 558 const HitTestingTransformState*, double* zOffset); |
559 RenderLayer* hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer*
rootLayer, const HitTestRequest& request, HitTestResult& result, | 559 Layer* hitTestChildLayerColumns(Layer* childLayer, Layer* rootLayer, const H
itTestRequest&, HitTestResult&, |
560 const LayoutRect& hitTestRect, const H
itTestLocation&, | 560 const LayoutRect& hitTestRect, const HitTestLocation&, |
561 const HitTestingTransformState* transf
ormState, double* zOffset, | 561 const HitTestingTransformState*, double* zOffset, |
562 const Vector<RenderLayer*>& columnLaye
rs, size_t columnIndex); | 562 const Vector<Layer*>& columnLayers, size_t columnIndex); |
563 | 563 |
564 PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer*
rootLayer, RenderLayer* containerLayer, | 564 PassRefPtr<HitTestingTransformState> createLocalTransformState(Layer* rootLa
yer, Layer* containerLayer, |
565 const LayoutRect& hitTestRect, const HitTestLocation
&, | 565 const LayoutRect& hitTestRect, const HitTestLocation&, |
566 const HitTestingTransformState* containerTransformSt
ate, | 566 const HitTestingTransformState* containerTransformState, |
567 const LayoutPoint& translationOffset = LayoutPoint()
) const; | 567 const LayoutPoint& translationOffset = LayoutPoint()) const; |
568 | 568 |
569 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect
& layerBounds, const HitTestLocation&, HitTestFilter) const; | 569 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect
& layerBounds, const HitTestLocation&, HitTestFilter) const; |
570 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest
&, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect)
const; | 570 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest
&, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect)
const; |
571 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend
erLayer* containerLayer, const HitTestRequest&, HitTestResult&, | 571 Layer* hitTestTransformedLayerInFragments(Layer* rootLayer, Layer* container
Layer, const HitTestRequest&, HitTestResult&, |
572 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT
ransformState* = 0, double* zOffset = 0); | 572 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT
ransformState* = 0, double* zOffset = 0); |
573 | 573 |
574 bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const; | 574 bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const; |
575 | 575 |
576 bool shouldBeSelfPaintingLayer() const; | 576 bool shouldBeSelfPaintingLayer() const; |
577 | 577 |
578 // FIXME: We should only create the stacking node if needed. | 578 // FIXME: We should only create the stacking node if needed. |
579 bool requiresStackingNode() const { return true; } | 579 bool requiresStackingNode() const { return true; } |
580 void updateStackingNode(); | 580 void updateStackingNode(); |
581 | 581 |
(...skipping 17 matching lines...) Expand all Loading... |
599 | 599 |
600 void updatePaginationRecursive(bool needsPaginationUpdate = false); | 600 void updatePaginationRecursive(bool needsPaginationUpdate = false); |
601 void updatePagination(); | 601 void updatePagination(); |
602 void clearPaginationRecursive(); | 602 void clearPaginationRecursive(); |
603 | 603 |
604 // FIXME: Temporary. Remove when new columns come online. | 604 // FIXME: Temporary. Remove when new columns come online. |
605 bool useRegionBasedColumns() const; | 605 bool useRegionBasedColumns() const; |
606 | 606 |
607 LayerType m_layerType; | 607 LayerType m_layerType; |
608 | 608 |
609 // Self-painting layer is an optimization where we avoid the heavy RenderLay
er painting | 609 // Self-painting layer is an optimization where we avoid the heavy Layer pai
nting |
610 // machinery for a RenderLayer allocated only to handle the overflow clip ca
se. | 610 // machinery for a Layer allocated only to handle the overflow clip case. |
611 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. | 611 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. |
612 unsigned m_isSelfPaintingLayer : 1; | 612 unsigned m_isSelfPaintingLayer : 1; |
613 | 613 |
614 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to | 614 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to |
615 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). | 615 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). |
616 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; | 616 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; |
617 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; | 617 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; |
618 | 618 |
619 const unsigned m_isRootLayer : 1; | 619 const unsigned m_isRootLayer : 1; |
620 | 620 |
(...skipping 26 matching lines...) Expand all Loading... |
647 unsigned m_hasCompositingDescendant : 1; | 647 unsigned m_hasCompositingDescendant : 1; |
648 | 648 |
649 // Applies to the real render layer tree (i.e., the tree determined by the l
ayer's parent and children and | 649 // Applies to the real render layer tree (i.e., the tree determined by the l
ayer's parent and children and |
650 // as opposed to the tree formed by the z-order and normal flow lists). | 650 // as opposed to the tree formed by the z-order and normal flow lists). |
651 unsigned m_hasNonCompositedChild : 1; | 651 unsigned m_hasNonCompositedChild : 1; |
652 | 652 |
653 // Should be for stacking contexts having unisolated blending descendants. | 653 // Should be for stacking contexts having unisolated blending descendants. |
654 unsigned m_shouldIsolateCompositedDescendants : 1; | 654 unsigned m_shouldIsolateCompositedDescendants : 1; |
655 | 655 |
656 // True if this render layer just lost its grouped mapping due to the Compos
itedLayerMapping being destroyed, | 656 // True if this render layer just lost its grouped mapping due to the Compos
itedLayerMapping being destroyed, |
657 // and we don't yet know to what graphics layer this RenderLayer will be ass
igned. | 657 // and we don't yet know to what graphics layer this Layer will be assigned. |
658 unsigned m_lostGroupedMapping : 1; | 658 unsigned m_lostGroupedMapping : 1; |
659 | 659 |
660 RenderLayerModelObject* m_renderer; | 660 LayoutLayerModelObject* m_renderer; |
661 | 661 |
662 RenderLayer* m_parent; | 662 Layer* m_parent; |
663 RenderLayer* m_previous; | 663 Layer* m_previous; |
664 RenderLayer* m_next; | 664 Layer* m_next; |
665 RenderLayer* m_first; | 665 Layer* m_first; |
666 RenderLayer* m_last; | 666 Layer* m_last; |
667 | 667 |
668 // Our current relative position offset. | 668 // Our current relative position offset. |
669 LayoutSize m_offsetForInFlowPosition; | 669 LayoutSize m_offsetForInFlowPosition; |
670 | 670 |
671 // Our (x,y) coordinates are in our parent layer's coordinate space. | 671 // Our (x,y) coordinates are in our parent layer's coordinate space. |
672 LayoutPoint m_location; | 672 LayoutPoint m_location; |
673 | 673 |
674 // The layer's width/height | 674 // The layer's width/height |
675 IntSize m_size; | 675 IntSize m_size; |
676 | 676 |
677 // Cached normal flow values for absolute positioned elements with static le
ft/top values. | 677 // Cached normal flow values for absolute positioned elements with static le
ft/top values. |
678 LayoutUnit m_staticInlinePosition; | 678 LayoutUnit m_staticInlinePosition; |
679 LayoutUnit m_staticBlockPosition; | 679 LayoutUnit m_staticBlockPosition; |
680 | 680 |
681 OwnPtr<TransformationMatrix> m_transform; | 681 OwnPtr<TransformationMatrix> m_transform; |
682 | 682 |
683 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i
s 0 if we are not paginated. | 683 // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if
we are not paginated. |
684 // | 684 // |
685 // See RenderMultiColumnFlowThread and | 685 // See RenderMultiColumnFlowThread and |
686 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/m
ulti-column-layout | 686 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/m
ulti-column-layout |
687 // for more information about the multicol implementation. It's important to
understand the | 687 // for more information about the multicol implementation. It's important to
understand the |
688 // difference between flow thread coordinates and visual coordinates when wo
rking with multicol | 688 // difference between flow thread coordinates and visual coordinates when wo
rking with multicol |
689 // in RenderLayer, since RenderLayer is one of the few places where we have
to worry about the | 689 // in Layer, since Layer is one of the few places where we have to worry abo
ut the |
690 // visual ones. Internally we try to use flow-thread coordinates whenever po
ssible. | 690 // visual ones. Internally we try to use flow-thread coordinates whenever po
ssible. |
691 RenderLayer* m_enclosingPaginationLayer; | 691 Layer* m_enclosingPaginationLayer; |
692 | 692 |
693 // These compositing reasons are updated whenever style changes, not while u
pdating compositing layers. | 693 // These compositing reasons are updated whenever style changes, not while u
pdating compositing layers. |
694 // They should not be used to infer the compositing state of this layer. | 694 // They should not be used to infer the compositing state of this layer. |
695 CompositingReasons m_potentialCompositingReasonsFromStyle; | 695 CompositingReasons m_potentialCompositingReasonsFromStyle; |
696 | 696 |
697 // Once computed, indicates all that a layer needs to become composited usin
g the CompositingReasons enum bitfield. | 697 // Once computed, indicates all that a layer needs to become composited usin
g the CompositingReasons enum bitfield. |
698 CompositingReasons m_compositingReasons; | 698 CompositingReasons m_compositingReasons; |
699 | 699 |
700 DescendantDependentCompositingInputs m_descendantDependentCompositingInputs; | 700 DescendantDependentCompositingInputs m_descendantDependentCompositingInputs; |
701 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; | 701 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; |
702 | 702 |
703 IntRect m_blockSelectionGapsBounds; | 703 IntRect m_blockSelectionGapsBounds; |
704 | 704 |
705 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; | 705 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; |
706 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; | 706 OwnPtr<LayerScrollableArea> m_scrollableArea; |
707 | 707 |
708 CompositedLayerMapping* m_groupedMapping; | 708 CompositedLayerMapping* m_groupedMapping; |
709 | 709 |
710 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? | 710 LayerClipper m_clipper; // FIXME: Lazily allocate? |
711 OwnPtr<RenderLayerStackingNode> m_stackingNode; | 711 OwnPtr<LayerStackingNode> m_stackingNode; |
712 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; | 712 OwnPtr<LayerReflectionInfo> m_reflectionInfo; |
713 | 713 |
714 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. | 714 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. |
715 }; | 715 }; |
716 | 716 |
717 } // namespace blink | 717 } // namespace blink |
718 | 718 |
719 #ifndef NDEBUG | 719 #ifndef NDEBUG |
720 // Outside the WebCore namespace for ease of invocation from gdb. | 720 // Outside the WebCore namespace for ease of invocation from gdb. |
721 void showLayerTree(const blink::RenderLayer*); | 721 void showLayerTree(const blink::Layer*); |
722 void showLayerTree(const blink::RenderObject*); | 722 void showLayerTree(const blink::RenderObject*); |
723 #endif | 723 #endif |
724 | 724 |
725 #endif // RenderLayer_h | 725 #endif // Layer_h |
OLD | NEW |