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

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

Issue 1472253003: Avoid RefPtr churn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | third_party/WebKit/Source/core/style/StyleFetchedImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e19a029d4c8d6fe5c6497ebf49887f9cd0e3639c..047dd95126a762ba7a3c974b76467e47439a4647 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
@@ -102,18 +102,20 @@ LayoutSize LayoutImageResource::imageSize(float multiplier) const
PassRefPtr<Image> LayoutImageResource::image(const IntSize& containerSize, float zoom) const
{
- RefPtr<Image> image = m_cachedImage ? m_cachedImage->image() : Image::nullImage();
- if (image->isSVGImage()) {
- KURL url;
- SVGImage* svgImage = toSVGImage(image.get());
- Node* node = m_layoutObject->node();
- if (node && node->isElementNode()) {
- const AtomicString& urlString = toElement(node)->imageSourceURL();
- url = node->document().completeURL(urlString);
- }
- return SVGImageForContainer::create(svgImage, containerSize, zoom, url);
+ if (!m_cachedImage)
+ return Image::nullImage();
+
+ if (!m_cachedImage->image()->isSVGImage())
+ return m_cachedImage->image();
+
+ KURL url;
+ SVGImage* svgImage = toSVGImage(m_cachedImage->image());
+ Node* node = m_layoutObject->node();
+ if (node && node->isElementNode()) {
+ const AtomicString& urlString = toElement(node)->imageSourceURL();
+ url = node->document().completeURL(urlString);
}
- return image;
+ return SVGImageForContainer::create(svgImage, containerSize, zoom, url);
}
bool LayoutImageResource::maybeAnimated() const
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/style/StyleFetchedImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698