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

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

Issue 1585823002: Improve performance when calling PaintLayer::setNeedsRepaint() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@RemoveVisualRect
Patch Set: Created 4 years, 11 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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 // This is valid because we want to invalidate the client in the display item list of the current backing. 1237 // This is valid because we want to invalidate the client in the display item list of the current backing.
1238 DisableCompositingQueryAsserts disabler; 1238 DisableCompositingQueryAsserts disabler;
1239 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) 1239 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries())
1240 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull); 1240 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull);
1241 enclosingLayer->setNeedsRepaint(); 1241 enclosingLayer->setNeedsRepaint();
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1245 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1246 { 1246 {
1247 // It's caller's responsibility to ensure enclosingLayer's needsRepaint is s et.
1248 // Don't set the flag here because enclosingLayer() has cost and the caller can use
1249 // various ways (e.g. PaintInvalidatinState::enclosingLayer()) to reduce the cost.
1250 ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint());
1247 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason); 1251 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason);
1252 }
1248 1253
1249 if (PaintLayer* enclosingLayer = this->enclosingLayer()) 1254 void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState& paintInvalidationState, PaintInvalidationReason invalidationReason) const
1250 enclosingLayer->setNeedsRepaint(); 1255 {
1256 ASSERT(&paintInvalidationState.enclosingLayer(*this) == enclosingLayer());
1257 paintInvalidationState.enclosingLayer(*this).setNeedsRepaint();
1258 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason) ;
1251 } 1259 }
1252 1260
1253 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const 1261 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const
1254 { 1262 {
1255 return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationCont ainer.layer(), paintInvalidationState); 1263 return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationCont ainer.layer(), paintInvalidationState);
1256 } 1264 }
1257 1265
1258 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const 1266 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const
1259 { 1267 {
1260 RELEASE_ASSERT(isRooted()); 1268 RELEASE_ASSERT(isRooted());
1261 1269
1262 if (dirtyRect.isEmpty()) 1270 if (dirtyRect.isEmpty())
1263 return nullptr; 1271 return nullptr;
1264 1272
1265 if (view()->document().printing()) 1273 if (view()->document().printing())
1266 return nullptr; // Don't invalidate paints if we're printing. 1274 return nullptr; // Don't invalidate paints if we're printing.
1267 1275
1268 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation(); 1276 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation();
1269 LayoutRect dirtyRectOnBacking = dirtyRect; 1277 LayoutRect dirtyRectOnBacking = dirtyRect;
1270 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai ner, dirtyRectOnBacking); 1278 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai ner, dirtyRectOnBacking);
1271 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle); 1279 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle);
1272 return &paintInvalidationContainer; 1280 return &paintInvalidationContainer;
1273 } 1281 }
1274 1282
1275 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const 1283 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const
1276 { 1284 {
1285 if (PaintLayer* enclosingLayer = this->enclosingLayer())
1286 enclosingLayer->setNeedsRepaint();
1277 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(rect); 1287 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect angleInternal(rect);
1278 if (paintInvalidationContainer) 1288 if (paintInvalidationContainer)
1279 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle); 1289 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle);
1280 } 1290 }
1281 1291
1282 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const 1292 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const
1283 { 1293 {
1284 invalidatePaintRectangleInternal(r); 1294 invalidatePaintRectangleInternal(r);
1285 } 1295 }
1286 1296
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap(); 1351 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap();
1342 } 1352 }
1343 1353
1344 if (selectionRect.isEmpty()) 1354 if (selectionRect.isEmpty())
1345 selectionPaintInvalidationMap->remove(this); 1355 selectionPaintInvalidationMap->remove(this);
1346 else 1356 else
1347 selectionPaintInvalidationMap->set(this, selectionRect); 1357 selectionPaintInvalidationMap->set(this, selectionRect);
1348 } 1358 }
1349 1359
1350 // TODO(wangxianzhu): Remove this for slimming paint v2 because we won't care ab out paint invalidation rects. 1360 // TODO(wangxianzhu): Remove this for slimming paint v2 because we won't care ab out paint invalidation rects.
1351 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject & paintInvalidationContainer, PaintInvalidationReason invalidationReason) 1361 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject & paintInvalidationContainer, const PaintInvalidationState& paintInvalidationSta te, PaintInvalidationReason invalidationReason)
1352 { 1362 {
1353 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.) 1363 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.)
1354 // or shouldInvalidationSelection is set (in case that the selection itself changed). 1364 // or shouldInvalidationSelection is set (in case that the selection itself changed).
1355 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI nvalidationReason(invalidationReason); 1365 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI nvalidationReason(invalidationReason);
1356 if (!fullInvalidation && !shouldInvalidateSelection()) 1366 if (!fullInvalidation && !shouldInvalidateSelection())
1357 return; 1367 return;
1358 1368
1359 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); 1369 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation();
1360 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali dationContainer); 1370 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali dationContainer);
1361 1371
1362 // 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
1363 // does not move on scroll. 1373 // does not move on scroll.
1364 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { 1374 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) {
1365 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); 1375 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset());
1366 newSelectionRect.move(inverseOffset); 1376 newSelectionRect.move(inverseOffset);
1367 } 1377 }
1368 1378
1369 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); 1379 setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
1370 1380
1371 if (shouldInvalidateSelection()) 1381 if (shouldInvalidateSelection())
1372 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati onSelection); 1382 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection);
1373 1383
1374 if (fullInvalidation) 1384 if (fullInvalidation)
1375 return; 1385 return;
1376 1386
1377 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); 1387 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect);
1378 } 1388 }
1379 1389
1380 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner) 1390 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta iner)
1381 { 1391 {
1382 LayoutView* v = view(); 1392 LayoutView* v = view();
(...skipping 19 matching lines...) Expand all
1402 1412
1403 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && !paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) { 1413 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && !paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) {
1404 ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinC ontainer()); 1414 ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinC ontainer());
1405 return PaintInvalidationNone; 1415 return PaintInvalidationNone;
1406 } 1416 }
1407 1417
1408 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn validationContainer, oldBounds, oldLocation, newBounds, newLocation); 1418 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn validationContainer, oldBounds, oldLocation, newBounds, newLocation);
1409 1419
1410 // We need to invalidate the selection before checking for whether we are do ing a full invalidation. 1420 // We need to invalidate the selection before checking for whether we are do ing a full invalidation.
1411 // This is because we need to update the old rect regardless. 1421 // This is because we need to update the old rect regardless.
1412 invalidateSelectionIfNeeded(paintInvalidationContainer, invalidationReason); 1422 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta te, invalidationReason);
1413 1423
1414 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintIfNeeded()", 1424 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintIfNeeded()",
1415 "object", this->debugName().ascii(), 1425 "object", this->debugName().ascii(),
1416 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation)); 1426 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation));
1417 1427
1418 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs cured(); 1428 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs cured();
1419 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) 1429 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured())
1420 invalidationReason = PaintInvalidationBackgroundObscurationChange; 1430 invalidationReason = PaintInvalidationBackgroundObscurationChange;
1421 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured); 1431 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured);
1422 1432
1423 if (invalidationReason == PaintInvalidationNone) { 1433 if (invalidationReason == PaintInvalidationNone) {
1424 // 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.
1425 // 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
1426 // 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
1427 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. 1437 // invalidation is issued. See crbug.com/508383 and crbug.com/515977.
1428 // 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.
1429 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer()) 1439 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer())
1430 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason); 1440 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida tionContainer, paintInvalidationState, invalidationReason);
1431 1441
1432 return invalidationReason; 1442 return invalidationReason;
1433 } 1443 }
1434 1444
1435 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason) ; 1445 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont ainer, paintInvalidationState, invalidationReason);
1436 1446
1437 if (invalidationReason == PaintInvalidationIncremental) { 1447 if (invalidationReason == PaintInvalidationIncremental) {
1438 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); 1448 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1439 return invalidationReason; 1449 return invalidationReason;
1440 } 1450 }
1441 1451
1442 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); 1452 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1443 1453
1444 return invalidationReason; 1454 return invalidationReason;
1445 } 1455 }
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
3393 PaintLayer* enclosingLayer = this->enclosingLayer(); 3403 PaintLayer* enclosingLayer = this->enclosingLayer();
3394 if (!enclosingLayer) 3404 if (!enclosingLayer)
3395 return; 3405 return;
3396 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLaye rForPaintInvalidationCrossingFrameBoundaries(); 3406 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLaye rForPaintInvalidationCrossingFrameBoundaries();
3397 if (!paintInvalidationLayer) 3407 if (!paintInvalidationLayer)
3398 return; 3408 return;
3399 paintInvalidationContainer = paintInvalidationLayer->layoutObject(); 3409 paintInvalidationContainer = paintInvalidationLayer->layoutObject();
3400 } 3410 }
3401 3411
3402 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI nvalidationContainer, paintInvalidationReason](LayoutObject& object) { 3412 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI nvalidationContainer, paintInvalidationReason](LayoutObject& object) {
3413 if (object.hasLayer())
3414 toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
3403 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn validationReason); 3415 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn validationReason);
3404 }); 3416 });
3405 } 3417 }
3406 3418
3407 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) 3419 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason)
3408 { 3420 {
3421 // It's caller's responsibility to ensure enclosingLayer's needsRepaint is s et.
3422 // Don't set the flag here because enclosingLayer() has cost and the caller can use
3423 // various ways (e.g. PaintInvalidatinState::enclosingLayer()) to reduce the cost.
3424 ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint());
3425
3409 // These disablers are valid because we want to use the current compositing/ invalidation status. 3426 // These disablers are valid because we want to use the current compositing/ invalidation status.
3410 DisablePaintInvalidationStateAsserts invalidationDisabler; 3427 DisablePaintInvalidationStateAsserts invalidationDisabler;
3411 DisableCompositingQueryAsserts compositingDisabler; 3428 DisableCompositingQueryAsserts compositingDisabler;
3412 3429
3413 LayoutRect invalidationRect = previousPaintInvalidationRect(); 3430 LayoutRect invalidationRect = previousPaintInvalidationRect();
3414 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); 3431 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3415 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); 3432 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer);
3416 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer); 3433 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer);
3417 3434
3418 // This method may be used to invalidate paint of an object changing paint i nvalidation container. 3435 // This method may be used to invalidate paint of an object changing paint i nvalidation container.
3419 // Clear previous paint invalidation rect on the original paint invalidation container to avoid 3436 // Clear previous paint invalidation rect on the original paint invalidation container to avoid
3420 // under-invalidation if the new paint invalidation rect on the new paint in validation container 3437 // under-invalidation if the new paint invalidation rect on the new paint in validation container
3421 // happens to be the same as the old one. 3438 // happens to be the same as the old one.
3422 clearPreviousPaintInvalidationRects(); 3439 clearPreviousPaintInvalidationRects();
3423 } 3440 }
3424 3441
3425 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3442 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3426 { 3443 {
3427 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer. 3444 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer.
3428 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation(); 3445 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation();
3429 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou tObject& object) { 3446 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou tObject& object) {
3447 if (object.hasLayer())
3448 toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
3430 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC ontainer, PaintInvalidationLayer); 3449 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC ontainer, PaintInvalidationLayer);
3431 }); 3450 });
3432 } 3451 }
3433 3452
3434 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097). 3453 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097).
3435 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants() 3454 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants()
3436 { 3455 {
3437 // Need to access the current compositing status. 3456 // Need to access the current compositing status.
3438 DisableCompositingQueryAsserts disabler; 3457 DisableCompositingQueryAsserts disabler;
3439 traverseNonCompositingDescendants(*this, [](LayoutObject& object) { 3458 traverseNonCompositingDescendants(*this, [](LayoutObject& object) {
3440 object.setShouldDoFullPaintInvalidation(); 3459 object.setShouldDoFullPaintInvalidation();
3441 }); 3460 });
3442 } 3461 }
3443 3462
3463 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern al(const LayoutBoxModelObject& paintInvalidationContainer)
3464 {
3465 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P aintInvalidationLayer);
3466 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
3467 if (child->hasLayer())
3468 toLayoutBoxModelObject(child)->layer()->setNeedsRepaint();
3469 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel fPaintingLayer())
3470 child->invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern al(paintInvalidationContainer);
3471 }
3472 }
3473
3444 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBoxModelObject& paintInvalidationContainer) 3474 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBoxModelObject& paintInvalidationContainer)
3445 { 3475 {
3446 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P aintInvalidationLayer); 3476 if (PaintLayer* enclosingLayer = this->enclosingLayer())
3447 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 3477 enclosingLayer->setNeedsRepaint();
3448 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel fPaintingLayer()) 3478 invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal(paintInvalid ationContainer);
3449 child->invalidatePaintIncludingNonSelfPaintingLayerDescendants(paint InvalidationContainer);
3450 }
3451 } 3479 }
3452 3480
3453 void LayoutObject::setIsBackgroundAttachmentFixedObject(bool isBackgroundAttachm entFixedObject) 3481 void LayoutObject::setIsBackgroundAttachmentFixedObject(bool isBackgroundAttachm entFixedObject)
3454 { 3482 {
3455 ASSERT(frameView()); 3483 ASSERT(frameView());
3456 if (m_bitfields.isBackgroundAttachmentFixedObject() == isBackgroundAttachmen tFixedObject) 3484 if (m_bitfields.isBackgroundAttachmentFixedObject() == isBackgroundAttachmen tFixedObject)
3457 return; 3485 return;
3458 m_bitfields.setIsBackgroundAttachmentFixedObject(isBackgroundAttachmentFixed Object); 3486 m_bitfields.setIsBackgroundAttachmentFixedObject(isBackgroundAttachmentFixed Object);
3459 if (isBackgroundAttachmentFixedObject) 3487 if (isBackgroundAttachmentFixedObject)
3460 frameView()->addBackgroundAttachmentFixedObject(this); 3488 frameView()->addBackgroundAttachmentFixedObject(this);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 const blink::LayoutObject* root = object1; 3539 const blink::LayoutObject* root = object1;
3512 while (root->parent()) 3540 while (root->parent())
3513 root = root->parent(); 3541 root = root->parent();
3514 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3542 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3515 } else { 3543 } else {
3516 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3544 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3517 } 3545 }
3518 } 3546 }
3519 3547
3520 #endif 3548 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698