Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1416053003: Let synchronized painting generate correct paint invalidation rects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 paintRect.intersect(frameView->visibleContentRect()); 1187 paintRect.intersect(frameView->visibleContentRect());
1188 if (paintRect.isEmpty()) 1188 if (paintRect.isEmpty())
1189 return; 1189 return;
1190 1190
1191 if (HostWindow* window = frameView->hostWindow()) 1191 if (HostWindow* window = frameView->hostWindow())
1192 window->invalidateRect(frameView->contentsToRootFrame(paintRect)); 1192 window->invalidateRect(frameView->contentsToRootFrame(paintRect));
1193 } 1193 }
1194 1194
1195 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai ntInvalidationContainer, const LayoutRect& dirtyRect, PaintInvalidationReason in validationReason) const 1195 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai ntInvalidationContainer, const LayoutRect& dirtyRect, PaintInvalidationReason in validationReason) const
1196 { 1196 {
1197 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) 1197 // TODO(wangxianzhu): Enable the following assert after paint invalidation f or spv2 is ready.
1198 return; 1198 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
1199 1199
1200 if (paintInvalidationContainer.frameView()->shouldThrottleRendering()) 1200 if (paintInvalidationContainer.frameView()->shouldThrottleRendering())
1201 return; 1201 return;
1202 1202
1203 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation); 1203 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation);
1204 1204
1205 if (dirtyRect.isEmpty()) 1205 if (dirtyRect.isEmpty())
1206 return; 1206 return;
1207 1207
1208 RELEASE_ASSERT(isRooted()); 1208 RELEASE_ASSERT(isRooted());
(...skipping 11 matching lines...) Expand all
1220 // painted, such as SVG images. 1220 // painted, such as SVG images.
1221 if (!paintInvalidationContainer.isPaintInvalidationContainer()) 1221 if (!paintInvalidationContainer.isPaintInvalidationContainer())
1222 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); 1222 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect));
1223 1223
1224 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) 1224 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer())
1225 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason); 1225 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason);
1226 } 1226 }
1227 1227
1228 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const 1228 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const
1229 { 1229 {
1230 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be en passed to PaintController.
1230 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. 1231 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree.
1231 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { 1232 if (PaintLayer* enclosingLayer = this->enclosingLayer()) {
1232 // This is valid because we want to invalidate the client in the display item list of the current backing. 1233 // This is valid because we want to invalidate the client in the display item list of the current backing.
1233 DisableCompositingQueryAsserts disabler; 1234 DisableCompositingQueryAsserts disabler;
1234 // Only the object needs to be invalidated, so use an empty invalidation rect.
1235 LayoutRect invalidationRect;
1236 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) 1235 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries())
1237 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull, invalidationRect, invalidatio nRect); 1236 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull, nullptr);
1238
1239 enclosingLayer->setNeedsRepaint(); 1237 enclosingLayer->setNeedsRepaint();
1240 } 1238 }
1241 } 1239 }
1242 1240
1243 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout Rect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const 1241 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout Rect* paintInvalidationRect) const
1244 { 1242 {
1245 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason, previousPaintInvalidationRect, newPaintInvalidationRect); 1243 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason, paintInvalidationRect);
1246 1244
1247 if (PaintLayer* enclosingLayer = this->enclosingLayer()) 1245 if (PaintLayer* enclosingLayer = this->enclosingLayer())
1248 enclosingLayer->setNeedsRepaint(); 1246 enclosingLayer->setNeedsRepaint();
1249 } 1247 }
1250 1248
1251 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const 1249 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const
1252 { 1250 {
1253 if (!paintInvalidationContainer) 1251 if (!paintInvalidationContainer)
1254 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); 1252 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState);
1255 return PaintLayer::computePaintInvalidationRect(this, paintInvalidationConta iner->layer(), paintInvalidationState); 1253 return PaintLayer::computePaintInvalidationRect(this, paintInvalidationConta iner->layer(), paintInvalidationState);
1256 } 1254 }
1257 1255
1258 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(Layou tRect& dirtyRect) const 1256 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const
1259 { 1257 {
1260 RELEASE_ASSERT(isRooted()); 1258 RELEASE_ASSERT(isRooted());
1261 1259
1262 if (dirtyRect.isEmpty()) 1260 if (dirtyRect.isEmpty())
1263 return nullptr; 1261 return nullptr;
1264 1262
1265 if (view()->document().printing()) 1263 if (view()->document().printing())
1266 return nullptr; // Don't invalidate paints if we're printing. 1264 return nullptr; // Don't invalidate paints if we're printing.
1267 1265
1268 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); 1266 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree();
1269 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai ner, dirtyRect); 1267 LayoutRect dirtyRectOnBacking = dirtyRect;
1270 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); 1268 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai ner, dirtyRectOnBacking);
1269 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle);
1270
1271 if (PaintLayer* enclosingLayer = this->enclosingLayer())
1272 enclosingLayer->setNeedsRepaint();
1273
1271 return &paintInvalidationContainer; 1274 return &paintInvalidationContainer;
1272 } 1275 }
1273 1276
1274 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const 1277 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const
1275 { 1278 {
1276 LayoutRect dirtyRect(rect); 1279 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(rect);
1277 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(dirtyRect);
1278 if (paintInvalidationContainer) { 1280 if (paintInvalidationContainer) {
1279 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle, dirtyRect, dirtyRect); 1281 // Don't need to change the paint invalidation bounds of the client, so pass nullptr.
1282 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle, nullptr);
1280 } 1283 }
1281 } 1284 }
1282 1285
1283 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const
1284 {
1285 LayoutRect dirtyRect(r);
1286 invalidatePaintRectangleInternal(dirtyRect);
1287 }
1288
1289 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) 1286 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState)
1290 { 1287 {
1291 ASSERT(!needsLayout()); 1288 ASSERT(!needsLayout());
1292 1289
1293 // If we didn't need paint invalidation then our children don't need as well . 1290 // If we didn't need paint invalidation then our children don't need as well .
1294 // Skip walking down the tree as everything should be fine below us. 1291 // Skip walking down the tree as everything should be fine below us.
1295 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 1292 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
1296 return; 1293 return;
1297 1294
1298 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate, paintInvalidationState.paintInvalidationContainer()); 1295 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate, paintInvalidationState.paintInvalidationContainer());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller 1361 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller
1365 // does not move on scroll. 1362 // does not move on scroll.
1366 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { 1363 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) {
1367 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); 1364 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset());
1368 newSelectionRect.move(inverseOffset); 1365 newSelectionRect.move(inverseOffset);
1369 } 1366 }
1370 1367
1371 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); 1368 setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
1372 1369
1373 if (shouldInvalidateSelection()) 1370 if (shouldInvalidateSelection())
1374 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati onSelection, oldSelectionRect, newSelectionRect); 1371 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati onSelection, nullptr);
1375 1372
1376 if (fullInvalidation) 1373 if (fullInvalidation)
1377 return; 1374 return;
1378 1375
1379 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); 1376 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect);
1380 } 1377 }
1381 1378
1382 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner) 1379 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner)
1383 { 1380 {
1384 LayoutView* v = view(); 1381 LayoutView* v = view();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 invalidationReason = PaintInvalidationBackgroundObscurationChange; 1419 invalidationReason = PaintInvalidationBackgroundObscurationChange;
1423 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured); 1420 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured);
1424 1421
1425 if (invalidationReason == PaintInvalidationNone) { 1422 if (invalidationReason == PaintInvalidationNone) {
1426 // TODO(trchen): Currently we don't keep track of paint offset of layout objects. 1423 // TODO(trchen): Currently we don't keep track of paint offset of layout objects.
1427 // There are corner cases that the display items need to be invalidated for paint offset 1424 // There are corner cases that the display items need to be invalidated for paint offset
1428 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based 1425 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based
1429 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. 1426 // invalidation is issued. See crbug.com/508383 and crbug.com/515977.
1430 // This is a workaround to force display items to update paint offset. 1427 // This is a workaround to force display items to update paint offset.
1431 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer()) 1428 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer())
1432 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason, oldBounds, newBounds); 1429 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason, &newBounds);
1433 1430
1434 return invalidationReason; 1431 return invalidationReason;
1435 } 1432 }
1436 1433
1437 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, oldBounds, newBounds); 1434 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason, &newBounds);
1438 1435
1439 if (invalidationReason == PaintInvalidationIncremental) { 1436 if (invalidationReason == PaintInvalidationIncremental) {
1440 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); 1437 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1441 return invalidationReason; 1438 return invalidationReason;
1442 } 1439 }
1443 1440
1444 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); 1441 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1445 1442
1446 return invalidationReason; 1443 return invalidationReason;
1447 } 1444 }
1448 1445
1449 void LayoutObject::invalidatePaintIfNeededForSynchronizedPainting(const PaintInf o& paintInfo)
1450 {
1451 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled());
1452 ASSERT(document().lifecycle().state() == DocumentLifecycle::InPaint);
1453 ASSERT(paintInfo.paintInvalidationState);
1454 ASSERT(paintInfo.paintContainer());
1455
1456 PaintController& paintController = paintInfo.context->paintController();
1457 if (paintController.clientHasCheckedPaintInvalidation(displayItemClient())) {
1458 ASSERT(paintController.clientCacheIsValid(displayItemClient())
1459 == (invalidatePaintIfNeeded(*paintInfo.paintInvalidationState, *pain tInfo.paintContainer()) == PaintInvalidationNone));
1460 return;
1461 }
1462
1463 PaintInvalidationReason reason = invalidatePaintIfNeeded(*paintInfo.paintInv alidationState, *paintInfo.paintContainer());
1464 clearPaintInvalidationState(*paintInfo.paintInvalidationState);
1465
1466 if (reason == PaintInvalidationDelayedFull)
1467 paintInfo.paintInvalidationState->pushDelayedPaintInvalidationTarget(*th is);
1468
1469 paintController.setClientHasCheckedPaintInvalidation(displayItemClient());
1470 }
1471
1472 PaintInvalidationReason LayoutObject::paintInvalidationReason(const LayoutBoxMod elObject& paintInvalidationContainer, 1446 PaintInvalidationReason LayoutObject::paintInvalidationReason(const LayoutBoxMod elObject& paintInvalidationContainer,
1473 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, 1447 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking,
1474 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const 1448 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const
1475 { 1449 {
1476 // First check for InvalidationLocationChange to avoid it from being hidden by other 1450 // First check for InvalidationLocationChange to avoid it from being hidden by other
1477 // invalidation reasons because we'll need to force check for paint invalida tion for 1451 // invalidation reasons because we'll need to force check for paint invalida tion for
1478 // children when location of this object changed. 1452 // children when location of this object changed.
1479 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking) 1453 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking)
1480 return PaintInvalidationLocationChange; 1454 return PaintInvalidationLocationChange;
1481 1455
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3357 findNonCompositedDescendantLayerToTraverse(*descendant, functor); 3331 findNonCompositedDescendantLayerToTraverse(*descendant, functor);
3358 descendant = descendant->nextInPreOrderAfterChildren(&object); 3332 descendant = descendant->nextInPreOrderAfterChildren(&object);
3359 } 3333 }
3360 } 3334 }
3361 3335
3362 } // unnamed namespace 3336 } // unnamed namespace
3363 3337
3364 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con st LayoutObject& object) const 3338 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con st LayoutObject& object) const
3365 { 3339 {
3366 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. 3340 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree.
3367 const PaintLayer* enclosingLayer = this->enclosingLayer(); 3341 PaintLayer* enclosingLayer = this->enclosingLayer();
3368 if (!enclosingLayer) 3342 if (!enclosingLayer)
3369 return; 3343 return;
3370 3344
3345 enclosingLayer->setNeedsRepaint();
3346
3371 // This is valid because we want to invalidate the client in the display ite m list of the current backing. 3347 // This is valid because we want to invalidate the client in the display ite m list of the current backing.
3372 DisableCompositingQueryAsserts disabler; 3348 DisableCompositingQueryAsserts disabler;
3373 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerFor PaintInvalidationCrossingFrameBoundaries(); 3349 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerFor PaintInvalidationCrossingFrameBoundaries();
3374 if (!paintInvalidationLayer) 3350 if (!paintInvalidationLayer)
3375 return; 3351 return;
3376 3352
3377 class Functor : public LayoutObjectTraversalFunctor { 3353 class Functor : public LayoutObjectTraversalFunctor {
3378 public: 3354 public:
3379 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } 3355 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { }
3380 void operator()(LayoutObject& object) const override 3356 void operator()(LayoutObject& object) const override
3381 { 3357 {
3382 // Only the objects need to be invalidated, not any paint rectangles . 3358 // TODO(wangxianzhu): Ensure correct bounds for the client will be o r has been passed to PaintController.
3383 LayoutRect invalidationRect; 3359 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, nullptr);
3384 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, invalidationRect, invalidationRect);
3385 } 3360 }
3386 private: 3361 private:
3387 const LayoutBoxModelObject& m_paintInvalidationContainer; 3362 const LayoutBoxModelObject& m_paintInvalidationContainer;
3388 }; 3363 };
3389 3364
3390 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject(); 3365 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject();
3391 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer)); 3366 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer));
3392 } 3367 }
3393 3368
3394 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const 3369 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const
3395 { 3370 {
3396 // These disablers are valid because we want to use the current compositing/ invalidation status. 3371 // These disablers are valid because we want to use the current compositing/ invalidation status.
3397 DisablePaintInvalidationStateAsserts invalidationDisabler; 3372 DisablePaintInvalidationStateAsserts invalidationDisabler;
3398 DisableCompositingQueryAsserts compositingDisabler; 3373 DisableCompositingQueryAsserts compositingDisabler;
3399 3374
3400 LayoutRect invalidationRect = previousPaintInvalidationRect(); 3375 LayoutRect invalidationRect = previousPaintInvalidationRect();
3401 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); 3376 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3402 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); 3377 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer);
3403 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, invalidationRect, invalidationRect); 3378
3379 // The PaintController may have changed. Pass the previous paint invalidatio n rect to the new PaintController.
3380 // The rect will be updated if it changes during the next paint invalidation .
3381 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, &invalidationRect);
3404 } 3382 }
3405 3383
3406 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3384 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3407 { 3385 {
3408 class Functor : public LayoutObjectTraversalFunctor { 3386 class Functor : public LayoutObjectTraversalFunctor {
3409 public: 3387 public:
3410 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } 3388 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { }
3411 void operator()(LayoutObject& object) const override 3389 void operator()(LayoutObject& object) const override
3412 { 3390 {
3413 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer); 3391 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 const blink::LayoutObject* root = object1; 3467 const blink::LayoutObject* root = object1;
3490 while (root->parent()) 3468 while (root->parent())
3491 root = root->parent(); 3469 root = root->parent();
3492 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3470 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3493 } else { 3471 } else {
3494 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3472 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3495 } 3473 }
3496 } 3474 }
3497 3475
3498 #endif 3476 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698