OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 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) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 #ifndef NDEBUG | 94 #ifndef NDEBUG |
95 #include <stdio.h> | 95 #include <stdio.h> |
96 #endif | 96 #endif |
97 | 97 |
98 namespace blink { | 98 namespace blink { |
99 | 99 |
100 namespace { | 100 namespace { |
101 | 101 |
102 static bool gModifyRenderTreeStructureAnyState = false; | 102 static bool gModifyRenderTreeStructureAnyState = false; |
103 | 103 |
104 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<const RenderObject> > RenderObj ectWeakSet; | |
105 RenderObjectWeakSet& renderObjectNeverHadPaintInvalidationSet() | |
106 { | |
107 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<RenderObjectWeakSet>, set, (adopt PtrWillBeNoop(new RenderObjectWeakSet()))); | |
108 return *set; | |
109 } | |
110 | |
111 } // namespace | 104 } // namespace |
112 | 105 |
113 using namespace HTMLNames; | 106 using namespace HTMLNames; |
114 | 107 |
115 #if ENABLE(ASSERT) | 108 #if ENABLE(ASSERT) |
116 | 109 |
117 RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(Rende rObject& renderObject) | 110 RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(Rende rObject& renderObject) |
118 : m_renderObject(renderObject) | 111 : m_renderObject(renderObject) |
119 , m_preexistingForbidden(m_renderObject.isSetNeedsLayoutForbidden()) | 112 , m_preexistingForbidden(m_renderObject.isSetNeedsLayoutForbidden()) |
120 { | 113 { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 , m_next(nullptr) | 228 , m_next(nullptr) |
236 #if ENABLE(ASSERT) | 229 #if ENABLE(ASSERT) |
237 , m_hasAXObject(false) | 230 , m_hasAXObject(false) |
238 , m_setNeedsLayoutForbidden(false) | 231 , m_setNeedsLayoutForbidden(false) |
239 #if ENABLE(OILPAN) | 232 #if ENABLE(OILPAN) |
240 , m_didCallDestroy(false) | 233 , m_didCallDestroy(false) |
241 #endif | 234 #endif |
242 #endif | 235 #endif |
243 , m_bitfields(node) | 236 , m_bitfields(node) |
244 { | 237 { |
245 if (firstPaintInvalidationTrackingEnabled()) | |
246 renderObjectNeverHadPaintInvalidationSet().add(this); | |
247 | |
248 #ifndef NDEBUG | 238 #ifndef NDEBUG |
249 renderObjectCounter.increment(); | 239 renderObjectCounter.increment(); |
250 #endif | 240 #endif |
251 ++s_instanceCount; | 241 ++s_instanceCount; |
252 } | 242 } |
253 | 243 |
254 RenderObject::~RenderObject() | 244 RenderObject::~RenderObject() |
255 { | 245 { |
256 if (firstPaintInvalidationTrackingEnabled()) | |
257 renderObjectNeverHadPaintInvalidationSet().remove(this); | |
258 | |
259 ASSERT(!m_hasAXObject); | 246 ASSERT(!m_hasAXObject); |
260 #if ENABLE(OILPAN) | 247 #if ENABLE(OILPAN) |
261 ASSERT(m_didCallDestroy); | 248 ASSERT(m_didCallDestroy); |
262 #endif | 249 #endif |
263 #ifndef NDEBUG | 250 #ifndef NDEBUG |
264 renderObjectCounter.decrement(); | 251 renderObjectCounter.decrement(); |
265 #endif | 252 #endif |
266 --s_instanceCount; | 253 --s_instanceCount; |
267 } | 254 } |
268 | 255 |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1091 topLevelRect = result; | 1078 topLevelRect = result; |
1092 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) | 1079 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) |
1093 current->addAbsoluteRectForLayer(result); | 1080 current->addAbsoluteRectForLayer(result); |
1094 return result; | 1081 return result; |
1095 } | 1082 } |
1096 | 1083 |
1097 void RenderObject::paint(PaintInfo&, const LayoutPoint&) | 1084 void RenderObject::paint(PaintInfo&, const LayoutPoint&) |
1098 { | 1085 { |
1099 } | 1086 } |
1100 | 1087 |
1101 void RenderObject::setHadPaintInvalidation() | |
1102 { | |
1103 if (firstPaintInvalidationTrackingEnabled()) | |
1104 renderObjectNeverHadPaintInvalidationSet().remove(this); | |
1105 } | |
1106 | |
1107 bool RenderObject::hadPaintInvalidation() const | |
1108 { | |
1109 if (!firstPaintInvalidationTrackingEnabled()) | |
1110 return true; | |
1111 | |
1112 return !renderObjectNeverHadPaintInvalidationSet().contains(this); | |
1113 } | |
1114 | |
1115 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons t | 1088 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons t |
1116 { | 1089 { |
1117 RELEASE_ASSERT(isRooted()); | 1090 RELEASE_ASSERT(isRooted()); |
1118 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner()); | 1091 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner()); |
1119 } | 1092 } |
1120 | 1093 |
1121 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const | 1094 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const |
1122 { | 1095 { |
1123 RenderLayerModelObject* container = 0; | 1096 RenderLayerModelObject* container = 0; |
1124 // FIXME: CompositingState is not necessarily up to date for many callers of this function. | 1097 // FIXME: CompositingState is not necessarily up to date for many callers of this function. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1198 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintUsingContainer()", | 1171 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintUsingContainer()", |
1199 "object", this->debugName().ascii(), | 1172 "object", this->debugName().ascii(), |
1200 "info", jsonObjectForPaintInvalidationInfo(r, invalidationReasonToString (invalidationReason))); | 1173 "info", jsonObjectForPaintInvalidationInfo(r, invalidationReasonToString (invalidationReason))); |
1201 | 1174 |
1202 if (paintInvalidationContainer->isRenderFlowThread()) { | 1175 if (paintInvalidationContainer->isRenderFlowThread()) { |
1203 toRenderFlowThread(paintInvalidationContainer)->paintInvalidationRectang leInRegions(r); | 1176 toRenderFlowThread(paintInvalidationContainer)->paintInvalidationRectang leInRegions(r); |
1204 return; | 1177 return; |
1205 } | 1178 } |
1206 | 1179 |
1207 if (paintInvalidationContainer->isRenderView()) { | 1180 if (paintInvalidationContainer->isRenderView()) { |
1208 toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r) ; | 1181 toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r, invalidationReason); |
1209 return; | 1182 return; |
1210 } | 1183 } |
1211 | 1184 |
1212 if (paintInvalidationContainer->view()->usesCompositing()) { | 1185 if (paintInvalidationContainer->view()->usesCompositing()) { |
1213 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); | 1186 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); |
1214 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r); | 1187 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r, in validationReason); |
1215 } | 1188 } |
1216 } | 1189 } |
1217 | 1190 |
1218 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio nState) const | 1191 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio nState) const |
1219 { | 1192 { |
1220 if (!paintInvalidationContainer) | 1193 if (!paintInvalidationContainer) |
1221 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); | 1194 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); |
1222 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont ainer->layer(), paintInvalidationState); | 1195 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont ainer->layer(), paintInvalidationState); |
1223 } | 1196 } |
1224 | 1197 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1257 case InvalidationBoundsChange: | 1230 case InvalidationBoundsChange: |
1258 return "bounds change"; | 1231 return "bounds change"; |
1259 case InvalidationLocationChange: | 1232 case InvalidationLocationChange: |
1260 return "location change"; | 1233 return "location change"; |
1261 case InvalidationScroll: | 1234 case InvalidationScroll: |
1262 return "scroll"; | 1235 return "scroll"; |
1263 case InvalidationSelection: | 1236 case InvalidationSelection: |
1264 return "selection"; | 1237 return "selection"; |
1265 case InvalidationLayer: | 1238 case InvalidationLayer: |
1266 return "layer"; | 1239 return "layer"; |
1240 case InvalidationRendererInsertion: | |
1241 return "renderer insertion"; | |
1267 case InvalidationRendererRemoval: | 1242 case InvalidationRendererRemoval: |
1268 return "renderer removal"; | 1243 return "renderer removal"; |
1269 case InvalidationPaintRectangle: | 1244 case InvalidationPaintRectangle: |
1270 return "invalidate paint rectangle"; | 1245 return "invalidate paint rectangle"; |
1271 } | 1246 } |
1272 ASSERT_NOT_REACHED(); | 1247 ASSERT_NOT_REACHED(); |
1273 return ""; | 1248 return ""; |
1274 } | 1249 } |
1275 | 1250 |
1276 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) | 1251 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1339 } | 1314 } |
1340 | 1315 |
1341 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); | 1316 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); |
1342 return invalidationReason; | 1317 return invalidationReason; |
1343 } | 1318 } |
1344 | 1319 |
1345 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod elObject& paintInvalidationContainer, | 1320 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod elObject& paintInvalidationContainer, |
1346 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, const LayoutRect& newBounds, const LayoutPoint& newPositionFromPain tInvalidationBacking) | 1321 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, const LayoutRect& newBounds, const LayoutPoint& newPositionFromPain tInvalidationBacking) |
1347 { | 1322 { |
1348 if (shouldDoFullPaintInvalidation()) | 1323 if (shouldDoFullPaintInvalidation()) |
1349 return InvalidationFull; | 1324 return m_bitfields.fullPaintInvalidationReason(); |
1350 | 1325 |
1351 // Presumably a background or a border exists if border-fit:lines was specif ied. | 1326 // Presumably a background or a border exists if border-fit:lines was specif ied. |
1352 if (style()->borderFit() == BorderFitLines) | 1327 if (style()->borderFit() == BorderFitLines) |
1353 return InvalidationBorderFitLines; | 1328 return InvalidationBorderFitLines; |
1354 | 1329 |
1355 if (compositingState() != PaintsIntoOwnBacking && newPositionFromPaintInvali dationBacking != oldPositionFromPaintInvalidationBacking) | 1330 if (compositingState() != PaintsIntoOwnBacking && newPositionFromPaintInvali dationBacking != oldPositionFromPaintInvalidationBacking) |
1356 return InvalidationLocationChange; | 1331 return InvalidationLocationChange; |
1357 | 1332 |
1358 // If the bounds are the same then we know that none of the statements below | 1333 // If the bounds are the same then we know that none of the statements below |
1359 // can match, so we can early out since we will not need to do any | 1334 // can match, so we can early out since we will not need to do any |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3070 return false; | 3045 return false; |
3071 } | 3046 } |
3072 | 3047 |
3073 bool RenderObject::isRelayoutBoundaryForInspector() const | 3048 bool RenderObject::isRelayoutBoundaryForInspector() const |
3074 { | 3049 { |
3075 return objectIsRelayoutBoundary(this); | 3050 return objectIsRelayoutBoundary(this); |
3076 } | 3051 } |
3077 | 3052 |
3078 void RenderObject::setShouldDoFullPaintInvalidation(bool b, MarkingBehavior mark Behavior) | 3053 void RenderObject::setShouldDoFullPaintInvalidation(bool b, MarkingBehavior mark Behavior) |
3079 { | 3054 { |
3055 setShouldDoFullPaintInvalidationWithReason(b ? InvalidationFull : Invalidati onNone, markBehavior); | |
3056 } | |
3057 | |
3058 void RenderObject::setShouldDoFullPaintInvalidationWithReason(InvalidationReason reason, MarkingBehavior markBehavior) | |
3059 { | |
3080 // RenderText objects don't know how to invalidate paint for themselves, sin ce they don't know how to compute their bounds. | 3060 // RenderText objects don't know how to invalidate paint for themselves, sin ce they don't know how to compute their bounds. |
3081 // Instead the parent fully invalidate when any text needs full paint invali dation. | 3061 // Instead the parent fully invalidate when any text needs full paint invali dation. |
3082 if (isText()) { | 3062 if (isText()) { |
3083 parent()->setShouldDoFullPaintInvalidation(b, markBehavior); | 3063 parent()->setShouldDoFullPaintInvalidationWithReason(reason, markBehavio r); |
3084 return; | 3064 return; |
3085 } | 3065 } |
3086 | 3066 |
3087 m_bitfields.setShouldDoFullPaintInvalidation(b); | 3067 if (!shouldDoFullPaintInvalidation()) |
Xianzhu
2014/09/23 21:06:41
This is incorrect. It will prevent us from resetti
Xianzhu
2014/09/23 21:26:17
Fixed.
| |
3068 m_bitfields.setFullPaintInvalidationReason(reason); | |
3088 | 3069 |
3089 if (markBehavior == MarkContainingBlockChain && b) { | 3070 if (markBehavior == MarkContainingBlockChain && reason != InvalidationNone) { |
3090 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval idation); | 3071 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval idation); |
3091 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called not during FrameView::updateLayoutAndStyleForPainting(). | 3072 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called not during FrameView::updateLayoutAndStyleForPainting(). |
3092 markContainingBlockChainForPaintInvalidation(); | 3073 markContainingBlockChainForPaintInvalidation(); |
3093 } | 3074 } |
3094 } | 3075 } |
3095 | 3076 |
3096 void RenderObject::clearPaintInvalidationState(const PaintInvalidationState& pai ntInvalidationState) | 3077 void RenderObject::clearPaintInvalidationState(const PaintInvalidationState& pai ntInvalidationState) |
3097 { | 3078 { |
3098 // paintInvalidationStateIsDirty should be kept in sync with the | 3079 // paintInvalidationStateIsDirty should be kept in sync with the |
3099 // booleans that are cleared below. | 3080 // booleans that are cleared below. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3165 { | 3146 { |
3166 if (object1) { | 3147 if (object1) { |
3167 const blink::RenderObject* root = object1; | 3148 const blink::RenderObject* root = object1; |
3168 while (root->parent()) | 3149 while (root->parent()) |
3169 root = root->parent(); | 3150 root = root->parent(); |
3170 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3151 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3171 } | 3152 } |
3172 } | 3153 } |
3173 | 3154 |
3174 #endif | 3155 #endif |
OLD | NEW |