From 8f72a673ca9c6c85f36467720fa201a2caaa6038 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 31 Jul 2020 13:01:58 -0700 Subject: Issue #1619 - Missing Dimension Computation This existed in Firefox before this bug. I don't know if it came from a previous bug or was removed post-fork. --- layout/base/nsCSSRendering.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'layout') diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index e6e3b5f6f..d5df17020 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -5290,6 +5290,16 @@ nsImageRenderer::ComputeIntrinsicSize() if (haveHeight) { result.SetHeight(nsPresContext::CSSPixelsToAppUnits(imageIntSize.height)); } + + if (!haveHeight && haveWidth && result.mRatio) { + nscoord intrinsicHeight = + result.mRatio.Inverted().ApplyTo(imageIntSize.width); + result.SetHeight(nsPresContext::CSSPixelsToAppUnits(intrinsicHeight)); + } else if (haveHeight && !haveWidth && result.mRatio) { + nscoord intrinsicWidth = result.mRatio.ApplyTo(imageIntSize.height); + result.SetWidth(nsPresContext::CSSPixelsToAppUnits(intrinsicWidth)); + } + break; } case eStyleImageType_Element: -- cgit v1.2.3