Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 126c191252fda4522a37db35b2eadc441243d360
      
https://github.com/WebKit/WebKit/commit/126c191252fda4522a37db35b2eadc441243d360
  Author: Issac Roy <[email protected]>
  Date:   2026-08-31 (Mon, 31 Aug 2026)

  Changed paths:
    A LayoutTests/css3/flexbox/flex-wrap-balance-disabled-expected.txt
    A LayoutTests/css3/flexbox/flex-wrap-balance-disabled.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-computed-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-valid-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/Headers.cmake
    M Source/WebCore/SaferCPPExpectations/NoDeleteCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/css/CSSFlexWrapValue.cpp
    A Source/WebCore/css/CSSFlexWrapValue.h
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/CSSValue.cpp
    M Source/WebCore/css/CSSValue.h
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSPropertyParserCustom.h
    A Source/WebCore/css/values/flexbox/CSSFlexWrap.h
    M Source/WebCore/html/shadow/TextControlInnerElements.cpp
    M Source/WebCore/inspector/InspectorOverlay.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h
    M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp
    M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
    M Source/WebCore/rendering/GridLayoutFunctions.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.h
    M Source/WebCore/style/computed/StyleComputedStyleBase.h
    M Source/WebCore/style/computed/data/StyleFlexibleBoxData.cpp
    M Source/WebCore/style/computed/data/StyleFlexibleBoxData.h
    A Source/WebCore/style/values/flexbox/StyleFlexWrap.cpp
    A Source/WebCore/style/values/flexbox/StyleFlexWrap.h
    M Source/WebCore/style/values/primitives/StyleKeyword+Mappings.h
    M 
Source/WebCore/style/values/primitives/StyleKeyword+ValueRepresentationNeeded.h

  Log Message:
  -----------
  Add parsing support for flex-wrap: balance
  https://bugs.webkit.org/show_bug.cgi?id=314423
  rdar://177185140

  Reviewed by Tim Nguyen and Sam Weinig.

  css-flexbox-2 widens flex-wrap to `nowrap | [ wrap | wrap-reverse ] || 
balance`,
  where `balance` evens out free space across flex lines instead of greedily
  filling each one. Parsing, storage and serialization only, behind
  CSSFlexWrapBalanceEnabled and off by default; `balance` still renders as
  `wrap` until the algorithm lands separately.

  flex-wrap moves off the plain RenderStyleConstants.h enum and onto a
  CSS::FlexWrap value type in css/values/flexbox/, modelled on 
CSS::GridAutoFlow.
  It is variant-like, so DEFINE_VARIANT_LIKE_CONFORMANCE supplies Serialize<>,
  CSSValueCreation<> and child visitation from switchOn alone, and the
  minimal-form elision the spec asks for -- `wrap balance` serializing as
  `balance` -- lives in switchOn and nowhere else. Style::FlexWrap is the
  computed-value type the builder dispatches through.

  `wrap-reverse balance` needs two keywords, so the grammar carries
  @(type=CSSFlexWrapValue) and the multi-keyword case parses into a
  CSSFlexWrapValue. Codegen keeps its single-item optimization ahead of the
  create() call, so a lone `nowrap`, `wrap`, `wrap-reverse` or `balance` still
  arrives at the Style conversion as a CSSKeywordValue; the conversion handles
  both shapes.

  Also drops two stale Safer C++ expectations that the checkers no longer
  report.

  Tests: css3/flexbox/flex-wrap-balance-disabled.html
  
imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-computed.html
  imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-invalid.html
  imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-valid.html

  * LayoutTests/css3/flexbox/flex-wrap-balance-disabled-expected.txt: Added.
  * LayoutTests/css3/flexbox/flex-wrap-balance-disabled.html: Added.
  * 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-computed-expected.txt:
  * 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-valid-expected.txt:
  `balance` and `wrap-reverse balance` now parse and serialize.
  * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
  Adds CSSFlexWrapBalanceEnabled, testable and off by default.
  * Source/WebCore/CMakeLists.txt:
  * Source/WebCore/Headers.cmake:
  * Source/WebCore/Sources.txt:
  * Source/WebCore/WebCore.xcodeproj/project.pbxproj:
  * Source/WebCore/SaferCPPExpectations/NoDeleteCheckerExpectations:
  * Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations:
  Removes css/DOMMatrixReadOnly.cpp and css/ShorthandSerializer.cpp, which the
  checkers stopped reporting.
  * Source/WebCore/css/CSSFlexWrapValue.cpp: Added.
  * Source/WebCore/css/CSSFlexWrapValue.h: Added.
  The CSSValue subclass holding a parsed two-keyword flex-wrap.
  * Source/WebCore/css/CSSProperties.json:
  The new grammar, `balance` gated on the setting, and Style::FlexWrap as the
  computed-style type.
  * Source/WebCore/css/CSSValue.cpp:
  * Source/WebCore/css/CSSValue.h:
  Registers ClassType::FlexWrap so visitDerived dispatches destruction, equals
  and cssText.
  * Source/WebCore/css/parser/CSSParserContext.cpp:
  (WebCore::add):
  * Source/WebCore/css/parser/CSSParserContext.h:
  A settings-flag needs three hand edits here: the bitfield, its initializer,
  and the hash and equality tuple.
  * Source/WebCore/css/parser/CSSPropertyParserCustom.h:
  Generated CSSPropertyParsing.cpp has a fixed include list and emits nothing
  imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-valid.html

  * LayoutTests/css3/flexbox/flex-wrap-balance-disabled-expected.txt: Added.
  * LayoutTests/css3/flexbox/flex-wrap-balance-disabled.html: Added.
  * 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-computed-expected.txt:
  * 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/flex-wrap-valid-expected.txt:
  `balance` and `wrap-reverse balance` now parse and serialize.
  * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
  Adds CSSFlexWrapBalanceEnabled, testable and off by default.
  * Source/WebCore/CMakeLists.txt:
  * Source/WebCore/Headers.cmake:
  * Source/WebCore/Sources.txt:
  * Source/WebCore/WebCore.xcodeproj/project.pbxproj:
  * Source/WebCore/SaferCPPExpectations/NoDeleteCheckerExpectations:
  * Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations:
  Removes css/DOMMatrixReadOnly.cpp and css/ShorthandSerializer.cpp, which the
  checkers stopped reporting.
  * Source/WebCore/css/CSSFlexWrapValue.cpp: Added.
  * Source/WebCore/css/CSSFlexWrapValue.h: Added.
  The CSSValue subclass holding a parsed two-keyword flex-wrap.
  * Source/WebCore/css/CSSProperties.json:
  The new grammar, `balance` gated on the setting, and Style::FlexWrap as the
  computed-style type.
  * Source/WebCore/css/CSSValue.cpp:
  * Source/WebCore/css/CSSValue.h:
  Registers ClassType::FlexWrap so visitDerived dispatches destruction, equals
  and cssText.
  * Source/WebCore/css/parser/CSSParserContext.cpp:
  (WebCore::add):
  * Source/WebCore/css/parser/CSSParserContext.h:
  A settings-flag needs three hand edits here: the bitfield, its initializer,
  and the hash and equality tuple.
  * Source/WebCore/css/parser/CSSPropertyParserCustom.h:
  Generated CSSPropertyParsing.cpp has a fixed include list and emits nothing
  for @(type=), so CSSFlexWrapValue.h has to be reachable from here.
  * Source/WebCore/css/values/flexbox/CSSFlexWrap.h: Added.
  * Source/WebCore/html/shadow/TextControlInnerElements.cpp:
  (WebCore::TextControlInnerContainer::resolveCustomStyle):
  * Source/WebCore/inspector/InspectorOverlay.cpp:
(WebCore::TextControlInnerContainer::resolveCustomStyle):
* Source/WebCore/inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildFlexOverlay):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp:
(WebCore::FlexFormattingUtils::isWrapReverse):
(WebCore::FlexFormattingUtils::isMultiline):
(WebCore::FlexFormattingUtils::isBalance):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h:
* Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp:
(WebCore::Layout::GridLayoutUtils::inlineContributionMayRequireFullSizingAlgorithmForIntrinsicWidth):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::flexLayoutConstraints const):
Plumbs isBalance through to layout, unread for now.
* Source/WebCore/rendering/GridLayoutFunctions.cpp:
(WebCore::GridLayoutFunctions::isGridItemInlineSizeDependentOnBlockConstraints):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::isStretchingColumnFlexItem const):
(WebCore::RenderBox::sizesLogicalWidthToFitContent const):
* Source/WebCore/rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* Source/WebCore/rendering/style/RenderStyleConstants.h:
(WebCore::toAxisDirection):
Removes the old three-value enum, its TextStream operator and its
AxisDirection overload. Callers that compared against enumerators now ask
isMultiline(), isReverse() or isBalance(), so growing to five states does not
multiply comparison sites.
* Source/WebCore/style/computed/StyleComputedStyleBase.h:
* Source/WebCore/style/computed/data/StyleFlexibleBoxData.cpp:
(WebCore::Style::FlexibleBoxData::FlexibleBoxData):
(WebCore::Style::FlexibleBoxData::dumpDifferences const):
* Source/WebCore/style/computed/data/StyleFlexibleBoxData.h:
Five states still fit the existing 3-bit field.
* Source/WebCore/style/values/flexbox/StyleFlexWrap.cpp: Added.
(WebCore::Style::CSSValueConversion<FlexWrap>::operator()):
* Source/WebCore/style/values/flexbox/StyleFlexWrap.h: Added.
(WebCore::Style::toAxisDirection):
Replaces the deleted RenderStyleConstants.h overload, so
ComputedStyle::flexFlowMode is unchanged.
* Source/WebCore/style/values/primitives/StyleKeyword+Mappings.h:
(WebCore::toCSSValueID):
(WebCore::fromCSSValueID):
* 
Source/WebCore/style/values/primitives/StyleKeyword+ValueRepresentationNeeded.h:
Removes the shared-table mapping, which cannot express a two-keyword value.
  
(WebCore::Layout::GridLayoutUtils::inlineContributionMayRequireFullSizingAlgorithmForIntrinsicWidth):
  * Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
  (WebCore::LayoutIntegration::FlexLayout::flexLayoutConstraints const):
  Plumbs isBalance through to layout, unread for now.
  * Source/WebCore/rendering/GridLayoutFunctions.cpp:
  
(WebCore::GridLayoutFunctions::isGridItemInlineSizeDependentOnBlockConstraints):
  * Source/WebCore/rendering/RenderBox.cpp:
  (WebCore::RenderBox::isStretchingColumnFlexItem const):
  (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
  * Source/WebCore/rendering/style/RenderStyleConstants.cpp:
  (WebCore::operator<<):
  * Source/WebCore/rendering/style/RenderStyleConstants.h:
  (WebCore::toAxisDirection):
  Removes the old three-value enum, its TextStream operator and its
  AxisDirection overload. Callers that compared against enumerators now ask
  isMultiline(), isReverse() or isBalance(), so growing to five states does not
  multiply comparison sites.
  * Source/WebCore/style/computed/StyleComputedStyleBase.h:
  * Source/WebCore/style/computed/data/StyleFlexibleBoxData.cpp:
  (WebCore::Style::FlexibleBoxData::FlexibleBoxData):
  (WebCore::Style::FlexibleBoxData::dumpDifferences const):
  * Source/WebCore/style/computed/data/StyleFlexibleBoxData.h:
  Five states still fit the existing 3-bit field.
  * Source/WebCore/style/values/flexbox/StyleFlexWrap.cpp: Added.
  (WebCore::Style::CSSValueConversion<FlexWrap>::operator()):
  * Source/WebCore/style/values/flexbox/StyleFlexWrap.h: Added.
  (WebCore::Style::toAxisDirection):
  Replaces the deleted RenderStyleConstants.h overload, so
  ComputedStyle::flexFlowMode is unchanged.
  * Source/WebCore/style/values/primitives/StyleKeyword+Mappings.h:
  (WebCore::toCSSValueID):
  (WebCore::fromCSSValueID):
  * 
Source/WebCore/style/values/primitives/StyleKeyword+ValueRepresentationNeeded.

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



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

Reply via email to