Bug 215409

Summary: getPropertyValue for url path doesn't return the "#" character
Product: WebKit Reporter: Thien <dvkndn>
Component: New BugsAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, koivisto, macpherson, menard, rbuis, sabouhallawa, sam, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: Mac   
OS: macOS 10.15   
Attachments:
Description Flags
Patch
none
Patch
none
Patch ews-feeder: commit-queue-

Description Thien 2020-08-12 03:59:09 PDT
When calling getPropertyValue of a property that is a url(...) pointing to another element (common in SVG), the result is returned without the "#" part.

For example, the CSS:

```
marker-mid: url(#dot)
```

The returned string in:
- Firefox 79: "url(#dot)"
- Chrome 84: "url(#dot)"
- Safari 13: "url(dot)"

Demo: https://codesandbox.io/s/modest-moon-z98tr?file=/index.html
Comment 1 Radar WebKit Bug Importer 2020-08-12 11:00:12 PDT
<rdar://problem/66919778>
Comment 2 Rob Buis 2021-05-01 06:06:28 PDT
Created attachment 427495 [details]
Patch
Comment 3 Rob Buis 2021-05-02 04:00:32 PDT
Created attachment 427523 [details]
Patch
Comment 4 EWS 2021-05-02 12:08:40 PDT
Committed r276888 (237234@main): <https://commits.webkit.org/237234@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 427523 [details].
Comment 5 Darin Adler 2021-05-02 17:52:46 PDT
Comment on attachment 427523 [details]
Patch

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

> Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp:125
> +            return CSSPrimitiveValue::create(makeString('#', svgStyle.maskerResource()), CSSUnitType::CSS_URI);

More efficient because it uses '#'.

> Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp:139
> +            return CSSPrimitiveValue::create(makeString("#", svgStyle.markerEndResource()), CSSUnitType::CSS_URI);

Slightly less efficient because it uses "#". Should be consistent.
Comment 6 Rob Buis 2021-05-03 00:59:52 PDT
Reopening to attach new patch.
Comment 7 Rob Buis 2021-05-03 00:59:55 PDT
Created attachment 427542 [details]
Patch
Comment 8 Rob Buis 2021-05-03 02:07:13 PDT
Comment on attachment 427523 [details]
Patch

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

>> Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp:125
>> +            return CSSPrimitiveValue::create(makeString('#', svgStyle.maskerResource()), CSSUnitType::CSS_URI);
> 
> More efficient because it uses '#'.

I see.

>> Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp:139
>> +            return CSSPrimitiveValue::create(makeString("#", svgStyle.markerEndResource()), CSSUnitType::CSS_URI);
> 
> Slightly less efficient because it uses "#". Should be consistent.

I intended to at least be consistent but failed there, so I made a fix-up patch.
Comment 9 EWS 2021-05-03 02:24:43 PDT
Committed r276894 (237240@main): <https://commits.webkit.org/237240@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 427542 [details].