Followup (r220289): RenderImageResourceStyleImage code clean up
[WebKit-https.git] / Source / WebCore / rendering / RenderImageResourceStyleImage.cpp
index 52f6286..4db1357 100644 (file)
@@ -39,28 +39,17 @@ RenderImageResourceStyleImage::RenderImageResourceStyleImage(StyleImage& styleIm
 {
 }
 
-RenderImageResourceStyleImage::~RenderImageResourceStyleImage()
+void RenderImageResourceStyleImage::initialize(RenderElement& renderer)
 {
-}
-
-void RenderImageResourceStyleImage::initialize(RenderElement* renderer)
-{
-    RenderImageResource::initialize(renderer);
-
-    if (m_styleImage->isCachedImage())
-        m_cachedImage = m_styleImage.get().cachedImage();
-
-    m_styleImage->addClient(m_renderer);
+    RenderImageResource::initialize(renderer, m_styleImage->isCachedImage() ? m_styleImage.get().cachedImage() : nullptr);
+    m_styleImage->addClient(this->renderer());
 }
 
 void RenderImageResourceStyleImage::shutdown()
 {
-    ASSERT(m_renderer);
-    image()->stopAnimation();
-    m_styleImage->removeClient(m_renderer);
-    if (!m_styleImage->isCachedImage() && m_cachedImage)
-        m_cachedImage->removeClient(*m_renderer);
-    m_cachedImage = nullptr;
+    ASSERT(renderer());
+    RenderImageResource::shutdown();
+    m_styleImage->removeClient(renderer());
 }
 
 RefPtr<Image> RenderImageResourceStyleImage::image(const IntSize& size) const
@@ -68,15 +57,15 @@ RefPtr<Image> RenderImageResourceStyleImage::image(const IntSize& size) const
     // Generated content may trigger calls to image() while we're still pending, don't assert but gracefully exit.
     if (m_styleImage->isPending())
         return &Image::nullImage();
-    if (auto image = m_styleImage->image(m_renderer, size))
+    if (auto image = m_styleImage->image(renderer(), size))
         return image;
     return &Image::nullImage();
 }
 
 void RenderImageResourceStyleImage::setContainerSizeForRenderer(const IntSize& size)
 {
-    ASSERT(m_renderer);
-    m_styleImage->setContainerSizeForRenderer(m_renderer, size, m_renderer->style().effectiveZoom());
+    ASSERT(renderer());
+    m_styleImage->setContainerSizeForRenderer(renderer(), size, renderer()->style().effectiveZoom());
 }
 
 } // namespace WebCore