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

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

Issue 14863002: Only update composited-scrolling state once after layout. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updating expectations. Created 7 years, 6 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
« no previous file with comments | « Source/core/platform/ScrollableArea.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 bool hasVisibleBoxDecorations() const; 595 bool hasVisibleBoxDecorations() const;
596 // Returns true if this layer has visible content (ignoring any child layers ). 596 // Returns true if this layer has visible content (ignoring any child layers ).
597 bool isVisuallyNonEmpty() const; 597 bool isVisuallyNonEmpty() const;
598 // True if this layer container renderers that paint. 598 // True if this layer container renderers that paint.
599 bool hasNonEmptyChildRenderers() const; 599 bool hasNonEmptyChildRenderers() const;
600 600
601 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above. 601 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above.
602 // Part of the issue is with subtree relayout: we don't check if our ancesto rs have some descendant flags dirty, missing some updates. 602 // Part of the issue is with subtree relayout: we don't check if our ancesto rs have some descendant flags dirty, missing some updates.
603 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD escendant; } 603 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD escendant; }
604 604
605 // This returns true if we have an out of flow positioned descendant whose 605 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S ee above.
606 // containing block is not a descendant of ours. If this is true, we cannot
607 // automatically opt into composited scrolling since this out of flow
608 // positioned descendant would become clipped by us, possibly altering the
609 // rendering of the page.
610 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty); here b ut we may hit the same bugs as visible content above.
611 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio nedDescendant; } 606 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio nedDescendant; }
612 607
608 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo wPositionedDescendant = hasDescendant; }
609 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo sitionedDescendantDirty = dirty; }
610
611 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; }
612 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan t = hasDescendant; }
613 void updateHasUnclippedDescendant();
614
613 // Gets the nearest enclosing positioned ancestor layer (also includes 615 // Gets the nearest enclosing positioned ancestor layer (also includes
614 // the <html> layer and the root layer). 616 // the <html> layer and the root layer).
615 RenderLayer* enclosingPositionedAncestor() const; 617 RenderLayer* enclosingPositionedAncestor() const;
616 618
617 // Returns the nearest enclosing layer that is scrollable. 619 // Returns the nearest enclosing layer that is scrollable.
618 RenderLayer* enclosingScrollableLayer() const; 620 RenderLayer* enclosingScrollableLayer() const;
619 621
620 // The layer relative to which clipping rects for this layer are computed. 622 // The layer relative to which clipping rects for this layer are computed.
621 RenderLayer* clippingRootForPainting() const; 623 RenderLayer* clippingRootForPainting() const;
622 624
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen derFlowThread(); } 867 bool isOutOfFlowRenderFlowThread() const { return renderer()->isOutOfFlowRen derFlowThread(); }
866 868
867 enum PaintOrderListType {BeforePromote, AfterPromote}; 869 enum PaintOrderListType {BeforePromote, AfterPromote};
868 void computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >&); 870 void computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >&);
869 871
870 enum ForceNeedsCompositedScrollingMode { 872 enum ForceNeedsCompositedScrollingMode {
871 DoNotForceCompositedScrolling = 0, 873 DoNotForceCompositedScrolling = 0,
872 CompositedScrollingAlwaysOn = 1, 874 CompositedScrollingAlwaysOn = 1,
873 CompositedScrollingAlwaysOff = 2 875 CompositedScrollingAlwaysOff = 2
874 }; 876 };
877
875 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); 878 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode);
876 879
877 private: 880 private:
878 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainer s }; 881 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainer s };
879 882
880 void updateZOrderLists(); 883 void updateZOrderLists();
881 void rebuildZOrderLists(); 884 void rebuildZOrderLists();
882 // See the comment for collectLayers for information about the layerToForceA sStackingContainer parameter. 885 // See the comment for collectLayers for information about the layerToForceA sStackingContainer parameter.
883 void rebuildZOrderLists(CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> > &, OwnPtr<Vector<RenderLayer*> >&, const RenderLayer* layerToForceAsStackingCont ainer = 0); 886 void rebuildZOrderLists(CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> > &, OwnPtr<Vector<RenderLayer*> >&, const RenderLayer* layerToForceAsStackingCont ainer = 0);
884 void clearZOrderLists(); 887 void clearZOrderLists();
885 888
886 void updateNormalFlowList(); 889 void updateNormalFlowList();
887 890
888 bool isStackingContext(const RenderStyle* style) const { return !style->hasA utoZIndex() || isRootLayer(); } 891 bool isStackingContext(const RenderStyle* style) const { return !style->hasA utoZIndex() || isRootLayer(); }
889 892
890 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack ingContainer(); } 893 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack ingContainer(); }
891 894
892 void setAncestorChainHasSelfPaintingLayerDescendant(); 895 void setAncestorChainHasSelfPaintingLayerDescendant();
893 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 896 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
894 897
898 void setAncestorChainHasOutOfFlowPositionedDescendant();
899 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
900
895 bool acceleratedCompositingForOverflowScrollEnabled() const; 901 bool acceleratedCompositingForOverflowScrollEnabled() const;
896 void updateDescendantsAreContiguousInStackingOrder(); 902 void updateDescendantsAreContiguousInStackingOrder();
897 void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<co nst RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIte ration); 903 void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<co nst RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIte ration);
898 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext, OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL ayer*> >& negZOrderListBeforePromote); 904 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext, OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL ayer*> >& negZOrderListBeforePromote);
899 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay er*> >& negZOrderListAfterPromote); 905 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay er*> >& negZOrderListAfterPromote);
900 906
901 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con st RenderGeometryMap* = 0); 907 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con st RenderGeometryMap* = 0);
902 void computeRepaintRectsIncludingDescendants(); 908 void computeRepaintRectsIncludingDescendants();
903 void clearRepaintRects(); 909 void clearRepaintRects();
904 910
905 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&, 911 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&,
906 BorderRadiusClippingRule = IncludeSelfForBorderRadius); 912 BorderRadiusClippingRule = IncludeSelfForBorderRadius);
907 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&); 913 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
908 914
909 bool shouldRepaintAfterLayout() const; 915 bool shouldRepaintAfterLayout() const;
910 916
911 void updateSelfPaintingLayer(); 917 void updateSelfPaintingLayer();
912 void updateIsNormalFlowOnly(); 918 void updateIsNormalFlowOnly();
913 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle); 919 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle);
914 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); 920 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle);
915 921
916 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); 922 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle);
917 void updateScrollbarsAfterLayout(); 923 void updateScrollbarsAfterLayout();
918 924
919 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containi ngBlock);
920 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
921 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); 925 void updateOutOfFlowPositioned(const RenderStyle* oldStyle);
922 926
923 void updateNeedsCompositedScrolling(); 927 virtual void updateNeedsCompositedScrolling() OVERRIDE;
928 void setNeedsCompositedScrolling(bool);
924 void didUpdateNeedsCompositedScrolling(); 929 void didUpdateNeedsCompositedScrolling();
925 930
926 // Returns true if the position changed. 931 // Returns true if the position changed.
927 bool updateLayerPosition(); 932 bool updateLayerPosition();
928 933
929 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags); 934 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
930 935
931 enum UpdateLayerPositionsAfterScrollFlag { 936 enum UpdateLayerPositionsAfterScrollFlag {
932 NoFlag = 0, 937 NoFlag = 0,
933 IsOverflowScroll = 1 << 0, 938 IsOverflowScroll = 1 << 0,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 void updateCompositingLayersAfterScroll(); 1083 void updateCompositingLayersAfterScroll();
1079 1084
1080 IntSize scrollbarOffset(const Scrollbar*) const; 1085 IntSize scrollbarOffset(const Scrollbar*) const;
1081 1086
1082 void updateResizerAreaSet(); 1087 void updateResizerAreaSet();
1083 void updateScrollableAreaSet(bool hasOverflow); 1088 void updateScrollableAreaSet(bool hasOverflow);
1084 1089
1085 void dirtyAncestorChainVisibleDescendantStatus(); 1090 void dirtyAncestorChainVisibleDescendantStatus();
1086 void setAncestorChainHasVisibleDescendant(); 1091 void setAncestorChainHasVisibleDescendant();
1087 1092
1088 void updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowD escendantContainingBlocks = 0); 1093 void updateDescendantDependentFlags();
1089 1094
1090 // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do. 1095 // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do.
1091 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; } 1096 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; }
1092 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; } 1097 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; }
1093 1098
1094 void dirty3DTransformedDescendantStatus(); 1099 void dirty3DTransformedDescendantStatus();
1095 // Both updates the status, and returns true if descendants of this have 3d. 1100 // Both updates the status, and returns true if descendants of this have 3d.
1096 bool update3DTransformedDescendantStatus(); 1101 bool update3DTransformedDescendantStatus();
1097 1102
1098 void createReflection(); 1103 void createReflection();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 bool m_normalFlowListDirty: 1; 1171 bool m_normalFlowListDirty: 1;
1167 bool m_isNormalFlowOnly : 1; 1172 bool m_isNormalFlowOnly : 1;
1168 1173
1169 bool m_isSelfPaintingLayer : 1; 1174 bool m_isSelfPaintingLayer : 1;
1170 1175
1171 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 1176 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
1172 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells). 1177 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
1173 bool m_hasSelfPaintingLayerDescendant : 1; 1178 bool m_hasSelfPaintingLayerDescendant : 1;
1174 bool m_hasSelfPaintingLayerDescendantDirty : 1; 1179 bool m_hasSelfPaintingLayerDescendantDirty : 1;
1175 1180
1176 // If we have no out of flow positioned descendants and no non-descendant
1177 // appears between our descendants in stacking order, then we may become a
1178 // stacking context.
1179 bool m_hasOutOfFlowPositionedDescendant : 1; 1181 bool m_hasOutOfFlowPositionedDescendant : 1;
1180 bool m_hasOutOfFlowPositionedDescendantDirty : 1; 1182 bool m_hasOutOfFlowPositionedDescendantDirty : 1;
1181 1183
1184 // This is true if we have an out-of-flow positioned descendant whose
1185 // containing block is our ancestor. If this is the case, the descendant
1186 // may fall outside of our clip preventing things like opting into
1187 // composited scrolling (which causes clipping of all descendants).
1188 bool m_hasUnclippedDescendant : 1;
1189
1182 bool m_needsCompositedScrolling : 1; 1190 bool m_needsCompositedScrolling : 1;
1183 1191
1184 // If this is true, then no non-descendant appears between any of our 1192 // If this is true, then no non-descendant appears between any of our
1185 // descendants in stacking order. This is one of the requirements of being 1193 // descendants in stacking order. This is one of the requirements of being
1186 // able to safely become a stacking context. 1194 // able to safely become a stacking context.
1187 bool m_descendantsAreContiguousInStackingOrder : 1; 1195 bool m_descendantsAreContiguousInStackingOrder : 1;
1188 bool m_descendantsAreContiguousInStackingOrderDirty : 1; 1196 bool m_descendantsAreContiguousInStackingOrderDirty : 1;
1189 1197
1190 const bool m_isRootLayer : 1; 1198 const bool m_isRootLayer : 1;
1191 1199
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 1368
1361 } // namespace WebCore 1369 } // namespace WebCore
1362 1370
1363 #ifndef NDEBUG 1371 #ifndef NDEBUG
1364 // Outside the WebCore namespace for ease of invocation from gdb. 1372 // Outside the WebCore namespace for ease of invocation from gdb.
1365 void showLayerTree(const WebCore::RenderLayer*); 1373 void showLayerTree(const WebCore::RenderLayer*);
1366 void showLayerTree(const WebCore::RenderObject*); 1374 void showLayerTree(const WebCore::RenderObject*);
1367 #endif 1375 #endif
1368 1376
1369 #endif // RenderLayer_h 1377 #endif // RenderLayer_h
OLDNEW
« no previous file with comments | « Source/core/platform/ScrollableArea.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698