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

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGImagePainter.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 // 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 "config.h" 5 #include "config.h"
6 #include "core/paint/SVGImagePainter.h" 6 #include "core/paint/SVGImagePainter.h"
7 7
8 #include "core/layout/ImageQualityController.h" 8 #include "core/layout/ImageQualityController.h"
9 #include "core/layout/LayoutImageResource.h" 9 #include "core/layout/LayoutImageResource.h"
10 #include "core/layout/svg/LayoutSVGImage.h" 10 #include "core/layout/svg/LayoutSVGImage.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 if (m_layoutSVGImage.style()->outlineWidth()) { 45 if (m_layoutSVGImage.style()->outlineWidth()) {
46 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); 46 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering);
47 outlinePaintInfo.phase = PaintPhaseSelfOutline; 47 outlinePaintInfo.phase = PaintPhaseSelfOutline;
48 ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, LayoutPoi nt(boundingBox.location())); 48 ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, LayoutPoi nt(boundingBox.location()));
49 } 49 }
50 } 50 }
51 51
52 void SVGImagePainter::paintForeground(const PaintInfo& paintInfo) 52 void SVGImagePainter::paintForeground(const PaintInfo& paintInfo)
53 { 53 {
54 const LayoutImageResource* imageResource = m_layoutSVGImage.imageResource(); 54 const LayoutImageResource* imageResource = m_layoutSVGImage.imageResource();
55 IntSize imageViewportSize = expandedIntSize(computeImageViewportSize()); 55 LayoutSize imageViewportSize(computeImageViewportSize());
56 if (imageViewportSize.isEmpty()) 56 if (imageViewportSize.isEmpty())
57 return; 57 return;
58 58
59 RefPtr<Image> image = imageResource->image(imageViewportSize, m_layoutSVGIma ge.style()->effectiveZoom()); 59 RefPtr<Image> image = imageResource->image(imageViewportSize, m_layoutSVGIma ge.style()->effectiveZoom());
60 FloatRect destRect = m_layoutSVGImage.objectBoundingBox(); 60 FloatRect destRect = m_layoutSVGImage.objectBoundingBox();
61 FloatRect srcRect(0, 0, image->width(), image->height()); 61 FloatRect srcRect(0, 0, image->width(), image->height());
62 62
63 SVGImageElement* imageElement = toSVGImageElement(m_layoutSVGImage.element() ); 63 SVGImageElement* imageElement = toSVGImageElement(m_layoutSVGImage.element() );
64 imageElement->preserveAspectRatio()->currentValue()->transformRect(destRect, srcRect); 64 imageElement->preserveAspectRatio()->currentValue()->transformRect(destRect, srcRect);
65 65
(...skipping 20 matching lines...) Expand all
86 // its viewport size (i.e. if a viewBox is available - use that - else use i ntrinsic size.) 86 // its viewport size (i.e. if a viewBox is available - use that - else use i ntrinsic size.)
87 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRa tio' attribute. 87 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRa tio' attribute.
88 Length intrinsicWidth; 88 Length intrinsicWidth;
89 Length intrinsicHeight; 89 Length intrinsicHeight;
90 FloatSize intrinsicRatio; 90 FloatSize intrinsicRatio;
91 cachedImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio); 91 cachedImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio);
92 return intrinsicRatio; 92 return intrinsicRatio;
93 } 93 }
94 94
95 } // namespace blink 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698