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

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: Update naming 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 842
843 // Invalidate the paint of a specific subrectangle within a given object. Th e rect |r| is in the object's coordinate space. 843 // Invalidate the paint of a specific subrectangle within a given object. Th e rect |r| is in the object's coordinate space.
844 void invalidatePaintRectangle(const LayoutRect&) const; 844 void invalidatePaintRectangle(const LayoutRect&) const;
845 845
846 bool invalidatePaintIfNeeded(const RenderLayerModelObject& paintInvalidation Container, 846 bool invalidatePaintIfNeeded(const RenderLayerModelObject& paintInvalidation Container,
847 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, const PaintInvalidationState&); 847 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, const PaintInvalidationState&);
848 848
849 // 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. 849 // 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.
850 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); 850 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&);
851 851
852 // For now RenderBoxes and RenderSVGModelObjects know how to invalidate them selves in invalidateTreeIfNeeded.
853 // Other objects (e.g. RenderText, RenderInline, etc) depend on their contai ners for invalidation.
854 // crbug.com/394133.
855 bool canSelfInvalidateDuringTreeInvalidation() const { return isBox() || isS VG(); }
856
852 virtual void invalidatePaintForOverflow(); 857 virtual void invalidatePaintForOverflow();
853 void invalidatePaintForOverflowIfNeeded(); 858 void invalidatePaintForOverflowIfNeeded();
854 859
855 bool checkForPaintInvalidation() const; 860 bool checkForPaintInvalidation() const;
856 861
857 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the view's 862 // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the view's
858 // coordinate space. This method deals with outlines and overflow. 863 // coordinate space. This method deals with outlines and overflow.
859 LayoutRect absoluteClippedOverflowRect() const 864 LayoutRect absoluteClippedOverflowRect() const
860 { 865 {
861 return clippedOverflowRectForPaintInvalidation(0); 866 return clippedOverflowRectForPaintInvalidation(0);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 996
992 bool isRelayoutBoundaryForInspector() const; 997 bool isRelayoutBoundaryForInspector() const;
993 998
994 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; } 999 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; }
995 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; } 1000 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; }
996 1001
997 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const { return m_previousPositionFromPaintInvalidationContainer; } 1002 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const { return m_previousPositionFromPaintInvalidationContainer; }
998 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo cation) { m_previousPositionFromPaintInvalidationContainer = location; } 1003 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo cation) { m_previousPositionFromPaintInvalidationContainer = location; }
999 1004
1000 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); } 1005 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); }
1001 void setShouldDoFullPaintInvalidation(bool b) { m_bitfields.setShouldDoFullP aintInvalidation(b); } 1006 void setShouldDoFullPaintInvalidation(bool);
1007
1002 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); } 1008 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); }
1003 1009
1004 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } 1010 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); }
1005 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); } 1011 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); }
1006 1012
1007 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); } 1013 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); }
1008 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); } 1014 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); }
1009 1015
1010 void clearPaintInvalidationState(); 1016 void clearPaintInvalidationState();
1011 1017
1012 // layoutDidGetCalled indicates whether this render object was re-laid-out 1018 // layoutDidGetCalled indicates whether this render object was re-laid-out
1013 // since the last call to setLayoutDidGetCalled(false) on this object. 1019 // since the last call to setLayoutDidGetCalled(false) on this object.
1014 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } 1020 bool layoutDidGetCalled() const { return m_bitfields.layoutDidGetCalled(); }
1015 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } 1021 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
1016 1022
1017 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); } 1023 bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInval idation(); }
1018 void setMayNeedPaintInvalidation(bool b) 1024 void setMayNeedPaintInvalidation(bool b)
1019 { 1025 {
1020 m_bitfields.setMayNeedPaintInvalidation(b); 1026 m_bitfields.setMayNeedPaintInvalidation(b);
1021 1027
1022 // Make sure our parent is marked as needing invalidation. 1028 // Make sure our parent is marked as needing invalidation.
1023 if (b && parent() && !parent()->mayNeedPaintInvalidation()) 1029 if (b && parent() && !parent()->mayNeedPaintInvalidation())
1024 parent()->setMayNeedPaintInvalidation(b); 1030 parent()->setMayNeedPaintInvalidation(b);
1025 } 1031 }
1026 1032
1027 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); } 1033 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); }
1028 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); } 1034 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); }
1029 1035
1030 bool shouldCheckForPaintInvalidation() 1036 bool shouldCheckForSelfOrChildPaintInvalidation() const
1031 { 1037 {
1032 return layoutDidGetCalled() || mayNeedPaintInvalidation(); 1038 return m_bitfields.childNeedsPaintInvalidation() || shouldCheckForPaintI nvalidation();
1039 }
1040 bool shouldCheckForPaintInvalidation() const
1041 {
1042 return layoutDidGetCalled() || mayNeedPaintInvalidation() || shouldDoFul lPaintInvalidation();
1033 } 1043 }
1034 1044
1035 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } 1045 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); }
1036 1046
1037 void setNeedsOverflowRecalcAfterStyleChange(); 1047 void setNeedsOverflowRecalcAfterStyleChange();
1038 void markContainingBlocksForOverflowRecalc(); 1048 void markContainingBlocksForOverflowRecalc();
1039 1049
1040 protected: 1050 protected:
1041 inline bool layerCreationAllowedForSubtree() const; 1051 inline bool layerCreationAllowedForSubtree() const;
1042 1052
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset 1098 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset
1089 // of this renderer within the current layer that should be used for each re sult. 1099 // of this renderer within the current layer that should be used for each re sult.
1090 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { }; 1100 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { };
1091 1101
1092 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer, 1102 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer,
1093 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, 1103 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer,
1094 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer); 1104 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer);
1095 void incrementallyInvalidatePaint(const RenderLayerModelObject& paintInvalid ationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds); 1105 void incrementallyInvalidatePaint(const RenderLayerModelObject& paintInvalid ationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds);
1096 void fullyInvalidatePaint(const RenderLayerModelObject& paintInvalidationCon tainer, InvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBo unds); 1106 void fullyInvalidatePaint(const RenderLayerModelObject& paintInvalidationCon tainer, InvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBo unds);
1097 1107
1108 void setChildNeedsPaintInvalidation(bool b) { m_bitfields.setChildNeedsPaint Invalidation(true); }
1109
1098 private: 1110 private:
1099 const RenderLayerModelObject* enclosingCompositedContainer() const; 1111 const RenderLayerModelObject* enclosingCompositedContainer() const;
1100 1112
1101 RenderBlock* containerForFixedPosition(const RenderLayerModelObject* paintIn validationContainer = 0, bool* paintInvalidationContainerSkipped = 0) const; 1113 RenderBlock* containerForFixedPosition(const RenderLayerModelObject* paintIn validationContainer = 0, bool* paintInvalidationContainerSkipped = 0) const;
1102 1114
1103 RenderFlowThread* locateFlowThreadContainingBlock() const; 1115 RenderFlowThread* locateFlowThreadContainingBlock() const;
1104 void removeFromRenderFlowThread(); 1116 void removeFromRenderFlowThread();
1105 void removeFromRenderFlowThreadRecursive(RenderFlowThread*); 1117 void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
1106 1118
1107 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const; 1119 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1161
1150 public: 1162 public:
1151 RenderObjectBitfields(Node* node) 1163 RenderObjectBitfields(Node* node)
1152 : m_selfNeedsLayout(false) 1164 : m_selfNeedsLayout(false)
1153 , m_shouldDoFullPaintInvalidation(false) 1165 , m_shouldDoFullPaintInvalidation(false)
1154 , m_shouldInvalidateOverflowForPaint(false) 1166 , m_shouldInvalidateOverflowForPaint(false)
1155 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false) 1167 , m_shouldDoFullPaintInvalidationIfSelfPaintingLayer(false)
1156 // FIXME: We should remove mayNeedPaintInvalidation once we are able to 1168 // FIXME: We should remove mayNeedPaintInvalidation once we are able to
1157 // use the other layout flags to detect the same cases. crbug.com/37 0118 1169 // use the other layout flags to detect the same cases. crbug.com/37 0118
1158 , m_mayNeedPaintInvalidation(false) 1170 , m_mayNeedPaintInvalidation(false)
1171 , m_childNeedsPaintInvalidation(false)
1159 , m_onlyNeededPositionedMovementLayout(false) 1172 , m_onlyNeededPositionedMovementLayout(false)
1160 , m_neededLayoutBecauseOfChildren(false) 1173 , m_neededLayoutBecauseOfChildren(false)
1161 , m_needsPositionedMovementLayout(false) 1174 , m_needsPositionedMovementLayout(false)
1162 , m_normalChildNeedsLayout(false) 1175 , m_normalChildNeedsLayout(false)
1163 , m_posChildNeedsLayout(false) 1176 , m_posChildNeedsLayout(false)
1164 , m_needsSimplifiedNormalFlowLayout(false) 1177 , m_needsSimplifiedNormalFlowLayout(false)
1165 , m_preferredLogicalWidthsDirty(false) 1178 , m_preferredLogicalWidthsDirty(false)
1166 , m_floating(false) 1179 , m_floating(false)
1167 , m_selfNeedsOverflowRecalcAfterStyleChange(false) 1180 , m_selfNeedsOverflowRecalcAfterStyleChange(false)
1168 , m_childNeedsOverflowRecalcAfterStyleChange(false) 1181 , m_childNeedsOverflowRecalcAfterStyleChange(false)
(...skipping 21 matching lines...) Expand all
1190 , m_hasPendingResourceUpdate(false) 1203 , m_hasPendingResourceUpdate(false)
1191 { 1204 {
1192 } 1205 }
1193 1206
1194 // 32 bits have been used in the first word, and 6 in the second. 1207 // 32 bits have been used in the first word, and 6 in the second.
1195 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); 1208 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
1196 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidation, ShouldDoFullPaintInv alidation); 1209 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidation, ShouldDoFullPaintInv alidation);
1197 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint); 1210 ADD_BOOLEAN_BITFIELD(shouldInvalidateOverflowForPaint, ShouldInvalidateO verflowForPaint);
1198 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer); 1211 ADD_BOOLEAN_BITFIELD(shouldDoFullPaintInvalidationIfSelfPaintingLayer, S houldDoFullPaintInvalidationIfSelfPaintingLayer);
1199 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ; 1212 ADD_BOOLEAN_BITFIELD(mayNeedPaintInvalidation, MayNeedPaintInvalidation) ;
1213 ADD_BOOLEAN_BITFIELD(childNeedsPaintInvalidation, ChildNeedsPaintInvalid ation);
1200 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout); 1214 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit ionedMovementLayout);
1201 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren); 1215 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO fChildren);
1202 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout); 1216 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem entLayout);
1203 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); 1217 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
1204 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); 1218 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
1205 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout); 1219 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor malFlowLayout);
1206 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty); 1220 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths Dirty);
1207 ADD_BOOLEAN_BITFIELD(floating, Floating); 1221 ADD_BOOLEAN_BITFIELD(floating, Floating);
1208 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange); 1222 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO verflowRecalcAfterStyleChange);
1209 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange); 1223 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed sOverflowRecalcAfterStyleChange);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 void showTree(const WebCore::RenderObject*); 1505 void showTree(const WebCore::RenderObject*);
1492 void showLineTree(const WebCore::RenderObject*); 1506 void showLineTree(const WebCore::RenderObject*);
1493 void showRenderTree(const WebCore::RenderObject* object1); 1507 void showRenderTree(const WebCore::RenderObject* object1);
1494 // We don't make object2 an optional parameter so that showRenderTree 1508 // We don't make object2 an optional parameter so that showRenderTree
1495 // can be called from gdb easily. 1509 // can be called from gdb easily.
1496 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1510 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1497 1511
1498 #endif 1512 #endif
1499 1513
1500 #endif // RenderObject_h 1514 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698