Bug 232932

Summary: Default computed value for "content" should be "none" for ::before and ::after
Product: WebKit Reporter: Antoine Quint <graouts>
Component: CSSAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, koivisto, macpherson, menard, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=232942
Attachments:
Description Flags
Patch
none
Patch
koivisto: review+, ews-feeder: commit-queue-
Patch none

Description Antoine Quint 2021-11-10 02:17:07 PST
Default computed value for "content" should be "none" for ::before and ::after
Comment 1 Antoine Quint 2021-11-10 02:17:43 PST
Created attachment 443787 [details]
Patch
Comment 2 Antoine Quint 2021-11-10 06:49:52 PST
Created attachment 443813 [details]
Patch
Comment 3 Antoine Quint 2021-11-10 12:23:33 PST
Created attachment 443846 [details]
Patch
Comment 4 Darin Adler 2021-11-10 14:13:38 PST
Comment on attachment 443846 [details]
Patch

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

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1822
> +        list->append(cssValuePool.createIdentifierValue(isBeforeOrAfter ? CSSValueNone : CSSValueNormal));

Is it correct that we return this in a list rather than just the identifier, not in a list? Seems to me that it should not be a list, just a single value.

Are we testing any code path that can tell the two apart, or only tests that involve serializing as text where we can’t tell a list with one element apart from a value?
Comment 5 Antoine Quint 2021-11-10 23:41:35 PST
(In reply to Darin Adler from comment #4)
> Comment on attachment 443846 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=443846&action=review
> 
> > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1822
> > +        list->append(cssValuePool.createIdentifierValue(isBeforeOrAfter ? CSSValueNone : CSSValueNormal));
> 
> Is it correct that we return this in a list rather than just the identifier,
> not in a list? Seems to me that it should not be a list, just a single value.

I assume as much as we return all values, even single ones, in a list as well. For instance, `content: "test"` will return that single value in a list.

> Are we testing any code path that can tell the two apart, or only tests that
> involve serializing as text where we can’t tell a list with one element
> apart from a value?

I haven't looked at all the WPT coverage for `content` to answer this, but the particular tests that are progressing only look at the serialized text value.
Comment 6 Antoine Quint 2021-11-10 23:42:02 PST
I will land this as-is because returning a single value within a list is not a new behavior here.
Comment 7 EWS 2021-11-11 00:08:32 PST
Committed r285621 (244122@main): <https://commits.webkit.org/244122@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 443846 [details].
Comment 8 Radar WebKit Bug Importer 2021-11-11 00:09:20 PST
<rdar://problem/85287828>
Comment 9 Darin Adler 2021-11-11 10:39:40 PST
Comment on attachment 443846 [details]
Patch

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

>>> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1822
>>> +        list->append(cssValuePool.createIdentifierValue(isBeforeOrAfter ? CSSValueNone : CSSValueNormal));
>> 
>> Is it correct that we return this in a list rather than just the identifier, not in a list? Seems to me that it should not be a list, just a single value.
>> 
>> Are we testing any code path that can tell the two apart, or only tests that involve serializing as text where we can’t tell a list with one element apart from a value?
> 
> I assume as much as we return all values, even single ones, in a list as well. For instance, `content: "test"` will return that single value in a list.

This patch is fine.

Separately, I think that we need to add tests that can tell the difference between lists and single values to WPT. Otherwise, differences between browsers can crop up and cause website incompatibilities.