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

Unified Diff: Source/core/layout/LayoutObject.cpp

Issue 1342503002: When style changes, set the LayoutObject as a client for all StyleImage loads. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutObject.cpp
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp
index ce0831564cfa852a75a2fa0b43278a58674a5a61..b74ecd9b4a19d5df02f8c0c3e53a06e61fbcff78 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -1834,12 +1834,24 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style)
updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderImage().image());
updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBoxImage().image());
+ const StyleImage* newContentImage = m_style->contentData() && m_style->contentData()->isImage() ?
+ toImageContentData(m_style->contentData())->image() : nullptr;
+ const StyleImage* oldContentImage = oldStyle && oldStyle->contentData() && oldStyle->contentData()->isImage() ?
+ toImageContentData(oldStyle->contentData())->image() : nullptr;
+ updateImage(const_cast<StyleImage*>(oldContentImage), const_cast<StyleImage*>(newContentImage));
+
+ StyleImage* newBoxReflectMaskImage = m_style->boxReflect() ? m_style->boxReflect()->mask().image() : nullptr;
+ StyleImage* oldBoxReflectMaskImage = oldStyle && oldStyle->boxReflect() ? oldStyle->boxReflect()->mask().image() : nullptr;
+ updateImage(oldBoxReflectMaskImage, newBoxReflectMaskImage);
+
updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOutside());
bool doesNotNeedLayoutOrPaintInvalidation = !m_parent;
styleDidChange(diff, oldStyle.get());
+ updateImage(oldStyle ? oldStyle->listStyleImage() : nullptr, m_style->listStyleImage());
Nate Chapin 2015/09/11 21:35:50 It appears that this and only this needs to be aft
esprehn 2015/09/17 08:20:48 That needs a comment, also can we not move them al
Nate Chapin 2015/09/22 20:24:07 Moved this logic to LayoutListItem, since listStyl
+
// FIXME: |this| might be destroyed here. This can currently happen for a LayoutTextFragment when
// its first-letter block gets an update in LayoutTextFragment::styleDidChange. For LayoutTextFragment(s),
// we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation flag. We might want to broaden
@@ -2479,6 +2491,15 @@ void LayoutObject::willBeDestroyed()
if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
maskBoxImage->removeClient(this);
+ if (m_style->contentData() && m_style->contentData()->isImage())
+ const_cast<StyleImage*>(toImageContentData(m_style->contentData())->image())->removeClient(this);
esprehn 2015/09/17 08:20:48 This const_cast seems sketchy, why is it okay to c
Nate Chapin 2015/09/22 20:24:07 I was scared to change it. :) Made ComputedStyle:
+
+ if (m_style->boxReflect() && m_style->boxReflect()->mask().image())
+ m_style->boxReflect()->mask().image()->removeClient(this);
+
+ if (StyleImage* listStyleImage = m_style->listStyleImage())
+ listStyleImage->removeClient(this);
+
removeShapeImageClient(m_style->shapeOutside());
}
ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayoutObject(this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698