| 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 topLevelRect = result; | 1068 topLevelRect = result; |
| 1082 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) | 1069 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) |
| 1083 current->addAbsoluteRectForLayer(result); | 1070 current->addAbsoluteRectForLayer(result); |
| 1084 return result; | 1071 return result; |
| 1085 } | 1072 } |
| 1086 | 1073 |
| 1087 void RenderObject::paint(PaintInfo&, const LayoutPoint&) | 1074 void RenderObject::paint(PaintInfo&, const LayoutPoint&) |
| 1088 { | 1075 { |
| 1089 } | 1076 } |
| 1090 | 1077 |
| 1091 void RenderObject::setHadPaintInvalidation() | |
| 1092 { | |
| 1093 if (firstPaintInvalidationTrackingEnabled()) | |
| 1094 renderObjectNeverHadPaintInvalidationSet().remove(this); | |
| 1095 } | |
| 1096 | |
| 1097 bool RenderObject::hadPaintInvalidation() const | |
| 1098 { | |
| 1099 if (!firstPaintInvalidationTrackingEnabled()) | |
| 1100 return true; | |
| 1101 | |
| 1102 return !renderObjectNeverHadPaintInvalidationSet().contains(this); | |
| 1103 } | |
| 1104 | |
| 1105 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons
t | 1078 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons
t |
| 1106 { | 1079 { |
| 1107 RELEASE_ASSERT(isRooted()); | 1080 RELEASE_ASSERT(isRooted()); |
| 1108 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); | 1081 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); |
| 1109 } | 1082 } |
| 1110 | 1083 |
| 1111 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const | 1084 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const |
| 1112 { | 1085 { |
| 1113 RenderLayerModelObject* container = 0; | 1086 RenderLayerModelObject* container = 0; |
| 1114 // FIXME: CompositingState is not necessarily up to date for many callers of
this function. | 1087 // FIXME: CompositingState is not necessarily up to date for many callers of
this function. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", | 1165 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", |
| 1193 "object", this->debugName().ascii(), | 1166 "object", this->debugName().ascii(), |
| 1194 "info", jsonObjectForPaintInvalidationInfo(r, invalidationReasonToString
(invalidationReason))); | 1167 "info", jsonObjectForPaintInvalidationInfo(r, invalidationReasonToString
(invalidationReason))); |
| 1195 | 1168 |
| 1196 if (paintInvalidationContainer->isRenderFlowThread()) { | 1169 if (paintInvalidationContainer->isRenderFlowThread()) { |
| 1197 toRenderFlowThread(paintInvalidationContainer)->paintInvalidationRectang
leInRegions(r); | 1170 toRenderFlowThread(paintInvalidationContainer)->paintInvalidationRectang
leInRegions(r); |
| 1198 return; | 1171 return; |
| 1199 } | 1172 } |
| 1200 | 1173 |
| 1201 if (paintInvalidationContainer->isRenderView()) { | 1174 if (paintInvalidationContainer->isRenderView()) { |
| 1202 toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r)
; | 1175 toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r,
invalidationReason); |
| 1203 return; | 1176 return; |
| 1204 } | 1177 } |
| 1205 | 1178 |
| 1206 if (paintInvalidationContainer->view()->usesCompositing()) { | 1179 if (paintInvalidationContainer->view()->usesCompositing()) { |
| 1207 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); | 1180 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); |
| 1208 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r); | 1181 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r, in
validationReason); |
| 1209 } | 1182 } |
| 1210 } | 1183 } |
| 1211 | 1184 |
| 1212 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb
ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio
nState) const | 1185 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb
ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio
nState) const |
| 1213 { | 1186 { |
| 1214 if (!paintInvalidationContainer) | 1187 if (!paintInvalidationContainer) |
| 1215 return computePaintInvalidationRect(paintInvalidationContainer, paintInv
alidationState); | 1188 return computePaintInvalidationRect(paintInvalidationContainer, paintInv
alidationState); |
| 1216 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont
ainer->layer(), paintInvalidationState); | 1189 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont
ainer->layer(), paintInvalidationState); |
| 1217 } | 1190 } |
| 1218 | 1191 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 case InvalidationBecameVisible: | 1228 case InvalidationBecameVisible: |
| 1256 return "became visible"; | 1229 return "became visible"; |
| 1257 case InvalidationBecameInvisible: | 1230 case InvalidationBecameInvisible: |
| 1258 return "became invisible"; | 1231 return "became invisible"; |
| 1259 case InvalidationScroll: | 1232 case InvalidationScroll: |
| 1260 return "scroll"; | 1233 return "scroll"; |
| 1261 case InvalidationSelection: | 1234 case InvalidationSelection: |
| 1262 return "selection"; | 1235 return "selection"; |
| 1263 case InvalidationLayer: | 1236 case InvalidationLayer: |
| 1264 return "layer"; | 1237 return "layer"; |
| 1238 case InvalidationRendererInsertion: |
| 1239 return "renderer insertion"; |
| 1265 case InvalidationRendererRemoval: | 1240 case InvalidationRendererRemoval: |
| 1266 return "renderer removal"; | 1241 return "renderer removal"; |
| 1267 case InvalidationPaintRectangle: | 1242 case InvalidationPaintRectangle: |
| 1268 return "invalidate paint rectangle"; | 1243 return "invalidate paint rectangle"; |
| 1269 } | 1244 } |
| 1270 ASSERT_NOT_REACHED(); | 1245 ASSERT_NOT_REACHED(); |
| 1271 return ""; | 1246 return ""; |
| 1272 } | 1247 } |
| 1273 | 1248 |
| 1274 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
alidationState) | 1249 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
alidationState) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 } | 1312 } |
| 1338 | 1313 |
| 1339 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); | 1314 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); |
| 1340 return invalidationReason; | 1315 return invalidationReason; |
| 1341 } | 1316 } |
| 1342 | 1317 |
| 1343 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod
elObject& paintInvalidationContainer, | 1318 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod
elObject& paintInvalidationContainer, |
| 1344 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, const LayoutRect& newBounds, const LayoutPoint& newPositionFromPain
tInvalidationBacking) | 1319 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, const LayoutRect& newBounds, const LayoutPoint& newPositionFromPain
tInvalidationBacking) |
| 1345 { | 1320 { |
| 1346 if (shouldDoFullPaintInvalidation()) | 1321 if (shouldDoFullPaintInvalidation()) |
| 1347 return InvalidationFull; | 1322 return m_bitfields.fullPaintInvalidationReason(); |
| 1348 | 1323 |
| 1349 // Presumably a background or a border exists if border-fit:lines was specif
ied. | 1324 // Presumably a background or a border exists if border-fit:lines was specif
ied. |
| 1350 if (style()->borderFit() == BorderFitLines) | 1325 if (style()->borderFit() == BorderFitLines) |
| 1351 return InvalidationBorderFitLines; | 1326 return InvalidationBorderFitLines; |
| 1352 | 1327 |
| 1353 if (compositingState() != PaintsIntoOwnBacking && newPositionFromPaintInvali
dationBacking != oldPositionFromPaintInvalidationBacking) | 1328 if (compositingState() != PaintsIntoOwnBacking && newPositionFromPaintInvali
dationBacking != oldPositionFromPaintInvalidationBacking) |
| 1354 return InvalidationLocationChange; | 1329 return InvalidationLocationChange; |
| 1355 | 1330 |
| 1356 // If the bounds are the same then we know that none of the statements below | 1331 // If the bounds are the same then we know that none of the statements below |
| 1357 // can match, so we can early out since we will not need to do any | 1332 // can match, so we can early out since we will not need to do any |
| (...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3091 return false; | 3066 return false; |
| 3092 } | 3067 } |
| 3093 | 3068 |
| 3094 bool RenderObject::isRelayoutBoundaryForInspector() const | 3069 bool RenderObject::isRelayoutBoundaryForInspector() const |
| 3095 { | 3070 { |
| 3096 return objectIsRelayoutBoundary(this); | 3071 return objectIsRelayoutBoundary(this); |
| 3097 } | 3072 } |
| 3098 | 3073 |
| 3099 void RenderObject::setShouldDoFullPaintInvalidation(bool b, MarkingBehavior mark
Behavior) | 3074 void RenderObject::setShouldDoFullPaintInvalidation(bool b, MarkingBehavior mark
Behavior) |
| 3100 { | 3075 { |
| 3076 if (b) |
| 3077 setShouldDoFullPaintInvalidationWithReason(InvalidationFull, markBehavio
r); |
| 3078 else |
| 3079 m_bitfields.setFullPaintInvalidationReason(InvalidationNone); |
| 3080 } |
| 3081 |
| 3082 void RenderObject::setShouldDoFullPaintInvalidationWithReason(InvalidationReason
reason, MarkingBehavior markBehavior) |
| 3083 { |
| 3084 // Only full invalidation reasons are allowed. |
| 3085 ASSERT(reason != InvalidationNone && reason != InvalidationIncremental); |
| 3086 |
| 3101 // RenderText objects don't know how to invalidate paint for themselves, sin
ce they don't know how to compute their bounds. | 3087 // RenderText objects don't know how to invalidate paint for themselves, sin
ce they don't know how to compute their bounds. |
| 3102 // Instead the parent fully invalidate when any text needs full paint invali
dation. | 3088 // Instead the parent fully invalidate when any text needs full paint invali
dation. |
| 3103 if (isText()) { | 3089 if (isText()) { |
| 3104 parent()->setShouldDoFullPaintInvalidation(b, markBehavior); | 3090 parent()->setShouldDoFullPaintInvalidationWithReason(reason, markBehavio
r); |
| 3105 return; | 3091 return; |
| 3106 } | 3092 } |
| 3107 | 3093 |
| 3108 m_bitfields.setShouldDoFullPaintInvalidation(b); | 3094 if (m_bitfields.fullPaintInvalidationReason() == InvalidationNone) |
| 3095 m_bitfields.setFullPaintInvalidationReason(reason); |
| 3109 | 3096 |
| 3110 if (markBehavior == MarkContainingBlockChain && b) { | 3097 if (markBehavior == MarkContainingBlockChain) { |
| 3111 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval
idation); | 3098 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval
idation); |
| 3112 frame()->page()->animator().scheduleVisualUpdate(); // In case that this
is called not during FrameView::updateLayoutAndStyleForPainting(). | 3099 frame()->page()->animator().scheduleVisualUpdate(); // In case that this
is called not during FrameView::updateLayoutAndStyleForPainting(). |
| 3113 markContainingBlockChainForPaintInvalidation(); | 3100 markContainingBlockChainForPaintInvalidation(); |
| 3114 } | 3101 } |
| 3115 } | 3102 } |
| 3116 | 3103 |
| 3117 void RenderObject::clearPaintInvalidationState(const PaintInvalidationState& pai
ntInvalidationState) | 3104 void RenderObject::clearPaintInvalidationState(const PaintInvalidationState& pai
ntInvalidationState) |
| 3118 { | 3105 { |
| 3119 // paintInvalidationStateIsDirty should be kept in sync with the | 3106 // paintInvalidationStateIsDirty should be kept in sync with the |
| 3120 // booleans that are cleared below. | 3107 // booleans that are cleared below. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3186 { | 3173 { |
| 3187 if (object1) { | 3174 if (object1) { |
| 3188 const blink::RenderObject* root = object1; | 3175 const blink::RenderObject* root = object1; |
| 3189 while (root->parent()) | 3176 while (root->parent()) |
| 3190 root = root->parent(); | 3177 root = root->parent(); |
| 3191 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3178 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3192 } | 3179 } |
| 3193 } | 3180 } |
| 3194 | 3181 |
| 3195 #endif | 3182 #endif |
| OLD | NEW |