Bug 257614 - Set intrinsic size for inline SVG earlier
Summary: Set intrinsic size for inline SVG earlier
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
: 230045 243661 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-06-01 12:21 PDT by Ahmad Saleem
Modified: 2023-07-26 09:34 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-06-01 12:21:56 PDT
Hi Team,

While going through failing testcases and bugs in SVG from Blink's Monorail, came across another failing:

Test Case: https://jsfiddle.net/k8w1og6d/show

^ Show 'Red' in STP171 while Chrome Canary 116 and Firefox Nightly 115 works fine and only have green.

Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/545b2183e1b4ee3eb433537f9a6386b5337d6588

Just wanted to raise, so we can track.

Marking this as 'BrowserCompat'.

Thanks!
Comment 1 Radar WebKit Bug Importer 2023-06-08 12:22:16 PDT
<rdar://problem/110480382>
Comment 2 Ahmad Saleem 2023-07-25 15:42:30 PDT
Changes needed in Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:

const int defaultWidth = 300;
const int defaultHeight = 150;

LegacyRenderSVGRoot::LegacyRenderSVGRoot(SVGSVGElement& element, RenderStyle&& style)
    : RenderReplaced(element, WTFMove(style))
    , m_isLayoutSizeChanged(false)
    , m_needsBoundariesOrTransformUpdate(true)
    , m_hasBoxDecorations(false)
{
    LayoutSize intrinsicSize(calculateIntrinsicSize());
    if (!intrinsicSize.width())
        intrinsicSize.setWidth(defaultWidth);
    if (!intrinsicSize.height())
        intrinsicSize.setHeight(defaultHeight);
    setIntrinsicSize(intrinsicSize);
}

and


FloatSize LegacyRenderSVGRoot::calculateIntrinsicSize() const
{
    return FloatSize(floatValueForLength(svgSVGElement().intrinsicWidth(), 0), floatValueForLength(svgSVGElement().intrinsicHeight(), 0));
}

void LegacyRenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, FloatSize& intrinsicRatio) const
{
    ASSERT(!shouldApplySizeContainment());
    // https://www.w3.org/TR/SVG/coords.html#IntrinsicSizing
    intrinsicSize = calculateIntrinsicSize();
    if (style().aspectRatio
...

__

and Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h:

FloatSize calculateIntrinsicSize() const;

_____

Make us pass the test in Legacy, will try LBSE next.
Comment 3 EWS 2023-07-26 08:50:00 PDT
Committed 266314@main (dbdb89fe49e8): <https://commits.webkit.org/266314@main>

Reviewed commits have been landed. Closing PR #16084 and removing active labels.
Comment 4 Ahmad Saleem 2023-07-26 09:34:48 PDT
*** Bug 230045 has been marked as a duplicate of this bug. ***
Comment 5 Ahmad Saleem 2023-07-26 09:34:59 PDT
*** Bug 243661 has been marked as a duplicate of this bug. ***