| 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 | 1223 |
| 1224 // This conditional handles situations where non-rooted (and hence non-compo
sited) frames are | 1224 // This conditional handles situations where non-rooted (and hence non-compo
sited) frames are |
| 1225 // painted, such as SVG images. | 1225 // painted, such as SVG images. |
| 1226 if (!paintInvalidationContainer.isPaintInvalidationContainer()) | 1226 if (!paintInvalidationContainer.isPaintInvalidationContainer()) |
| 1227 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn
tRect(dirtyRect)); | 1227 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn
tRect(dirtyRect)); |
| 1228 | 1228 |
| 1229 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio
nContainer.isPaintInvalidationContainer()) | 1229 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio
nContainer.isPaintInvalidationContainer()) |
| 1230 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR
ect, invalidationReason, *this); | 1230 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR
ect, invalidationReason, *this); |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI
temClient) const | 1233 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI
temClient) |
| 1234 { | 1234 { |
| 1235 setPaintingLayerNeedsRepaint(); |
| 1236 |
| 1237 // TODO(wangxianzhu): Let FrameView instead of the paint invalidation contai
ner track object paint invalidations. |
| 1238 #if !DCHECK_IS_ON() |
| 1239 // This is a fast path when we don't need to inform the GraphicsLayer about
this paint invalidation. |
| 1240 FrameView* frameView = this->frameView(); |
| 1241 if (!frameView || !frameView->isTrackingPaintInvalidations()) { |
| 1242 displayItemClient.setDisplayItemsUncached(); |
| 1243 return; |
| 1244 } |
| 1245 #endif |
| 1246 |
| 1235 if (PaintLayer* paintingLayer = this->paintingLayer()) { | 1247 if (PaintLayer* paintingLayer = this->paintingLayer()) { |
| 1236 paintingLayer->setNeedsRepaint(); | |
| 1237 | |
| 1238 #if !ENABLE(ASSERT) | |
| 1239 // This is a fast path when we don't need to inform the GraphicsLayer ab
out this paint invalidation. | |
| 1240 FrameView* frameView = this->frameView(); | |
| 1241 if (!frameView || !frameView->isTrackingPaintInvalidations()) { | |
| 1242 displayItemClient.setDisplayItemsUncached(); | |
| 1243 return; | |
| 1244 } | |
| 1245 #endif | |
| 1246 // This is valid because we want to invalidate the client in the display
item list of the current backing. | 1248 // This is valid because we want to invalidate the client in the display
item list of the current backing. |
| 1247 DisableCompositingQueryAsserts disabler; | 1249 DisableCompositingQueryAsserts disabler; |
| 1248 if (const PaintLayer* paintInvalidationLayer = paintingLayer->enclosingL
ayerForPaintInvalidationCrossingFrameBoundaries()) | 1250 if (const PaintLayer* paintInvalidationLayer = paintingLayer->enclosingL
ayerForPaintInvalidationCrossingFrameBoundaries()) |
| 1249 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO
nBacking(displayItemClient, PaintInvalidationFull); | 1251 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO
nBacking(displayItemClient, PaintInvalidationFull); |
| 1250 } | 1252 } |
| 1251 } | 1253 } |
| 1252 | 1254 |
| 1253 void LayoutObject::setPaintingLayerNeedsRepaint() const | 1255 void LayoutObject::setPaintingLayerNeedsRepaint() |
| 1254 { | 1256 { |
| 1255 if (PaintLayer* paintingLayer = this->paintingLayer()) | 1257 m_bitfields.setPaintingLayerNeedsRepaint(true); |
| 1256 paintingLayer->setNeedsRepaint(); | 1258 markAncestorsForPaintInvalidation(); |
| 1257 } | 1259 } |
| 1258 | 1260 |
| 1259 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const | 1261 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) |
| 1260 { | 1262 { |
| 1261 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. | 1263 setPaintingLayerNeedsRepaint(); |
| 1262 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use | |
| 1263 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. | |
| 1264 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); | |
| 1265 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason, this); | 1264 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason, this); |
| 1266 } | 1265 } |
| 1267 | 1266 |
| 1268 void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const
LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState&
paintInvalidationState, PaintInvalidationReason invalidationReason) const | |
| 1269 { | |
| 1270 paintInvalidationState.paintingLayer().setNeedsRepaint(); | |
| 1271 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; | |
| 1272 } | |
| 1273 | |
| 1274 | |
| 1275 bool LayoutObject::compositedScrollsWithRespectTo(const LayoutBoxModelObject& pa
intInvalidationContainer) const | 1267 bool LayoutObject::compositedScrollsWithRespectTo(const LayoutBoxModelObject& pa
intInvalidationContainer) const |
| 1276 { | 1268 { |
| 1277 return paintInvalidationContainer.usesCompositedScrolling() && this != &pain
tInvalidationContainer; | 1269 return paintInvalidationContainer.usesCompositedScrolling() && this != &pain
tInvalidationContainer; |
| 1278 } | 1270 } |
| 1279 | 1271 |
| 1280 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const
LayoutRect& dirtyRect) const | 1272 void LayoutObject::invalidatePaintRectangle(const LayoutRect& dirtyRect) |
| 1281 { | 1273 { |
| 1282 RELEASE_ASSERT(isRooted()); | 1274 RELEASE_ASSERT(isRooted()); |
| 1283 | 1275 |
| 1284 if (dirtyRect.isEmpty()) | 1276 if (dirtyRect.isEmpty()) |
| 1285 return nullptr; | 1277 return; |
| 1286 | 1278 |
| 1287 if (view()->document().printing()) | 1279 if (view()->document().printing()) |
| 1288 return nullptr; // Don't invalidate paints if we're printing. | 1280 return; // Don't invalidate paints if we're printing. |
| 1289 | 1281 |
| 1290 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); | 1282 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); |
| 1291 LayoutRect dirtyRectOnBacking = dirtyRect; | 1283 LayoutRect dirtyRectOnBacking = dirtyRect; |
| 1292 PaintLayer::mapRectToPaintInvalidationBacking(*this, paintInvalidationContai
ner, dirtyRectOnBacking); | 1284 PaintLayer::mapRectToPaintInvalidationBacking(*this, paintInvalidationContai
ner, dirtyRectOnBacking); |
| 1293 | 1285 |
| 1294 // Composited scrolling should not be included in the bounds of composited-s
crolled items. | 1286 // Composited scrolling should not be included in the bounds of composited-s
crolled items. |
| 1295 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) { | 1287 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) { |
| 1296 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); | 1288 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); |
| 1297 dirtyRectOnBacking.move(inverseOffset); | 1289 dirtyRectOnBacking.move(inverseOffset); |
| 1298 } | 1290 } |
| 1299 | 1291 |
| 1300 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); | 1292 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking
, PaintInvalidationRectangle); |
| 1301 return &paintInvalidationContainer; | 1293 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationRe
ctangle); |
| 1302 } | |
| 1303 | |
| 1304 void LayoutObject::invalidatePaintRectangle(const LayoutRect& rect) const | |
| 1305 { | |
| 1306 setPaintingLayerNeedsRepaint(); | |
| 1307 const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaintRect
angleInternal(rect); | |
| 1308 if (paintInvalidationContainer) | |
| 1309 invalidateDisplayItemClients(*paintInvalidationContainer, PaintInvalidat
ionRectangle); | |
| 1310 } | |
| 1311 | |
| 1312 void LayoutObject::invalidatePaintRectangleNotInvalidatingDisplayItemClients(con
st LayoutRect& r) const | |
| 1313 { | |
| 1314 invalidatePaintRectangleInternal(r); | |
| 1315 } | 1294 } |
| 1316 | 1295 |
| 1317 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
alidationState) | 1296 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
alidationState) |
| 1318 { | 1297 { |
| 1319 ASSERT(!needsLayout()); | 1298 ASSERT(!needsLayout()); |
| 1320 | 1299 |
| 1321 // If we didn't need paint invalidation then our children don't need as well
. | 1300 // If we didn't need paint invalidation then our children don't need as well
. |
| 1322 // Skip walking down the tree as everything should be fine below us. | 1301 // Skip walking down the tree as everything should be fine below us. |
| 1323 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 1302 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
| 1324 return; | 1303 return; |
| 1325 | 1304 |
| 1326 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th
is); | 1305 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th
is); |
| 1327 | 1306 |
| 1328 if (mayNeedPaintInvalidationSubtree()) | 1307 if (mayNeedPaintInvalidationSubtree()) |
| 1329 newPaintInvalidationState.setForceSubtreeInvalidationCheckingWithinConta
iner(); | 1308 newPaintInvalidationState.setForceSubtreeInvalidationCheckingWithinConta
iner(); |
| 1330 | 1309 |
| 1331 PaintInvalidationReason reason = invalidatePaintIfNeeded(newPaintInvalidatio
nState); | 1310 PaintInvalidationReason reason = invalidatePaintIfNeeded(newPaintInvalidatio
nState); |
| 1332 clearPaintInvalidationFlags(newPaintInvalidationState); | |
| 1333 | |
| 1334 newPaintInvalidationState.updateForChildren(reason); | 1311 newPaintInvalidationState.updateForChildren(reason); |
| 1335 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); | 1312 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); |
| 1313 clearPaintInvalidationFlags(newPaintInvalidationState); |
| 1336 } | 1314 } |
| 1337 | 1315 |
| 1338 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& childPaintInvalidationState) | 1316 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& childPaintInvalidationState) |
| 1339 { | 1317 { |
| 1340 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1318 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
| 1341 // Column spanners are invalidated through their placeholders. | 1319 // Column spanners are invalidated through their placeholders. |
| 1342 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). | 1320 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). |
| 1343 if (child->isColumnSpanAll()) | 1321 if (child->isColumnSpanAll()) |
| 1344 continue; | 1322 continue; |
| 1345 child->invalidateTreeIfNeeded(childPaintInvalidationState); | 1323 child->invalidateTreeIfNeeded(childPaintInvalidationState); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 newSelectionRect.move(inverseOffset); | 1385 newSelectionRect.move(inverseOffset); |
| 1408 } | 1386 } |
| 1409 } | 1387 } |
| 1410 | 1388 |
| 1411 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); | 1389 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); |
| 1412 | 1390 |
| 1413 // TODO(wangxianzhu): Combine the following two conditions when removing Lay
outView::doingFullPaintInvalidation(). | 1391 // TODO(wangxianzhu): Combine the following two conditions when removing Lay
outView::doingFullPaintInvalidation(). |
| 1414 if (!fullInvalidation) | 1392 if (!fullInvalidation) |
| 1415 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelect
ion, oldSelectionRect, newSelectionRect); | 1393 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelect
ion, oldSelectionRect, newSelectionRect); |
| 1416 if (shouldInvalidateSelection()) | 1394 if (shouldInvalidateSelection()) |
| 1417 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationSelection); | 1395 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidati
onSelection); |
| 1418 } | 1396 } |
| 1419 | 1397 |
| 1420 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid
ationState& paintInvalidationState) | 1398 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid
ationState& paintInvalidationState) |
| 1421 { | 1399 { |
| 1422 ASSERT(&paintInvalidationState.currentObject() == this); | 1400 ASSERT(&paintInvalidationState.currentObject() == this); |
| 1423 | 1401 |
| 1424 if (styleRef().hasOutline()) { | 1402 if (styleRef().hasOutline()) { |
| 1425 PaintLayer& layer = paintInvalidationState.paintingLayer(); | 1403 PaintLayer& layer = paintInvalidationState.paintingLayer(); |
| 1426 if (layer.layoutObject() != this) | 1404 if (layer.layoutObject() != this) |
| 1427 layer.setNeedsPaintPhaseDescendantOutlines(); | 1405 layer.setNeedsPaintPhaseDescendantOutlines(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1449 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
| 1472 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); | 1450 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); |
| 1473 | 1451 |
| 1474 if (invalidationReason == PaintInvalidationNone) { | 1452 if (invalidationReason == PaintInvalidationNone) { |
| 1475 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. | 1453 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. |
| 1476 // There are corner cases that the display items need to be invalidated
for paint offset | 1454 // There are corner cases that the display items need to be invalidated
for paint offset |
| 1477 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based | 1455 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based |
| 1478 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1456 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
| 1479 // This is a workaround to force display items to update paint offset. | 1457 // This is a workaround to force display items to update paint offset. |
| 1480 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationCheckingWithinContainer()) | 1458 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationCheckingWithinContainer()) |
| 1481 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); | 1459 invalidateDisplayItemClients(paintInvalidationContainer, invalidatio
nReason); |
| 1482 | 1460 |
| 1483 return invalidationReason; | 1461 return invalidationReason; |
| 1484 } | 1462 } |
| 1485 | 1463 |
| 1486 if (invalidationReason == PaintInvalidationIncremental) | 1464 if (invalidationReason == PaintInvalidationIncremental) |
| 1487 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1465 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
| 1488 else | 1466 else |
| 1489 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old
Bounds, newBounds); | 1467 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old
Bounds, newBounds); |
| 1490 | 1468 |
| 1491 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); | 1469 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; |
| 1492 return invalidationReason; | 1470 return invalidationReason; |
| 1493 } | 1471 } |
| 1494 | 1472 |
| 1495 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const PaintInva
lidationState& paintInvalidationState, | 1473 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const PaintInva
lidationState& paintInvalidationState, |
| 1496 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, | 1474 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, |
| 1497 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida
tionBacking) const | 1475 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida
tionBacking) const |
| 1498 { | 1476 { |
| 1499 if (paintInvalidationState.forcedSubtreeFullInvalidationWithinContainer()) | 1477 if (paintInvalidationState.forcedSubtreeFullInvalidationWithinContainer()) |
| 1500 return PaintInvalidationSubtree; | 1478 return PaintInvalidationSubtree; |
| 1501 | 1479 |
| (...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3473 void LayoutObject::setMayNeedPaintInvalidationSubtree() | 3451 void LayoutObject::setMayNeedPaintInvalidationSubtree() |
| 3474 { | 3452 { |
| 3475 if (mayNeedPaintInvalidationSubtree()) | 3453 if (mayNeedPaintInvalidationSubtree()) |
| 3476 return; | 3454 return; |
| 3477 m_bitfields.setMayNeedPaintInvalidationSubtree(true); | 3455 m_bitfields.setMayNeedPaintInvalidationSubtree(true); |
| 3478 setMayNeedPaintInvalidation(); | 3456 setMayNeedPaintInvalidation(); |
| 3479 } | 3457 } |
| 3480 | 3458 |
| 3481 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) | 3459 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) |
| 3482 { | 3460 { |
| 3483 // paintInvalidationStateIsDirty should be kept in sync with the | 3461 // paintInvalidationFlagsAreDirty should be kept in sync with the |
| 3484 // booleans that are cleared below. | 3462 // booleans that are cleared below. |
| 3485 ASSERT(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()
|| paintInvalidationStateIsDirty()); | 3463 #if DCHECK_IS_ON() |
| 3464 DCHECK(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()
|| paintInvalidationFlagsAreDirty()); |
| 3465 #endif |
| 3466 |
| 3486 clearShouldDoFullPaintInvalidation(); | 3467 clearShouldDoFullPaintInvalidation(); |
| 3487 m_bitfields.setChildShouldCheckForPaintInvalidation(false); | 3468 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
| 3488 m_bitfields.setNeededLayoutBecauseOfChildren(false); | 3469 m_bitfields.setNeededLayoutBecauseOfChildren(false); |
| 3489 m_bitfields.setShouldInvalidateOverflowForPaint(false); | 3470 m_bitfields.setShouldInvalidateOverflowForPaint(false); |
| 3490 m_bitfields.setMayNeedPaintInvalidation(false); | 3471 m_bitfields.setMayNeedPaintInvalidation(false); |
| 3491 m_bitfields.setMayNeedPaintInvalidationSubtree(false); | 3472 m_bitfields.setMayNeedPaintInvalidationSubtree(false); |
| 3492 m_bitfields.setShouldInvalidateSelection(false); | 3473 m_bitfields.setShouldInvalidateSelection(false); |
| 3474 |
| 3475 if (m_bitfields.paintingLayerNeedsRepaint()) { |
| 3476 paintInvalidationState.paintingLayer().setNeedsRepaint(); |
| 3477 m_bitfields.setPaintingLayerNeedsRepaint(false); |
| 3478 } |
| 3479 |
| 3480 #if DCHECK_IS_ON() |
| 3481 DCHECK(!paintInvalidationFlagsAreDirty()); |
| 3482 #endif |
| 3493 } | 3483 } |
| 3494 | 3484 |
| 3495 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) | 3485 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) |
| 3496 { | 3486 { |
| 3497 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre
eStateInAnyState() | 3487 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre
eStateInAnyState() |
| 3498 || document.lifecycle().stateAllowsLayoutTreeMutations(); | 3488 || document.lifecycle().stateAllowsLayoutTreeMutations(); |
| 3499 } | 3489 } |
| 3500 | 3490 |
| 3501 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout
TreeStructureAsserts() | 3491 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout
TreeStructureAsserts() |
| 3502 : m_disabler(gModifyLayoutTreeStructureAnyState, true) | 3492 : m_disabler(gModifyLayoutTreeStructureAnyState, true) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3568 | 3558 |
| 3569 // If a paint invalidation container is not a stacking context, | 3559 // If a paint invalidation container is not a stacking context, |
| 3570 // some of its descendants may belong to the parent container. | 3560 // some of its descendants may belong to the parent container. |
| 3571 findNonCompositedDescendantLayerToTraverse(*descendant, functor); | 3561 findNonCompositedDescendantLayerToTraverse(*descendant, functor); |
| 3572 descendant = descendant->nextInPreOrderAfterChildren(&object); | 3562 descendant = descendant->nextInPreOrderAfterChildren(&object); |
| 3573 } | 3563 } |
| 3574 } | 3564 } |
| 3575 | 3565 |
| 3576 } // unnamed namespace | 3566 } // unnamed namespace |
| 3577 | 3567 |
| 3578 void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant
s(const LayoutBoxModelObject* paintInvalidationContainer, PaintInvalidationReaso
n paintInvalidationReason) const | 3568 void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant
s(const LayoutBoxModelObject* paintInvalidationContainer, PaintInvalidationReaso
n paintInvalidationReason) |
| 3579 { | 3569 { |
| 3580 // This is valid because we want to invalidate the client in the display ite
m list of the current backing. | 3570 // This is valid because we want to invalidate the client in the display ite
m list of the current backing. |
| 3581 DisableCompositingQueryAsserts disabler; | 3571 DisableCompositingQueryAsserts disabler; |
| 3582 if (!paintInvalidationContainer) { | 3572 if (!paintInvalidationContainer) { |
| 3583 paintInvalidationContainer = enclosingCompositedContainer(); | 3573 paintInvalidationContainer = enclosingCompositedContainer(); |
| 3584 if (!paintInvalidationContainer) | 3574 if (!paintInvalidationContainer) |
| 3585 return; | 3575 return; |
| 3586 } | 3576 } |
| 3587 | 3577 |
| 3588 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { | 3578 traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [&paintI
nvalidationContainer, paintInvalidationReason](LayoutObject& object) { |
| 3589 if (object.hasLayer()) | |
| 3590 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | |
| 3591 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); | 3579 object.invalidateDisplayItemClients(*paintInvalidationContainer, paintIn
validationReason); |
| 3592 }); | 3580 }); |
| 3593 } | 3581 } |
| 3594 | 3582 |
| 3595 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) | 3583 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo
xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) |
| 3596 { | 3584 { |
| 3597 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. | |
| 3598 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use | |
| 3599 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. | |
| 3600 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); | |
| 3601 | |
| 3602 // These disablers are valid because we want to use the current compositing/
invalidation status. | 3585 // These disablers are valid because we want to use the current compositing/
invalidation status. |
| 3603 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3586 DisablePaintInvalidationStateAsserts invalidationDisabler; |
| 3604 DisableCompositingQueryAsserts compositingDisabler; | 3587 DisableCompositingQueryAsserts compositingDisabler; |
| 3605 | 3588 |
| 3606 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3589 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
| 3607 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
reason); | 3590 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
reason); |
| 3608 invalidateDisplayItemClients(paintInvalidationContainer, reason); | 3591 invalidateDisplayItemClients(paintInvalidationContainer, reason); |
| 3609 | 3592 |
| 3610 // This method may be used to invalidate paint of an object changing paint i
nvalidation container. | 3593 // This method may be used to invalidate paint of an object changing paint i
nvalidation container. |
| 3611 // Clear previous paint invalidation rect on the original paint invalidation
container to avoid | 3594 // Clear previous paint invalidation rect on the original paint invalidation
container to avoid |
| 3612 // under-invalidation if the new paint invalidation rect on the new paint in
validation container | 3595 // under-invalidation if the new paint invalidation rect on the new paint in
validation container |
| 3613 // happens to be the same as the old one. | 3596 // happens to be the same as the old one. |
| 3614 clearPreviousPaintInvalidationRects(); | 3597 clearPreviousPaintInvalidationRects(); |
| 3615 } | 3598 } |
| 3616 | 3599 |
| 3617 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3600 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
| 3618 { | 3601 { |
| 3619 // Since we're only painting non-composited layers, we know that they all sh
are the same paintInvalidationContainer. | 3602 // Since we're only painting non-composited layers, we know that they all sh
are the same paintInvalidationContainer. |
| 3620 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); | 3603 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); |
| 3621 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou
tObject& object) { | 3604 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou
tObject& object) { |
| 3622 if (object.hasLayer()) | |
| 3623 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | |
| 3624 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC
ontainer, PaintInvalidationSubtree); | 3605 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC
ontainer, PaintInvalidationSubtree); |
| 3625 }); | 3606 }); |
| 3626 } | 3607 } |
| 3627 | 3608 |
| 3628 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() | 3609 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() |
| 3629 { | 3610 { |
| 3630 // Clear first because PaintInvalidationSubtree overrides other full paint i
nvalidation reasons. | 3611 // Clear first because PaintInvalidationSubtree overrides other full paint i
nvalidation reasons. |
| 3631 clearShouldDoFullPaintInvalidation(); | 3612 clearShouldDoFullPaintInvalidation(); |
| 3632 setShouldDoFullPaintInvalidation(PaintInvalidationSubtree); | 3613 setShouldDoFullPaintInvalidation(PaintInvalidationSubtree); |
| 3633 } | 3614 } |
| 3634 | 3615 |
| 3635 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(const LayoutBoxModelObject& paintInvalidationContainer) | |
| 3636 { | |
| 3637 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P
aintInvalidationSubtree); | |
| 3638 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | |
| 3639 if (child->hasLayer()) | |
| 3640 toLayoutBoxModelObject(child)->layer()->setNeedsRepaint(); | |
| 3641 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel
fPaintingLayer()) | |
| 3642 child->invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(paintInvalidationContainer); | |
| 3643 } | |
| 3644 } | |
| 3645 | |
| 3646 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const
LayoutBoxModelObject& paintInvalidationContainer) | 3616 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const
LayoutBoxModelObject& paintInvalidationContainer) |
| 3647 { | 3617 { |
| 3648 setPaintingLayerNeedsRepaint(); | 3618 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P
aintInvalidationSubtree); |
| 3649 invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal(paintInvalid
ationContainer); | 3619 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
| 3620 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel
fPaintingLayer()) |
| 3621 child->invalidatePaintIncludingNonSelfPaintingLayerDescendants(paint
InvalidationContainer); |
| 3622 } |
| 3650 } | 3623 } |
| 3651 | 3624 |
| 3652 void LayoutObject::setIsBackgroundAttachmentFixedObject(bool isBackgroundAttachm
entFixedObject) | 3625 void LayoutObject::setIsBackgroundAttachmentFixedObject(bool isBackgroundAttachm
entFixedObject) |
| 3653 { | 3626 { |
| 3654 ASSERT(frameView()); | 3627 ASSERT(frameView()); |
| 3655 if (m_bitfields.isBackgroundAttachmentFixedObject() == isBackgroundAttachmen
tFixedObject) | 3628 if (m_bitfields.isBackgroundAttachmentFixedObject() == isBackgroundAttachmen
tFixedObject) |
| 3656 return; | 3629 return; |
| 3657 m_bitfields.setIsBackgroundAttachmentFixedObject(isBackgroundAttachmentFixed
Object); | 3630 m_bitfields.setIsBackgroundAttachmentFixedObject(isBackgroundAttachmentFixed
Object); |
| 3658 if (isBackgroundAttachmentFixedObject) | 3631 if (isBackgroundAttachmentFixedObject) |
| 3659 frameView()->addBackgroundAttachmentFixedObject(this); | 3632 frameView()->addBackgroundAttachmentFixedObject(this); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3714 const blink::LayoutObject* root = object1; | 3687 const blink::LayoutObject* root = object1; |
| 3715 while (root->parent()) | 3688 while (root->parent()) |
| 3716 root = root->parent(); | 3689 root = root->parent(); |
| 3717 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3690 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3718 } else { | 3691 } else { |
| 3719 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3692 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3720 } | 3693 } |
| 3721 } | 3694 } |
| 3722 | 3695 |
| 3723 #endif | 3696 #endif |
| OLD | NEW |