[webkit-changes] [WebKit/WebKit] a24a25: Back identifier tokens in custom properties with s...

Antti Koivisto noreply at github.com
Tue Feb 27 04:00:16 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a24a25b87e86c3c62d9e4ca0cc1e8f4d3939c8eb
      https://github.com/WebKit/WebKit/commit/a24a25b87e86c3c62d9e4ca0cc1e8f4d3939c8eb
  Author: Antti Koivisto <antti at apple.com>
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
    M Source/WebCore/css/CSSVariableData.cpp
    M Source/WebCore/css/parser/CSSParserToken.cpp
    M Source/WebCore/css/parser/CSSParserToken.h

  Log Message:
  -----------
  Back identifier tokens in custom properties with string literals
https://bugs.webkit.org/show_bug.cgi?id=269986
rdar://123506269

Reviewed by Cameron McCormack.

Tokens don't own the underlying string so we construct a separate backing string for tokens that need it.
Identifier tokens can in mosts cases be backed by their string literals, saving memory and work.

* Source/WebCore/css/CSSVariableData.cpp:
(WebCore::CSSVariableData::updateBackingStringsInTokens):
(WebCore::CSSVariableData::CSSVariableData):

Point the string backing to a literal if possible.

* Source/WebCore/css/parser/CSSParserToken.cpp:
(WebCore::CSSParserToken::id const):
(WebCore::CSSParserToken::functionId const):
(WebCore::CSSParserToken::identOrFunctionId const):
(WebCore::CSSParserToken::tryUseStringLiteralBacking):

Known identifier tokens can use literal backing if cases match (usually all lowercase).

(WebCore::CSSParserToken::copyWithUpdatedString const): Deleted.

Remove unsed function.

* Source/WebCore/css/parser/CSSParserToken.h:
(WebCore::CSSParserToken::isBackedByStringLiteral const):
(WebCore::CSSParserToken::initValueFromStringView):

* Source/WebCore/css/parser/CSSParserToken.h:

Canonical link: https://commits.webkit.org/275375@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list