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

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGImagePainter.cpp

Issue 1685353004: Clean up Image::computeIntrinsicDimensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/SVGImagePainter.h" 5 #include "core/paint/SVGImagePainter.h"
6 6
7 #include "core/layout/ImageQualityController.h" 7 #include "core/layout/ImageQualityController.h"
8 #include "core/layout/LayoutImageResource.h" 8 #include "core/layout/LayoutImageResource.h"
9 #include "core/layout/svg/LayoutSVGImage.h" 9 #include "core/layout/svg/LayoutSVGImage.h"
10 #include "core/layout/svg/SVGLayoutSupport.h" 10 #include "core/layout/svg/SVGLayoutSupport.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 if (toSVGImageElement(m_layoutSVGImage.element())->preserveAspectRatio()->cu rrentValue()->align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) 78 if (toSVGImageElement(m_layoutSVGImage.element())->preserveAspectRatio()->cu rrentValue()->align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
79 return m_layoutSVGImage.objectBoundingBox().size(); 79 return m_layoutSVGImage.objectBoundingBox().size();
80 80
81 ImageResource* cachedImage = m_layoutSVGImage.imageResource()->cachedImage() ; 81 ImageResource* cachedImage = m_layoutSVGImage.imageResource()->cachedImage() ;
82 82
83 // Images with preserveAspectRatio=none should force non-uniform 83 // Images with preserveAspectRatio=none should force non-uniform
84 // scaling. This can be achieved by setting the image's container size to 84 // scaling. This can be achieved by setting the image's container size to
85 // its viewport size (i.e. if a viewBox is available - use that - else use i ntrinsic size.) 85 // its viewport size (i.e. if a viewBox is available - use that - else use i ntrinsic size.)
86 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRa tio' attribute. 86 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRa tio' attribute.
87 Length intrinsicWidth; 87 FloatSize intrinsicSize;
88 Length intrinsicHeight;
89 FloatSize intrinsicRatio; 88 FloatSize intrinsicRatio;
90 cachedImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio); 89 cachedImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio);
91 return intrinsicRatio; 90 return intrinsicRatio;
92 } 91 }
93 92
94 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp ('k') | third_party/WebKit/Source/core/style/StyleFetchedImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698