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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1133 addJsonObjectForRect(value.get(), "rect", rect); | 1133 addJsonObjectForRect(value.get(), "rect", rect); |
1134 value->setString("invalidation_reason", invalidationReason); | 1134 value->setString("invalidation_reason", invalidationReason); |
1135 return value; | 1135 return value; |
1136 } | 1136 } |
1137 | 1137 |
1138 LayoutRect LayoutObject::computePaintInvalidationRect(const LayoutBoxModelObject * paintInvalidationContainer, const PaintInvalidationState* paintInvalidationSta te) const | 1138 LayoutRect LayoutObject::computePaintInvalidationRect(const LayoutBoxModelObject * paintInvalidationContainer, const PaintInvalidationState* paintInvalidationSta te) const |
1139 { | 1139 { |
1140 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, p aintInvalidationState); | 1140 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, p aintInvalidationState); |
1141 } | 1141 } |
1142 | 1142 |
1143 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject* pai ntInvalidationContainer, const LayoutRect& r, PaintInvalidationReason invalidati onReason) const | 1143 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai ntInvalidationContainer, const LayoutRect& r, PaintInvalidationReason invalidati onReason) const |
1144 { | 1144 { |
1145 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation); | 1145 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation); |
1146 | 1146 |
1147 if (r.isEmpty()) | 1147 if (r.isEmpty()) |
1148 return; | 1148 return; |
1149 | 1149 |
1150 RELEASE_ASSERT(isRooted()); | 1150 RELEASE_ASSERT(isRooted()); |
1151 | 1151 |
1152 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527. | 1152 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527. |
1153 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"), | 1153 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"), |
1154 "PaintInvalidationTracking", | 1154 "PaintInvalidationTracking", |
1155 TRACE_EVENT_SCOPE_THREAD, | 1155 TRACE_EVENT_SCOPE_THREAD, |
1156 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer)); | 1156 "data", InspectorPaintInvalidationTrackingEvent::data(this, &paintInvali dationContainer)); |
Julien - ping for review
2015/05/29 18:19:12
It seems like we should change this function to us
huayong.xu
2015/06/01 02:42:39
Done.
| |
1157 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()", | 1157 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()", |
1158 "object", this->debugName().ascii(), | 1158 "object", this->debugName().ascii(), |
1159 "info", jsonObjectForPaintInvalidationInfo(r, paintInvalidationReasonToS tring(invalidationReason))); | 1159 "info", jsonObjectForPaintInvalidationInfo(r, paintInvalidationReasonToS tring(invalidationReason))); |
1160 | 1160 |
1161 if (paintInvalidationContainer->isLayoutView()) { | 1161 if (paintInvalidationContainer.isLayoutView()) { |
1162 toLayoutView(paintInvalidationContainer)->invalidatePaintForRectangle(r, invalidationReason); | 1162 toLayoutView(&paintInvalidationContainer)->invalidatePaintForRectangle(r , invalidationReason); |
1163 return; | 1163 return; |
1164 } | 1164 } |
1165 | 1165 |
1166 if (paintInvalidationContainer->view()->usesCompositing()) { | 1166 if (paintInvalidationContainer.view()->usesCompositing()) { |
1167 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); | 1167 ASSERT(paintInvalidationContainer.isPaintInvalidationContainer()); |
1168 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r, in validationReason); | 1168 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(r, inv alidationReason); |
1169 } | 1169 } |
1170 } | 1170 } |
1171 | 1171 |
1172 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const | 1172 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const |
1173 { | 1173 { |
1174 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 1174 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) |
1175 return; | 1175 return; |
1176 | 1176 |
1177 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 1177 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
1178 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { | 1178 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1223 RELEASE_ASSERT(isRooted()); | 1223 RELEASE_ASSERT(isRooted()); |
1224 | 1224 |
1225 if (r.isEmpty()) | 1225 if (r.isEmpty()) |
1226 return nullptr; | 1226 return nullptr; |
1227 | 1227 |
1228 if (view()->document().printing()) | 1228 if (view()->document().printing()) |
1229 return nullptr; // Don't invalidate paints if we're printing. | 1229 return nullptr; // Don't invalidate paints if we're printing. |
1230 | 1230 |
1231 LayoutRect dirtyRect(r); | 1231 LayoutRect dirtyRect(r); |
1232 | 1232 |
1233 const LayoutBoxModelObject* paintInvalidationContainer = containerForPaintIn validation(); | 1233 const LayoutBoxModelObject& paintInvalidationContainer = *containerForPaintI nvalidation(); |
Julien - ping for review
2015/05/29 18:19:12
I think we should still check that the returned po
huayong.xu
2015/06/01 02:42:39
Done.
| |
1234 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, paintInvalidat ionContainer, dirtyRect); | 1234 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalida tionContainer, dirtyRect); |
1235 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); | 1235 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); |
1236 return paintInvalidationContainer; | 1236 return &paintInvalidationContainer; |
1237 } | 1237 } |
1238 | 1238 |
1239 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) const | 1239 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) const |
1240 { | 1240 { |
1241 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { | 1241 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { |
1242 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 1242 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
1243 invalidateDisplayItemClients(*paintInvalidationContainer); | 1243 invalidateDisplayItemClients(*paintInvalidationContainer); |
1244 } | 1244 } |
1245 } | 1245 } |
1246 | 1246 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1422 | 1422 |
1423 return PaintInvalidationIncremental; | 1423 return PaintInvalidationIncremental; |
1424 } | 1424 } |
1425 | 1425 |
1426 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking) | 1426 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking) |
1427 { | 1427 { |
1428 ASSERT(oldBounds.location() == newBounds.location()); | 1428 ASSERT(oldBounds.location() == newBounds.location()); |
1429 | 1429 |
1430 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); | 1430 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); |
1431 if (deltaRight > 0) | 1431 if (deltaRight > 0) |
1432 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), PaintInvalidatio nIncremental); | 1432 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old Bounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), PaintInvalidation Incremental); |
1433 else if (deltaRight < 0) | 1433 else if (deltaRight < 0) |
1434 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), PaintInvalidati onIncremental); | 1434 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new Bounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), PaintInvalidatio nIncremental); |
1435 | 1435 |
1436 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); | 1436 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); |
1437 if (deltaBottom > 0) | 1437 if (deltaBottom > 0) |
1438 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), PaintInvalidatio nIncremental); | 1438 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new Bounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), PaintInvalidation Incremental); |
1439 else if (deltaBottom < 0) | 1439 else if (deltaBottom < 0) |
1440 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), PaintInvalidati onIncremental); | 1440 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old Bounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), PaintInvalidatio nIncremental); |
1441 } | 1441 } |
1442 | 1442 |
1443 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol dBounds, const LayoutRect& newBounds) | 1443 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol dBounds, const LayoutRect& newBounds) |
1444 { | 1444 { |
1445 // Otherwise do full paint invalidation. | 1445 // Otherwise do full paint invalidation. |
1446 invalidatePaintUsingContainer(&paintInvalidationContainer, oldBounds, invali dationReason); | 1446 invalidatePaintUsingContainer(paintInvalidationContainer, oldBounds, invalid ationReason); |
1447 if (newBounds != oldBounds) | 1447 if (newBounds != oldBounds) |
1448 invalidatePaintUsingContainer(&paintInvalidationContainer, newBounds, in validationReason); | 1448 invalidatePaintUsingContainer(paintInvalidationContainer, newBounds, inv alidationReason); |
1449 } | 1449 } |
1450 | 1450 |
1451 void LayoutObject::invalidatePaintForOverflow() | 1451 void LayoutObject::invalidatePaintForOverflow() |
1452 { | 1452 { |
1453 } | 1453 } |
1454 | 1454 |
1455 void LayoutObject::invalidatePaintForOverflowIfNeeded() | 1455 void LayoutObject::invalidatePaintForOverflowIfNeeded() |
1456 { | 1456 { |
1457 if (shouldInvalidateOverflowForPaint()) | 1457 if (shouldInvalidateOverflowForPaint()) |
1458 invalidatePaintForOverflow(); | 1458 invalidatePaintForOverflow(); |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3246 } | 3246 } |
3247 | 3247 |
3248 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 3248 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
3249 : m_disabler(gDisablePaintInvalidationStateAsserts, true) | 3249 : m_disabler(gDisablePaintInvalidationStateAsserts, true) |
3250 { | 3250 { |
3251 } | 3251 } |
3252 | 3252 |
3253 // Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer. | 3253 // Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer. |
3254 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3254 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
3255 { | 3255 { |
3256 invalidatePaintIncludingNonCompositingDescendantsInternal(containerForPaintI nvalidation()); | 3256 invalidatePaintIncludingNonCompositingDescendantsInternal(*containerForPaint Invalidation()); |
3257 } | 3257 } |
3258 | 3258 |
3259 void LayoutObject::invalidatePaintIncludingNonCompositingDescendantsInternal(con st LayoutBoxModelObject* paintInvalidationContainer) | 3259 void LayoutObject::invalidatePaintIncludingNonCompositingDescendantsInternal(con st LayoutBoxModelObject& paintInvalidationContainer) |
3260 { | 3260 { |
3261 invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInval idationRect(), PaintInvalidationLayer); | 3261 invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInval idationRect(), PaintInvalidationLayer); |
3262 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 3262 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
3263 invalidateDisplayItemClients(*paintInvalidationContainer); | 3263 invalidateDisplayItemClients(paintInvalidationContainer); |
3264 | 3264 |
3265 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | 3265 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { |
3266 if (!child->isPaintInvalidationContainer()) | 3266 if (!child->isPaintInvalidationContainer()) |
3267 child->invalidatePaintIncludingNonCompositingDescendantsInternal(pai ntInvalidationContainer); | 3267 child->invalidatePaintIncludingNonCompositingDescendantsInternal(pai ntInvalidationContainer); |
3268 } | 3268 } |
3269 } | 3269 } |
3270 | 3270 |
3271 | 3271 |
3272 } // namespace blink | 3272 } // namespace blink |
3273 | 3273 |
(...skipping 26 matching lines...) Expand all Loading... | |
3300 const blink::LayoutObject* root = object1; | 3300 const blink::LayoutObject* root = object1; |
3301 while (root->parent()) | 3301 while (root->parent()) |
3302 root = root->parent(); | 3302 root = root->parent(); |
3303 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3303 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3304 } else { | 3304 } else { |
3305 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3305 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3306 } | 3306 } |
3307 } | 3307 } |
3308 | 3308 |
3309 #endif | 3309 #endif |
OLD | NEW |