Bug 223205 - Add CSSValuePair.h in preparation for Pair.h refactor
Summary: Add CSSValuePair.h in preparation for Pair.h refactor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 223204
  Show dependency treegraph
 
Reported: 2021-03-15 12:06 PDT by Tyler Wilcock
Modified: 2021-03-16 20:17 PDT (History)
9 users (show)

See Also:


Attachments
Patch (17.08 KB, patch)
2021-03-15 12:54 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (17.14 KB, patch)
2021-03-15 16:23 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (16.97 KB, patch)
2021-03-16 11:03 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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