[webkit-reviews] review granted: [Bug 216947] CSS serialization expects comments between certain tokens : [Attachment 409909] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 28 16:54:12 PDT 2020


Darin Adler <darin at apple.com> has granted Keith Miller
<keith_miller at apple.com>'s request for review:
Bug 216947: CSS serialization expects comments between certain tokens
https://bugs.webkit.org/show_bug.cgi?id=216947

Attachment 409909: Patch

https://bugs.webkit.org/attachment.cgi?id=409909&action=review




--- Comment #17 from Darin Adler <darin at apple.com> ---
Comment on attachment 409909
  --> https://bugs.webkit.org/attachment.cgi?id=409909
Patch

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

> Source/WebCore/css/parser/CSSParserToken.cpp:403
> +template<typename... CSSParserTokenTypes>
> +constexpr std::array<bool, numberOfCSSParserTokenTypes>
buildNextTokenNeedsCommentTable(CSSParserTokenTypes...
nextTokenNeedsCommentTable)
> +{
> +    std::array<bool, numberOfCSSParserTokenTypes> table { false };
> +    (table[nextTokenNeedsCommentTable] = ... = true);
> +    return table;
> +}

OK as is, but: Seems like this is *really* close to reinventing OptionSet.
Seems a shame to build something so specific to this use when we would have
something reusable. Also seems likely that using bits and shifting would be
even more efficient than the arrays here, and the count here is comfortably
under the 64 or 32 boundary.


More information about the webkit-reviews mailing list