| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |