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 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1243 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) | 1243 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing LayerForPaintInvalidationCrossingFrameBoundaries()) |
1244 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient, PaintInvalidationFull); | 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 | 1249 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
1250 { | 1250 { |
1251 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason); | 1251 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval idationReason); |
1252 | 1252 |
1253 if (PaintLayer* enclosingLayer = this->enclosingLayer()) | 1253 if (PaintLayer* enclosingLayer = this->enclosingLayer()) |
chrishtr
2016/01/15 00:02:21
In particular, this is still calling setNeedsRepai
Xianzhu
2016/01/15 00:32:05
Oops. Sorry I thought I had removed these two line
| |
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 |
1262 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const | 1262 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& dirtyRect) const |
1263 { | 1263 { |
(...skipping 10 matching lines...) Expand all Loading... | |
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 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle); | 1283 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat ionRectangle); |
1284 if (PaintLayer* enclosingLayer = this->enclosingLayer()) | |
1285 enclosingLayer->setNeedsRepaint(); | |
1284 } | 1286 } |
1285 | 1287 |
1286 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const | 1288 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con st LayoutRect& r) const |
1287 { | 1289 { |
1288 invalidatePaintRectangleInternal(r); | 1290 invalidatePaintRectangleInternal(r); |
1289 } | 1291 } |
1290 | 1292 |
1291 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) | 1293 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) |
1292 { | 1294 { |
1293 ASSERT(!needsLayout()); | 1295 ASSERT(!needsLayout()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1423 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) | 1425 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) |
1424 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1426 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
1425 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured); | 1427 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb scured); |
1426 | 1428 |
1427 if (invalidationReason == PaintInvalidationNone) { | 1429 if (invalidationReason == PaintInvalidationNone) { |
1428 // TODO(trchen): Currently we don't keep track of paint offset of layout objects. | 1430 // TODO(trchen): Currently we don't keep track of paint offset of layout objects. |
1429 // There are corner cases that the display items need to be invalidated for paint offset | 1431 // There are corner cases that the display items need to be invalidated for paint offset |
1430 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based | 1432 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based |
1431 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1433 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
1432 // This is a workaround to force display items to update paint offset. | 1434 // This is a workaround to force display items to update paint offset. |
1433 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer()) | 1435 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain tInvalidationState.forcedSubtreeInvalidationWithinContainer()) { |
1434 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason); | 1436 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio nReason); |
1437 paintInvalidationState.enclosingLayer().setNeedsRepaint(); | |
1438 } | |
1435 | 1439 |
1436 return invalidationReason; | 1440 return invalidationReason; |
1437 } | 1441 } |
1438 | 1442 |
1439 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason) ; | 1443 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason) ; |
1444 paintInvalidationState.enclosingLayer().setNeedsRepaint(); | |
1440 | 1445 |
1441 if (invalidationReason == PaintInvalidationIncremental) { | 1446 if (invalidationReason == PaintInvalidationIncremental) { |
1442 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); | 1447 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); |
1443 return invalidationReason; | 1448 return invalidationReason; |
1444 } | 1449 } |
1445 | 1450 |
1446 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); | 1451 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); |
1447 | 1452 |
1448 return invalidationReason; | 1453 return invalidationReason; |
1449 } | 1454 } |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3398 if (!enclosingLayer) | 3403 if (!enclosingLayer) |
3399 return; | 3404 return; |
3400 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLaye rForPaintInvalidationCrossingFrameBoundaries(); | 3405 const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLaye rForPaintInvalidationCrossingFrameBoundaries(); |
3401 if (!paintInvalidationLayer) | 3406 if (!paintInvalidationLayer) |
3402 return; | 3407 return; |
3403 paintInvalidationContainer = paintInvalidationLayer->layoutObject(); | 3408 paintInvalidationContainer = paintInvalidationLayer->layoutObject(); |
3404 } | 3409 } |
3405 | 3410 |
3406 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI nvalidationContainer, paintInvalidationReason](LayoutObject& object) { | 3411 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI nvalidationContainer, paintInvalidationReason](LayoutObject& object) { |
3407 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn validationReason); | 3412 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn validationReason); |
3413 if (object.hasLayer()) | |
3414 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | |
3408 }); | 3415 }); |
3409 } | 3416 } |
3410 | 3417 |
3411 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) | 3418 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) |
3412 { | 3419 { |
3420 invalidatePaintOfPreviousPaintInvalidationRectNotSettingLayerNeedsRepaint(pa intInvalidationContainer, reason); | |
3421 if (PaintLayer* enclosingLayer = this->enclosingLayer()) | |
3422 enclosingLayer->setNeedsRepaint(); | |
3423 } | |
3424 | |
3425 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRectNotSettingLayer NeedsRepaint(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvali dationReason reason) | |
3426 { | |
chrishtr
2016/01/14 18:51:13
This looks like a copy of the old code. I expected
Xianzhu
2016/01/14 19:19:08
Now invalidateDisplayItemClients() doesn't set lay
chrishtr
2016/01/15 00:02:21
I understand the goal, but can't find where you ar
| |
3413 // These disablers are valid because we want to use the current compositing/ invalidation status. | 3427 // These disablers are valid because we want to use the current compositing/ invalidation status. |
3414 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3428 DisablePaintInvalidationStateAsserts invalidationDisabler; |
3415 DisableCompositingQueryAsserts compositingDisabler; | 3429 DisableCompositingQueryAsserts compositingDisabler; |
3416 | 3430 |
3417 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3431 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
3418 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); | 3432 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); |
3419 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); | 3433 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); |
3420 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer); | 3434 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer); |
3421 | 3435 |
3422 // This method may be used to invalidate paint of an object changing paint i nvalidation container. | 3436 // This method may be used to invalidate paint of an object changing paint i nvalidation container. |
3423 // Clear previous paint invalidation rect on the original paint invalidation container to avoid | 3437 // Clear previous paint invalidation rect on the original paint invalidation container to avoid |
3424 // under-invalidation if the new paint invalidation rect on the new paint in validation container | 3438 // under-invalidation if the new paint invalidation rect on the new paint in validation container |
3425 // happens to be the same as the old one. | 3439 // happens to be the same as the old one. |
3426 clearPreviousPaintInvalidationRects(); | 3440 clearPreviousPaintInvalidationRects(); |
3427 } | 3441 } |
3428 | 3442 |
3429 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3443 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
3430 { | 3444 { |
3431 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer. | 3445 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer. |
3432 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation(); | 3446 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation(); |
3433 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou tObject& object) { | 3447 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou tObject& object) { |
3434 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC ontainer, PaintInvalidationLayer); | 3448 object.invalidatePaintOfPreviousPaintInvalidationRectNotSettingLayerNeed sRepaint(paintInvalidationContainer, PaintInvalidationLayer); |
3449 if (object.hasLayer()) | |
3450 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | |
3435 }); | 3451 }); |
3436 } | 3452 } |
3437 | 3453 |
3438 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097). | 3454 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097). |
3439 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants() | 3455 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants() |
3440 { | 3456 { |
3441 // Need to access the current compositing status. | 3457 // Need to access the current compositing status. |
3442 DisableCompositingQueryAsserts disabler; | 3458 DisableCompositingQueryAsserts disabler; |
3443 traverseNonCompositingDescendants(*this, [](LayoutObject& object) { | 3459 traverseNonCompositingDescendants(*this, [](LayoutObject& object) { |
3444 object.setShouldDoFullPaintInvalidation(); | 3460 object.setShouldDoFullPaintInvalidation(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3515 const blink::LayoutObject* root = object1; | 3531 const blink::LayoutObject* root = object1; |
3516 while (root->parent()) | 3532 while (root->parent()) |
3517 root = root->parent(); | 3533 root = root->parent(); |
3518 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3534 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3519 } else { | 3535 } else { |
3520 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3536 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3521 } | 3537 } |
3522 } | 3538 } |
3523 | 3539 |
3524 #endif | 3540 #endif |
OLD | NEW |