Bug 201731

Summary: [SVG2] fill-opacity, stroke-opacity, stop-opacity and flood-opacity doe not support percentage
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: SVGAssignee: Dirk Schulze <krit>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dbates, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, joepeck, krit, macpherson, menard, simon.fraser, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 191292, 200143, 203503    
Attachments:
Description Flags
fill-opacity-percentage
none
Patch
none
Archive of layout-test-results from ews210 for win-future
none
Patch none

Description Said Abou-Hallawa 2019-09-12 11:50:41 PDT
The specs:

https://svgwg.org/svg2-draft/painting.html#FillOpacityProperty
https://svgwg.org/svg2-draft/painting.html#StrokeOpacity
https://svgwg.org/svg2-draft/pservers.html#StopOpacityProperty
https://drafts.fxtf.org/filter-effects/#propdef-flood-opacity
https://drafts.csswg.org/css-color-4/#typedef-alpha-value

show that the opacity can be either a number or a percentage which should be clamped to the range [0..1]. Currently we only support the number format and we do not support the percentage. See the attached test case.
Comment 1 Said Abou-Hallawa 2019-09-12 11:52:35 PDT
Created attachment 378665 [details]
fill-opacity-percentage
Comment 3 Dirk Schulze 2019-10-28 07:17:54 PDT
This is an issue with the normal opacity property as well. All take the same values now.
Comment 4 Dirk Schulze 2019-10-28 13:20:48 PDT
Created attachment 382098 [details]
Patch
Comment 5 Simon Fraser (smfr) 2019-10-28 13:27:00 PDT
Comment on attachment 382098 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=382098&action=review

> Source/WebCore/ChangeLog:16
> +        Tests: fast/css/parsing-opacity.html
> +               fast/svg/parsing-fill-opacity.html
> +               fast/svg/parsing-flood-opacity.html
> +               fast/svg/parsing-stop-opacity.html
> +               fast/svg/parsing-stroke-opacity.html

These should be WPT, if there isn't already WPT coverage.

> LayoutTests/fast/css/parsing-opacity.html:62
> +testInner("opacity", "0", "0");
> +testInner("opacity", "0.5", "0.5");
> +testInner("opacity", "1", "1");
> +testInner("opacity", "1000", "1000");
> +testInner("opacity", "-400", "-400");
> +testInner("opacity", "20%", "20%");
> +testInner("opacity", "-600%", "-600%");
> +testInner("opacity", "700%", "700%");
> +testComputed("opacity", "0", "0");
> +testComputed("opacity", "0.5", "0.5");
> +testComputed("opacity", "1", "1");
> +testComputed("opacity", "1000", "1");
> +testComputed("opacity", "-400", "0");
> +testComputed("opacity", "25%", "0.25");
> +testComputed("opacity", "-600%", "0");
> +testComputed("opacity", "700%", "1");
> +negativeTest("opacity", "2px");
> +negativeTest("opacity", "auto");
> +negativeTest("opacity", "none");
> +negativeTest("opacity", "'str'");

How about 100.2% and 2.5E2 values and %?
Comment 6 EWS Watchlist 2019-10-28 15:02:00 PDT
Comment on attachment 382098 [details]
Patch

Attachment 382098 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/13185980

New failing tests:
svg/W3C-SVG-1.1/painting-fill-05-b.svg
svg/css/parse-calc-length.html
svg/custom/invalid-css.svg
Comment 7 EWS Watchlist 2019-10-28 15:02:03 PDT
Created attachment 382115 [details]
Archive of layout-test-results from ews210 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews210  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 8 Dirk Schulze 2019-10-29 00:57:36 PDT
Created attachment 382163 [details]
Patch
Comment 9 Dirk Schulze 2019-10-29 01:01:03 PDT
There are indeed WPT tests. However, Bug 203503 prevents them from running currently. No need to duplicate the tests in WPT.

Added suggested additional tests.
Comment 10 WebKit Commit Bot 2019-10-29 03:27:43 PDT
Comment on attachment 382163 [details]
Patch

Clearing flags on attachment: 382163

Committed r251696: <https://trac.webkit.org/changeset/251696>
Comment 11 WebKit Commit Bot 2019-10-29 03:27:45 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2019-10-29 03:28:18 PDT
<rdar://problem/56702114>