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

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

Issue 389573008: Enforce clearing renderers' paint invalidation state (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated TestExpectations for landing. 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
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderObject.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) 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 #endif 243 #endif
244 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout()); 244 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
245 } 245 }
246 246
247 void assertSubtreeIsLaidOut() const 247 void assertSubtreeIsLaidOut() const
248 { 248 {
249 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) 249 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder())
250 renderer->assertRendererLaidOut(); 250 renderer->assertRendererLaidOut();
251 } 251 }
252 252
253 void assertRendererClearedPaintInvalidationState() const
254 {
255 #ifndef NDEBUG
256 if (paintInvalidationStateIsDirty()) {
257 showRenderTreeForThis();
258 ASSERT_NOT_REACHED();
259 }
260 #endif
261 }
262
263 void assertSubtreeClearedPaintInvalidationState() const
264 {
265 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) {
266 renderer->assertRendererClearedPaintInvalidationState();
267
268 // Currently we skip some SVG containers for performance (see Render SVGModelObject::invalidateTreeAfterLayout)
269 // so we just skip the underlying subtree. This is not strictly the condition in the previous function but
270 // it makes little sense to cover SVG subtrees if we know they are s kipped anyway.
271 if (renderer->isSVGContainer())
272 return;
273 }
274 }
275
253 #endif 276 #endif
254 277
255 bool skipInvalidationWhenLaidOutChildren() const; 278 bool skipInvalidationWhenLaidOutChildren() const;
256 279
257 // FIXME: This could be used when changing the size of a renderer without ch ildren to skip some invalidations. 280 // FIXME: This could be used when changing the size of a renderer without ch ildren to skip some invalidations.
258 bool rendererHasNoBoxEffect() const 281 bool rendererHasNoBoxEffect() const
259 { 282 {
260 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() & & !style()->hasBackground(); 283 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() & & !style()->hasBackground();
261 } 284 }
262 285
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 1018
996 bool isRelayoutBoundaryForInspector() const; 1019 bool isRelayoutBoundaryForInspector() const;
997 1020
998 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; } 1021 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP aintInvalidationRect; }
999 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; } 1022 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa intInvalidationRect = rect; }
1000 1023
1001 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const { return m_previousPositionFromPaintInvalidationContainer; } 1024 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const { return m_previousPositionFromPaintInvalidationContainer; }
1002 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo cation) { m_previousPositionFromPaintInvalidationContainer = location; } 1025 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo cation) { m_previousPositionFromPaintInvalidationContainer = location; }
1003 1026
1004 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); } 1027 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull PaintInvalidation(); }
1005 void setShouldDoFullPaintInvalidation(bool b) { m_bitfields.setShouldDoFullP aintInvalidation(b); } 1028 void setShouldDoFullPaintInvalidation(bool b, MarkingBehavior markBehavior = MarkContainingBlockChain)
1029 {
1030 m_bitfields.setShouldDoFullPaintInvalidation(b);
1031
1032 if (markBehavior == MarkContainingBlockChain && b)
1033 markContainingBlockChainForPaintInvalidation();
1034 }
1035
1006 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); } 1036 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); }
1007 1037
1008 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } 1038 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); }
1009 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); } 1039 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b)
1040 {
1041 m_bitfields.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b);
1042
1043 if (b)
1044 markContainingBlockChainForPaintInvalidation();
1045 }
1010 1046
1011 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); } 1047 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); }
1012 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); } 1048 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); }
1013 1049
1014 void clearPaintInvalidationState(); 1050 void clearPaintInvalidationState();
1015 1051
1016 // layoutDidGetCalled indicates whether this render object was re-laid-out 1052 // layoutDidGetCalled indicates whether this render object was re-laid-out
1017 // since the last call to setLayoutDidGetCalled(false) on this object. 1053 // since the last call to setLayoutDidGetCalled(false) on this object.
1018 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } 1054 bool layoutDidGetCalled() const { return m_bitfields.layoutDidGetCalled(); }
1019 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } 1055 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
1020 1056
1021 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); } 1057 bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInval idation(); }
1022 void setMayNeedPaintInvalidation(bool b) 1058 void setMayNeedPaintInvalidation(bool b)
1023 { 1059 {
1024 m_bitfields.setMayNeedPaintInvalidation(b); 1060 m_bitfields.setMayNeedPaintInvalidation(b);
1025 1061
1026 // Make sure our parent is marked as needing invalidation. 1062 // Make sure our parent is marked as needing invalidation.
1027 if (b && parent() && !parent()->mayNeedPaintInvalidation()) 1063 if (b)
1028 parent()->setMayNeedPaintInvalidation(b); 1064 markContainingBlockChainForPaintInvalidation();
1029 } 1065 }
1030 1066
1031 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); } 1067 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); }
1032 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); } 1068 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); }
1033 1069
1034 bool shouldCheckForPaintInvalidation() 1070 bool shouldCheckForPaintInvalidation()
1035 { 1071 {
1036 return layoutDidGetCalled() || mayNeedPaintInvalidation(); 1072 return layoutDidGetCalled() || mayNeedPaintInvalidation() || shouldDoFul lPaintInvalidation() || shouldDoFullPaintInvalidationIfSelfPaintingLayer();
1037 } 1073 }
1038 1074
1039 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } 1075 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); }
1040 1076
1041 void setNeedsOverflowRecalcAfterStyleChange(); 1077 void setNeedsOverflowRecalcAfterStyleChange();
1042 void markContainingBlocksForOverflowRecalc(); 1078 void markContainingBlocksForOverflowRecalc();
1043 1079
1044 protected: 1080 protected:
1045 inline bool layerCreationAllowedForSubtree() const; 1081 inline bool layerCreationAllowedForSubtree() const;
1046 1082
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 1148
1113 RenderStyle* cachedFirstLineStyle() const; 1149 RenderStyle* cachedFirstLineStyle() const;
1114 StyleDifference adjustStyleDifference(StyleDifference) const; 1150 StyleDifference adjustStyleDifference(StyleDifference) const;
1115 1151
1116 Color selectionColor(int colorProperty) const; 1152 Color selectionColor(int colorProperty) const;
1117 1153
1118 void removeShapeImageClient(ShapeValue*); 1154 void removeShapeImageClient(ShapeValue*);
1119 1155
1120 #if ENABLE(ASSERT) 1156 #if ENABLE(ASSERT)
1121 void checkBlockPositionedObjectsNeedLayout(); 1157 void checkBlockPositionedObjectsNeedLayout();
1158
1159 bool paintInvalidationStateIsDirty() const
1160 {
1161 return layoutDidGetCalled() || shouldDoFullPaintInvalidation() || should DoFullPaintInvalidationIfSelfPaintingLayer()
1162 || onlyNeededPositionedMovementLayout() || neededLayoutBecauseOfChil dren() || mayNeedPaintInvalidation();
1163 }
1122 #endif 1164 #endif
1123 const char* invalidationReasonToString(InvalidationReason) const; 1165 const char* invalidationReasonToString(InvalidationReason) const;
1124 1166
1167 void markContainingBlockChainForPaintInvalidation()
1168 {
1169 for (RenderObject* container = this->container(); container && !containe r->shouldCheckForPaintInvalidation(); container = container->container())
1170 container->setMayNeedPaintInvalidation(true);
1171 }
1172
1125 static bool isAllowedToModifyRenderTreeStructure(Document&); 1173 static bool isAllowedToModifyRenderTreeStructure(Document&);
1126 1174
1127 RefPtr<RenderStyle> m_style; 1175 RefPtr<RenderStyle> m_style;
1128 1176
1129 Node* m_node; 1177 Node* m_node;
1130 1178
1131 RenderObject* m_parent; 1179 RenderObject* m_parent;
1132 RenderObject* m_previous; 1180 RenderObject* m_previous;
1133 RenderObject* m_next; 1181 RenderObject* m_next;
1134 1182
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 void showTree(const blink::RenderObject*); 1543 void showTree(const blink::RenderObject*);
1496 void showLineTree(const blink::RenderObject*); 1544 void showLineTree(const blink::RenderObject*);
1497 void showRenderTree(const blink::RenderObject* object1); 1545 void showRenderTree(const blink::RenderObject* object1);
1498 // We don't make object2 an optional parameter so that showRenderTree 1546 // We don't make object2 an optional parameter so that showRenderTree
1499 // can be called from gdb easily. 1547 // can be called from gdb easily.
1500 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2); 1548 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2);
1501 1549
1502 #endif 1550 #endif
1503 1551
1504 #endif // RenderObject_h 1552 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698