[webkit-changes] [WebKit/WebKit] 7baf60: Only use CSSVariableReferenceValues for storing va...

Antti Koivisto noreply at github.com
Tue Sep 5 12:33:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7baf601ffa8bc860d7dcabb656d6de284afed5cb
      https://github.com/WebKit/WebKit/commit/7baf601ffa8bc860d7dcabb656d6de284afed5cb
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M Source/WebCore/css/CSSCustomPropertyValue.cpp
    M Source/WebCore/css/CSSVariableData.cpp
    M Source/WebCore/css/CSSVariableData.h
    M Source/WebCore/css/CSSVariableReferenceValue.cpp
    M Source/WebCore/css/CSSVariableReferenceValue.h
    M Source/WebCore/css/parser/CSSParserTokenRange.h
    M Source/WebCore/css/parser/CSSVariableParser.cpp
    M Source/WebCore/css/typedom/CSSUnparsedValue.cpp
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilder.h

  Log Message:
  -----------
  Only use CSSVariableReferenceValues for storing values that actually contain variable references
https://bugs.webkit.org/show_bug.cgi?id=261158
rdar://114983076

Reviewed by Alan Baradlay.

Currently all regular custom properties gets stored as CSSVariableReferenceValues even
when they don't contains any references. They should use the plain CSSVariableData instead
for efficiency.

* Source/WebCore/css/CSSCustomPropertyValue.cpp:
(WebCore::CSSCustomPropertyValue::isCurrentColor const):
* Source/WebCore/css/CSSVariableData.cpp:
(WebCore::CSSVariableData::CSSVariableData):

Move parser context from CSSVariableReferenceValue to CSSVariableData. It is needed for
resolving registered custom properties.

* Source/WebCore/css/CSSVariableData.h:
(WebCore::CSSVariableData::create):
(WebCore::CSSVariableData::context const):
* Source/WebCore/css/CSSVariableReferenceValue.cpp:
(WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue):
(WebCore::CSSVariableReferenceValue::create):
(WebCore::CSSVariableReferenceValue::context const):
(WebCore::CSSVariableReferenceValue::resolveVariableFallback const):
(WebCore::CSSVariableReferenceValue::resolveVariableReferences const):
* Source/WebCore/css/CSSVariableReferenceValue.h:
(WebCore::CSSVariableReferenceValue::context const): Deleted.
* Source/WebCore/css/parser/CSSParserTokenRange.h:
* Source/WebCore/css/parser/CSSVariableParser.cpp:
(WebCore::CSSVariableParser::parseDeclarationValue):

If there are no references create a plain CSSVariableData instead of CSSVariableReferenceValue.

* Source/WebCore/css/typedom/CSSUnparsedValue.cpp:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyCustomProperty):
(WebCore::Style::Builder::resolveCustomPropertyValue):

In case we have a variable containing CSSVariableData we can just return it directly and
not do anything with the tokens.

(WebCore::Style::Builder::resolveCustomPropertyValueWithVariableReferences): Deleted.

Rename for clarity. Also registered properties need resolving.

* Source/WebCore/style/StyleBuilder.h:

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




More information about the webkit-changes mailing list