| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. | 542 // Part of the issue is with subtree relayout: we don't check if our ancesto
rs have some descendant flags dirty, missing some updates. |
| 543 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } | 543 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD
escendant; } |
| 544 | 544 |
| 545 // This returns true if we have an out of flow positioned descendant whose | 545 // This returns true if we have an out of flow positioned descendant whose |
| 546 // containing block is not a descendant of ours. If this is true, we cannot | 546 // containing block is not a descendant of ours. If this is true, we cannot |
| 547 // automatically opt into composited scrolling since this out of flow | 547 // automatically opt into composited scrolling since this out of flow |
| 548 // positioned descendant would become clipped by us, possibly altering the | 548 // positioned descendant would become clipped by us, possibly altering the |
| 549 // rendering of the page. | 549 // rendering of the page. |
| 550 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty); here b
ut we may hit the same bugs as visible content above. | 550 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty); here b
ut we may hit the same bugs as visible content above. |
| 551 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } | 551 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio
nedDescendant; } |
| 552 void updateHasOutOfFlowPositionedDescendant(HashSet<const RenderObject*>* co
ntainingBlocks = 0); |
| 552 | 553 |
| 553 // Gets the nearest enclosing positioned ancestor layer (also includes | 554 // Gets the nearest enclosing positioned ancestor layer (also includes |
| 554 // the <html> layer and the root layer). | 555 // the <html> layer and the root layer). |
| 555 RenderLayer* enclosingPositionedAncestor() const; | 556 RenderLayer* enclosingPositionedAncestor() const; |
| 556 | 557 |
| 557 // Returns the nearest enclosing layer that is scrollable. | 558 // Returns the nearest enclosing layer that is scrollable. |
| 558 RenderLayer* enclosingScrollableLayer() const; | 559 RenderLayer* enclosingScrollableLayer() const; |
| 559 | 560 |
| 560 // The layer relative to which clipping rects for this layer are computed. | 561 // The layer relative to which clipping rects for this layer are computed. |
| 561 RenderLayer* clippingRootForPainting() const; | 562 RenderLayer* clippingRootForPainting() const; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 }; | 808 }; |
| 808 | 809 |
| 809 void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotComposi
tedReason reason) { m_compositingProperties.viewportConstrainedNotCompositedReas
on = reason; } | 810 void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotComposi
tedReason reason) { m_compositingProperties.viewportConstrainedNotCompositedReas
on = reason; } |
| 810 ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReaso
n() const { return static_cast<ViewportConstrainedNotCompositedReason>(m_composi
tingProperties.viewportConstrainedNotCompositedReason); } | 811 ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReaso
n() const { return static_cast<ViewportConstrainedNotCompositedReason>(m_composi
tingProperties.viewportConstrainedNotCompositedReason); } |
| 811 | 812 |
| 812 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen
derFlowThread(); } | 813 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen
derFlowThread(); } |
| 813 | 814 |
| 814 enum PaintOrderListType {BeforePromote, AfterPromote}; | 815 enum PaintOrderListType {BeforePromote, AfterPromote}; |
| 815 void computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >&); | 816 void computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >&); |
| 816 | 817 |
| 818 enum ForceNeedsCompositedScrollingMode { |
| 819 DoNotForceCompositedScrolling = 0, |
| 820 ForceCompositedScrollingOn, |
| 821 ForceCompositedScrollingOff |
| 822 }; |
| 823 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode mode
); |
| 824 |
| 817 private: | 825 private: |
| 818 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainer
s }; | 826 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainer
s }; |
| 819 | 827 |
| 820 void updateZOrderLists(); | 828 void updateZOrderLists(); |
| 821 void rebuildZOrderLists(); | 829 void rebuildZOrderLists(); |
| 822 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. | 830 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. |
| 823 void rebuildZOrderLists(CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> >
&, OwnPtr<Vector<RenderLayer*> >&, const RenderLayer* layerToForceAsStackingCont
ainer = 0); | 831 void rebuildZOrderLists(CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> >
&, OwnPtr<Vector<RenderLayer*> >&, const RenderLayer* layerToForceAsStackingCont
ainer = 0); |
| 824 void clearZOrderLists(); | 832 void clearZOrderLists(); |
| 825 | 833 |
| 826 void updateNormalFlowList(); | 834 void updateNormalFlowList(); |
| 827 | 835 |
| 828 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } | 836 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } |
| 829 | 837 |
| 830 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack
ingContainer(); } | 838 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack
ingContainer(); } |
| 831 | 839 |
| 832 void setAncestorChainHasSelfPaintingLayerDescendant(); | 840 void setAncestorChainHasSelfPaintingLayerDescendant(); |
| 833 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 841 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 834 | 842 |
| 835 bool acceleratedCompositingForOverflowScrollEnabled() const; | 843 bool acceleratedCompositingForOverflowScrollEnabled() const; |
| 836 void updateDescendantsAreContiguousInStackingOrder(); | 844 void updateCanBeStackingContainer(RenderLayer*); |
| 837 void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<co
nst RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIte
ration); | 845 void updateCanBeStackingContainerRecursively(RenderLayer*); |
| 838 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext,
OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL
ayer*> >& negZOrderListBeforePromote); | 846 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext,
OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL
ayer*> >& negZOrderListBeforePromote); |
| 839 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O
wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay
er*> >& negZOrderListAfterPromote); | 847 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O
wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay
er*> >& negZOrderListAfterPromote); |
| 840 | 848 |
| 841 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con
st RenderGeometryMap* = 0); | 849 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con
st RenderGeometryMap* = 0); |
| 842 void computeRepaintRectsIncludingDescendants(); | 850 void computeRepaintRectsIncludingDescendants(); |
| 843 void clearRepaintRects(); | 851 void clearRepaintRects(); |
| 844 | 852 |
| 845 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect&
paintDirtyRect, const ClipRect&, | 853 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect&
paintDirtyRect, const ClipRect&, |
| 846 BorderRadiusClippingRule = IncludeSelfForBorderRadius); | 854 BorderRadiusClippingRule = IncludeSelfForBorderRadius); |
| 847 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); | 855 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); |
| 848 | 856 |
| 849 bool shouldRepaintAfterLayout() const; | 857 bool shouldRepaintAfterLayout() const; |
| 850 | 858 |
| 851 void updateSelfPaintingLayer(); | 859 void updateSelfPaintingLayer(); |
| 852 void updateIsNormalFlowOnly(); | 860 void updateIsNormalFlowOnly(); |
| 853 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle); | 861 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle); |
| 854 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); | 862 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); |
| 855 | 863 |
| 856 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); | 864 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); |
| 857 void updateScrollbarsAfterLayout(); | 865 void updateScrollbarsAfterLayout(); |
| 858 | 866 |
| 859 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containi
ngBlock); | |
| 860 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
| 861 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); | 867 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); |
| 862 | 868 |
| 863 void updateNeedsCompositedScrolling(); | 869 void updateNeedsCompositedScrolling(); |
| 870 void setNeedsCompositedScrolling(bool); |
| 871 |
| 872 void didSetNeedsCompositedScrolling(); |
| 864 | 873 |
| 865 // Returns true if the position changed. | 874 // Returns true if the position changed. |
| 866 bool updateLayerPosition(); | 875 bool updateLayerPosition(); |
| 867 | 876 |
| 868 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags
= defaultFlags); | 877 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags
= defaultFlags); |
| 869 | 878 |
| 870 enum UpdateLayerPositionsAfterScrollFlag { | 879 enum UpdateLayerPositionsAfterScrollFlag { |
| 871 NoFlag = 0, | 880 NoFlag = 0, |
| 872 IsOverflowScroll = 1 << 0, | 881 IsOverflowScroll = 1 << 0, |
| 873 HasSeenViewportConstrainedAncestor = 1 << 1, | 882 HasSeenViewportConstrainedAncestor = 1 << 1, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 void scrollTo(int, int); | 1027 void scrollTo(int, int); |
| 1019 void updateCompositingLayersAfterScroll(); | 1028 void updateCompositingLayersAfterScroll(); |
| 1020 | 1029 |
| 1021 IntSize scrollbarOffset(const Scrollbar*) const; | 1030 IntSize scrollbarOffset(const Scrollbar*) const; |
| 1022 | 1031 |
| 1023 void updateScrollableAreaSet(bool hasOverflow); | 1032 void updateScrollableAreaSet(bool hasOverflow); |
| 1024 | 1033 |
| 1025 void dirtyAncestorChainVisibleDescendantStatus(); | 1034 void dirtyAncestorChainVisibleDescendantStatus(); |
| 1026 void setAncestorChainHasVisibleDescendant(); | 1035 void setAncestorChainHasVisibleDescendant(); |
| 1027 | 1036 |
| 1028 void updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowD
escendantContainingBlocks = 0); | 1037 void updateDescendantDependentFlags(); |
| 1029 | 1038 |
| 1030 // This flag is computed by RenderLayerCompositor, which knows more about 3d
hierarchies than we do. | 1039 // This flag is computed by RenderLayerCompositor, which knows more about 3d
hierarchies than we do. |
| 1031 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant =
b; } | 1040 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant =
b; } |
| 1032 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } | 1041 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } |
| 1033 | 1042 |
| 1034 void dirty3DTransformedDescendantStatus(); | 1043 void dirty3DTransformedDescendantStatus(); |
| 1035 // Both updates the status, and returns true if descendants of this have 3d. | 1044 // Both updates the status, and returns true if descendants of this have 3d. |
| 1036 bool update3DTransformedDescendantStatus(); | 1045 bool update3DTransformedDescendantStatus(); |
| 1037 | 1046 |
| 1038 void createReflection(); | 1047 void createReflection(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 | 1130 |
| 1122 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to | 1131 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to |
| 1123 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). | 1132 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). |
| 1124 bool m_hasSelfPaintingLayerDescendant : 1; | 1133 bool m_hasSelfPaintingLayerDescendant : 1; |
| 1125 bool m_hasSelfPaintingLayerDescendantDirty : 1; | 1134 bool m_hasSelfPaintingLayerDescendantDirty : 1; |
| 1126 | 1135 |
| 1127 // If we have no out of flow positioned descendants and no non-descendant | 1136 // If we have no out of flow positioned descendants and no non-descendant |
| 1128 // appears between our descendants in stacking order, then we may become a | 1137 // appears between our descendants in stacking order, then we may become a |
| 1129 // stacking context. | 1138 // stacking context. |
| 1130 bool m_hasOutOfFlowPositionedDescendant : 1; | 1139 bool m_hasOutOfFlowPositionedDescendant : 1; |
| 1131 bool m_hasOutOfFlowPositionedDescendantDirty : 1; | |
| 1132 | 1140 |
| 1141 ForceNeedsCompositedScrollingMode m_forceNeedsCompositedScrolling; |
| 1133 bool m_needsCompositedScrolling : 1; | 1142 bool m_needsCompositedScrolling : 1; |
| 1143 bool m_updatingNeedsCompositedScrolling : 1; |
| 1134 | 1144 |
| 1135 // If this is true, then no non-descendant appears between any of our | 1145 // If this is true, then no non-descendant appears between any of our |
| 1136 // descendants in stacking order. This is one of the requirements of being | 1146 // descendants in stacking order. This is one of the requirements of being |
| 1137 // able to safely become a stacking context. | 1147 // able to safely become a stacking context. |
| 1138 bool m_descendantsAreContiguousInStackingOrder : 1; | 1148 bool m_canBePromotedToStackingContainer : 1; |
| 1139 bool m_descendantsAreContiguousInStackingOrderDirty : 1; | 1149 bool m_updatingCanBePromotedToStackingContainer : 1; |
| 1140 | 1150 |
| 1141 const bool m_isRootLayer : 1; | 1151 const bool m_isRootLayer : 1; |
| 1142 | 1152 |
| 1143 bool m_usedTransparency : 1; // Tracks whether we need to close a transparen
t layer, i.e., whether | 1153 bool m_usedTransparency : 1; // Tracks whether we need to close a transparen
t layer, i.e., whether |
| 1144 // we ended up painting this layer or any desce
ndants (and therefore need to | 1154 // we ended up painting this layer or any desce
ndants (and therefore need to |
| 1145 // blend). | 1155 // blend). |
| 1146 bool m_paintingInsideReflection : 1; // A state bit tracking if we are pain
ting inside a replica. | 1156 bool m_paintingInsideReflection : 1; // A state bit tracking if we are pain
ting inside a replica. |
| 1147 bool m_inOverflowRelayout : 1; | 1157 bool m_inOverflowRelayout : 1; |
| 1148 unsigned m_repaintStatus : 2; // RepaintStatus | 1158 unsigned m_repaintStatus : 2; // RepaintStatus |
| 1149 | 1159 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 | 1321 |
| 1312 } // namespace WebCore | 1322 } // namespace WebCore |
| 1313 | 1323 |
| 1314 #ifndef NDEBUG | 1324 #ifndef NDEBUG |
| 1315 // Outside the WebCore namespace for ease of invocation from gdb. | 1325 // Outside the WebCore namespace for ease of invocation from gdb. |
| 1316 void showLayerTree(const WebCore::RenderLayer*); | 1326 void showLayerTree(const WebCore::RenderLayer*); |
| 1317 void showLayerTree(const WebCore::RenderObject*); | 1327 void showLayerTree(const WebCore::RenderObject*); |
| 1318 #endif | 1328 #endif |
| 1319 | 1329 |
| 1320 #endif // RenderLayer_h | 1330 #endif // RenderLayer_h |
| OLD | NEW |