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

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: 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 showRenderTreeForThis(); 239 showRenderTreeForThis();
240 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout()); 240 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
241 } 241 }
242 242
243 void assertSubtreeIsLaidOut() const 243 void assertSubtreeIsLaidOut() const
244 { 244 {
245 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) 245 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder())
246 renderer->assertRendererLaidOut(); 246 renderer->assertRendererLaidOut();
247 } 247 }
248 248
249 void assertRendererClearedPaintInvalidationState() const
250 {
251 if (paintInvalidationStateIsDirty()) {
dsinclair 2014/07/11 20:48:55 if (!paintInvalidationStateIsDirt()) return;
Julien - ping for review 2014/07/11 20:52:46 A'right.
252 showRenderTreeForThis();
dsinclair 2014/07/11 20:48:55 Is this included on purpose?
Julien - ping for review 2014/07/11 20:52:46 It is, see assertRendererLaidOut() above. The reas
253 ASSERT_NOT_REACHED();
254 }
255 }
256
257 void assertSubtreeClearedPaintInvalidationState() const
258 {
259 for (const RenderObject* renderer = this; renderer; renderer = renderer- >nextInPreOrder()) {
260 renderer->assertRendererClearedPaintInvalidationState();
261
262 // Currently we skip some SVG containers for performance (see Render SVGModelObject::invalidateTreeAfterLayout)
263 // so we just skip the underlying subtree. This is not strictly the condition in the previous function but
264 // it makes little sense to cover SVG subtrees if we know they are s kipped anyway.
265 if (renderer->isSVGContainer())
266 return;
267 }
268 }
269
249 #endif 270 #endif
250 271
251 bool skipInvalidationWhenLaidOutChildren() const; 272 bool skipInvalidationWhenLaidOutChildren() const;
252 273
253 // FIXME: This could be used when changing the size of a renderer without ch ildren to skip some invalidations. 274 // FIXME: This could be used when changing the size of a renderer without ch ildren to skip some invalidations.
254 bool rendererHasNoBoxEffect() const 275 bool rendererHasNoBoxEffect() const
255 { 276 {
256 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() & & !style()->hasBackground(); 277 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() & & !style()->hasBackground();
257 } 278 }
258 279
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } 1022 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); }
1002 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); } 1023 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); }
1003 1024
1004 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); } 1025 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee dedPositionedMovementLayout(); }
1005 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); } 1026 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed edPositionedMovementLayout(b); }
1006 1027
1007 void clearPaintInvalidationState(); 1028 void clearPaintInvalidationState();
1008 1029
1009 // layoutDidGetCalled indicates whether this render object was re-laid-out 1030 // layoutDidGetCalled indicates whether this render object was re-laid-out
1010 // since the last call to setLayoutDidGetCalled(false) on this object. 1031 // since the last call to setLayoutDidGetCalled(false) on this object.
1011 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } 1032 bool layoutDidGetCalled() const { return m_bitfields.layoutDidGetCalled(); }
1012 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } 1033 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
1013 1034
1014 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio n(); } 1035 bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInval idation(); }
1015 void setMayNeedPaintInvalidation(bool b) 1036 void setMayNeedPaintInvalidation(bool b)
1016 { 1037 {
1017 m_bitfields.setMayNeedPaintInvalidation(b); 1038 m_bitfields.setMayNeedPaintInvalidation(b);
1018 1039
1019 // Make sure our parent is marked as needing invalidation. 1040 // Make sure our parent is marked as needing invalidation.
1020 if (b && parent() && !parent()->mayNeedPaintInvalidation()) 1041 if (b && parent() && !parent()->mayNeedPaintInvalidation())
1021 parent()->setMayNeedPaintInvalidation(b); 1042 parent()->setMayNeedPaintInvalidation(b);
1022 } 1043 }
1023 1044
1024 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); } 1045 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout BecauseOfChildren(); }
1025 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); } 1046 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB ecauseOfChildren(b); }
1026 1047
1027 bool shouldCheckForPaintInvalidationAfterLayout() 1048 bool shouldCheckForPaintInvalidationAfterLayout()
1028 { 1049 {
1029 return layoutDidGetCalled() || mayNeedPaintInvalidation(); 1050 return layoutDidGetCalled() || mayNeedPaintInvalidation() || shouldDoFul lPaintInvalidationAfterLayout();
1030 } 1051 }
1031 1052
1032 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } 1053 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); }
1033 1054
1034 void setNeedsOverflowRecalcAfterStyleChange(); 1055 void setNeedsOverflowRecalcAfterStyleChange();
1035 void markContainingBlocksForOverflowRecalc(); 1056 void markContainingBlocksForOverflowRecalc();
1036 1057
1037 protected: 1058 protected:
1038 inline bool layerCreationAllowedForSubtree() const; 1059 inline bool layerCreationAllowedForSubtree() const;
1039 1060
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1126
1106 RenderStyle* cachedFirstLineStyle() const; 1127 RenderStyle* cachedFirstLineStyle() const;
1107 StyleDifference adjustStyleDifference(StyleDifference) const; 1128 StyleDifference adjustStyleDifference(StyleDifference) const;
1108 1129
1109 Color selectionColor(int colorProperty) const; 1130 Color selectionColor(int colorProperty) const;
1110 1131
1111 void removeShapeImageClient(ShapeValue*); 1132 void removeShapeImageClient(ShapeValue*);
1112 1133
1113 #ifndef NDEBUG 1134 #ifndef NDEBUG
1114 void checkBlockPositionedObjectsNeedLayout(); 1135 void checkBlockPositionedObjectsNeedLayout();
1136
1137 bool paintInvalidationStateIsDirty() const
1138 {
1139 return layoutDidGetCalled() || shouldDoFullPaintInvalidationAfterLayout( ) || shouldDoFullPaintInvalidationIfSelfPaintingLayer()
1140 || onlyNeededPositionedMovementLayout() || neededLayoutBecauseOfChil dren() || mayNeedPaintInvalidation();
1141 }
1115 #endif 1142 #endif
1116 const char* invalidationReasonToString(InvalidationReason) const; 1143 const char* invalidationReasonToString(InvalidationReason) const;
1117 1144
1118 static bool isAllowedToModifyRenderTreeStructure(Document&); 1145 static bool isAllowedToModifyRenderTreeStructure(Document&);
1119 1146
1120 RefPtr<RenderStyle> m_style; 1147 RefPtr<RenderStyle> m_style;
1121 1148
1122 Node* m_node; 1149 Node* m_node;
1123 1150
1124 RenderObject* m_parent; 1151 RenderObject* m_parent;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 void showTree(const WebCore::RenderObject*); 1519 void showTree(const WebCore::RenderObject*);
1493 void showLineTree(const WebCore::RenderObject*); 1520 void showLineTree(const WebCore::RenderObject*);
1494 void showRenderTree(const WebCore::RenderObject* object1); 1521 void showRenderTree(const WebCore::RenderObject* object1);
1495 // We don't make object2 an optional parameter so that showRenderTree 1522 // We don't make object2 an optional parameter so that showRenderTree
1496 // can be called from gdb easily. 1523 // can be called from gdb easily.
1497 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1524 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1498 1525
1499 #endif 1526 #endif
1500 1527
1501 #endif // RenderObject_h 1528 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698