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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.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
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index 3defaf5d34cb8192754a53731e0589d5766952f6..90a7524683d22369ce3b6c8bc99df714f4db7f04 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -153,26 +153,25 @@ IntSize SVGImage::containerSize() const
// Assure that a container size is always given for a non-identity zoom level.
ASSERT(layoutObject->style()->effectiveZoom() == 1);
- FloatSize intrinsicSize;
- double intrinsicRatio = 0;
- layoutObject->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
-
- if (intrinsicSize.isEmpty() && intrinsicRatio) {
- if (!intrinsicSize.width() && intrinsicSize.height())
- intrinsicSize.setWidth(intrinsicSize.height() * intrinsicRatio);
- else if (intrinsicSize.width() && !intrinsicSize.height())
- intrinsicSize.setHeight(intrinsicSize.width() / intrinsicRatio);
+ LayoutBox::IntrinsicSizingInfo intrinsicSizingInfo;
+ layoutObject->computeIntrinsicSizingInfo(intrinsicSizingInfo);
+
+ if (intrinsicSizingInfo.size.isEmpty() && intrinsicSizingInfo.aspectRatio) {
+ if (!intrinsicSizingInfo.size.width() && intrinsicSizingInfo.size.height())
+ intrinsicSizingInfo.size.setWidth(intrinsicSizingInfo.size.height() * intrinsicSizingInfo.aspectRatio);
+ else if (intrinsicSizingInfo.size.width() && !intrinsicSizingInfo.size.height())
+ intrinsicSizingInfo.size.setHeight(intrinsicSizingInfo.size.width() / intrinsicSizingInfo.aspectRatio);
}
// TODO(davve): In order to maintain aspect ratio the intrinsic
// size is faked from the viewBox as a last resort. This may cause
// unwanted side effects. Preferably we should be able to signal
// the intrinsic ratio in another way.
- if (intrinsicSize.isEmpty())
- intrinsicSize = rootElement->currentViewBoxRect().size();
+ if (intrinsicSizingInfo.size.isEmpty())
+ intrinsicSizingInfo.size = rootElement->currentViewBoxRect().size();
- if (!intrinsicSize.isEmpty())
- return expandedIntSize(intrinsicSize);
+ if (!intrinsicSizingInfo.size.isEmpty())
+ return expandedIntSize(intrinsicSizingInfo.size);
// As last resort, use CSS replaced element fallback size.
return IntSize(300, 150);
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698