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

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

Issue 1117753003: Fix under-invalidation about view background change caused by body style change (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 { 1742 {
1743 ASSERT(style); 1743 ASSERT(style);
1744 1744
1745 if (m_style == style) { 1745 if (m_style == style) {
1746 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so 1746 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
1747 // style sharing is disabled for them. That should ensure that we never hit this code path. 1747 // style sharing is disabled for them. That should ensure that we never hit this code path.
1748 ASSERT(!isLayoutIFrame() && !isEmbeddedObject() && !isCanvas()); 1748 ASSERT(!isLayoutIFrame() && !isEmbeddedObject() && !isCanvas());
1749 return; 1749 return;
1750 } 1750 }
1751 1751
1752 // These are used later to check invalidation of document element caused by
1753 // body background change. FIXME: This may be related to crbug.com/475115.
1754 LayoutObject* oldViewBackgroundLayoutObject = nullptr;
1755 LayoutView* layoutView = view();
1756 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && layoutView && isBody() )
1757 oldViewBackgroundLayoutObject = layoutView->backgroundLayoutObject();
1758
1752 StyleDifference diff; 1759 StyleDifference diff;
1753 if (m_style) 1760 if (m_style)
1754 diff = m_style->visualInvalidationDiff(*style); 1761 diff = m_style->visualInvalidationDiff(*style);
1755 1762
1756 diff = adjustStyleDifference(diff); 1763 diff = adjustStyleDifference(diff);
1757 1764
1758 styleWillChange(diff, *style); 1765 styleWillChange(diff, *style);
1759 1766
1760 RefPtr<ComputedStyle> oldStyle = m_style.release(); 1767 RefPtr<ComputedStyle> oldStyle = m_style.release();
1761 setStyleInternal(style); 1768 setStyleInternal(style);
1762 1769
1763 updateFillImages(oldStyle ? &oldStyle->backgroundLayers() : 0, m_style->back groundLayers()); 1770 updateFillImages(oldStyle ? &oldStyle->backgroundLayers() : 0, m_style->back groundLayers());
1764 updateFillImages(oldStyle ? &oldStyle->maskLayers() : 0, m_style->maskLayers ()); 1771 updateFillImages(oldStyle ? &oldStyle->maskLayers() : 0, m_style->maskLayers ());
1765 1772
1766 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderI mage().image()); 1773 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderI mage().image());
1767 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBo xImage().image()); 1774 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBo xImage().image());
1768 1775
1769 updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOuts ide()); 1776 updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOuts ide());
1770 1777
1771 bool doesNotNeedLayoutOrPaintInvalidation = !m_parent; 1778 bool doesNotNeedLayoutOrPaintInvalidation = !m_parent;
1772 1779
1773 styleDidChange(diff, oldStyle.get()); 1780 styleDidChange(diff, oldStyle.get());
1774 1781
1782 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && layoutView && isBody() && layoutView->backgroundLayoutObject() == this) {
chrishtr 2015/04/30 01:23:57 How about always invalidating the LayoutView and t
Xianzhu 2015/04/30 04:46:39 We don't need to invalidate the LayoutView, but th
chrishtr 2015/04/30 17:48:36 Yeah I mean just always invalidating both if one o
1783 // The rootObject paints view's background. We need to invalidate it whe n
1784 // view's background changes because of change of body's style.
1785 if (LayoutObject* rootObject = document().documentElement()->layoutObjec t()) {
1786 if (oldViewBackgroundLayoutObject != this
1787 || (!oldStyle && m_style->hasBackground())
1788 || (oldStyle && oldStyle->visitedDependentColor(CSSPropertyBackg roundColor) != m_style->visitedDependentColor(CSSPropertyBackgroundColor))
1789 || (oldStyle && oldStyle->backgroundLayers() != m_style->backgro undLayers()))
1790 rootObject->setShouldDoFullPaintInvalidation();
1791 }
1792 }
1793
1775 // FIXME: |this| might be destroyed here. This can currently happen for a La youtTextFragment when 1794 // FIXME: |this| might be destroyed here. This can currently happen for a La youtTextFragment when
1776 // its first-letter block gets an update in LayoutTextFragment::styleDidChan ge. For LayoutTextFragment(s), 1795 // its first-letter block gets an update in LayoutTextFragment::styleDidChan ge. For LayoutTextFragment(s),
1777 // we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation fla g. We might want to broaden 1796 // we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation fla g. We might want to broaden
1778 // this condition in the future as we move layoutObject changes out of layou t and into style changes. 1797 // this condition in the future as we move layoutObject changes out of layou t and into style changes.
1779 if (doesNotNeedLayoutOrPaintInvalidation) 1798 if (doesNotNeedLayoutOrPaintInvalidation)
1780 return; 1799 return;
1781 1800
1782 // Now that the layer (if any) has been updated, we need to adjust the diff again, 1801 // Now that the layer (if any) has been updated, we need to adjust the diff again,
1783 // check whether we should layout now, and decide if we need to invalidate p aints. 1802 // check whether we should layout now, and decide if we need to invalidate p aints.
1784 StyleDifference updatedDiff = adjustStyleDifference(diff); 1803 StyleDifference updatedDiff = adjustStyleDifference(diff);
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 { 3329 {
3311 if (object1) { 3330 if (object1) {
3312 const blink::LayoutObject* root = object1; 3331 const blink::LayoutObject* root = object1;
3313 while (root->parent()) 3332 while (root->parent())
3314 root = root->parent(); 3333 root = root->parent();
3315 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3334 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3316 } 3335 }
3317 } 3336 }
3318 3337
3319 #endif 3338 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698