From a06e965dfb201acc0ffbdf696f1bb963ccc75cdb Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Tue, 28 Jun 2022 10:30:49 +0000 Subject: [PATCH] Bug 1762792 - SVG elements should render despite zero values in their width and height attributes (unless they're referencing a or element) r=emilio Differential Revision: https://phabricator.services.mozilla.com/D150258 --- dom/svg/SVGUseElement.cpp | 4 ++++ layout/reftests/svg/dynamic-use-03.svg | 4 +++- layout/reftests/svg/dynamic-use-04.svg | 14 +++++++------- layout/reftests/svg/reftest.list | 1 + layout/reftests/svg/use-01.svg | 10 +++++++--- layout/reftests/svg/use-02.svg | 17 +++++++++++++++++ 6 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 layout/reftests/svg/use-02.svg diff --git a/dom/svg/SVGUseElement.cpp b/dom/svg/SVGUseElement.cpp index a90cceb4ddc9..25521a5ba857 100644 --- a/dom/svg/SVGUseElement.cpp +++ b/dom/svg/SVGUseElement.cpp @@ -577,6 +577,10 @@ gfxMatrix SVGUseElement::PrependLocalTransformsTo( /* virtual */ bool SVGUseElement::HasValidDimensions() const { + if (!OurWidthAndHeightAreUsed()) { + return true; + } + return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() || mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) && (!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() || diff --git a/layout/reftests/svg/dynamic-use-03.svg b/layout/reftests/svg/dynamic-use-03.svg index 345d7b30c8ee..542b7e93559b 100644 --- a/layout/reftests/svg/dynamic-use-03.svg +++ b/layout/reftests/svg/dynamic-use-03.svg @@ -6,7 +6,9 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="background: lime;" class="reftest-wait"> - + + +