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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 | 1310 |
1311 // If we didn't need paint invalidation then our children don't need as well
. | 1311 // If we didn't need paint invalidation then our children don't need as well
. |
1312 // Skip walking down the tree as everything should be fine below us. | 1312 // Skip walking down the tree as everything should be fine below us. |
1313 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 1313 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
1314 return; | 1314 return; |
1315 | 1315 |
1316 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th
is); | 1316 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th
is); |
1317 PaintInvalidationReason reason = invalidatePaintIfNeeded(newPaintInvalidatio
nState); | 1317 PaintInvalidationReason reason = invalidatePaintIfNeeded(newPaintInvalidatio
nState); |
1318 clearPaintInvalidationFlags(newPaintInvalidationState); | 1318 clearPaintInvalidationFlags(newPaintInvalidationState); |
1319 | 1319 |
1320 newPaintInvalidationState.updateForChildren(reason); | 1320 if (reason == PaintInvalidationDelayedFull) |
| 1321 newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this); |
| 1322 |
| 1323 newPaintInvalidationState.updateForChildren(); |
1321 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); | 1324 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); |
1322 } | 1325 } |
1323 | 1326 |
1324 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& childPaintInvalidationState) | 1327 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& childPaintInvalidationState) |
1325 { | 1328 { |
1326 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1329 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1327 // Column spanners are invalidated through their placeholders. | 1330 // Column spanners are invalidated through their placeholders. |
1328 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). | 1331 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). |
1329 if (child->isColumnSpanAll()) | 1332 if (child->isColumnSpanAll()) |
1330 continue; | 1333 continue; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { | 1433 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { |
1431 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); | 1434 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); |
1432 newLocation.move(inverseOffset); | 1435 newLocation.move(inverseOffset); |
1433 newBounds.move(inverseOffset); | 1436 newBounds.move(inverseOffset); |
1434 } | 1437 } |
1435 | 1438 |
1436 setPreviousPaintInvalidationRect(newBounds); | 1439 setPreviousPaintInvalidationRect(newBounds); |
1437 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 1440 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
1438 setPreviousPositionFromPaintInvalidationBacking(newLocation); | 1441 setPreviousPositionFromPaintInvalidationBacking(newLocation); |
1439 | 1442 |
1440 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainerOnly())
{ | 1443 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
!paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) { |
1441 // We are done updating the paint invalidation rect. No other paint inva
lidation work to do for this object. | 1444 ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinC
ontainer()); |
1442 return PaintInvalidationNone; | 1445 return PaintInvalidationNone; |
1443 } | 1446 } |
1444 | 1447 |
1445 PaintInvalidationReason invalidationReason = getPaintInvalidationReason(pain
tInvalidationState, oldBounds, oldLocation, newBounds, newLocation); | 1448 PaintInvalidationReason invalidationReason = getPaintInvalidationReason(pain
tInvalidationContainer, oldBounds, oldLocation, newBounds, newLocation); |
1446 | 1449 |
1447 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. | 1450 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. |
1448 // This is because we need to update the old rect regardless. | 1451 // This is because we need to update the old rect regardless. |
1449 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta
te, invalidationReason); | 1452 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta
te, invalidationReason); |
1450 | 1453 |
1451 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject:
:invalidatePaintIfNeeded()", | 1454 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject:
:invalidatePaintIfNeeded()", |
1452 "object", this->debugName().ascii(), | 1455 "object", this->debugName().ascii(), |
1453 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); | 1456 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); |
1454 | 1457 |
1455 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs
cured(); | 1458 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs
cured(); |
1456 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg
roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) | 1459 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg
roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) |
1457 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1460 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
1458 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); | 1461 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); |
1459 | 1462 |
1460 if (invalidationReason == PaintInvalidationNone) { | 1463 if (invalidationReason == PaintInvalidationNone) { |
1461 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. | 1464 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. |
1462 // There are corner cases that the display items need to be invalidated
for paint offset | 1465 // There are corner cases that the display items need to be invalidated
for paint offset |
1463 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based | 1466 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based |
1464 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1467 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
1465 // This is a workaround to force display items to update paint offset. | 1468 // This is a workaround to force display items to update paint offset. |
1466 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationCheckingWithinContainer()) | 1469 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationWithinContainer()) |
1467 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); | 1470 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); |
1468 | 1471 |
1469 return invalidationReason; | 1472 return invalidationReason; |
1470 } | 1473 } |
1471 | 1474 |
1472 if (invalidationReason == PaintInvalidationIncremental) | 1475 if (invalidationReason == PaintInvalidationIncremental) |
1473 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1476 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
1474 else | 1477 else |
1475 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old
Bounds, newBounds); | 1478 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old
Bounds, newBounds); |
1476 | 1479 |
1477 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); | 1480 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); |
1478 return invalidationReason; | 1481 return invalidationReason; |
1479 } | 1482 } |
1480 | 1483 |
1481 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const PaintInva
lidationState& paintInvalidationState, | 1484 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const LayoutBox
ModelObject& paintInvalidationContainer, |
1482 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, | 1485 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, |
1483 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida
tionBacking) const | 1486 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida
tionBacking) const |
1484 { | 1487 { |
1485 if (paintInvalidationState.forcedSubtreeFullInvalidationWithinContainer()) | |
1486 return PaintInvalidationSubtree; | |
1487 | |
1488 if (shouldDoFullPaintInvalidation()) | 1488 if (shouldDoFullPaintInvalidation()) |
1489 return m_bitfields.fullPaintInvalidationReason(); | 1489 return m_bitfields.fullPaintInvalidationReason(); |
1490 | 1490 |
1491 // The outline may change shape because of position change of descendants. F
or simplicity, | 1491 // The outline may change shape because of position change of descendants. F
or simplicity, |
1492 // just force full paint invalidation if this object is marked for checking
paint invalidation | 1492 // just force full paint invalidation if this object is marked for checking
paint invalidation |
1493 // for any reason. | 1493 // for any reason. |
1494 if (styleRef().hasOutline()) | 1494 if (styleRef().hasOutline()) |
1495 return PaintInvalidationOutline; | 1495 return PaintInvalidationOutline; |
1496 | 1496 |
1497 bool locationChanged = newPositionFromPaintInvalidationBacking != oldPositio
nFromPaintInvalidationBacking; | 1497 bool locationChanged = newPositionFromPaintInvalidationBacking != oldPositio
nFromPaintInvalidationBacking; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 // Skip a full layout for transforms at the html/svg boundary which do n
ot affect sizes inside SVG. | 1784 // Skip a full layout for transforms at the html/svg boundary which do n
ot affect sizes inside SVG. |
1785 if (!isSVGRoot()) | 1785 if (!isSVGRoot()) |
1786 diff.setNeedsFullLayout(); | 1786 diff.setNeedsFullLayout(); |
1787 } | 1787 } |
1788 | 1788 |
1789 // If transform changed, and the layer does not paint into its own separate
backing, then we need to invalidate paints. | 1789 // If transform changed, and the layer does not paint into its own separate
backing, then we need to invalidate paints. |
1790 if (diff.transformChanged()) { | 1790 if (diff.transformChanged()) { |
1791 // Text nodes share style with their parents but transforms don't apply
to them, | 1791 // Text nodes share style with their parents but transforms don't apply
to them, |
1792 // hence the !isText() check. | 1792 // hence the !isText() check. |
1793 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()-
>hasStyleDeterminedDirectCompositingReasons())) | 1793 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()-
>hasStyleDeterminedDirectCompositingReasons())) |
1794 diff.setNeedsPaintInvalidationSubtree(); | 1794 diff.setNeedsPaintInvalidationLayer(); |
1795 } | 1795 } |
1796 | 1796 |
1797 // If opacity or zIndex changed, and the layer does not paint into its own s
eparate backing, then we need to invalidate paints (also | 1797 // If opacity or zIndex changed, and the layer does not paint into its own s
eparate backing, then we need to invalidate paints (also |
1798 // ignoring text nodes) | 1798 // ignoring text nodes) |
1799 if (diff.opacityChanged() || diff.zIndexChanged()) { | 1799 if (diff.opacityChanged() || diff.zIndexChanged()) { |
1800 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()-
>hasStyleDeterminedDirectCompositingReasons())) | 1800 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()-
>hasStyleDeterminedDirectCompositingReasons())) |
1801 diff.setNeedsPaintInvalidationSubtree(); | 1801 diff.setNeedsPaintInvalidationLayer(); |
1802 } | 1802 } |
1803 | 1803 |
1804 // If filter changed, and the layer does not paint into its own separate bac
king or it paints with filters, then we need to invalidate paints. | 1804 // If filter changed, and the layer does not paint into its own separate bac
king or it paints with filters, then we need to invalidate paints. |
1805 if (diff.filterChanged() && hasLayer()) { | 1805 if (diff.filterChanged() && hasLayer()) { |
1806 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); | 1806 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); |
1807 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint
sWithFilters()) | 1807 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint
sWithFilters()) |
1808 diff.setNeedsPaintInvalidationSubtree(); | 1808 diff.setNeedsPaintInvalidationLayer(); |
1809 } | 1809 } |
1810 | 1810 |
1811 // If backdrop filter changed, and the layer does not paint into its own sep
arate backing or it paints with filters, then we need to invalidate paints. | 1811 // If backdrop filter changed, and the layer does not paint into its own sep
arate backing or it paints with filters, then we need to invalidate paints. |
1812 if (diff.backdropFilterChanged() && hasLayer()) { | 1812 if (diff.backdropFilterChanged() && hasLayer()) { |
1813 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); | 1813 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); |
1814 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint
sWithBackdropFilters()) | 1814 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint
sWithBackdropFilters()) |
1815 diff.setNeedsPaintInvalidationSubtree(); | 1815 diff.setNeedsPaintInvalidationLayer(); |
1816 } | 1816 } |
1817 | 1817 |
1818 // Optimization: for decoration/color property changes, invalidation is only
needed if we have style or text affected by these properties. | 1818 // Optimization: for decoration/color property changes, invalidation is only
needed if we have style or text affected by these properties. |
1819 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) { | 1819 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) { |
1820 if (style()->hasBorder() || style()->hasOutline() | 1820 if (style()->hasBorder() || style()->hasOutline() |
1821 || style()->hasBackgroundRelatedColorReferencingCurrentColor() | 1821 || style()->hasBackgroundRelatedColorReferencingCurrentColor() |
1822 // Skip any text nodes that do not contain text boxes. Whitespace ca
nnot be | 1822 // Skip any text nodes that do not contain text boxes. Whitespace ca
nnot be |
1823 // skipped or we will miss invalidating decorations (e.g., underline
s). | 1823 // skipped or we will miss invalidating decorations (e.g., underline
s). |
1824 || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()) | 1824 || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()) |
1825 // Caret is painted in text color. | 1825 // Caret is painted in text color. |
1826 || (isLayoutBlock() && toLayoutBlock(this)->hasCaret()) | 1826 || (isLayoutBlock() && toLayoutBlock(this)->hasCaret()) |
1827 || (isSVG() && style()->svgStyle().isFillColorCurrentColor()) | 1827 || (isSVG() && style()->svgStyle().isFillColorCurrentColor()) |
1828 || (isSVG() && style()->svgStyle().isStrokeColorCurrentColor()) | 1828 || (isSVG() && style()->svgStyle().isStrokeColorCurrentColor()) |
1829 || isListMarker()) | 1829 || isListMarker()) |
1830 diff.setNeedsPaintInvalidationObject(); | 1830 diff.setNeedsPaintInvalidationObject(); |
1831 } | 1831 } |
1832 | 1832 |
1833 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch
ange without the actual | 1833 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch
ange without the actual |
1834 // style changing, since it depends on whether we decide to composite these
elements. When the | 1834 // style changing, since it depends on whether we decide to composite these
elements. When the |
1835 // layer status of one of these elements changes, we need to force a layout. | 1835 // layer status of one of these elements changes, we need to force a layout. |
1836 if (!diff.needsFullLayout() && style() && isBoxModelObject()) { | 1836 if (!diff.needsFullLayout() && style() && isBoxModelObject()) { |
1837 bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() !
= NoPaintLayer; | 1837 bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() !
= NoPaintLayer; |
1838 if (hasLayer() != requiresLayer) | 1838 if (hasLayer() != requiresLayer) |
1839 diff.setNeedsFullLayout(); | 1839 diff.setNeedsFullLayout(); |
1840 } | 1840 } |
1841 | 1841 |
| 1842 // If we have no layer(), just treat a PaintInvalidationLayer hint as a norm
al paint invalidation. |
| 1843 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { |
| 1844 diff.clearNeedsPaintInvalidation(); |
| 1845 diff.setNeedsPaintInvalidationObject(); |
| 1846 } |
| 1847 |
1842 return diff; | 1848 return diff; |
1843 } | 1849 } |
1844 | 1850 |
1845 void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle) | 1851 void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle) |
1846 { | 1852 { |
1847 ASSERT(pseudoStyle->styleType() == PseudoIdBefore || pseudoStyle->styleType(
) == PseudoIdAfter || pseudoStyle->styleType() == PseudoIdFirstLetter); | 1853 ASSERT(pseudoStyle->styleType() == PseudoIdBefore || pseudoStyle->styleType(
) == PseudoIdAfter || pseudoStyle->styleType() == PseudoIdFirstLetter); |
1848 | 1854 |
1849 // FIXME: We should consider just making all pseudo items use an inherited s
tyle. | 1855 // FIXME: We should consider just making all pseudo items use an inherited s
tyle. |
1850 | 1856 |
1851 // Images are special and must inherit the pseudoStyle so the width and heig
ht of | 1857 // Images are special and must inherit the pseudoStyle so the width and heig
ht of |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 } | 1991 } |
1986 | 1992 |
1987 if (diff.needsRecomputeOverflow() && !needsLayout()) { | 1993 if (diff.needsRecomputeOverflow() && !needsLayout()) { |
1988 // TODO(rhogan): Make inlines capable of recomputing overflow too. | 1994 // TODO(rhogan): Make inlines capable of recomputing overflow too. |
1989 if (isLayoutBlock()) | 1995 if (isLayoutBlock()) |
1990 setNeedsOverflowRecalcAfterStyleChange(); | 1996 setNeedsOverflowRecalcAfterStyleChange(); |
1991 else | 1997 else |
1992 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha
nge); | 1998 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha
nge); |
1993 } | 1999 } |
1994 | 2000 |
1995 if (diff.needsPaintInvalidationSubtree() || updatedDiff.needsPaintInvalidati
onSubtree()) | 2001 if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidation
Layer()) |
1996 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 2002 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
1997 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali
dationObject()) | 2003 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali
dationObject()) |
1998 setShouldDoFullPaintInvalidation(); | 2004 setShouldDoFullPaintInvalidation(); |
1999 } | 2005 } |
2000 | 2006 |
2001 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne
wStyle) | 2007 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne
wStyle) |
2002 { | 2008 { |
2003 if (m_style) { | 2009 if (m_style) { |
2004 // If our z-index changes value or our visibility changes, | 2010 // If our z-index changes value or our visibility changes, |
2005 // we need to dirty our stacking context's z-order list. | 2011 // we need to dirty our stacking context's z-order list. |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3452 return; | 3458 return; |
3453 m_bitfields.setMayNeedPaintInvalidation(true); | 3459 m_bitfields.setMayNeedPaintInvalidation(true); |
3454 markAncestorsForPaintInvalidation(); | 3460 markAncestorsForPaintInvalidation(); |
3455 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3461 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
3456 } | 3462 } |
3457 | 3463 |
3458 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) | 3464 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) |
3459 { | 3465 { |
3460 // paintInvalidationStateIsDirty should be kept in sync with the | 3466 // paintInvalidationStateIsDirty should be kept in sync with the |
3461 // booleans that are cleared below. | 3467 // booleans that are cleared below. |
3462 ASSERT(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()
|| paintInvalidationStateIsDirty()); | 3468 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() ||
paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p
aintInvalidationStateIsDirty()); |
3463 clearShouldDoFullPaintInvalidation(); | 3469 clearShouldDoFullPaintInvalidation(); |
3464 m_bitfields.setChildShouldCheckForPaintInvalidation(false); | 3470 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
3465 m_bitfields.setNeededLayoutBecauseOfChildren(false); | 3471 m_bitfields.setNeededLayoutBecauseOfChildren(false); |
3466 m_bitfields.setShouldInvalidateOverflowForPaint(false); | 3472 m_bitfields.setShouldInvalidateOverflowForPaint(false); |
3467 m_bitfields.setMayNeedPaintInvalidation(false); | 3473 m_bitfields.setMayNeedPaintInvalidation(false); |
3468 m_bitfields.setShouldInvalidateSelection(false); | 3474 m_bitfields.setShouldInvalidateSelection(false); |
3469 } | 3475 } |
3470 | 3476 |
3471 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) | 3477 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) |
3472 { | 3478 { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3591 clearPreviousPaintInvalidationRects(); | 3597 clearPreviousPaintInvalidationRects(); |
3592 } | 3598 } |
3593 | 3599 |
3594 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3600 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
3595 { | 3601 { |
3596 // 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. |
3597 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); | 3603 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); |
3598 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou
tObject& object) { | 3604 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou
tObject& object) { |
3599 if (object.hasLayer()) | 3605 if (object.hasLayer()) |
3600 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | 3606 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); |
3601 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC
ontainer, PaintInvalidationSubtree); | 3607 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC
ontainer, PaintInvalidationLayer); |
3602 }); | 3608 }); |
3603 } | 3609 } |
3604 | 3610 |
| 3611 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g
et rid of this function (crbug.com/410097). |
3605 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() | 3612 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() |
3606 { | 3613 { |
3607 // Clear first because PaintInvalidationSubtree overrides other full paint i
nvalidation reasons. | 3614 // Need to access the current compositing status. |
3608 clearShouldDoFullPaintInvalidation(); | 3615 DisableCompositingQueryAsserts disabler; |
3609 setShouldDoFullPaintInvalidation(PaintInvalidationSubtree); | 3616 traverseNonCompositingDescendants(*this, [](LayoutObject& object) { |
| 3617 object.setShouldDoFullPaintInvalidation(); |
| 3618 }); |
3610 } | 3619 } |
3611 | 3620 |
3612 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(const LayoutBoxModelObject& paintInvalidationContainer) | 3621 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(const LayoutBoxModelObject& paintInvalidationContainer) |
3613 { | 3622 { |
3614 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P
aintInvalidationSubtree); | 3623 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P
aintInvalidationLayer); |
3615 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 3624 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
3616 if (child->hasLayer()) | 3625 if (child->hasLayer()) |
3617 toLayoutBoxModelObject(child)->layer()->setNeedsRepaint(); | 3626 toLayoutBoxModelObject(child)->layer()->setNeedsRepaint(); |
3618 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel
fPaintingLayer()) | 3627 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel
fPaintingLayer()) |
3619 child->invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(paintInvalidationContainer); | 3628 child->invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(paintInvalidationContainer); |
3620 } | 3629 } |
3621 } | 3630 } |
3622 | 3631 |
3623 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const
LayoutBoxModelObject& paintInvalidationContainer) | 3632 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const
LayoutBoxModelObject& paintInvalidationContainer) |
3624 { | 3633 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3690 const blink::LayoutObject* root = object1; | 3699 const blink::LayoutObject* root = object1; |
3691 while (root->parent()) | 3700 while (root->parent()) |
3692 root = root->parent(); | 3701 root = root->parent(); |
3693 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3702 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3694 } else { | 3703 } else { |
3695 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3704 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3696 } | 3705 } |
3697 } | 3706 } |
3698 | 3707 |
3699 #endif | 3708 #endif |
OLD | NEW |