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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp

Issue 1687503002: Introduce IntrinsicSizingInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make passed reference const 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
index 165d5f50d4b7783a9ae406a29deb71a29b05700c..840ffc71caabd6fc42427e2c0249692b45269f0f 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
@@ -68,16 +68,16 @@ FloatSize LayoutSVGRoot::calculateIntrinsicSize() const
return FloatSize(floatValueForLength(svg->intrinsicWidth(), 0), floatValueForLength(svg->intrinsicHeight(), 0));
}
-void LayoutSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
+void LayoutSVGRoot::computeIntrinsicSizingInfo(IntrinsicSizingInfo& intrinsicSizingInfo) const
{
// https://www.w3.org/TR/SVG/coords.html#IntrinsicSizing
- intrinsicSize = calculateIntrinsicSize();
+ intrinsicSizingInfo.size = calculateIntrinsicSize();
if (!isHorizontalWritingMode())
- intrinsicSize = intrinsicSize.transposedSize();
+ intrinsicSizingInfo.size = intrinsicSizingInfo.size.transposedSize();
- if (!intrinsicSize.isEmpty()) {
- intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height());
+ if (!intrinsicSizingInfo.size.isEmpty()) {
+ intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size.width() / static_cast<double>(intrinsicSizingInfo.size.height());
} else {
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
@@ -85,9 +85,9 @@ void LayoutSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, d
FloatSize viewBoxSize = svg->viewBox()->currentValue()->value().size();
if (!viewBoxSize.isEmpty()) {
// The viewBox can only yield an intrinsic ratio, not an intrinsic size.
- intrinsicRatio = viewBoxSize.width() / static_cast<double>(viewBoxSize.height());
+ intrinsicSizingInfo.aspectRatio = viewBoxSize.width() / static_cast<double>(viewBoxSize.height());
if (!isHorizontalWritingMode())
- intrinsicRatio = 1 / intrinsicRatio;
+ intrinsicSizingInfo.aspectRatio = 1 / intrinsicSizingInfo.aspectRatio;
}
}
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.h ('k') | third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698