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 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 // painted, such as SVG images. | 1224 // painted, such as SVG images. |
1225 if (!paintInvalidationContainer.isPaintInvalidationContainer()) | 1225 if (!paintInvalidationContainer.isPaintInvalidationContainer()) |
1226 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn
tRect(dirtyRect)); | 1226 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn
tRect(dirtyRect)); |
1227 | 1227 |
1228 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio
nContainer.isPaintInvalidationContainer()) | 1228 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio
nContainer.isPaintInvalidationContainer()) |
1229 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR
ect, invalidationReason); | 1229 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR
ect, invalidationReason); |
1230 } | 1230 } |
1231 | 1231 |
1232 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI
temClient) const | 1232 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI
temClient) const |
1233 { | 1233 { |
1234 // TODO(wangxianzhu): Ensure correct bounds for the client will be or has be
en passed to PaintController. crbug.com/547119. | |
1235 // Not using enclosingCompositedContainer() directly because this object may
be in an orphaned subtree. | |
1236 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { | 1234 if (PaintLayer* enclosingLayer = this->enclosingLayer()) { |
1237 // This is valid because we want to invalidate the client in the display
item list of the current backing. | 1235 // This is valid because we want to invalidate the client in the display
item list of the current backing. |
1238 DisableCompositingQueryAsserts disabler; | 1236 DisableCompositingQueryAsserts disabler; |
1239 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing
LayerForPaintInvalidationCrossingFrameBoundaries()) | 1237 if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosing
LayerForPaintInvalidationCrossingFrameBoundaries()) |
1240 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO
nBacking(displayItemClient, PaintInvalidationFull); | 1238 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO
nBacking(displayItemClient, PaintInvalidationFull); |
1241 enclosingLayer->setNeedsRepaint(); | 1239 enclosingLayer->setNeedsRepaint(); |
1242 } | 1240 } |
1243 } | 1241 } |
1244 | 1242 |
| 1243 #if ENABLE(ASSERT) |
| 1244 static void assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(const LayoutObjec
t& layoutObject) |
| 1245 { |
| 1246 PaintLayer* enclosingSelfPaintingLayer = nullptr; |
| 1247 const LayoutObject* curr = &layoutObject; |
| 1248 while (curr) { |
| 1249 if (curr->hasLayer() && toLayoutBoxModelObject(curr)->hasSelfPaintingLay
er()) { |
| 1250 enclosingSelfPaintingLayer = toLayoutBoxModelObject(curr)->layer(); |
| 1251 break; |
| 1252 } |
| 1253 // Multi-column spanner is painted by the layer of the multi-column cont
ainer instead of |
| 1254 // its enclosing layer (the layer of the multi-column flow thread). |
| 1255 curr = curr->isColumnSpanAll() ? curr->containingBlock() : curr->parent(
); |
| 1256 } |
| 1257 ASSERT(!enclosingSelfPaintingLayer || enclosingSelfPaintingLayer->needsRepai
nt()); |
| 1258 } |
| 1259 #endif |
| 1260 |
1245 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const | 1261 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
1246 { | 1262 { |
1247 // It's caller's responsibility to ensure enclosingLayer's needsRepaint is s
et. | 1263 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. |
1248 // Don't set the flag here because enclosingLayer() has cost and the caller
can use | 1264 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use |
1249 // various ways (e.g. PaintInvalidatinState::enclosingLayer()) to reduce the
cost. | 1265 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. |
1250 ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint()); | 1266 #if ENABLE(ASSERT) |
| 1267 assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this); |
| 1268 #endif |
1251 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason); | 1269 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason); |
1252 } | 1270 } |
1253 | 1271 |
1254 void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const
LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState&
paintInvalidationState, PaintInvalidationReason invalidationReason) const | 1272 void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const
LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState&
paintInvalidationState, PaintInvalidationReason invalidationReason) const |
1255 { | 1273 { |
1256 ASSERT(&paintInvalidationState.enclosingLayer(*this) == enclosingLayer()); | 1274 paintInvalidationState.enclosingSelfPaintingLayer(*this).setNeedsRepaint(); |
1257 paintInvalidationState.enclosingLayer(*this).setNeedsRepaint(); | |
1258 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; | 1275 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; |
1259 } | 1276 } |
1260 | 1277 |
1261 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje
ct& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS
tate) const | 1278 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje
ct& paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS
tate) const |
1262 { | 1279 { |
1263 return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationCont
ainer.layer(), paintInvalidationState); | 1280 return PaintLayer::computePaintInvalidationRect(*this, paintInvalidationCont
ainer.layer(), paintInvalidationState); |
1264 } | 1281 } |
1265 | 1282 |
1266 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const
LayoutRect& dirtyRect) const | 1283 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const
LayoutRect& dirtyRect) const |
1267 { | 1284 { |
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3411 | 3428 |
3412 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { | 3429 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { |
3413 if (object.hasLayer()) | 3430 if (object.hasLayer()) |
3414 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | 3431 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); |
3415 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); | 3432 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); |
3416 }); | 3433 }); |
3417 } | 3434 } |
3418 | 3435 |
3419 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) | 3436 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) |
3420 { | 3437 { |
3421 // It's caller's responsibility to ensure enclosingLayer's needsRepaint is s
et. | 3438 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. |
3422 // Don't set the flag here because enclosingLayer() has cost and the caller
can use | 3439 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use |
3423 // various ways (e.g. PaintInvalidatinState::enclosingLayer()) to reduce the
cost. | 3440 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. |
3424 ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint()); | 3441 #if ENABLE(ASSERT) |
| 3442 assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this); |
| 3443 #endif |
3425 | 3444 |
3426 // These disablers are valid because we want to use the current compositing/
invalidation status. | 3445 // These disablers are valid because we want to use the current compositing/
invalidation status. |
3427 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3446 DisablePaintInvalidationStateAsserts invalidationDisabler; |
3428 DisableCompositingQueryAsserts compositingDisabler; | 3447 DisableCompositingQueryAsserts compositingDisabler; |
3429 | 3448 |
3430 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3449 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
3431 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); | 3450 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); |
3432 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
PaintInvalidationLayer); | 3451 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
PaintInvalidationLayer); |
3433 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa
yer); | 3452 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa
yer); |
3434 | 3453 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3539 const blink::LayoutObject* root = object1; | 3558 const blink::LayoutObject* root = object1; |
3540 while (root->parent()) | 3559 while (root->parent()) |
3541 root = root->parent(); | 3560 root = root->parent(); |
3542 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3561 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3543 } else { | 3562 } else { |
3544 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3563 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3545 } | 3564 } |
3546 } | 3565 } |
3547 | 3566 |
3548 #endif | 3567 #endif |
OLD | NEW |