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

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

Issue 398343003: Use unified invalidation path for repaint-only style changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 840
841 // Invalidate the paint of a specific subrectangle within a given object. Th e rect |r| is in the object's coordinate space. 841 // Invalidate the paint of a specific subrectangle within a given object. Th e rect |r| is in the object's coordinate space.
842 void invalidatePaintRectangle(const LayoutRect&) const; 842 void invalidatePaintRectangle(const LayoutRect&) const;
843 843
844 bool invalidatePaintIfNeeded(const RenderLayerModelObject& paintInvalidation Container, 844 bool invalidatePaintIfNeeded(const RenderLayerModelObject& paintInvalidation Container,
845 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, const PaintInvalidationState&); 845 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, const PaintInvalidationState&);
846 846
847 // Walk the tree after layout issuing paint invalidations for renderers that have changed or moved, updating bounds that have changed, and clearing paint in validation state. 847 // Walk the tree after layout issuing paint invalidations for renderers that have changed or moved, updating bounds that have changed, and clearing paint in validation state.
848 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); 848 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&);
849 849
850 // For now RenderBoxes and RenderSVGModelObjects know how to invalidate them selves in invalidateTreeIfNeeded.
dsinclair 2014/07/17 18:36:01 This makes it sound like we're going to make all o
Xianzhu 2014/07/17 21:57:34 Updated crbug.com/394133 and added link here.
851 // Other objects (e.g. RenderText, RenderInline, etc) depend on their contai ners for invalidation.
852 bool invalidatesSelfDuringTreeInvalidation() const { return isBox() || isSVG (); }
dsinclair 2014/07/17 18:36:01 canSelfInvalidate?
Xianzhu 2014/07/17 21:57:34 As the object just don't self invalidate during in
853
850 virtual void invalidatePaintForOverflow(); 854 virtual void invalidatePaintForOverflow();
851 void invalidatePaintForOverflowIfNeeded(); 855 void invalidatePaintForOverflowIfNeeded();
852 856
853 bool checkForPaintInvalidation() const; 857 bool checkForPaintInvalidation() const;
854 858
855 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the view's 859 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the view's
856 // coordinate space. This method deals with outlines and overflow. 860 // coordinate space. This method deals with outlines and overflow.
857 LayoutRect absoluteClippedOverflowRect() const 861 LayoutRect absoluteClippedOverflowRect() const
858 { 862 {
859 return clippedOverflowRectForPaintInvalidation(0); 863 return clippedOverflowRectForPaintInvalidation(0);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 993
990 bool isRelayoutBoundaryForInspector() const; 994 bool isRelayoutBoundaryForInspector() const;
991 995
992 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; } 996 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; }
993 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; } 997 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; }
994 998
995 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const { return m_previousPositionFromPaintInvalidationContainer; } 999 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const { return m_previousPositionFromPaintInvalidationContainer; }
996 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo cation) { m_previousPositionFromPaintInvalidationContainer = location; } 1000 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo cation) { m_previousPositionFromPaintInvalidationContainer = location; }
997 1001
998 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); } 1002 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); }
999 void setShouldDoFullPaintInvalidation(bool b) { m_bitfields.setShouldDoFullP aintInvalidation(b); } 1003 void setShouldDoFullPaintInvalidation(bool);
1004
1000 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); } 1005 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); }
1001 1006
1002 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } 1007 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); }
1003 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); } 1008 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); }
1004 1009
1005 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); } 1010 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); }
1006 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); } 1011 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); }
1007 1012
1008 void clearPaintInvalidationState(); 1013 void clearPaintInvalidationState();
1009 1014
1010 // layoutDidGetCalled indicates whether this render object was re-laid-out 1015 // layoutDidGetCalled indicates whether this render object was re-laid-out
1011 // since the last call to setLayoutDidGetCalled(false) on this object. 1016 // since the last call to setLayoutDidGetCalled(false) on this object.
1012 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } 1017 bool layoutDidGetCalled() const { return m_bitfields.layoutDidGetCalled(); }
1013 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } 1018 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
1014 1019
1015 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); } 1020 bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInval idation(); }
1016 void setMayNeedPaintInvalidation(bool b) 1021 void setMayNeedPaintInvalidation(bool b)
1017 { 1022 {
1018 m_bitfields.setMayNeedPaintInvalidation(b); 1023 m_bitfields.setMayNeedPaintInvalidation(b);
1019 1024
1020 // Make sure our parent is marked as needing invalidation. 1025 // Make sure our parent is marked as needing invalidation.
1021 if (b && parent() && !parent()->mayNeedPaintInvalidation()) 1026 if (b && parent() && !parent()->mayNeedPaintInvalidation())
1022 parent()->setMayNeedPaintInvalidation(b); 1027 parent()->setMayNeedPaintInvalidation(b);
1023 } 1028 }
1024 1029
1025 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); } 1030 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); }
1026 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); } 1031 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); }
1027 1032
1028 bool shouldCheckForPaintInvalidation() 1033 bool shouldCheckForPaintInvalidation() const
1029 { 1034 {
1030 return layoutDidGetCalled() || mayNeedPaintInvalidation(); 1035 return m_bitfields.childNeedsPaintInvalidation() || shouldCheckForSelfPa intInvalidation();
1036 }
1037 bool shouldCheckForSelfPaintInvalidation() const
dsinclair 2014/07/17 18:36:01 The naming of these two methods doesn't seem quite
Xianzhu 2014/07/17 21:57:34 How about shouldCheckForTreePaintInvalidation() an
dsinclair 2014/07/18 14:15:04 My preference would be to get the word Tree out of
Xianzhu 2014/07/18 17:15:22 Agreed. Done.
1038 {
1039 return layoutDidGetCalled() || mayNeedPaintInvalidation() || shouldDoFul lPaintInvalidation();
1031 } 1040 }
1032 1041
1033 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } 1042 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); }
1034 1043
1035 void setNeedsOverflowRecalcAfterStyleChange(); 1044 void setNeedsOverflowRecalcAfterStyleChange();
1036 void markContainingBlocksForOverflowRecalc(); 1045 void markContainingBlocksForOverflowRecalc();
1037 1046
1038 protected: 1047 protected:
1039 inline bool layerCreationAllowedForSubtree() const; 1048 inline bool layerCreationAllowedForSubtree() const;
1040 1049
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset 1095 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset
1087 // of this renderer within the current layer that should be used for each re sult. 1096 // of this renderer within the current layer that should be used for each re sult.
1088 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { }; 1097 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { };
1089 1098
1090 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer, 1099 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer,
1091 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, 1100 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer,
1092 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer); 1101 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer);
1093 void incrementallyInvalidatePaint(const RenderLayerModelObject& paintInvalid ationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds); 1102 void incrementallyInvalidatePaint(const RenderLayerModelObject& paintInvalid ationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds);
1094 void fullyInvalidatePaint(const RenderLayerModelObject& paintInvalidationCon tainer, InvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBo unds); 1103 void fullyInvalidatePaint(const RenderLayerModelObject& paintInvalidationCon tainer, InvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBo unds);
1095 1104
1105 void setChildNeedsPaintInvalidation(bool b) { m_bitfields.setChildNeedsPaint Invalidation(true); }
1106
1096 private: 1107 private:
1097 const RenderLayerModelObject* enclosingCompositedContainer() const; 1108 const RenderLayerModelObject* enclosingCompositedContainer() const;
1098 1109
1099 RenderBlock* containerForFixedPosition(const RenderLayerModelObject* paintIn validationContainer = 0, bool* paintInvalidationContainerSkipped = 0) const; 1110 RenderBlock* containerForFixedPosition(const RenderLayerModelObject* paintIn validationContainer = 0, bool* paintInvalidationContainerSkipped = 0) const;
1100 1111
1101 RenderFlowThread* locateFlowThreadContainingBlock() const; 1112 RenderFlowThread* locateFlowThreadContainingBlock() const;
1102 void removeFromRenderFlowThread(); 1113 void removeFromRenderFlowThread();
1103 void removeFromRenderFlowThreadRecursive(RenderFlowThread*); 1114 void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
1104 1115
1105 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const; 1116 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1158
1148 public: 1159 public:
1149 RenderObjectBitfields(Node* node) 1160 RenderObjectBitfields(Node* node)
1150 : m_selfNeedsLayout(false) 1161 : m_selfNeedsLayout(false)
1151 , m_shouldDoFullPaintInvalidation(false) 1162 , m_shouldDoFullPaintInvalidation(false)
1152 , m_shouldInvalidateOverflowForPaint(false) 1163 , m_shouldInvalidateOverflowForPaint(false)
1153 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false) 1164 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false)
1154 // FIXME: We should remove mayNeedPaintInvalidation once we are able to 1165 // FIXME: We should remove mayNeedPaintInvalidation once we are able to
1155 // use the other layout flags to detect the same cases. crbug.com/37 0118 1166 // use the other layout flags to detect the same cases. crbug.com/37 0118
1156 , m_mayNeedPaintInvalidation(false) 1167 , m_mayNeedPaintInvalidation(false)
1168 , m_childNeedsPaintInvalidation(false)
1157 , m_onlyNeededPositionedMovementLayout(false) 1169 , m_onlyNeededPositionedMovementLayout(false)
1158 , m_neededLayoutBecauseOfChildren(false) 1170 , m_neededLayoutBecauseOfChildren(false)
1159 , m_needsPositionedMovementLayout(false) 1171 , m_needsPositionedMovementLayout(false)
1160 , m_normalChildNeedsLayout(false) 1172 , m_normalChildNeedsLayout(false)
1161 , m_posChildNeedsLayout(false) 1173 , m_posChildNeedsLayout(false)
1162 , m_needsSimplifiedNormalFlowLayout(false) 1174 , m_needsSimplifiedNormalFlowLayout(false)
1163 , m_preferredLogicalWidthsDirty(false) 1175 , m_preferredLogicalWidthsDirty(false)
1164 , m_floating(false) 1176 , m_floating(false)
1165 , m_selfNeedsOverflowRecalcAfterStyleChange(false) 1177 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1166 , m_childNeedsOverflowRecalcAfterStyleChange(false) 1178 , m_childNeedsOverflowRecalcAfterStyleChange(false)
(...skipping 21 matching lines...) Expand all
1188 , m_hasPendingResourceUpdate(false) 1200 , m_hasPendingResourceUpdate(false)
1189 { 1201 {
1190 } 1202 }
1191 1203
1192 // 32 bits have been used in the first word, and 6 in the second. 1204 // 32 bits have been used in the first word, and 6 in the second.
1193 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1205 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1194 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidation, ShouldDoFullPaintInv alidation); 1206 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidation, ShouldDoFullPaintInv alidation);
1195 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint); 1207 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint);
1196 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer); 1208 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer);
1197 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1209 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1210 ADD_BOOLEAN_BITFIELD(childNeedsPaintInvalidation, ChildNeedsPaintInvalid ation);
1198 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1211 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1199 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren); 1212 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren);
1200 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1213 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1201 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1214 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1202 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1215 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1203 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1216 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1204 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1217 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1205 ADD_BOOLEAN_BITFIELD(floating, Floating); 1218 ADD_BOOLEAN_BITFIELD(floating, Floating);
1206 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange); 1219 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange);
1207 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange); 1220 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 void showTree(const WebCore::RenderObject*); 1502 void showTree(const WebCore::RenderObject*);
1490 void showLineTree(const WebCore::RenderObject*); 1503 void showLineTree(const WebCore::RenderObject*);
1491 void showRenderTree(const WebCore::RenderObject* object1); 1504 void showRenderTree(const WebCore::RenderObject* object1);
1492 // We don't make object2 an optional parameter so that showRenderTree 1505 // We don't make object2 an optional parameter so that showRenderTree
1493 // can be called from gdb easily. 1506 // can be called from gdb easily.
1494 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1507 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1495 1508
1496 #endif 1509 #endif
1497 1510
1498 #endif // RenderObject_h 1511 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698