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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1197 paintRect.intersect(frameView->visibleContentRect()); | 1197 paintRect.intersect(frameView->visibleContentRect()); |
1198 if (paintRect.isEmpty()) | 1198 if (paintRect.isEmpty()) |
1199 return; | 1199 return; |
1200 | 1200 |
1201 if (HostWindow* window = frameView->hostWindow()) | 1201 if (HostWindow* window = frameView->hostWindow()) |
1202 window->invalidateRect(frameView->contentsToRootFrame(paintRect)); | 1202 window->invalidateRect(frameView->contentsToRootFrame(paintRect)); |
1203 } | 1203 } |
1204 | 1204 |
1205 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai ntInvalidationContainer, const LayoutRect& dirtyRect, PaintInvalidationReason in validationReason) const | 1205 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai ntInvalidationContainer, const LayoutRect& dirtyRect, PaintInvalidationReason in validationReason) const |
1206 { | 1206 { |
1207 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) | 1207 // TODO(wangxianzhu): Enable the following assert after paint invalidation f or spv2 is ready. |
1208 return; | 1208 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
1209 | 1209 |
1210 if (paintInvalidationContainer.frameView()->shouldThrottleRendering()) | 1210 if (paintInvalidationContainer.frameView()->shouldThrottleRendering()) |
1211 return; | 1211 return; |
1212 | 1212 |
1213 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation); | 1213 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation); |
1214 | 1214 |
1215 if (dirtyRect.isEmpty()) | 1215 if (dirtyRect.isEmpty()) |
1216 return; | 1216 return; |
1217 | 1217 |
1218 RELEASE_ASSERT(isRooted()); | 1218 RELEASE_ASSERT(isRooted()); |
(...skipping 11 matching lines...) Expand all Loading... | |
1230 // painted, such as SVG images. | 1230 // painted, such as SVG images. |
1231 if (!paintInvalidationContainer.isPaintInvalidationContainer()) | 1231 if (!paintInvalidationContainer.isPaintInvalidationContainer()) |
1232 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); | 1232 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); |
1233 | 1233 |
1234 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) | 1234 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) |
1235 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason); | 1235 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason); |
1236 } | 1236 } |
1237 | 1237 |
1238 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const | 1238 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const |
1239 { | 1239 { |
1240 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be en passed to PaintController. crbug.com/547119. | |
1240 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 1241 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
1241 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { | 1242 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { |
1242 // This is valid because we want to invalidate the client in the display item list of the current backing. | 1243 // This is valid because we want to invalidate the client in the display item list of the current backing. |
1243 DisableCompositingQueryAsserts disabler; | 1244 DisableCompositingQueryAsserts disabler; |
1244 // Only the object needs to be invalidated, so use an empty invalidation rect. | |
1245 LayoutRect invalidationRect; | |
1246 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) | 1245 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) |
1247 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull, invalidationRect, invalidatio nRect); | 1246 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull, nullptr); |
1248 | |
1249 enclosingLayer->setNeedsRepaint(); | 1247 enclosingLayer->setNeedsRepaint(); |
1250 } | 1248 } |
1251 } | 1249 } |
1252 | 1250 |
1253 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout Rect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const | 1251 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout Rect* paintInvalidationRect) const |
1254 { | 1252 { |
1255 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason, previousPaintInvalidationRect, newPaintInvalidationRect); | 1253 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason, paintInvalidationRect); |
1256 | 1254 |
1257 if (PaintLayer* enclosingLayer = this->enclosingLayer()) | 1255 if (PaintLayer* enclosingLayer = this->enclosingLayer()) |
1258 enclosingLayer->setNeedsRepaint(); | 1256 enclosingLayer->setNeedsRepaint(); |
1259 } | 1257 } |
1260 | 1258 |
1261 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const | 1259 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const |
1262 { | 1260 { |
1263 if (!paintInvalidationContainer) | 1261 if (!paintInvalidationContainer) |
1264 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); | 1262 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); |
1265 return PaintLayer::computePaintInvalidationRect(this, paintInvalidationConta iner->layer(), paintInvalidationState); | 1263 return PaintLayer::computePaintInvalidationRect(this, paintInvalidationConta iner->layer(), paintInvalidationState); |
1266 } | 1264 } |
1267 | 1265 |
1268 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(Layou tRect& dirtyRect) const | 1266 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const |
1269 { | 1267 { |
1270 RELEASE_ASSERT(isRooted()); | 1268 RELEASE_ASSERT(isRooted()); |
1271 | 1269 |
1272 if (dirtyRect.isEmpty()) | 1270 if (dirtyRect.isEmpty()) |
1273 return nullptr; | 1271 return nullptr; |
1274 | 1272 |
1275 if (view()->document().printing()) | 1273 if (view()->document().printing()) |
1276 return nullptr; // Don't invalidate paints if we're printing. | 1274 return nullptr; // Don't invalidate paints if we're printing. |
1277 | 1275 |
1278 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); | 1276 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); |
1279 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai ner, dirtyRect); | 1277 LayoutRect dirtyRectOnBacking = dirtyRect; |
1280 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); | 1278 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai ner, dirtyRectOnBacking); |
1279 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle); | |
1281 return &paintInvalidationContainer; | 1280 return &paintInvalidationContainer; |
1282 } | 1281 } |
1283 | 1282 |
1284 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const | 1283 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const |
1285 { | 1284 { |
1286 LayoutRect dirtyRect(rect); | 1285 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(rect); |
1287 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(dirtyRect); | |
1288 if (paintInvalidationContainer) { | 1286 if (paintInvalidationContainer) { |
1289 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle, dirtyRect, dirtyRect); | 1287 // Don't need to change the paint invalidation bounds of the client, so pass nullptr. |
1288 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle, nullptr); | |
1290 } | 1289 } |
1291 } | 1290 } |
1292 | 1291 |
1293 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const | 1292 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const |
1294 { | 1293 { |
1295 LayoutRect dirtyRect(r); | 1294 invalidatePaintRectangleInternal(r); |
1296 invalidatePaintRectangleInternal(dirtyRect); | |
1297 } | 1295 } |
1298 | 1296 |
1299 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) | 1297 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) |
1300 { | 1298 { |
1301 ASSERT(!needsLayout()); | 1299 ASSERT(!needsLayout()); |
1302 | 1300 |
1303 // If we didn't need paint invalidation then our children don't need as well . | 1301 // If we didn't need paint invalidation then our children don't need as well . |
1304 // Skip walking down the tree as everything should be fine below us. | 1302 // Skip walking down the tree as everything should be fine below us. |
1305 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 1303 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
1306 return; | 1304 return; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller | 1372 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller |
1375 // does not move on scroll. | 1373 // does not move on scroll. |
1376 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { | 1374 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { |
1377 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); | 1375 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); |
1378 newSelectionRect.move(inverseOffset); | 1376 newSelectionRect.move(inverseOffset); |
1379 } | 1377 } |
1380 | 1378 |
1381 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); | 1379 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); |
1382 | 1380 |
1383 if (shouldInvalidateSelection()) | 1381 if (shouldInvalidateSelection()) |
1384 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati onSelection, oldSelectionRect, newSelectionRect); | 1382 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati onSelection, nullptr); |
1385 | 1383 |
1386 if (fullInvalidation) | 1384 if (fullInvalidation) |
1387 return; | 1385 return; |
1388 | 1386 |
1389 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); | 1387 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); |
1390 } | 1388 } |
1391 | 1389 |
1392 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner) | 1390 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner) |
1393 { | 1391 { |
1394 LayoutView* v = view(); | 1392 LayoutView* v = view(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1432 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1430 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
1433 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured); | 1431 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured); |
1434 | 1432 |
1435 if (invalidationReason == PaintInvalidationNone) { | 1433 if (invalidationReason == PaintInvalidationNone) { |
1436 // TODO(trchen): Currently we don't keep track of paint offset of layout objects. | 1434 // TODO(trchen): Currently we don't keep track of paint offset of layout objects. |
1437 // There are corner cases that the display items need to be invalidated for paint offset | 1435 // There are corner cases that the display items need to be invalidated for paint offset |
1438 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based | 1436 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based |
1439 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1437 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
1440 // This is a workaround to force display items to update paint offset. | 1438 // This is a workaround to force display items to update paint offset. |
1441 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer()) | 1439 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer()) |
1442 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason, oldBounds, newBounds); | 1440 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason, &newBounds); |
1443 | 1441 |
1444 return invalidationReason; | 1442 return invalidationReason; |
1445 } | 1443 } |
1446 | 1444 |
1447 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, oldBounds, newBounds); | 1445 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, &newBounds); |
1448 | 1446 |
1449 if (invalidationReason == PaintInvalidationIncremental) { | 1447 if (invalidationReason == PaintInvalidationIncremental) { |
1450 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); | 1448 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); |
1451 return invalidationReason; | 1449 return invalidationReason; |
1452 } | 1450 } |
1453 | 1451 |
1454 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); | 1452 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); |
1455 | 1453 |
1456 return invalidationReason; | 1454 return invalidationReason; |
1457 } | 1455 } |
1458 | 1456 |
1459 void LayoutObject::invalidatePaintIfNeededForSynchronizedPainting(const PaintInf o& paintInfo) | |
1460 { | |
1461 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); | |
1462 ASSERT(document().lifecycle().state() == DocumentLifecycle::InPaint); | |
1463 ASSERT(paintInfo.paintInvalidationState); | |
1464 ASSERT(paintInfo.paintContainer()); | |
1465 | |
1466 PaintController& paintController = paintInfo.context->paintController(); | |
1467 if (paintController.clientHasCheckedPaintInvalidation(displayItemClient())) { | |
1468 ASSERT(paintController.clientCacheIsValid(displayItemClient()) | |
1469 == (invalidatePaintIfNeeded(*paintInfo.paintInvalidationState, *pain tInfo.paintContainer()) == PaintInvalidationNone)); | |
1470 return; | |
1471 } | |
1472 | |
1473 PaintInvalidationReason reason = invalidatePaintIfNeeded(*paintInfo.paintInv alidationState, *paintInfo.paintContainer()); | |
1474 clearPaintInvalidationState(*paintInfo.paintInvalidationState); | |
1475 | |
1476 if (reason == PaintInvalidationDelayedFull) | |
1477 paintInfo.paintInvalidationState->pushDelayedPaintInvalidationTarget(*th is); | |
1478 | |
1479 paintController.setClientHasCheckedPaintInvalidation(displayItemClient()); | |
1480 } | |
1481 | |
1482 PaintInvalidationReason LayoutObject::paintInvalidationReason(const LayoutBoxMod elObject& paintInvalidationContainer, | 1457 PaintInvalidationReason LayoutObject::paintInvalidationReason(const LayoutBoxMod elObject& paintInvalidationContainer, |
1483 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, | 1458 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, |
1484 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const | 1459 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const |
1485 { | 1460 { |
1486 // First check for InvalidationLocationChange to avoid it from being hidden by other | 1461 // First check for InvalidationLocationChange to avoid it from being hidden by other |
1487 // invalidation reasons because we'll need to force check for paint invalida tion for | 1462 // invalidation reasons because we'll need to force check for paint invalida tion for |
1488 // children when location of this object changed. | 1463 // children when location of this object changed. |
1489 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking) | 1464 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking) |
1490 return PaintInvalidationLocationChange; | 1465 return PaintInvalidationLocationChange; |
1491 | 1466 |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3373 findNonCompositedDescendantLayerToTraverse(*descendant, functor); | 3348 findNonCompositedDescendantLayerToTraverse(*descendant, functor); |
3374 descendant = descendant->nextInPreOrderAfterChildren(&object); | 3349 descendant = descendant->nextInPreOrderAfterChildren(&object); |
3375 } | 3350 } |
3376 } | 3351 } |
3377 | 3352 |
3378 } // unnamed namespace | 3353 } // unnamed namespace |
3379 | 3354 |
3380 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con st LayoutObject& object) const | 3355 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con st LayoutObject& object) const |
3381 { | 3356 { |
3382 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 3357 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
3383 const PaintLayer* enclosingLayer = this->enclosingLayer(); | 3358 PaintLayer* enclosingLayer = this->enclosingLayer(); |
3384 if (!enclosingLayer) | 3359 if (!enclosingLayer) |
3385 return; | 3360 return; |
3386 | 3361 |
3362 // TODO(wangxianzhu): This is a workaround for invalidation of detached cust om scrollbar parts which can't find | |
3363 // their own enclosing layers. May remove this when fixing crbug.com/547119 for scrollbars. | |
3364 enclosingLayer->setNeedsRepaint(); | |
chrishtr
2015/10/23 19:57:49
If they can't find their layers, how can they call
Xianzhu
2015/10/23 20:56:53
Here the |this| object is the LayoutBox containing
chrishtr
2015/10/23 20:59:45
How is the containing LayoutBox getting called int
Xianzhu
2015/10/23 21:28:22
I should have included the following in the previo
| |
3365 | |
3387 // This is valid because we want to invalidate the client in the display ite m list of the current backing. | 3366 // This is valid because we want to invalidate the client in the display ite m list of the current backing. |
3388 DisableCompositingQueryAsserts disabler; | 3367 DisableCompositingQueryAsserts disabler; |
3389 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerFor PaintInvalidationCrossingFrameBoundaries(); | 3368 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerFor PaintInvalidationCrossingFrameBoundaries(); |
3390 if (!paintInvalidationLayer) | 3369 if (!paintInvalidationLayer) |
3391 return; | 3370 return; |
3392 | 3371 |
3393 class Functor : public LayoutObjectTraversalFunctor { | 3372 class Functor : public LayoutObjectTraversalFunctor { |
3394 public: | 3373 public: |
3395 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } | 3374 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } |
3396 void operator()(LayoutObject& object) const override | 3375 void operator()(LayoutObject& object) const override |
3397 { | 3376 { |
3398 // Only the objects need to be invalidated, not any paint rectangles . | 3377 // TODO(wangxianzhu): Ensure correct bounds for the client will be o r has been passed to PaintController. crbug.com/547119. |
3399 LayoutRect invalidationRect; | 3378 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, nullptr); |
3400 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, invalidationRect, invalidationRect); | |
3401 } | 3379 } |
3402 private: | 3380 private: |
3403 const LayoutBoxModelObject& m_paintInvalidationContainer; | 3381 const LayoutBoxModelObject& m_paintInvalidationContainer; |
3404 }; | 3382 }; |
3405 | 3383 |
3406 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject(); | 3384 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject(); |
3407 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer)); | 3385 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer)); |
3408 } | 3386 } |
3409 | 3387 |
3410 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const | 3388 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const |
3411 { | 3389 { |
3412 // These disablers are valid because we want to use the current compositing/ invalidation status. | 3390 // These disablers are valid because we want to use the current compositing/ invalidation status. |
3413 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3391 DisablePaintInvalidationStateAsserts invalidationDisabler; |
3414 DisableCompositingQueryAsserts compositingDisabler; | 3392 DisableCompositingQueryAsserts compositingDisabler; |
3415 | 3393 |
3416 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3394 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
3417 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); | 3395 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); |
3418 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); | 3396 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); |
3419 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, invalidationRect, invalidationRect); | 3397 |
3398 // The PaintController may have changed. Pass the previous paint invalidatio n rect to the new PaintController. | |
3399 // The rect will be updated if it changes during the next paint invalidation . | |
3400 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, &invalidationRect); | |
3420 } | 3401 } |
3421 | 3402 |
3422 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3403 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
3423 { | 3404 { |
3424 class Functor : public LayoutObjectTraversalFunctor { | 3405 class Functor : public LayoutObjectTraversalFunctor { |
3425 public: | 3406 public: |
3426 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } | 3407 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } |
3427 void operator()(LayoutObject& object) const override | 3408 void operator()(LayoutObject& object) const override |
3428 { | 3409 { |
3429 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer); | 3410 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3525 const blink::LayoutObject* root = object1; | 3506 const blink::LayoutObject* root = object1; |
3526 while (root->parent()) | 3507 while (root->parent()) |
3527 root = root->parent(); | 3508 root = root->parent(); |
3528 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3509 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3529 } else { | 3510 } else { |
3530 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3511 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3531 } | 3512 } |
3532 } | 3513 } |
3533 | 3514 |
3534 #endif | 3515 #endif |
OLD | NEW |