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

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

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

Powered by Google App Engine
This is Rietveld 408576698