[webkit-changes] [WebKit/WebKit] b3ba78: Implement CSS Values 5 random()

Sam Weinig noreply at github.com
Sun Jan 12 16:40:21 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b3ba78888598c43590405267ac1d2c740f6e3cdb
      https://github.com/WebKit/WebKit/commit/b3ba78888598c43590405267ac1d2c740f6e3cdb
  Author: Sam Weinig <sam at webkit.org>
  Date:   2025-01-12 (Sun, 12 Jan 2025)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-computed.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-computed.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-invalid.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-invalid.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-serialize.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-serialize.tentative.html
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/calc/CSSCalcTree+CalculationValue.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Copy.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Evaluation.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Parser.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Serialization.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Simplification.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Simplification.h
    M Source/WebCore/css/calc/CSSCalcTree+Traversal.h
    M Source/WebCore/css/calc/CSSCalcTree.cpp
    M Source/WebCore/css/calc/CSSCalcTree.h
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/ElementRareData.cpp
    M Source/WebCore/dom/ElementRareData.h
    M Source/WebCore/platform/calc/CalculationExecutor.h
    M Source/WebCore/platform/calc/CalculationOperator.cpp
    M Source/WebCore/platform/calc/CalculationOperator.h
    A Source/WebCore/platform/calc/CalculationRandomKey.h
    A Source/WebCore/platform/calc/CalculationRandomKeyMap.h
    M Source/WebCore/platform/calc/CalculationTree+Copy.cpp
    M Source/WebCore/platform/calc/CalculationTree+Evaluation.cpp
    M Source/WebCore/platform/calc/CalculationTree+Traversal.h
    M Source/WebCore/platform/calc/CalculationTree.cpp
    M Source/WebCore/platform/calc/CalculationTree.h
    M Source/WebCore/style/MatchedDeclarationsCache.cpp
    M Source/WebCore/style/StyleBuilderState.cpp
    M Source/WebCore/style/StyleBuilderState.h
    M Source/WebCore/style/StyleSharingResolver.cpp

  Log Message:
  -----------
  Implement CSS Values 5 random()
https://bugs.webkit.org/show_bug.cgi?id=284344

Reviewed by Darin Adler.

Implements CSS Values 5 random() math function behind a
new feature flag, CSSRandomFunctionEnabled.

random() requires maintaining state on a per-document basis for
random values based on a "random cache key" derived from the
parameters to random(). Due to the layering of the Calculation
tree in platform, the mapping was divided into two parts: a
per-element/document wide mapping and then a mapping for the
remaining bits (optional identifier, min, max, optional step).

A conservative approach was take to disable style sharing as
necessary for per-element unique values where we use the
existence of any random key map on an element as indicator
that the element's style should not be shared. This is checked
in MatchedDeclarationsCache and SharingResolver.

* LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-computed.tentative-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-computed.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-invalid.tentative-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-invalid.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-serialize.tentative-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-serialize.tentative.html: Added.
    - Add new tests.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
    - Add feature flag.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/Headers.cmake:
    - Add new files.
* Source/WebCore/css/CSSValueKeywords.in:
    - Add new keywords.
* Source/WebCore/css/calc/CSSCalcTree+CalculationValue.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Copy.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Evaluation.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Parser.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Serialization.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Simplification.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Simplification.h:
* Source/WebCore/css/calc/CSSCalcTree+Traversal.h:
* Source/WebCore/css/calc/CSSCalcTree.cpp:
* Source/WebCore/css/calc/CSSCalcTree.h:
* Source/WebCore/css/parser/CSSParserContext.cpp:
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/dom/Document.cpp:
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Element.cpp:
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/ElementRareData.cpp:
* Source/WebCore/dom/ElementRareData.h:
* Source/WebCore/platform/calc/CalculationExecutor.h:
* Source/WebCore/platform/calc/CalculationOperator.cpp:
* Source/WebCore/platform/calc/CalculationOperator.h:
* Source/WebCore/platform/calc/CalculationRandomKey.h: Added.
* Source/WebCore/platform/calc/CalculationRandomKeyMap.h: Added.
* Source/WebCore/platform/calc/CalculationTree+Copy.cpp:
* Source/WebCore/platform/calc/CalculationTree+Evaluation.cpp:
* Source/WebCore/platform/calc/CalculationTree+Traversal.h:
* Source/WebCore/platform/calc/CalculationTree.cpp:
* Source/WebCore/platform/calc/CalculationTree.h:
* Source/WebCore/style/MatchedDeclarationsCache.cpp:
* Source/WebCore/style/StyleBuilderState.cpp:
* Source/WebCore/style/StyleBuilderState.h:
* Source/WebCore/style/StyleSharingResolver.cpp:

Canonical link: https://commits.webkit.org/288779@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