Chromium Code Reviews| Index: Source/core/svg/graphics/SVGImage.cpp |
| diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp |
| index 88cd91b701dece68fed9b64a2e83845ba2bb5218..b9513150f1f21e6751fab7962fa1d2c60e988768 100644 |
| --- a/Source/core/svg/graphics/SVGImage.cpp |
| +++ b/Source/core/svg/graphics/SVGImage.cpp |
| @@ -162,16 +162,21 @@ IntSize SVGImage::containerSize() const |
| // Assure that a container size is always given for a non-identity zoom level. |
| ASSERT(renderer->style()->effectiveZoom() == 1); |
| - FloatSize currentSize; |
| - if (rootElement->hasIntrinsicWidth() && rootElement->hasIntrinsicHeight()) |
| - currentSize = rootElement->currentViewportSize(); |
| - else |
| - currentSize = rootElement->currentViewBoxRect().size(); |
| + FloatSize intrinsicSize; |
| + double intrinsicRatio = 0; |
| + renderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); |
| + |
| + if (intrinsicSize.isEmpty() && intrinsicRatio) { |
|
pdr.
2014/06/06 03:54:50
This logic seems correct but why isn't it needed e
davve
2014/06/06 20:26:26
AFAICT, private method computeAspectRatioInformati
|
| + if (!intrinsicSize.width() && intrinsicSize.height()) |
| + intrinsicSize.setWidth(intrinsicSize.height() * intrinsicRatio); |
| + else if (intrinsicSize.width() && !intrinsicSize.height()) |
| + intrinsicSize.setHeight(intrinsicSize.width() / intrinsicRatio); |
| + } |
| - if (!currentSize.isEmpty()) |
| - return IntSize(static_cast<int>(ceilf(currentSize.width())), static_cast<int>(ceilf(currentSize.height()))); |
| + if (!intrinsicSize.isEmpty()) |
| + return IntSize(static_cast<int>(ceilf(intrinsicSize.width())), static_cast<int>(ceilf(intrinsicSize.height()))); |
|
pdr.
2014/06/06 03:54:50
I think this is just expandedIntSize
davve
2014/06/06 20:26:27
Done.
|
| - // As last resort, use CSS default intrinsic size. |
| + // As last resort, use CSS replaced element fallback size. |
| return IntSize(300, 150); |
| } |