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 // If the object has spannerPlaceholder(), it is a multicol spanner whic
h is painted by |
| 1254 // the layer of the placeholder instead of its own enclosing layer. |
| 1255 curr = curr->spannerPlaceholder() ? curr->spannerPlaceholder() : curr->p
arent(); |
| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationSelection); | 1399 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationSelection); |
1383 | 1400 |
1384 if (fullInvalidation) | 1401 if (fullInvalidation) |
1385 return; | 1402 return; |
1386 | 1403 |
1387 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection,
oldSelectionRect, newSelectionRect); | 1404 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection,
oldSelectionRect, newSelectionRect); |
1388 } | 1405 } |
1389 | 1406 |
1390 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta
iner) | 1407 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
tate& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationConta
iner) |
1391 { | 1408 { |
| 1409 if (styleRef().hasOutline()) { |
| 1410 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t
his); |
| 1411 if (layer.layoutObject() != this) |
| 1412 layer.setNeedsPaintPhaseDescendantOutlines(); |
| 1413 } |
| 1414 |
1392 LayoutView* v = view(); | 1415 LayoutView* v = view(); |
1393 if (v->document().printing()) | 1416 if (v->document().printing()) |
1394 return PaintInvalidationNone; // Don't invalidate paints if we're printi
ng. | 1417 return PaintInvalidationNone; // Don't invalidate paints if we're printi
ng. |
1395 | 1418 |
1396 const LayoutRect oldBounds = previousPaintInvalidationRect(); | 1419 const LayoutRect oldBounds = previousPaintInvalidationRect(); |
1397 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintOffsetC
achingEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking()
; | 1420 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintOffsetC
achingEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking()
; |
1398 LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationConta
iner, &paintInvalidationState); | 1421 LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationConta
iner, &paintInvalidationState); |
1399 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintOffsetCaching
Enabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(thi
s, &paintInvalidationContainer, &paintInvalidationState); | 1422 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintOffsetCaching
Enabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(thi
s, &paintInvalidationContainer, &paintInvalidationState); |
1400 | 1423 |
1401 // Composited scrolling should not be included in the bounds and position tr
acking, because the graphics layer backing the scroller | 1424 // Composited scrolling should not be included in the bounds and position tr
acking, because the graphics layer backing the scroller |
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3411 | 3434 |
3412 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { | 3435 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { |
3413 if (object.hasLayer()) | 3436 if (object.hasLayer()) |
3414 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | 3437 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); |
3415 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); | 3438 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); |
3416 }); | 3439 }); |
3417 } | 3440 } |
3418 | 3441 |
3419 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) | 3442 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) |
3420 { | 3443 { |
3421 // It's caller's responsibility to ensure enclosingLayer's needsRepaint is s
et. | 3444 // 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 | 3445 // 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. | 3446 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. |
3424 ASSERT(!enclosingLayer() || enclosingLayer()->needsRepaint()); | 3447 #if ENABLE(ASSERT) |
| 3448 assertEnclosingSelfPaintingLayerHasSetNeedsRepaint(*this); |
| 3449 #endif |
3425 | 3450 |
3426 // These disablers are valid because we want to use the current compositing/
invalidation status. | 3451 // These disablers are valid because we want to use the current compositing/
invalidation status. |
3427 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3452 DisablePaintInvalidationStateAsserts invalidationDisabler; |
3428 DisableCompositingQueryAsserts compositingDisabler; | 3453 DisableCompositingQueryAsserts compositingDisabler; |
3429 | 3454 |
3430 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3455 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
3431 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); | 3456 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); |
3432 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
PaintInvalidationLayer); | 3457 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
PaintInvalidationLayer); |
3433 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa
yer); | 3458 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa
yer); |
3434 | 3459 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3539 const blink::LayoutObject* root = object1; | 3564 const blink::LayoutObject* root = object1; |
3540 while (root->parent()) | 3565 while (root->parent()) |
3541 root = root->parent(); | 3566 root = root->parent(); |
3542 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3567 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3543 } else { | 3568 } else { |
3544 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3569 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3545 } | 3570 } |
3546 } | 3571 } |
3547 | 3572 |
3548 #endif | 3573 #endif |
OLD | NEW |