Bug 223205

Summary: Add CSSValuePair.h in preparation for Pair.h refactor
Product: WebKit Reporter: Tyler Wilcock <twilco.o>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, macpherson, menard, simon.fraser, 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=223300
Bug Depends on:    
Bug Blocks: 223204    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Tyler Wilcock 2021-03-15 12:06:52 PDT
See parent bug for the motivation behind this work: https://bugs.webkit.org/show_bug.cgi?id=223204
Comment 1 Tyler Wilcock 2021-03-15 12:54:14 PDT
Created attachment 423226 [details]
Patch
Comment 2 Tyler Wilcock 2021-03-15 16:23:39 PDT
Created attachment 423260 [details]
Patch
Comment 3 Simon Fraser (smfr) 2021-03-16 09:20:56 PDT
Comment on attachment 423260 [details]
Patch

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

> Source/WebCore/css/CSSValuePair.cpp:37
> +    return first + separatorCssText() + second;

makeString() might be more efficient.

> Source/WebCore/css/CSSValuePair.h:36
> + * Intended to replace Pair.h, which is only capable of containing CSSPrimitiveValues, and is not a sub-class of
> + * CSSValue itself. See https://bugs.webkit.org/show_bug.cgi?id=223204.

This comment won't be useful in the future when Pair.h is lost in the mists of time.
Comment 4 Tyler Wilcock 2021-03-16 11:03:52 PDT
Created attachment 423358 [details]
Patch
Comment 5 Tyler Wilcock 2021-03-16 17:36:09 PDT
Thanks for the review, Simon.  Marked this new patch with cq?
Comment 6 EWS 2021-03-16 19:12:17 PDT
Committed r274546: <https://commits.webkit.org/r274546>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423358 [details].
Comment 7 Radar WebKit Bug Importer 2021-03-16 19:13:14 PDT
<rdar://problem/75506725>
Comment 8 Darin Adler 2021-03-16 19:18:35 PDT
Comment on attachment 423358 [details]
Patch

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

> Source/WebCore/css/CSSValue.h:80
> +    String separatorCssText() const;

For efficiency, this should return ASCIILiteral instead of String. It never needs to return a value that’s not an ASCII literal, and this saves some memory allocation.

The name should be separatorCSSText, rather than separatorCssText.

> Source/WebCore/css/CSSValueList.cpp:89
> +    String separator = separatorCssText();

If we change separatorCSSText to return an ASCIILiteral, that’s the type we’ll want for this local variable too. Could just use "auto".
Comment 9 Tyler Wilcock 2021-03-16 20:17:31 PDT
(In reply to Darin Adler from comment #8)
> Comment on attachment 423358 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=423358&action=review
> 
> > Source/WebCore/css/CSSValue.h:80
> > +    String separatorCssText() const;
> 
> For efficiency, this should return ASCIILiteral instead of String. It never
> needs to return a value that’s not an ASCII literal, and this saves some
> memory allocation.
> 
> The name should be separatorCSSText, rather than separatorCssText.
> 
> > Source/WebCore/css/CSSValueList.cpp:89
> > +    String separator = separatorCssText();
> 
> If we change separatorCSSText to return an ASCIILiteral, that’s the type
> we’ll want for this local variable too. Could just use "auto".

Good to know, thanks!  I've made these changes here[1].  I'll mark this follow-up patch r? and cq? but feel free to wait to be sure EWS goes green first.

[1]: https://bugs.webkit.org/show_bug.cgi?id=223300