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

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

Issue 2761863002: Add StyleDifference::needsVisualRectUpdate (Closed)
Patch Set: Still keep visibility change detection for full paint invalidation. Will optimize in later CLs Created 3 years, 9 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. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 } else if (diff.needsPaintInvalidationObject() || 1729 } else if (diff.needsPaintInvalidationObject() ||
1730 updatedDiff.needsPaintInvalidationObject()) { 1730 updatedDiff.needsPaintInvalidationObject()) {
1731 // TODO(wangxianzhu): For now LayoutSVGRoot::localVisualRect() depends on 1731 // TODO(wangxianzhu): For now LayoutSVGRoot::localVisualRect() depends on
1732 // several styles. Refactor to avoid this special case. 1732 // several styles. Refactor to avoid this special case.
1733 if (isSVGRoot()) 1733 if (isSVGRoot())
1734 setShouldDoFullPaintInvalidation(); 1734 setShouldDoFullPaintInvalidation();
1735 else 1735 else
1736 setShouldDoFullPaintInvalidationWithoutGeometryChange(); 1736 setShouldDoFullPaintInvalidationWithoutGeometryChange();
1737 } 1737 }
1738 1738
1739 if (diff.needsVisualRectUpdate())
1740 setMayNeedPaintInvalidation();
1741
1739 // Text nodes share style with their parents but the paint properties don't 1742 // Text nodes share style with their parents but the paint properties don't
1740 // apply to them, hence the !isText() check. 1743 // apply to them, hence the !isText() check.
1741 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && !isText() && 1744 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && !isText() &&
1742 (diff.transformChanged() || diff.opacityChanged() || 1745 (diff.transformChanged() || diff.opacityChanged() ||
1743 diff.zIndexChanged() || diff.filterChanged() || 1746 diff.zIndexChanged() || diff.filterChanged() ||
1744 diff.backdropFilterChanged() || diff.cssClipChanged())) { 1747 diff.backdropFilterChanged() || diff.cssClipChanged())) {
1745 setNeedsPaintPropertyUpdate(); 1748 setNeedsPaintPropertyUpdate();
1746 1749
1747 // We don't need to invalidate paint of objects on SPv2 when only paint 1750 // We don't need to invalidate paint of objects on SPv2 when only paint
1748 // property or paint order change. Mark the painting layer needing repaint 1751 // property or paint order change. Mark the painting layer needing repaint
1749 // for changed paint property or paint order. Raster invalidation will be 1752 // for changed paint property or paint order. Raster invalidation will be
1750 // issued if needed during paint. 1753 // issued if needed during paint.
1751 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 1754 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
1752 !shouldDoFullPaintInvalidation()) 1755 !shouldDoFullPaintInvalidation())
1753 ObjectPaintInvalidator(*this).slowSetPaintingLayerNeedsRepaint(); 1756 ObjectPaintInvalidator(*this).slowSetPaintingLayerNeedsRepaint();
1754 } 1757 }
1755 } 1758 }
1756 1759
1757 void LayoutObject::styleWillChange(StyleDifference diff, 1760 void LayoutObject::styleWillChange(StyleDifference diff,
1758 const ComputedStyle& newStyle) { 1761 const ComputedStyle& newStyle) {
1759 if (m_style) { 1762 if (m_style) {
1763 bool visibilityChanged = m_style->visibility() != newStyle.visibility();
1760 // If our z-index changes value or our visibility changes, 1764 // If our z-index changes value or our visibility changes,
1761 // we need to dirty our stacking context's z-order list. 1765 // we need to dirty our stacking context's z-order list.
1762 bool visibilityChanged = 1766 if (visibilityChanged || m_style->zIndex() != newStyle.zIndex() ||
1763 m_style->visibility() != newStyle.visibility() || 1767 m_style->isStackingContext() != newStyle.isStackingContext()) {
1764 m_style->zIndex() != newStyle.zIndex() ||
1765 m_style->isStackingContext() != newStyle.isStackingContext();
1766 if (visibilityChanged) {
1767 document().setAnnotatedRegionsDirty(true); 1768 document().setAnnotatedRegionsDirty(true);
1768 if (AXObjectCache* cache = document().existingAXObjectCache()) 1769 if (AXObjectCache* cache = document().existingAXObjectCache())
1769 cache->childrenChanged(parent()); 1770 cache->childrenChanged(parent());
1770 } 1771 }
1771 1772
1772 // Keep layer hierarchy visibility bits up to date if visibility changes. 1773 // Keep layer hierarchy visibility bits up to date if visibility changes.
1773 if (m_style->visibility() != newStyle.visibility()) { 1774 if (visibilityChanged) {
1774 // We might not have an enclosing layer yet because we might not be in the 1775 // We might not have an enclosing layer yet because we might not be in the
1775 // tree. 1776 // tree.
1776 if (PaintLayer* layer = enclosingLayer()) 1777 if (PaintLayer* layer = enclosingLayer())
1777 layer->dirtyVisibleContentStatus(); 1778 layer->dirtyVisibleContentStatus();
1778 } 1779 }
1779 1780
1780 if (isFloating() && (m_style->floating() != newStyle.floating())) { 1781 if (isFloating() && (m_style->floating() != newStyle.floating())) {
1781 // For changes in float styles, we need to conceivably remove ourselves 1782 // For changes in float styles, we need to conceivably remove ourselves
1782 // from the floating objects list. 1783 // from the floating objects list.
1783 toLayoutBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 1784 toLayoutBox(this)->removeFloatingOrPositionedChildFromBlockLists();
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 const blink::LayoutObject* root = object1; 3626 const blink::LayoutObject* root = object1;
3626 while (root->parent()) 3627 while (root->parent())
3627 root = root->parent(); 3628 root = root->parent();
3628 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3629 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3629 } else { 3630 } else {
3630 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3631 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3631 } 3632 }
3632 } 3633 }
3633 3634
3634 #endif 3635 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698