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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutImageResource.cpp

Issue 1367193003: NOT FOR LANDING Allocate SVGImageForContainer on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some NeedsRebaseline and revived some LayoutListMarker code that turned out to be important Created 5 years, 2 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
Index: third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp b/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
index 85e24d61d56493228c2276e38b94076d114c9807..a4a0b6e25eca8c735d669c5211d2b1791636dc24 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
@@ -29,6 +29,7 @@
#include "core/layout/LayoutImageResource.h"
#include "core/layout/LayoutImage.h"
+#include "core/svg/graphics/SVGImageForContainer.h"
namespace blink {
@@ -83,18 +84,11 @@ void LayoutImageResource::resetAnimation()
if (!m_cachedImage)
return;
- image()->resetAnimation();
+ m_cachedImage->image()->resetAnimation();
m_layoutObject->setShouldDoFullPaintInvalidation();
}
-void LayoutImageResource::setContainerSizeForLayoutObject(const IntSize& imageContainerSize)
-{
- ASSERT(m_layoutObject);
- if (m_cachedImage)
- m_cachedImage->setContainerSizeForLayoutObject(m_layoutObject, imageContainerSize, m_layoutObject->style()->effectiveZoom());
-}
-
LayoutSize LayoutImageResource::getImageSize(float multiplier, ImageResource::SizeType type) const
{
if (!m_cachedImage)
@@ -105,4 +99,19 @@ LayoutSize LayoutImageResource::getImageSize(float multiplier, ImageResource::Si
return size;
}
+PassRefPtr<Image> LayoutImageResource::image(const IntSize& containerSize, float zoom, const KURL& url) const
+{
+ RefPtr<Image> image = m_cachedImage ? m_cachedImage->image() : Image::nullImage();
+ if (image->isSVGImage())
+ return SVGImageForContainer::create(toSVGImage(image.get()), containerSize, zoom, url);
+ return image;
+}
+
+bool LayoutImageResource::maybeAnimated() const
+{
+ RefPtr<Image> image = m_cachedImage ? m_cachedImage->image() : Image::nullImage();
+ return image->maybeAnimated();
+}
+
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698