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 if (reason == PaintInvalidationDelayedFull) | 1320 newPaintInvalidationState.updateForChildren(reason); |
1321 newPaintInvalidationState.pushDelayedPaintInvalidationTarget(*this); | |
1322 | |
1323 newPaintInvalidationState.updateForChildren(); | |
1324 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); | 1321 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); |
1325 } | 1322 } |
1326 | 1323 |
1327 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& childPaintInvalidationState) | 1324 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& childPaintInvalidationState) |
1328 { | 1325 { |
1329 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1326 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1330 // Column spanners are invalidated through their placeholders. | 1327 // Column spanners are invalidated through their placeholders. |
1331 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). | 1328 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). |
1332 if (child->isColumnSpanAll()) | 1329 if (child->isColumnSpanAll()) |
1333 continue; | 1330 continue; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { | 1430 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { |
1434 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); | 1431 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); |
1435 newLocation.move(inverseOffset); | 1432 newLocation.move(inverseOffset); |
1436 newBounds.move(inverseOffset); | 1433 newBounds.move(inverseOffset); |
1437 } | 1434 } |
1438 | 1435 |
1439 setPreviousPaintInvalidationRect(newBounds); | 1436 setPreviousPaintInvalidationRect(newBounds); |
1440 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 1437 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
1441 setPreviousPositionFromPaintInvalidationBacking(newLocation); | 1438 setPreviousPositionFromPaintInvalidationBacking(newLocation); |
1442 | 1439 |
1443 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
!paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) { | 1440 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainerOnly())
{ |
1444 ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinC
ontainer()); | 1441 // We are done updating the paint invalidation rect. No other paint inva
lidation work to do for this object. |
1445 return PaintInvalidationNone; | 1442 return PaintInvalidationNone; |
1446 } | 1443 } |
1447 | 1444 |
1448 PaintInvalidationReason invalidationReason = getPaintInvalidationReason(pain
tInvalidationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1445 PaintInvalidationReason invalidationReason = getPaintInvalidationReason(pain
tInvalidationState, oldBounds, oldLocation, newBounds, newLocation); |
1449 | 1446 |
1450 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. | 1447 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. |
1451 // This is because we need to update the old rect regardless. | 1448 // This is because we need to update the old rect regardless. |
1452 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta
te, invalidationReason); | 1449 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta
te, invalidationReason); |
1453 | 1450 |
1454 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject:
:invalidatePaintIfNeeded()", | 1451 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject:
:invalidatePaintIfNeeded()", |
1455 "object", this->debugName().ascii(), | 1452 "object", this->debugName().ascii(), |
1456 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); | 1453 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); |
1457 | 1454 |
1458 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs
cured(); | 1455 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs
cured(); |
1459 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg
roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) | 1456 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg
roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) |
1460 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1457 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
1461 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); | 1458 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); |
1462 | 1459 |
1463 if (invalidationReason == PaintInvalidationNone) { | 1460 if (invalidationReason == PaintInvalidationNone) { |
1464 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. | 1461 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. |
1465 // There are corner cases that the display items need to be invalidated
for paint offset | 1462 // There are corner cases that the display items need to be invalidated
for paint offset |
1466 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based | 1463 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based |
1467 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1464 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
1468 // This is a workaround to force display items to update paint offset. | 1465 // This is a workaround to force display items to update paint offset. |
1469 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationWithinContainer()) | 1466 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationCheckingWithinContainer()) |
1470 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); | 1467 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); |
1471 | 1468 |
1472 return invalidationReason; | 1469 return invalidationReason; |
1473 } | 1470 } |
1474 | 1471 |
1475 if (invalidationReason == PaintInvalidationIncremental) | 1472 if (invalidationReason == PaintInvalidationIncremental) |
1476 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1473 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
1477 else | 1474 else |
1478 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old
Bounds, newBounds); | 1475 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old
Bounds, newBounds); |
1479 | 1476 |
1480 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); | 1477 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); |
1481 return invalidationReason; | 1478 return invalidationReason; |
1482 } | 1479 } |
1483 | 1480 |
1484 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const LayoutBox
ModelObject& paintInvalidationContainer, | 1481 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const PaintInva
lidationState& paintInvalidationState, |
1485 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, | 1482 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida
tionBacking, |
1486 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida
tionBacking) const | 1483 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida
tionBacking) const |
1487 { | 1484 { |
| 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.setNeedsPaintInvalidationLayer(); | 1794 diff.setNeedsPaintInvalidationSubtree(); |
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.setNeedsPaintInvalidationLayer(); | 1801 diff.setNeedsPaintInvalidationSubtree(); |
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.setNeedsPaintInvalidationLayer(); | 1808 diff.setNeedsPaintInvalidationSubtree(); |
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.setNeedsPaintInvalidationLayer(); | 1815 diff.setNeedsPaintInvalidationSubtree(); |
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 | |
1848 return diff; | 1842 return diff; |
1849 } | 1843 } |
1850 | 1844 |
1851 void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle) | 1845 void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle) |
1852 { | 1846 { |
1853 ASSERT(pseudoStyle->styleType() == PseudoIdBefore || pseudoStyle->styleType(
) == PseudoIdAfter || pseudoStyle->styleType() == PseudoIdFirstLetter); | 1847 ASSERT(pseudoStyle->styleType() == PseudoIdBefore || pseudoStyle->styleType(
) == PseudoIdAfter || pseudoStyle->styleType() == PseudoIdFirstLetter); |
1854 | 1848 |
1855 // FIXME: We should consider just making all pseudo items use an inherited s
tyle. | 1849 // FIXME: We should consider just making all pseudo items use an inherited s
tyle. |
1856 | 1850 |
1857 // Images are special and must inherit the pseudoStyle so the width and heig
ht of | 1851 // 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... |
1991 } | 1985 } |
1992 | 1986 |
1993 if (diff.needsRecomputeOverflow() && !needsLayout()) { | 1987 if (diff.needsRecomputeOverflow() && !needsLayout()) { |
1994 // TODO(rhogan): Make inlines capable of recomputing overflow too. | 1988 // TODO(rhogan): Make inlines capable of recomputing overflow too. |
1995 if (isLayoutBlock()) | 1989 if (isLayoutBlock()) |
1996 setNeedsOverflowRecalcAfterStyleChange(); | 1990 setNeedsOverflowRecalcAfterStyleChange(); |
1997 else | 1991 else |
1998 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha
nge); | 1992 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha
nge); |
1999 } | 1993 } |
2000 | 1994 |
2001 if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidation
Layer()) | 1995 if (diff.needsPaintInvalidationSubtree() || updatedDiff.needsPaintInvalidati
onSubtree()) |
2002 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 1996 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
2003 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali
dationObject()) | 1997 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali
dationObject()) |
2004 setShouldDoFullPaintInvalidation(); | 1998 setShouldDoFullPaintInvalidation(); |
2005 } | 1999 } |
2006 | 2000 |
2007 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne
wStyle) | 2001 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne
wStyle) |
2008 { | 2002 { |
2009 if (m_style) { | 2003 if (m_style) { |
2010 // If our z-index changes value or our visibility changes, | 2004 // If our z-index changes value or our visibility changes, |
2011 // we need to dirty our stacking context's z-order list. | 2005 // we need to dirty our stacking context's z-order list. |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3458 return; | 3452 return; |
3459 m_bitfields.setMayNeedPaintInvalidation(true); | 3453 m_bitfields.setMayNeedPaintInvalidation(true); |
3460 markAncestorsForPaintInvalidation(); | 3454 markAncestorsForPaintInvalidation(); |
3461 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3455 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
3462 } | 3456 } |
3463 | 3457 |
3464 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) | 3458 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai
ntInvalidationState) |
3465 { | 3459 { |
3466 // paintInvalidationStateIsDirty should be kept in sync with the | 3460 // paintInvalidationStateIsDirty should be kept in sync with the |
3467 // booleans that are cleared below. | 3461 // booleans that are cleared below. |
3468 ASSERT(paintInvalidationState.forcedSubtreeInvalidationWithinContainer() ||
paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinContainer() || p
aintInvalidationStateIsDirty()); | 3462 ASSERT(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()
|| paintInvalidationStateIsDirty()); |
3469 clearShouldDoFullPaintInvalidation(); | 3463 clearShouldDoFullPaintInvalidation(); |
3470 m_bitfields.setChildShouldCheckForPaintInvalidation(false); | 3464 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
3471 m_bitfields.setNeededLayoutBecauseOfChildren(false); | 3465 m_bitfields.setNeededLayoutBecauseOfChildren(false); |
3472 m_bitfields.setShouldInvalidateOverflowForPaint(false); | 3466 m_bitfields.setShouldInvalidateOverflowForPaint(false); |
3473 m_bitfields.setMayNeedPaintInvalidation(false); | 3467 m_bitfields.setMayNeedPaintInvalidation(false); |
3474 m_bitfields.setShouldInvalidateSelection(false); | 3468 m_bitfields.setShouldInvalidateSelection(false); |
3475 } | 3469 } |
3476 | 3470 |
3477 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) | 3471 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) |
3478 { | 3472 { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 clearPreviousPaintInvalidationRects(); | 3591 clearPreviousPaintInvalidationRects(); |
3598 } | 3592 } |
3599 | 3593 |
3600 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() | 3594 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() |
3601 { | 3595 { |
3602 // Since we're only painting non-composited layers, we know that they all sh
are the same paintInvalidationContainer. | 3596 // Since we're only painting non-composited layers, we know that they all sh
are the same paintInvalidationContainer. |
3603 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); | 3597 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn
validation(); |
3604 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou
tObject& object) { | 3598 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou
tObject& object) { |
3605 if (object.hasLayer()) | 3599 if (object.hasLayer()) |
3606 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); | 3600 toLayoutBoxModelObject(object).layer()->setNeedsRepaint(); |
3607 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC
ontainer, PaintInvalidationLayer); | 3601 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC
ontainer, PaintInvalidationSubtree); |
3608 }); | 3602 }); |
3609 } | 3603 } |
3610 | 3604 |
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). | |
3612 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() | 3605 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() |
3613 { | 3606 { |
3614 // Need to access the current compositing status. | 3607 // Clear first because PaintInvalidationSubtree overrides other full paint i
nvalidation reasons. |
3615 DisableCompositingQueryAsserts disabler; | 3608 clearShouldDoFullPaintInvalidation(); |
3616 traverseNonCompositingDescendants(*this, [](LayoutObject& object) { | 3609 setShouldDoFullPaintInvalidation(PaintInvalidationSubtree); |
3617 object.setShouldDoFullPaintInvalidation(); | |
3618 }); | |
3619 } | 3610 } |
3620 | 3611 |
3621 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(const LayoutBoxModelObject& paintInvalidationContainer) | 3612 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(const LayoutBoxModelObject& paintInvalidationContainer) |
3622 { | 3613 { |
3623 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P
aintInvalidationLayer); | 3614 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P
aintInvalidationSubtree); |
3624 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 3615 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
3625 if (child->hasLayer()) | 3616 if (child->hasLayer()) |
3626 toLayoutBoxModelObject(child)->layer()->setNeedsRepaint(); | 3617 toLayoutBoxModelObject(child)->layer()->setNeedsRepaint(); |
3627 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel
fPaintingLayer()) | 3618 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel
fPaintingLayer()) |
3628 child->invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(paintInvalidationContainer); | 3619 child->invalidatePaintIncludingNonSelfPaintingLayerDescendantsIntern
al(paintInvalidationContainer); |
3629 } | 3620 } |
3630 } | 3621 } |
3631 | 3622 |
3632 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const
LayoutBoxModelObject& paintInvalidationContainer) | 3623 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const
LayoutBoxModelObject& paintInvalidationContainer) |
3633 { | 3624 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3699 const blink::LayoutObject* root = object1; | 3690 const blink::LayoutObject* root = object1; |
3700 while (root->parent()) | 3691 while (root->parent()) |
3701 root = root->parent(); | 3692 root = root->parent(); |
3702 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3693 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3703 } else { | 3694 } else { |
3704 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3695 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3705 } | 3696 } |
3706 } | 3697 } |
3707 | 3698 |
3708 #endif | 3699 #endif |
OLD | NEW |