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

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

Issue 1174373003: Deregister image client in LayoutObject::willBeDestroyed() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « Source/core/layout/LayoutObject.h ('k') | Source/core/layout/LayoutPart.cpp » ('j') | 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 e96113c8527123bac9e23bd9410e148474f9f1a9..a7b8e682b5abcdea7f19cc08ee328d0ce6aa8524 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -2417,6 +2417,27 @@ void LayoutObject::willBeDestroyed()
selectionPaintInvalidationMap->remove(this);
clearLayoutRootIfNeeded();
+
+ if (m_style) {
+ for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
+ if (StyleImage* backgroundImage = bgLayer->image())
+ backgroundImage->removeClient(this);
+ }
+
+ for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
+ if (StyleImage* maskImage = maskLayer->image())
+ maskImage->removeClient(this);
+ }
+
+ if (StyleImage* borderImage = m_style->borderImage().image())
+ borderImage->removeClient(this);
+
+ if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
+ maskBoxImage->removeClient(this);
+
+ removeShapeImageClient(m_style->shapeOutside());
+ }
+ ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayoutObject(this);
}
void LayoutObject::insertedIntoTree()
@@ -2538,7 +2559,7 @@ void LayoutObject::destroyAndCleanupAnonymousWrappers()
void LayoutObject::destroy()
{
willBeDestroyed();
- postDestroy();
+ delete this;
}
void LayoutObject::removeShapeImageClient(ShapeValue* shapeValue)
@@ -2549,32 +2570,6 @@ void LayoutObject::removeShapeImageClient(ShapeValue* shapeValue)
shapeImage->removeClient(this);
}
-void LayoutObject::postDestroy()
-{
- // It seems ugly that this is not in willBeDestroyed().
trchen 2015/06/16 04:05:55 Hello cevans@, I noticed you added this comment in
- if (m_style) {
- for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
- if (StyleImage* backgroundImage = bgLayer->image())
- backgroundImage->removeClient(this);
- }
-
- for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
- if (StyleImage* maskImage = maskLayer->image())
- maskImage->removeClient(this);
- }
-
- if (StyleImage* borderImage = m_style->borderImage().image())
- borderImage->removeClient(this);
-
- if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
- maskBoxImage->removeClient(this);
-
- removeShapeImageClient(m_style->shapeOutside());
- }
- ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayoutObject(this);
- delete this;
-}
-
PositionWithAffinity LayoutObject::positionForPoint(const LayoutPoint&)
{
return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM);
@@ -2928,6 +2923,7 @@ bool LayoutObject::isInert() const
void LayoutObject::imageChanged(ImageResource* image, const IntRect* rect)
{
+ ASSERT(m_node);
imageChanged(static_cast<WrappedImagePtr>(image), rect);
}
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | Source/core/layout/LayoutPart.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698