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

Unified Diff: Source/core/svg/graphics/SVGImage.cpp

Issue 1019813002: Use viewBox for SVG image as intrinsic size when all else fails (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated test expectations and added TODOs Created 5 years, 9 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 | « Source/core/layout/LayoutReplaced.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/graphics/SVGImage.cpp
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp
index 32d839fdebc7156085228a0d38be1ce4a596b7d8..dbb770f8a0e850419f0d6d2b33193c817ba44f11 100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -178,6 +178,13 @@ IntSize SVGImage::containerSize() const
intrinsicSize.setHeight(intrinsicSize.width() / intrinsicRatio);
}
+ // 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 (!intrinsicSize.isEmpty())
return expandedIntSize(intrinsicSize);
« no previous file with comments | « Source/core/layout/LayoutReplaced.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698