Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: Source/core/rendering/RenderLayer.h

Issue 14741004: NOT FOR REVIEW - Update comp-scrolling state at a well defined point in the pipeline. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added annotations describing how this patch will be split. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // PATCH 2 -- the change to the OOFPD requires a tree walk. We need to split this into phases
553 // or else the perf hit will be too great.
554 void updateHasOutOfFlowPositionedDescendant(HashSet<const RenderObject*>* co ntainingBlocks = 0);
552 555
553 // Gets the nearest enclosing positioned ancestor layer (also includes 556 // Gets the nearest enclosing positioned ancestor layer (also includes
554 // the <html> layer and the root layer). 557 // the <html> layer and the root layer).
555 RenderLayer* enclosingPositionedAncestor() const; 558 RenderLayer* enclosingPositionedAncestor() const;
556 559
557 // Returns the nearest enclosing layer that is scrollable. 560 // Returns the nearest enclosing layer that is scrollable.
558 RenderLayer* enclosingScrollableLayer() const; 561 RenderLayer* enclosingScrollableLayer() const;
559 562
560 // The layer relative to which clipping rects for this layer are computed. 563 // The layer relative to which clipping rects for this layer are computed.
561 RenderLayer* clippingRootForPainting() const; 564 RenderLayer* clippingRootForPainting() const;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 }; 810 };
808 811
809 void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotComposi tedReason reason) { m_compositingProperties.viewportConstrainedNotCompositedReas on = reason; } 812 void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotComposi tedReason reason) { m_compositingProperties.viewportConstrainedNotCompositedReas on = reason; }
810 ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReaso n() const { return static_cast<ViewportConstrainedNotCompositedReason>(m_composi tingProperties.viewportConstrainedNotCompositedReason); } 813 ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReaso n() const { return static_cast<ViewportConstrainedNotCompositedReason>(m_composi tingProperties.viewportConstrainedNotCompositedReason); }
811 814
812 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen derFlowThread(); } 815 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen derFlowThread(); }
813 816
814 enum PaintOrderListType {BeforePromote, AfterPromote}; 817 enum PaintOrderListType {BeforePromote, AfterPromote};
815 void computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >&); 818 void computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >&);
816 819
820 // PATCH 1
821 enum ForceNeedsCompositedScrollingMode {
822 DoNotForceCompositedScrolling = 0,
823 ForceCompositedScrollingOn,
824 ForceCompositedScrollingOff
825 };
826 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode mode );
827
817 private: 828 private:
818 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainer s }; 829 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainer s };
819 830
820 void updateZOrderLists(); 831 void updateZOrderLists();
821 void rebuildZOrderLists(); 832 void rebuildZOrderLists();
822 // See the comment for collectLayers for information about the layerToForceA sStackingContainer parameter. 833 // 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); 834 void rebuildZOrderLists(CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> > &, OwnPtr<Vector<RenderLayer*> >&, const RenderLayer* layerToForceAsStackingCont ainer = 0);
824 void clearZOrderLists(); 835 void clearZOrderLists();
825 836
826 void updateNormalFlowList(); 837 void updateNormalFlowList();
827 838
828 bool isStackingContext(const RenderStyle* style) const { return !style->hasA utoZIndex() || isRootLayer(); } 839 bool isStackingContext(const RenderStyle* style) const { return !style->hasA utoZIndex() || isRootLayer(); }
829 840
830 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack ingContainer(); } 841 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack ingContainer(); }
831 842
832 void setAncestorChainHasSelfPaintingLayerDescendant(); 843 void setAncestorChainHasSelfPaintingLayerDescendant();
833 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 844 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
834 845
835 bool acceleratedCompositingForOverflowScrollEnabled() const; 846 bool acceleratedCompositingForOverflowScrollEnabled() const;
836 void updateDescendantsAreContiguousInStackingOrder(); 847 // PATCH 3
837 void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<co nst RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIte ration); 848 void updateCanBeStackingContainer(RenderLayer*);
849 void updateCanBeStackingContainerRecursively(RenderLayer*);
838 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext, OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL ayer*> >& negZOrderListBeforePromote); 850 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); 851 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay er*> >& negZOrderListAfterPromote);
840 852
841 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con st RenderGeometryMap* = 0); 853 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con st RenderGeometryMap* = 0);
842 void computeRepaintRectsIncludingDescendants(); 854 void computeRepaintRectsIncludingDescendants();
843 void clearRepaintRects(); 855 void clearRepaintRects();
844 856
845 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&, 857 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&,
846 BorderRadiusClippingRule = IncludeSelfForBorderRadius); 858 BorderRadiusClippingRule = IncludeSelfForBorderRadius);
847 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&); 859 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
848 860
849 bool shouldRepaintAfterLayout() const; 861 bool shouldRepaintAfterLayout() const;
850 862
851 void updateSelfPaintingLayer(); 863 void updateSelfPaintingLayer();
852 void updateIsNormalFlowOnly(); 864 void updateIsNormalFlowOnly();
853 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle); 865 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle);
854 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); 866 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle);
855 867
856 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); 868 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle);
857 void updateScrollbarsAfterLayout(); 869 void updateScrollbarsAfterLayout();
858 870
859 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containi ngBlock); 871 // PATCH 2
860 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
861 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); 872 void updateOutOfFlowPositioned(const RenderStyle* oldStyle);
862 873
863 void updateNeedsCompositedScrolling(); 874 void updateNeedsCompositedScrolling();
875 // PATCH 1
876 void didUpdateNeedsCompositedScrolling();
864 877
865 // Returns true if the position changed. 878 // Returns true if the position changed.
866 bool updateLayerPosition(); 879 bool updateLayerPosition();
867 880
868 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags); 881 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
869 882
870 enum UpdateLayerPositionsAfterScrollFlag { 883 enum UpdateLayerPositionsAfterScrollFlag {
871 NoFlag = 0, 884 NoFlag = 0,
872 IsOverflowScroll = 1 << 0, 885 IsOverflowScroll = 1 << 0,
873 HasSeenViewportConstrainedAncestor = 1 << 1, 886 HasSeenViewportConstrainedAncestor = 1 << 1,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 void scrollTo(int, int); 1031 void scrollTo(int, int);
1019 void updateCompositingLayersAfterScroll(); 1032 void updateCompositingLayersAfterScroll();
1020 1033
1021 IntSize scrollbarOffset(const Scrollbar*) const; 1034 IntSize scrollbarOffset(const Scrollbar*) const;
1022 1035
1023 void updateScrollableAreaSet(bool hasOverflow); 1036 void updateScrollableAreaSet(bool hasOverflow);
1024 1037
1025 void dirtyAncestorChainVisibleDescendantStatus(); 1038 void dirtyAncestorChainVisibleDescendantStatus();
1026 void setAncestorChainHasVisibleDescendant(); 1039 void setAncestorChainHasVisibleDescendant();
1027 1040
1028 void updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowD escendantContainingBlocks = 0); 1041 // PATCH 2
1042 void updateDescendantDependentFlags();
1029 1043
1030 // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do. 1044 // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do.
1031 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; } 1045 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; }
1032 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; } 1046 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; }
1033 1047
1034 void dirty3DTransformedDescendantStatus(); 1048 void dirty3DTransformedDescendantStatus();
1035 // Both updates the status, and returns true if descendants of this have 3d. 1049 // Both updates the status, and returns true if descendants of this have 3d.
1036 bool update3DTransformedDescendantStatus(); 1050 bool update3DTransformedDescendantStatus();
1037 1051
1038 void createReflection(); 1052 void createReflection();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1135
1122 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 1136 // 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). 1137 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
1124 bool m_hasSelfPaintingLayerDescendant : 1; 1138 bool m_hasSelfPaintingLayerDescendant : 1;
1125 bool m_hasSelfPaintingLayerDescendantDirty : 1; 1139 bool m_hasSelfPaintingLayerDescendantDirty : 1;
1126 1140
1127 // If we have no out of flow positioned descendants and no non-descendant 1141 // 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 1142 // appears between our descendants in stacking order, then we may become a
1129 // stacking context. 1143 // stacking context.
1130 bool m_hasOutOfFlowPositionedDescendant : 1; 1144 bool m_hasOutOfFlowPositionedDescendant : 1;
1131 bool m_hasOutOfFlowPositionedDescendantDirty : 1; 1145 // PATCH 2 (removal)
1132 1146
1147 // PATCH 1
1148 ForceNeedsCompositedScrollingMode m_forceNeedsCompositedScrolling;
1133 bool m_needsCompositedScrolling : 1; 1149 bool m_needsCompositedScrolling : 1;
1134 1150
1135 // If this is true, then no non-descendant appears between any of our 1151 // 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 1152 // descendants in stacking order. This is one of the requirements of being
1137 // able to safely become a stacking context. 1153 // able to safely become a stacking context.
1138 bool m_descendantsAreContiguousInStackingOrder : 1; 1154 // PATCH 3
1139 bool m_descendantsAreContiguousInStackingOrderDirty : 1; 1155 bool m_canBePromotedToStackingContainer : 1;
1156 bool m_canBePromotedToStackingContainerDirty : 1;
1140 1157
1141 const bool m_isRootLayer : 1; 1158 const bool m_isRootLayer : 1;
1142 1159
1143 bool m_usedTransparency : 1; // Tracks whether we need to close a transparen t layer, i.e., whether 1160 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 1161 // we ended up painting this layer or any desce ndants (and therefore need to
1145 // blend). 1162 // blend).
1146 bool m_paintingInsideReflection : 1; // A state bit tracking if we are pain ting inside a replica. 1163 bool m_paintingInsideReflection : 1; // A state bit tracking if we are pain ting inside a replica.
1147 bool m_inOverflowRelayout : 1; 1164 bool m_inOverflowRelayout : 1;
1148 unsigned m_repaintStatus : 2; // RepaintStatus 1165 unsigned m_repaintStatus : 2; // RepaintStatus
1149 1166
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 1328
1312 } // namespace WebCore 1329 } // namespace WebCore
1313 1330
1314 #ifndef NDEBUG 1331 #ifndef NDEBUG
1315 // Outside the WebCore namespace for ease of invocation from gdb. 1332 // Outside the WebCore namespace for ease of invocation from gdb.
1316 void showLayerTree(const WebCore::RenderLayer*); 1333 void showLayerTree(const WebCore::RenderLayer*);
1317 void showLayerTree(const WebCore::RenderObject*); 1334 void showLayerTree(const WebCore::RenderObject*);
1318 #endif 1335 #endif
1319 1336
1320 #endif // RenderLayer_h 1337 #endif // RenderLayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698