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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutImageResource.cpp

Issue 1477433004: Use LayoutUnit for SVG container size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll <knoll@kde.org> 2 * Copyright (C) 1999 Lars Knoll <knoll@kde.org>
3 * Copyright (C) 1999 Antti Koivisto <koivisto@kde.org> 3 * Copyright (C) 1999 Antti Koivisto <koivisto@kde.org>
4 * Copyright (C) 2000 Dirk Mueller <mueller@kde.org> 4 * Copyright (C) 2000 Dirk Mueller <mueller@kde.org>
5 * Copyright (C) 2006 Allan Sandfeld Jensen <kde@carewolf.com> 5 * Copyright (C) 2006 Allan Sandfeld Jensen <kde@carewolf.com>
6 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 6 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
10 * 10 *
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 LayoutSize LayoutImageResource::imageSize(float multiplier) const 93 LayoutSize LayoutImageResource::imageSize(float multiplier) const
94 { 94 {
95 if (!m_cachedImage) 95 if (!m_cachedImage)
96 return LayoutSize(); 96 return LayoutSize();
97 LayoutSize size = m_cachedImage->imageSizeForLayoutObject(m_layoutObject, mu ltiplier); 97 LayoutSize size = m_cachedImage->imageSizeForLayoutObject(m_layoutObject, mu ltiplier);
98 if (m_layoutObject && m_layoutObject->isLayoutImage() && size.width() && siz e.height()) 98 if (m_layoutObject && m_layoutObject->isLayoutImage() && size.width() && siz e.height())
99 size.scale(toLayoutImage(m_layoutObject)->imageDevicePixelRatio()); 99 size.scale(toLayoutImage(m_layoutObject)->imageDevicePixelRatio());
100 return size; 100 return size;
101 } 101 }
102 102
103 PassRefPtr<Image> LayoutImageResource::image(const IntSize& containerSize, float zoom) const 103 PassRefPtr<Image> LayoutImageResource::image(const LayoutSize& containerSize, fl oat zoom) const
104 { 104 {
105 if (!m_cachedImage) 105 if (!m_cachedImage)
106 return Image::nullImage(); 106 return Image::nullImage();
107 107
108 if (!m_cachedImage->image()->isSVGImage()) 108 if (!m_cachedImage->image()->isSVGImage())
109 return m_cachedImage->image(); 109 return m_cachedImage->image();
110 110
111 KURL url; 111 KURL url;
112 SVGImage* svgImage = toSVGImage(m_cachedImage->image()); 112 SVGImage* svgImage = toSVGImage(m_cachedImage->image());
113 Node* node = m_layoutObject->node(); 113 Node* node = m_layoutObject->node();
114 if (node && node->isElementNode()) { 114 if (node && node->isElementNode()) {
115 const AtomicString& urlString = toElement(node)->imageSourceURL(); 115 const AtomicString& urlString = toElement(node)->imageSourceURL();
116 url = node->document().completeURL(urlString); 116 url = node->document().completeURL(urlString);
117 } 117 }
118 return SVGImageForContainer::create(svgImage, containerSize, zoom, url); 118 return SVGImageForContainer::create(svgImage, containerSize, zoom, url);
119 } 119 }
120 120
121 bool LayoutImageResource::maybeAnimated() const 121 bool LayoutImageResource::maybeAnimated() const
122 { 122 {
123 Image* image = m_cachedImage ? m_cachedImage->image() : Image::nullImage(); 123 Image* image = m_cachedImage ? m_cachedImage->image() : Image::nullImage();
124 return image->maybeAnimated(); 124 return image->maybeAnimated();
125 } 125 }
126 126
127 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698