[webkit-changes] [WebKit/WebKit] 30f321: [css-text-4] Implement multi-value syntax for whit...

Tim Nguyen noreply at github.com
Wed Jun 28 10:24:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 30f3214ab2d13ea5977cdba2f97ea230a4d5d5d9
      https://github.com/WebKit/WebKit/commit/30f3214ab2d13ea5977cdba2f97ea230a4d5d5d9
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/white-space-shorthand-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/white-space-expected.txt
    M Source/WebCore/css/CSSPrimitiveValueMappings.h
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/ShorthandSerializer.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.h

  Log Message:
  -----------
  [css-text-4] Implement multi-value syntax for white-space CSS property
https://bugs.webkit.org/show_bug.cgi?id=256926
rdar://109486180

Reviewed by Antti Koivisto and Darin Adler.

Implement `<white-space-collapse> || <text-wrap>` syntax from: https://drafts.csswg.org/css-text-4/#white-space-property

This allows new combinations to be expressed using the shorthand, notably:
- white-space-collapse: preserve-breaks; with text-wrap: nowrap;
- white-space-collapse: break-spaces; with text-wrap: nowrap;

Gate the new syntax behind the CSSWhiteSpaceLonghandsEnabled preference, since we don't have full layout support for those new combinations yet.

Also remove discard/preserve-spaces values from white-space-collapse that we don't plan to implement in the layout engine in the near future.
They can be re-added later easily once we get to implementing them.

* LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/white-space-shorthand-expected.txt:
Rebaseline now passing test.

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/white-space-expected.txt:
Rebaseline test now that we removed discard/preserve-spaces.

* Source/WebCore/css/CSSPrimitiveValueMappings.h:
Remove white-space-collapse values that aren't planned in the near future (discard & preserve-spaces).

* Source/WebCore/css/CSSProperties.json:
Remove white-space-collapse values that aren't planned in the near future (discard & preserve-spaces).
Also export parsers for white-space-collapse/text-wrap so they can be reused in CSSPropertyParser.cpp.

* Source/WebCore/css/CSSValueKeywords.in:
Remove white-space-collapse values that aren't planned in the near future (discard & preserve-spaces).

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::ComputedStyleExtractor::whiteSpaceShorthandValue):
Implement computed style serialization for the previously unsupported combinations of text-wrap/white-space-collapse.

* Source/WebCore/css/ShorthandSerializer.cpp:
(WebCore::ShorthandSerializer::serializeWhiteSpace const):
Implement specified style serialization for the previously unsupported combinations of text-wrap/white-space-collapse.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeWhiteSpaceShorthand):
Add parsing support for the multi-value syntax.

* Source/WebCore/rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* Source/WebCore/rendering/style/RenderStyleConstants.h:
Remove white-space-collapse values that aren't planned to be implemented in the layout engine (discard & preserve-spaces).

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




More information about the webkit-changes mailing list