Bug 248212 - [SVG] default for x1, y1 and y2 is 0% for LinearGradient
Summary: [SVG] default for x1, y1 and y2 is 0% for LinearGradient
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2022-11-22 03:35 PST by Ahmad Saleem
Modified: 2022-12-14 13:22 PST (History)
4 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 2022-11-22 03:35:14 PST
Hi Team,

While going through Blink's commit, I come across following commit and while testing, noticed that we are still failing three out of four tests compared to Chrome Canary 110 and Firefox Nightly 109.

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/219dff463987f53c22f5f96f35a794246a13538d

Failing Test Case - https://jsfiddle.net/hpdbe0mr/show

Just wanted to raise bug for someone to tackle it.

I couldn't find 1-1 Webkit GitHub code so I might not be able to fix it.

Thanks!
Comment 1 Nikolas Zimmermann 2022-11-22 03:51:06 PST
Ahmad, that one is easy. SVGLinearGradientElement.h contains the default values as strings for WebKit, x2 is 100%, the rest is unset, aka 0.

    Ref<SVGAnimatedLength> m_x1 { SVGAnimatedLength::create(this, SVGLengthMode::Width) };
    Ref<SVGAnimatedLength> m_y1 { SVGAnimatedLength::create(this, SVGLengthMode::Height) };
    Ref<SVGAnimatedLength> m_x2 { SVGAnimatedLength::create(this, SVGLengthMode::Width, "100%"_s) };
    Ref<SVGAnimatedLength> m_y2 { SVGAnimatedLength::create(this, SVGLengthMode::Height) };
Comment 2 Ahmad Saleem 2022-11-22 03:51:55 PST
(In reply to Nikolas Zimmermann from comment #1)
> Ahmad, that one is easy. SVGLinearGradientElement.h contains the default
> values as strings for WebKit, x2 is 100%, the rest is unset, aka 0.
> 
>     Ref<SVGAnimatedLength> m_x1 { SVGAnimatedLength::create(this,
> SVGLengthMode::Width) };
>     Ref<SVGAnimatedLength> m_y1 { SVGAnimatedLength::create(this,
> SVGLengthMode::Height) };
>     Ref<SVGAnimatedLength> m_x2 { SVGAnimatedLength::create(this,
> SVGLengthMode::Width, "100%"_s) };
>     Ref<SVGAnimatedLength> m_y2 { SVGAnimatedLength::create(this,
> SVGLengthMode::Height) };

Should I give it a try or you want to take it?
Comment 3 Nikolas Zimmermann 2022-11-22 05:04:05 PST
(In reply to Ahmad Saleem from comment #2)
> Should I give it a try or you want to take it?
Give it a shot -- you might want to check if there's WPT test coverage for the default values, if so your patch will be a progression for WebKit on that front.
Comment 4 Ahmad Saleem 2022-11-22 05:22:47 PST
https://github.com/WebKit/WebKit/pull/6731
Comment 5 EWS 2022-11-26 04:01:38 PST
Committed 257032@main (7a2abd482abc): <https://commits.webkit.org/257032@main>

Reviewed commits have been landed. Closing PR #6731 and removing active labels.
Comment 6 Radar WebKit Bug Importer 2022-11-26 04:02:16 PST
<rdar://problem/102680120>
Comment 7 Said Abou-Hallawa 2022-12-14 13:22:30 PST
The specs link is: https://www.w3.org/TR/SVG2/pservers.html#LinearGradients