Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

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

Powered by Google App Engine
This is Rietveld 408576698