OLD | NEW |
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 Loading... |
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 | 253 #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 | |
276 #endif | |
277 | 254 |
278 bool skipInvalidationWhenLaidOutChildren() const; | 255 bool skipInvalidationWhenLaidOutChildren() const; |
279 | 256 |
280 // FIXME: This could be used when changing the size of a renderer without ch
ildren to skip some invalidations. | 257 // FIXME: This could be used when changing the size of a renderer without ch
ildren to skip some invalidations. |
281 bool rendererHasNoBoxEffect() const | 258 bool rendererHasNoBoxEffect() const |
282 { | 259 { |
283 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() &
& !style()->hasBackground(); | 260 return !style()->hasVisualOverflowingEffect() && !style()->hasBorder() &
& !style()->hasBackground(); |
284 } | 261 } |
285 | 262 |
286 // Obtains the nearest enclosing block (including this block) that contribut
es a first-line style to our inline | 263 // Obtains the nearest enclosing block (including this block) that contribut
es a first-line style to our inline |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 | 992 |
1016 bool isRelayoutBoundaryForInspector() const; | 993 bool isRelayoutBoundaryForInspector() const; |
1017 | 994 |
1018 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP
aintInvalidationRect; } | 995 const LayoutRect& previousPaintInvalidationRect() const { return m_previousP
aintInvalidationRect; } |
1019 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa
intInvalidationRect = rect; } | 996 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { m_previousPa
intInvalidationRect = rect; } |
1020 | 997 |
1021 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const {
return m_previousPositionFromPaintInvalidationContainer; } | 998 const LayoutPoint& previousPositionFromPaintInvalidationContainer() const {
return m_previousPositionFromPaintInvalidationContainer; } |
1022 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo
cation) { m_previousPositionFromPaintInvalidationContainer = location; } | 999 void setPreviousPositionFromPaintInvalidationContainer(const LayoutPoint& lo
cation) { m_previousPositionFromPaintInvalidationContainer = location; } |
1023 | 1000 |
1024 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull
PaintInvalidation(); } | 1001 bool shouldDoFullPaintInvalidation() const { return m_bitfields.shouldDoFull
PaintInvalidation(); } |
1025 void setShouldDoFullPaintInvalidation(bool b, MarkingBehavior markBehavior =
MarkContainingBlockChain) | 1002 void setShouldDoFullPaintInvalidation(bool b) { m_bitfields.setShouldDoFullP
aintInvalidation(b); } |
1026 { | |
1027 m_bitfields.setShouldDoFullPaintInvalidation(b); | |
1028 | |
1029 if (markBehavior == MarkContainingBlockChain && b) | |
1030 markContainingBlockChainForPaintInvalidation(); | |
1031 } | |
1032 | |
1033 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv
alidateOverflowForPaint(); } | 1003 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv
alidateOverflowForPaint(); } |
1034 | 1004 |
1035 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit
fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } | 1005 bool shouldDoFullPaintInvalidationIfSelfPaintingLayer() const { return m_bit
fields.shouldDoFullPaintInvalidationIfSelfPaintingLayer(); } |
1036 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) | 1006 void setShouldDoFullPaintInvalidationIfSelfPaintingLayer(bool b) { m_bitfiel
ds.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); } |
1037 { | |
1038 m_bitfields.setShouldDoFullPaintInvalidationIfSelfPaintingLayer(b); | |
1039 | |
1040 if (b) | |
1041 markContainingBlockChainForPaintInvalidation(); | |
1042 } | |
1043 | 1007 |
1044 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee
dedPositionedMovementLayout(); } | 1008 bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNee
dedPositionedMovementLayout(); } |
1045 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed
edPositionedMovementLayout(b); } | 1009 void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeed
edPositionedMovementLayout(b); } |
1046 | 1010 |
1047 void clearPaintInvalidationState(); | 1011 void clearPaintInvalidationState(); |
1048 | 1012 |
1049 // layoutDidGetCalled indicates whether this render object was re-laid-out | 1013 // layoutDidGetCalled indicates whether this render object was re-laid-out |
1050 // since the last call to setLayoutDidGetCalled(false) on this object. | 1014 // since the last call to setLayoutDidGetCalled(false) on this object. |
1051 bool layoutDidGetCalled() const { return m_bitfields.layoutDidGetCalled(); } | 1015 bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); } |
1052 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } | 1016 void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); } |
1053 | 1017 |
1054 bool mayNeedPaintInvalidation() const { return m_bitfields.mayNeedPaintInval
idation(); } | 1018 bool mayNeedPaintInvalidation() { return m_bitfields.mayNeedPaintInvalidatio
n(); } |
1055 void setMayNeedPaintInvalidation(bool b) | 1019 void setMayNeedPaintInvalidation(bool b) |
1056 { | 1020 { |
1057 m_bitfields.setMayNeedPaintInvalidation(b); | 1021 m_bitfields.setMayNeedPaintInvalidation(b); |
1058 | 1022 |
1059 // Make sure our parent is marked as needing invalidation. | 1023 // Make sure our parent is marked as needing invalidation. |
1060 if (b) | 1024 if (b && parent() && !parent()->mayNeedPaintInvalidation()) |
1061 markContainingBlockChainForPaintInvalidation(); | 1025 parent()->setMayNeedPaintInvalidation(b); |
1062 } | 1026 } |
1063 | 1027 |
1064 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout
BecauseOfChildren(); } | 1028 bool neededLayoutBecauseOfChildren() const { return m_bitfields.neededLayout
BecauseOfChildren(); } |
1065 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB
ecauseOfChildren(b); } | 1029 void setNeededLayoutBecauseOfChildren(bool b) { m_bitfields.setNeededLayoutB
ecauseOfChildren(b); } |
1066 | 1030 |
1067 bool shouldCheckForPaintInvalidation() | 1031 bool shouldCheckForPaintInvalidation() |
1068 { | 1032 { |
1069 return layoutDidGetCalled() || mayNeedPaintInvalidation() || shouldDoFul
lPaintInvalidation() || shouldDoFullPaintInvalidationIfSelfPaintingLayer(); | 1033 return layoutDidGetCalled() || mayNeedPaintInvalidation(); |
1070 } | 1034 } |
1071 | 1035 |
1072 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has
Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } | 1036 bool supportsLayoutStateCachedOffsets() const { return !hasColumns() && !has
Transform() && !hasReflection() && !style()->isFlippedBlocksWritingMode(); } |
1073 | 1037 |
1074 void setNeedsOverflowRecalcAfterStyleChange(); | 1038 void setNeedsOverflowRecalcAfterStyleChange(); |
1075 void markContainingBlocksForOverflowRecalc(); | 1039 void markContainingBlocksForOverflowRecalc(); |
1076 | 1040 |
1077 protected: | 1041 protected: |
1078 inline bool layerCreationAllowedForSubtree() const; | 1042 inline bool layerCreationAllowedForSubtree() const; |
1079 | 1043 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1109 |
1146 RenderStyle* cachedFirstLineStyle() const; | 1110 RenderStyle* cachedFirstLineStyle() const; |
1147 StyleDifference adjustStyleDifference(StyleDifference) const; | 1111 StyleDifference adjustStyleDifference(StyleDifference) const; |
1148 | 1112 |
1149 Color selectionColor(int colorProperty) const; | 1113 Color selectionColor(int colorProperty) const; |
1150 | 1114 |
1151 void removeShapeImageClient(ShapeValue*); | 1115 void removeShapeImageClient(ShapeValue*); |
1152 | 1116 |
1153 #if ENABLE(ASSERT) | 1117 #if ENABLE(ASSERT) |
1154 void checkBlockPositionedObjectsNeedLayout(); | 1118 void checkBlockPositionedObjectsNeedLayout(); |
1155 | |
1156 bool paintInvalidationStateIsDirty() const | |
1157 { | |
1158 return layoutDidGetCalled() || shouldDoFullPaintInvalidation() || should
DoFullPaintInvalidationIfSelfPaintingLayer() | |
1159 || onlyNeededPositionedMovementLayout() || neededLayoutBecauseOfChil
dren() || mayNeedPaintInvalidation(); | |
1160 } | |
1161 #endif | 1119 #endif |
1162 const char* invalidationReasonToString(InvalidationReason) const; | 1120 const char* invalidationReasonToString(InvalidationReason) const; |
1163 | 1121 |
1164 void markContainingBlockChainForPaintInvalidation() | |
1165 { | |
1166 for (RenderObject* container = this->container(); container && !containe
r->shouldCheckForPaintInvalidation(); container = container->container()) | |
1167 container->setMayNeedPaintInvalidation(true); | |
1168 } | |
1169 | |
1170 static bool isAllowedToModifyRenderTreeStructure(Document&); | 1122 static bool isAllowedToModifyRenderTreeStructure(Document&); |
1171 | 1123 |
1172 RefPtr<RenderStyle> m_style; | 1124 RefPtr<RenderStyle> m_style; |
1173 | 1125 |
1174 Node* m_node; | 1126 Node* m_node; |
1175 | 1127 |
1176 RenderObject* m_parent; | 1128 RenderObject* m_parent; |
1177 RenderObject* m_previous; | 1129 RenderObject* m_previous; |
1178 RenderObject* m_next; | 1130 RenderObject* m_next; |
1179 | 1131 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 void showTree(const blink::RenderObject*); | 1492 void showTree(const blink::RenderObject*); |
1541 void showLineTree(const blink::RenderObject*); | 1493 void showLineTree(const blink::RenderObject*); |
1542 void showRenderTree(const blink::RenderObject* object1); | 1494 void showRenderTree(const blink::RenderObject* object1); |
1543 // We don't make object2 an optional parameter so that showRenderTree | 1495 // We don't make object2 an optional parameter so that showRenderTree |
1544 // can be called from gdb easily. | 1496 // can be called from gdb easily. |
1545 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); | 1497 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); |
1546 | 1498 |
1547 #endif | 1499 #endif |
1548 | 1500 |
1549 #endif // RenderObject_h | 1501 #endif // RenderObject_h |
OLD | NEW |