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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 } | 1234 } |
1235 | 1235 |
1236 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI
temClient) const | 1236 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI
temClient) const |
1237 { | 1237 { |
1238 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be
en passed to PaintController. crbug.com/547119. | 1238 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be
en passed to PaintController. crbug.com/547119. |
1239 // Not using enclosingCompositedContainer() directly because this object may
be in an orphaned subtree. | 1239 // Not using enclosingCompositedContainer() directly because this object may
be in an orphaned subtree. |
1240 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { | 1240 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { |
1241 // This is valid because we want to invalidate the client in the display
item list of the current backing. | 1241 // This is valid because we want to invalidate the client in the display
item list of the current backing. |
1242 DisableCompositingQueryAsserts disabler; | 1242 DisableCompositingQueryAsserts disabler; |
1243 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing
LayerForPaintInvalidationCrossingFrameBoundaries()) | 1243 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing
LayerForPaintInvalidationCrossingFrameBoundaries()) |
1244 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO
nBacking(displayItemClient, PaintInvalidationFull, nullptr); | 1244 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO
nBacking(displayItemClient, PaintInvalidationFull); |
1245 enclosingLayer->setNeedsRepaint(); | 1245 enclosingLayer->setNeedsRepaint(); |
1246 } | 1246 } |
1247 } | 1247 } |
1248 | 1248 |
1249 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason, const Layout
Rect* paintInvalidationRect) const | 1249 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
1250 { | 1250 { |
1251 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason, paintInvalidationRect); | 1251 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason); |
1252 | 1252 |
1253 if (PaintLayer* enclosingLayer = this->enclosingLayer()) | 1253 if (PaintLayer* enclosingLayer = this->enclosingLayer()) |
1254 enclosingLayer->setNeedsRepaint(); | 1254 enclosingLayer->setNeedsRepaint(); |
1255 } | 1255 } |
1256 | 1256 |
1257 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje
ct& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS
tate) const | 1257 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje
ct& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS
tate) const |
1258 { | 1258 { |
1259 return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationCont
ainer.layer(), paintInvalidationState); | 1259 return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationCont
ainer.layer(), paintInvalidationState); |
1260 } | 1260 } |
1261 | 1261 |
(...skipping 10 matching lines...) Expand all Loading... |
1272 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); | 1272 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); |
1273 LayoutRect dirtyRectOnBacking = dirtyRect; | 1273 LayoutRect dirtyRectOnBacking = dirtyRect; |
1274 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai
ner, dirtyRectOnBacking); | 1274 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContai
ner, dirtyRectOnBacking); |
1275 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); | 1275 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); |
1276 return &paintInvalidationContainer; | 1276 return &paintInvalidationContainer; |
1277 } | 1277 } |
1278 | 1278 |
1279 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const | 1279 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const |
1280 { | 1280 { |
1281 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect
angleInternal(rect); | 1281 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect
angleInternal(rect); |
1282 if (paintInvalidationContainer) { | 1282 if (paintInvalidationContainer) |
1283 // Don't need to change the paint invalidation bounds of the client, so
pass nullptr. | 1283 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat
ionRectangle); |
1284 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat
ionRectangle, nullptr); | |
1285 } | |
1286 } | 1284 } |
1287 | 1285 |
1288 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con
st LayoutRect& r) const | 1286 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con
st LayoutRect& r) const |
1289 { | 1287 { |
1290 invalidatePaintRectangleInternal(r); | 1288 invalidatePaintRectangleInternal(r); |
1291 } | 1289 } |
1292 | 1290 |
1293 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat
ionState) | 1291 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat
ionState) |
1294 { | 1292 { |
1295 ASSERT(!needsLayout()); | 1293 ASSERT(!needsLayout()); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 // Composited scrolling should not be included in the bounds and position tr
acking, because the graphics layer backing the scroller | 1366 // Composited scrolling should not be included in the bounds and position tr
acking, because the graphics layer backing the scroller |
1369 // does not move on scroll. | 1367 // does not move on scroll. |
1370 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { | 1368 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { |
1371 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); | 1369 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); |
1372 newSelectionRect.move(inverseOffset); | 1370 newSelectionRect.move(inverseOffset); |
1373 } | 1371 } |
1374 | 1372 |
1375 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); | 1373 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); |
1376 | 1374 |
1377 if (shouldInvalidateSelection()) | 1375 if (shouldInvalidateSelection()) |
1378 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati
onSelection, nullptr); | 1376 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati
onSelection); |
1379 | 1377 |
1380 if (fullInvalidation) | 1378 if (fullInvalidation) |
1381 return; | 1379 return; |
1382 | 1380 |
1383 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection,
oldSelectionRect, newSelectionRect); | 1381 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection,
oldSelectionRect, newSelectionRect); |
1384 } | 1382 } |
1385 | 1383 |
1386 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta
iner) | 1384 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta
iner) |
1387 { | 1385 { |
1388 LayoutView* v = view(); | 1386 LayoutView* v = view(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1424 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
1427 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); | 1425 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); |
1428 | 1426 |
1429 if (invalidationReason == PaintInvalidationNone) { | 1427 if (invalidationReason == PaintInvalidationNone) { |
1430 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. | 1428 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. |
1431 // There are corner cases that the display items need to be invalidated
for paint offset | 1429 // There are corner cases that the display items need to be invalidated
for paint offset |
1432 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based | 1430 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based |
1433 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1431 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
1434 // This is a workaround to force display items to update paint offset. | 1432 // This is a workaround to force display items to update paint offset. |
1435 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain
tInvalidationState.forcedSubtreeInvalidationWithinContainer()) | 1433 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain
tInvalidationState.forcedSubtreeInvalidationWithinContainer()) |
1436 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio
nReason, &newBounds); | 1434 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio
nReason); |
1437 | 1435 |
1438 return invalidationReason; | 1436 return invalidationReason; |
1439 } | 1437 } |
1440 | 1438 |
1441 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason,
&newBounds); | 1439 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; |
1442 | 1440 |
1443 if (invalidationReason == PaintInvalidationIncremental) { | 1441 if (invalidationReason == PaintInvalidationIncremental) { |
1444 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1442 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
1445 return invalidationReason; | 1443 return invalidationReason; |
1446 } | 1444 } |
1447 | 1445 |
1448 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); | 1446 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); |
1449 | 1447 |
1450 return invalidationReason; | 1448 return invalidationReason; |
1451 } | 1449 } |
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 | 3381 |
3384 // If a paint invalidation container is not a stacking context, | 3382 // If a paint invalidation container is not a stacking context, |
3385 // some of its descendants may belong to the parent container. | 3383 // some of its descendants may belong to the parent container. |
3386 findNonCompositedDescendantLayerToTraverse(*descendant, functor); | 3384 findNonCompositedDescendantLayerToTraverse(*descendant, functor); |
3387 descendant = descendant->nextInPreOrderAfterChildren(&object); | 3385 descendant = descendant->nextInPreOrderAfterChildren(&object); |
3388 } | 3386 } |
3389 } | 3387 } |
3390 | 3388 |
3391 } // unnamed namespace | 3389 } // unnamed namespace |
3392 | 3390 |
3393 void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant
s(const LayoutBoxModelObject* paintInvalidationContainer, PaintInvalidationReaso
n paintInvalidationReason, const LayoutRect* paintInvalidationRect) const | 3391 void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant
s(const LayoutBoxModelObject* paintInvalidationContainer, PaintInvalidationReaso
n paintInvalidationReason) const |
3394 { | 3392 { |
3395 // This is valid because we want to invalidate the client in the display ite
m list of the current backing. | 3393 // This is valid because we want to invalidate the client in the display ite
m list of the current backing. |
3396 DisableCompositingQueryAsserts disabler; | 3394 DisableCompositingQueryAsserts disabler; |
3397 if (!paintInvalidationContainer) { | 3395 if (!paintInvalidationContainer) { |
3398 // Not using enclosingCompositedContainer() directly because this object
may be in an orphaned subtree. | 3396 // Not using enclosingCompositedContainer() directly because this object
may be in an orphaned subtree. |
3399 PaintLayer* enclosingLayer = this->enclosingLayer(); | 3397 PaintLayer* enclosingLayer = this->enclosingLayer(); |
3400 if (!enclosingLayer) | 3398 if (!enclosingLayer) |
3401 return; | 3399 return; |
3402 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLaye
rForPaintInvalidationCrossingFrameBoundaries(); | 3400 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLaye
rForPaintInvalidationCrossingFrameBoundaries(); |
3403 if (!paintInvalidationLayer) | 3401 if (!paintInvalidationLayer) |
3404 return; | 3402 return; |
3405 paintInvalidationContainer = paintInvalidationLayer->layoutObject(); | 3403 paintInvalidationContainer = paintInvalidationLayer->layoutObject(); |
3406 } | 3404 } |
3407 | 3405 |
3408 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason, paintInvalidationRect](LayoutObje
ct& object) { | 3406 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { |
3409 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason, paintInvalidationRect); | 3407 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); |
3410 }); | 3408 }); |
3411 } | 3409 } |
3412 | 3410 |
3413 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) | 3411 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) |
3414 { | 3412 { |
3415 // These disablers are valid because we want to use the current compositing/
invalidation status. | 3413 // These disablers are valid because we want to use the current compositing/
invalidation status. |
3416 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3414 DisablePaintInvalidationStateAsserts invalidationDisabler; |
3417 DisableCompositingQueryAsserts compositingDisabler; | 3415 DisableCompositingQueryAsserts compositingDisabler; |
3418 | 3416 |
3419 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3417 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
3420 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); | 3418 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); |
3421 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
PaintInvalidationLayer); | 3419 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
PaintInvalidationLayer); |
3422 | 3420 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa
yer); |
3423 // The PaintController may have changed. Pass the previous paint invalidatio
n rect to the new PaintController. | |
3424 // The rect will be updated if it changes during the next paint invalidation
. | |
3425 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa
yer, &invalidationRect); | |
3426 | 3421 |
3427 // This method may be used to invalidate paint of an object changing paint i
nvalidation container. | 3422 // This method may be used to invalidate paint of an object changing paint i
nvalidation container. |
3428 // Clear previous paint invalidation rect on the original paint invalidation
container to avoid | 3423 // Clear previous paint invalidation rect on the original paint invalidation
container to avoid |
3429 // under-invalidation if the new paint invalidation rect on the new paint in
validation container | 3424 // under-invalidation if the new paint invalidation rect on the new paint in
validation container |
3430 // happens to be the same as the old one. | 3425 // happens to be the same as the old one. |
3431 clearPreviousPaintInvalidationRects(); | 3426 clearPreviousPaintInvalidationRects(); |
3432 } | 3427 } |
3433 | 3428 |
3434 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3429 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
3435 { | 3430 { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 const blink::LayoutObject* root = object1; | 3515 const blink::LayoutObject* root = object1; |
3521 while (root->parent()) | 3516 while (root->parent()) |
3522 root = root->parent(); | 3517 root = root->parent(); |
3523 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3518 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3524 } else { | 3519 } else { |
3525 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3520 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3526 } | 3521 } |
3527 } | 3522 } |
3528 | 3523 |
3529 #endif | 3524 #endif |
OLD | NEW |