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

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: Address reviewer comments. 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 bool hasVisibleBoxDecorations() const; 535 bool hasVisibleBoxDecorations() const;
536 // Returns true if this layer has visible content (ignoring any child layers ). 536 // Returns true if this layer has visible content (ignoring any child layers ).
537 bool isVisuallyNonEmpty() const; 537 bool isVisuallyNonEmpty() const;
538 // True if this layer container renderers that paint. 538 // True if this layer container renderers that paint.
539 bool hasNonEmptyChildRenderers() const; 539 bool hasNonEmptyChildRenderers() const;
540 540
541 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above. 541 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above.
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 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S ee above.
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
548 // positioned descendant would become clipped by us, possibly altering the
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.
551 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio nedDescendant; } 546 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio nedDescendant; }
552 547
548 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; }
549 typedef HashMap<RenderLayer*, OwnPtr<HashSet<const RenderObject*> > > Ancest orContainingBlockMap;
550 void updateHasUnclippedDescendant(AncestorContainingBlockMap&);
551
553 // Gets the nearest enclosing positioned ancestor layer (also includes 552 // Gets the nearest enclosing positioned ancestor layer (also includes
554 // the <html> layer and the root layer). 553 // the <html> layer and the root layer).
555 RenderLayer* enclosingPositionedAncestor() const; 554 RenderLayer* enclosingPositionedAncestor() const;
556 555
557 // Returns the nearest enclosing layer that is scrollable. 556 // Returns the nearest enclosing layer that is scrollable.
558 RenderLayer* enclosingScrollableLayer() const; 557 RenderLayer* enclosingScrollableLayer() const;
559 558
560 // The layer relative to which clipping rects for this layer are computed. 559 // The layer relative to which clipping rects for this layer are computed.
561 RenderLayer* clippingRootForPainting() const; 560 RenderLayer* clippingRootForPainting() const;
562 561
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 831
833 void updateNormalFlowList(); 832 void updateNormalFlowList();
834 833
835 bool isStackingContext(const RenderStyle* style) const { return !style->hasA utoZIndex() || isRootLayer(); } 834 bool isStackingContext(const RenderStyle* style) const { return !style->hasA utoZIndex() || isRootLayer(); }
836 835
837 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack ingContainer(); } 836 bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStack ingContainer(); }
838 837
839 void setAncestorChainHasSelfPaintingLayerDescendant(); 838 void setAncestorChainHasSelfPaintingLayerDescendant();
840 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 839 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
841 840
841 void setAncestorChainHasOutOfFlowPositionedDescendant();
842 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
843
842 bool acceleratedCompositingForOverflowScrollEnabled() const; 844 bool acceleratedCompositingForOverflowScrollEnabled() const;
843 void updateDescendantsAreContiguousInStackingOrder(); 845 void updateDescendantsAreContiguousInStackingOrder();
844 void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<co nst RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIte ration); 846 void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<co nst RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIte ration);
845 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext, OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL ayer*> >& negZOrderListBeforePromote); 847 void collectBeforePromotionZOrderList(RenderLayer* ancestorStackingContext, OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vector<RenderL ayer*> >& negZOrderListBeforePromote);
846 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay er*> >& negZOrderListAfterPromote); 848 void collectAfterPromotionZOrderList(RenderLayer* ancestorStackingContext, O wnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<RenderLay er*> >& negZOrderListAfterPromote);
847 849
848 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con st RenderGeometryMap* = 0); 850 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, con st RenderGeometryMap* = 0);
849 void computeRepaintRectsIncludingDescendants(); 851 void computeRepaintRectsIncludingDescendants();
850 void clearRepaintRects(); 852 void clearRepaintRects();
851 853
852 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&, 854 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&,
853 BorderRadiusClippingRule = IncludeSelfForBorderRadius); 855 BorderRadiusClippingRule = IncludeSelfForBorderRadius);
854 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&); 856 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
855 857
856 bool shouldRepaintAfterLayout() const; 858 bool shouldRepaintAfterLayout() const;
857 859
858 void updateSelfPaintingLayer(); 860 void updateSelfPaintingLayer();
859 void updateIsNormalFlowOnly(); 861 void updateIsNormalFlowOnly();
860 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle); 862 void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle);
861 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); 863 void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle);
862 864
863 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); 865 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle);
864 void updateScrollbarsAfterLayout(); 866 void updateScrollbarsAfterLayout();
865 867
866 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containi ngBlock);
867 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
868 void updateOutOfFlowPositioned(const RenderStyle* oldStyle); 868 void updateOutOfFlowPositioned(const RenderStyle* oldStyle);
869 869
870 void updateNeedsCompositedScrolling(); 870 virtual void updateNeedsCompositedScrolling() OVERRIDE;
871 void setNeedsCompositedScrolling(bool);
871 void didUpdateNeedsCompositedScrolling(); 872 void didUpdateNeedsCompositedScrolling();
872 873
873 // Returns true if the position changed. 874 // Returns true if the position changed.
874 bool updateLayerPosition(); 875 bool updateLayerPosition();
875 876
876 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags); 877 void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
877 878
878 enum UpdateLayerPositionsAfterScrollFlag { 879 enum UpdateLayerPositionsAfterScrollFlag {
879 NoFlag = 0, 880 NoFlag = 0,
880 IsOverflowScroll = 1 << 0, 881 IsOverflowScroll = 1 << 0,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 void scrollTo(int, int); 1027 void scrollTo(int, int);
1027 void updateCompositingLayersAfterScroll(); 1028 void updateCompositingLayersAfterScroll();
1028 1029
1029 IntSize scrollbarOffset(const Scrollbar*) const; 1030 IntSize scrollbarOffset(const Scrollbar*) const;
1030 1031
1031 void updateScrollableAreaSet(bool hasOverflow); 1032 void updateScrollableAreaSet(bool hasOverflow);
1032 1033
1033 void dirtyAncestorChainVisibleDescendantStatus(); 1034 void dirtyAncestorChainVisibleDescendantStatus();
1034 void setAncestorChainHasVisibleDescendant(); 1035 void setAncestorChainHasVisibleDescendant();
1035 1036
1036 void updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowD escendantContainingBlocks = 0); 1037 void updateDescendantDependentFlags();
1037 1038
1038 // 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.
1039 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; } 1040 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; }
1040 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; } 1041 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; }
1041 1042
1042 void dirty3DTransformedDescendantStatus(); 1043 void dirty3DTransformedDescendantStatus();
1043 // 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.
1044 bool update3DTransformedDescendantStatus(); 1045 bool update3DTransformedDescendantStatus();
1045 1046
1046 void createReflection(); 1047 void createReflection();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 bool m_normalFlowListDirty: 1; 1126 bool m_normalFlowListDirty: 1;
1126 bool m_isNormalFlowOnly : 1; 1127 bool m_isNormalFlowOnly : 1;
1127 1128
1128 bool m_isSelfPaintingLayer : 1; 1129 bool m_isSelfPaintingLayer : 1;
1129 1130
1130 // 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
1131 // 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).
1132 bool m_hasSelfPaintingLayerDescendant : 1; 1133 bool m_hasSelfPaintingLayerDescendant : 1;
1133 bool m_hasSelfPaintingLayerDescendantDirty : 1; 1134 bool m_hasSelfPaintingLayerDescendantDirty : 1;
1134 1135
1135 // If we have no out of flow positioned descendants and no non-descendant
1136 // appears between our descendants in stacking order, then we may become a
1137 // stacking context.
1138 bool m_hasOutOfFlowPositionedDescendant : 1; 1136 bool m_hasOutOfFlowPositionedDescendant : 1;
1139 bool m_hasOutOfFlowPositionedDescendantDirty : 1; 1137 bool m_hasOutOfFlowPositionedDescendantDirty : 1;
1140 1138
1139 // This is true if we have an out-of-flow positioned descendant whose
1140 // containing block is our ancestor. If this is the case, the descendant
1141 // may fall outside of our clip preventing things like opting into
1142 // composited scrolling (which causes clipping of all descendants).
1143 bool m_hasUnclippedDescendant : 1;
1144
1141 ForceNeedsCompositedScrollingMode m_forceNeedsCompositedScrolling; 1145 ForceNeedsCompositedScrollingMode m_forceNeedsCompositedScrolling;
1142 bool m_needsCompositedScrolling : 1; 1146 bool m_needsCompositedScrolling : 1;
1143 1147
1144 // If this is true, then no non-descendant appears between any of our 1148 // If this is true, then no non-descendant appears between any of our
1145 // descendants in stacking order. This is one of the requirements of being 1149 // descendants in stacking order. This is one of the requirements of being
1146 // able to safely become a stacking context. 1150 // able to safely become a stacking context.
1147 bool m_descendantsAreContiguousInStackingOrder : 1; 1151 bool m_descendantsAreContiguousInStackingOrder : 1;
1148 bool m_descendantsAreContiguousInStackingOrderDirty : 1; 1152 bool m_descendantsAreContiguousInStackingOrderDirty : 1;
1149 1153
1150 const bool m_isRootLayer : 1; 1154 const bool m_isRootLayer : 1;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1324
1321 } // namespace WebCore 1325 } // namespace WebCore
1322 1326
1323 #ifndef NDEBUG 1327 #ifndef NDEBUG
1324 // Outside the WebCore namespace for ease of invocation from gdb. 1328 // Outside the WebCore namespace for ease of invocation from gdb.
1325 void showLayerTree(const WebCore::RenderLayer*); 1329 void showLayerTree(const WebCore::RenderLayer*);
1326 void showLayerTree(const WebCore::RenderObject*); 1330 void showLayerTree(const WebCore::RenderObject*);
1327 #endif 1331 #endif
1328 1332
1329 #endif // RenderLayer_h 1333 #endif // RenderLayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698