Remove some unneeded code noticed while looking at StylePendingImage
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Dec 2013 08:44:32 +0000 (08:44 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Dec 2013 08:44:32 +0000 (08:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125618

Reviewed by Andreas Kling.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::loadPendingImage): Removed redundant function calls.

* rendering/RenderImageResource.cpp: Removed unneeded nullImage and
usesImageContainerSize member functions.
(WebCore::RenderImageResource::image): Use Image::nullImage directly instead of
through RenderImageResourceImage::nullImage.

* rendering/RenderImageResource.h: Removed unneeded usesImageContainerSize
and nullImage functions. Also removed unneeded includes.

* rendering/RenderImageResourceStyleImage.h: Removed unneeded
usesImageContainerSize override. Nobody was calling it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160478 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/RenderImageResource.cpp
Source/WebCore/rendering/RenderImageResource.h
Source/WebCore/rendering/RenderImageResourceStyleImage.h

index 13259eb..e3e733d 100644 (file)
@@ -1,3 +1,24 @@
+2013-12-11  Darin Adler  <darin@apple.com>
+
+        Remove some unneeded code noticed while looking at StylePendingImage
+        https://bugs.webkit.org/show_bug.cgi?id=125618
+
+        Reviewed by Andreas Kling.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::loadPendingImage): Removed redundant function calls.
+
+        * rendering/RenderImageResource.cpp: Removed unneeded nullImage and
+        usesImageContainerSize member functions.
+        (WebCore::RenderImageResource::image): Use Image::nullImage directly instead of
+        through RenderImageResourceImage::nullImage.
+
+        * rendering/RenderImageResource.h: Removed unneeded usesImageContainerSize
+        and nullImage functions. Also removed unneeded includes.
+
+        * rendering/RenderImageResourceStyleImage.h: Removed unneeded
+        usesImageContainerSize override. Nobody was calling it.
+
 2013-12-11  Benjamin Poulain  <bpoulain@apple.com>
 
         Add the CFNetwork implementation of the asynchronous ResourceHandle
index c5bf8dc..8b25e23 100644 (file)
@@ -3876,32 +3876,23 @@ bool StyleResolver::createFilterOperations(CSSValue* inValue, FilterOperations&
 
 PassRefPtr<StyleImage> StyleResolver::loadPendingImage(StylePendingImage* pendingImage)
 {
-    CachedResourceLoader* cachedResourceLoader = m_state.document().cachedResourceLoader();
-
-    if (pendingImage->cssImageValue()) {
-        CSSImageValue* imageValue = pendingImage->cssImageValue();
-        return imageValue->cachedImage(cachedResourceLoader);
-    }
+    if (auto imageValue = pendingImage->cssImageValue())
+        return imageValue->cachedImage(m_state.document().cachedResourceLoader());
 
-    if (pendingImage->cssImageGeneratorValue()) {
-        CSSImageGeneratorValue* imageGeneratorValue = pendingImage->cssImageGeneratorValue();
-        imageGeneratorValue->loadSubimages(cachedResourceLoader);
+    if (auto imageGeneratorValue = pendingImage->cssImageGeneratorValue()) {
+        imageGeneratorValue->loadSubimages(m_state.document().cachedResourceLoader());
         return StyleGeneratedImage::create(imageGeneratorValue);
     }
 
-    if (pendingImage->cssCursorImageValue()) {
-        CSSCursorImageValue* cursorImageValue = pendingImage->cssCursorImageValue();
-        return cursorImageValue->cachedImage(cachedResourceLoader);
-    }
+    if (auto cursorImageValue = pendingImage->cssCursorImageValue())
+        return cursorImageValue->cachedImage(m_state.document().cachedResourceLoader());
 
 #if ENABLE(CSS_IMAGE_SET)
-    if (pendingImage->cssImageSetValue()) {
-        CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue();
-        return imageSetValue->cachedImageSet(cachedResourceLoader);
-    }
+    if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue())
+        return imageSetValue->cachedImageSet(m_state.document().cachedResourceLoader());
 #endif
 
-    return 0;
+    return nullptr;
 }
 
 
index f459bea..e6a1dc4 100644 (file)
@@ -91,7 +91,7 @@ void RenderImageResource::resetAnimation()
 
 PassRefPtr<Image> RenderImageResource::image(int, int) const
 {
-    return m_cachedImage ? m_cachedImage->imageForRenderer(m_renderer) : nullImage();
+    return m_cachedImage ? m_cachedImage->imageForRenderer(m_renderer) : Image::nullImage();
 }
 
 bool RenderImageResource::errorOccurred() const
@@ -106,16 +106,6 @@ void RenderImageResource::setContainerSizeForRenderer(const IntSize& imageContai
         m_cachedImage->setContainerSizeForRenderer(m_renderer, imageContainerSize, m_renderer->style().effectiveZoom());
 }
 
-Image* RenderImageResource::nullImage()
-{
-    return Image::nullImage();
-}
-
-bool RenderImageResource::usesImageContainerSize() const
-{
-    return m_cachedImage ? m_cachedImage->usesImageContainerSize() : false;
-}
-
 bool RenderImageResource::imageHasRelativeWidth() const
 {
     return m_cachedImage ? m_cachedImage->imageHasRelativeWidth() : false;
index 5339b32..b7630b4 100644 (file)
 #define RenderImageResource_h
 
 #include "CachedResourceHandle.h"
-#include "Image.h"
-#include "LayoutSize.h"
 #include "StyleImage.h"
+#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
+class CachedImage;
 class RenderElement;
 
 class RenderImageResource {
@@ -58,7 +58,6 @@ public:
     virtual bool errorOccurred() const;
 
     virtual void setContainerSizeForRenderer(const IntSize&);
-    virtual bool usesImageContainerSize() const;
     virtual bool imageHasRelativeWidth() const;
     virtual bool imageHasRelativeHeight() const;
 
@@ -69,11 +68,9 @@ public:
 
 protected:
     RenderImageResource();
+
     RenderElement* m_renderer;
     CachedResourceHandle<CachedImage> m_cachedImage;
-
-private:
-    static Image* nullImage();
 };
 
 } // namespace WebCore
index 73472e9..40d923a 100644 (file)
@@ -52,7 +52,6 @@ private:
     virtual bool errorOccurred() const OVERRIDE { return m_styleImage->errorOccurred(); }
 
     virtual void setContainerSizeForRenderer(const IntSize&) OVERRIDE;
-    virtual bool usesImageContainerSize() const OVERRIDE { return m_styleImage->usesImageContainerSize(); }
     virtual bool imageHasRelativeWidth() const OVERRIDE { return m_styleImage->imageHasRelativeWidth(); }
     virtual bool imageHasRelativeHeight() const OVERRIDE { return m_styleImage->imageHasRelativeHeight(); }