| 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 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // Also unique to paginated fragments. An additional clip that applies to th
e layer. It is in layer-local | 308 // Also unique to paginated fragments. An additional clip that applies to th
e layer. It is in layer-local |
| 309 // (physical) coordinates. | 309 // (physical) coordinates. |
| 310 LayoutRect paginationClip; | 310 LayoutRect paginationClip; |
| 311 }; | 311 }; |
| 312 | 312 |
| 313 typedef Vector<LayerFragment, 1> LayerFragments; | 313 typedef Vector<LayerFragment, 1> LayerFragments; |
| 314 | 314 |
| 315 class RenderLayer : public ScrollableArea { | 315 class RenderLayer : public ScrollableArea { |
| 316 public: | 316 public: |
| 317 friend class RenderReplica; | 317 friend class RenderReplica; |
| 318 friend struct ScopedCompositedScrollingUpdater; |
| 318 | 319 |
| 319 RenderLayer(RenderLayerModelObject*); | 320 RenderLayer(RenderLayerModelObject*); |
| 320 ~RenderLayer(); | 321 ~RenderLayer(); |
| 321 | 322 |
| 322 String name() const; | 323 String name() const; |
| 323 | 324 |
| 324 RenderLayerModelObject* renderer() const { return m_renderer; } | 325 RenderLayerModelObject* renderer() const { return m_renderer; } |
| 325 RenderBox* renderBox() const { return m_renderer && m_renderer->isBox() ? to
RenderBox(m_renderer) : 0; } | 326 RenderBox* renderBox() const { return m_renderer && m_renderer->isBox() ? to
RenderBox(m_renderer) : 0; } |
| 326 RenderLayer* parent() const { return m_parent; } | 327 RenderLayer* parent() const { return m_parent; } |
| 327 RenderLayer* previousSibling() const { return m_previous; } | 328 RenderLayer* previousSibling() const { return m_previous; } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 // A stacking container can have z-order lists. All stacking contexts are | 491 // A stacking container can have z-order lists. All stacking contexts are |
| 491 // stacking containers, but the converse is not true. Layers that use | 492 // stacking containers, but the converse is not true. Layers that use |
| 492 // composited scrolling are stacking containers, but they may not | 493 // composited scrolling are stacking containers, but they may not |
| 493 // necessarily be stacking contexts. | 494 // necessarily be stacking contexts. |
| 494 bool isStackingContainer() const { return isStackingContext() || needsCompos
itedScrolling(); } | 495 bool isStackingContainer() const { return isStackingContext() || needsCompos
itedScrolling(); } |
| 495 | 496 |
| 496 // Gets the enclosing stacking container for this layer, excluding this | 497 // Gets the enclosing stacking container for this layer, excluding this |
| 497 // layer itself. | 498 // layer itself. |
| 498 RenderLayer* stackingContainer() const; | 499 RenderLayer* stackingContainer() const; |
| 499 | 500 |
| 501 // Gets the enclosing stacking context for this layer, excluding this |
| 502 // layer itself. |
| 503 RenderLayer* stackingContext() const; |
| 504 |
| 500 // Gets the enclosing stacking container for this layer, possibly the layer | 505 // Gets the enclosing stacking container for this layer, possibly the layer |
| 501 // itself, if it is a stacking container. | 506 // itself, if it is a stacking container. |
| 502 RenderLayer* enclosingStackingContainer() { return isStackingContainer() ? t
his : stackingContainer(); } | 507 RenderLayer* enclosingStackingContainer() { return isStackingContainer() ? t
his : stackingContainer(); } |
| 503 | 508 |
| 509 // Gets the enclosing stacking context for this layer, possibly the layer |
| 510 // itself, if it is a stacking context. |
| 511 RenderLayer* enclosingStackingContext() { return isStackingContext() ? this
: stackingContext(); } |
| 512 |
| 504 void dirtyZOrderLists(); | 513 void dirtyZOrderLists(); |
| 505 void dirtyStackingContainerZOrderLists(); | 514 void dirtyStackingContainerZOrderLists(); |
| 506 | 515 |
| 507 Vector<RenderLayer*>* posZOrderList() const | 516 Vector<RenderLayer*>* posZOrderList() const |
| 508 { | 517 { |
| 509 ASSERT(!m_zOrderListsDirty); | 518 ASSERT(!m_zOrderListsDirty); |
| 510 ASSERT(isStackingContainer() || !m_posZOrderList); | 519 ASSERT(isStackingContainer() || !m_posZOrderList); |
| 511 return m_posZOrderList.get(); | 520 return m_posZOrderList.get(); |
| 512 } | 521 } |
| 513 | 522 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 void computeRepaintRectsIncludingDescendants(); | 868 void computeRepaintRectsIncludingDescendants(); |
| 860 void clearRepaintRects(); | 869 void clearRepaintRects(); |
| 861 | 870 |
| 862 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect&
paintDirtyRect, const ClipRect&, | 871 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect&
paintDirtyRect, const ClipRect&, |
| 863 BorderRadiusClippingRule = IncludeSelfForBorderRadius); | 872 BorderRadiusClippingRule = IncludeSelfForBorderRadius); |
| 864 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); | 873 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); |
| 865 | 874 |
| 866 bool shouldRepaintAfterLayout() const; | 875 bool shouldRepaintAfterLayout() const; |
| 867 | 876 |
| 868 void updateSelfPaintingLayer(); | 877 void updateSelfPaintingLayer(); |
| 878 void updateIsNormalFlowOnly(); |
| 879 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle); |
| 869 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); | 880 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); |
| 870 | 881 |
| 871 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); | 882 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); |
| 872 void updateScrollbarsAfterLayout(); | 883 void updateScrollbarsAfterLayout(); |
| 873 | 884 |
| 874 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containi
ngBlock); | 885 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containi
ngBlock); |
| 875 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 886 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 876 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); | 887 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); |
| 877 | 888 |
| 878 void updateNeedsCompositedScrolling(); | 889 void updateNeedsCompositedScrolling(); |
| 890 void setNeedsCompositedScrolling(bool); |
| 891 |
| 892 void requestNeedsCompositedScrollingUpdate(); |
| 893 void requestDescendantsAreContiguousInStackingOrderUpdate(); |
| 894 void cancelScheduledCompositedScrollingUpdates() const; |
| 879 | 895 |
| 880 // Returns true if the position changed. | 896 // Returns true if the position changed. |
| 881 bool updateLayerPosition(); | 897 bool updateLayerPosition(); |
| 882 | 898 |
| 883 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags
= defaultFlags); | 899 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags
= defaultFlags); |
| 884 | 900 |
| 885 enum UpdateLayerPositionsAfterScrollFlag { | 901 enum UpdateLayerPositionsAfterScrollFlag { |
| 886 NoFlag = 0, | 902 NoFlag = 0, |
| 887 IsOverflowScroll = 1 << 0, | 903 IsOverflowScroll = 1 << 0, |
| 888 HasSeenViewportConstrainedAncestor = 1 << 1, | 904 HasSeenViewportConstrainedAncestor = 1 << 1, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 // stacking context. | 1160 // stacking context. |
| 1145 bool m_hasOutOfFlowPositionedDescendant : 1; | 1161 bool m_hasOutOfFlowPositionedDescendant : 1; |
| 1146 bool m_hasOutOfFlowPositionedDescendantDirty : 1; | 1162 bool m_hasOutOfFlowPositionedDescendantDirty : 1; |
| 1147 | 1163 |
| 1148 bool m_needsCompositedScrolling : 1; | 1164 bool m_needsCompositedScrolling : 1; |
| 1149 | 1165 |
| 1150 // If this is true, then no non-descendant appears between any of our | 1166 // If this is true, then no non-descendant appears between any of our |
| 1151 // descendants in stacking order. This is one of the requirements of being | 1167 // descendants in stacking order. This is one of the requirements of being |
| 1152 // able to safely become a stacking context. | 1168 // able to safely become a stacking context. |
| 1153 bool m_descendantsAreContiguousInStackingOrder : 1; | 1169 bool m_descendantsAreContiguousInStackingOrder : 1; |
| 1170 bool m_descendantsAreContiguousInStackingOrderDirty : 1; |
| 1154 | 1171 |
| 1155 const bool m_isRootLayer : 1; | 1172 const bool m_isRootLayer : 1; |
| 1156 | 1173 |
| 1157 bool m_usedTransparency : 1; // Tracks whether we need to close a transparen
t layer, i.e., whether | 1174 bool m_usedTransparency : 1; // Tracks whether we need to close a transparen
t layer, i.e., whether |
| 1158 // we ended up painting this layer or any desce
ndants (and therefore need to | 1175 // we ended up painting this layer or any desce
ndants (and therefore need to |
| 1159 // blend). | 1176 // blend). |
| 1160 bool m_paintingInsideReflection : 1; // A state bit tracking if we are pain
ting inside a replica. | 1177 bool m_paintingInsideReflection : 1; // A state bit tracking if we are pain
ting inside a replica. |
| 1161 bool m_inOverflowRelayout : 1; | 1178 bool m_inOverflowRelayout : 1; |
| 1162 unsigned m_repaintStatus : 2; // RepaintStatus | 1179 unsigned m_repaintStatus : 2; // RepaintStatus |
| 1163 | 1180 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 }; | 1282 }; |
| 1266 | 1283 |
| 1267 inline void RenderLayer::clearZOrderLists() | 1284 inline void RenderLayer::clearZOrderLists() |
| 1268 { | 1285 { |
| 1269 ASSERT(!isStackingContainer()); | 1286 ASSERT(!isStackingContainer()); |
| 1270 | 1287 |
| 1271 m_posZOrderList.clear(); | 1288 m_posZOrderList.clear(); |
| 1272 m_negZOrderList.clear(); | 1289 m_negZOrderList.clear(); |
| 1273 } | 1290 } |
| 1274 | 1291 |
| 1275 inline void RenderLayer::updateZOrderLists() | |
| 1276 { | |
| 1277 if (!m_zOrderListsDirty) | |
| 1278 return; | |
| 1279 | |
| 1280 if (!isStackingContainer()) { | |
| 1281 clearZOrderLists(); | |
| 1282 m_zOrderListsDirty = false; | |
| 1283 return; | |
| 1284 } | |
| 1285 | |
| 1286 rebuildZOrderLists(); | |
| 1287 } | |
| 1288 | |
| 1289 #if !ASSERT_DISABLED | 1292 #if !ASSERT_DISABLED |
| 1290 class LayerListMutationDetector { | 1293 class LayerListMutationDetector { |
| 1291 public: | 1294 public: |
| 1292 LayerListMutationDetector(RenderLayer* layer) | 1295 LayerListMutationDetector(RenderLayer* layer) |
| 1293 : m_layer(layer) | 1296 : m_layer(layer) |
| 1294 , m_previousMutationAllowedState(layer->layerListMutationAllowed()) | 1297 , m_previousMutationAllowedState(layer->layerListMutationAllowed()) |
| 1295 { | 1298 { |
| 1296 m_layer->setLayerListMutationAllowed(false); | 1299 m_layer->setLayerListMutationAllowed(false); |
| 1297 } | 1300 } |
| 1298 | 1301 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1310 | 1313 |
| 1311 } // namespace WebCore | 1314 } // namespace WebCore |
| 1312 | 1315 |
| 1313 #ifndef NDEBUG | 1316 #ifndef NDEBUG |
| 1314 // Outside the WebCore namespace for ease of invocation from gdb. | 1317 // Outside the WebCore namespace for ease of invocation from gdb. |
| 1315 void showLayerTree(const WebCore::RenderLayer*); | 1318 void showLayerTree(const WebCore::RenderLayer*); |
| 1316 void showLayerTree(const WebCore::RenderObject*); | 1319 void showLayerTree(const WebCore::RenderObject*); |
| 1317 #endif | 1320 #endif |
| 1318 | 1321 |
| 1319 #endif // RenderLayer_h | 1322 #endif // RenderLayer_h |
| OLD | NEW |