Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4a9be0d0de8fae73bf03cb6f4ed25f65fa53a87f
https://github.com/WebKit/WebKit/commit/4a9be0d0de8fae73bf03cb6f4ed25f65fa53a87f
Author: Sam Weinig <[email protected]>
Date: 2025-06-04 (Wed, 04 Jun 2025)
Changed paths:
M Source/WebCore/CMakeLists.txt
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/animation/ViewTimeline.cpp
M Source/WebCore/css/CSSProperties.json
M Source/WebCore/css/values/CSSValueAggregates.h
M Source/WebCore/css/values/primitives/CSSPrimitiveNumericUnits.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/html/shadow/TextControlInnerElements.cpp
M Source/WebCore/layout/Verification.cpp
M Source/WebCore/layout/formattingContexts/FormattingGeometry.cpp
M Source/WebCore/layout/formattingContexts/FormattingGeometry.h
M Source/WebCore/layout/formattingContexts/block/BlockMarginCollapse.cpp
M Source/WebCore/layout/integration/LayoutIntegrationBoxGeometryUpdater.cpp
M Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
M Source/WebCore/page/PrintContext.cpp
M Source/WebCore/page/ios/ContentChangeObserver.cpp
M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp
M Source/WebCore/platform/Length.h
M Source/WebCore/platform/LengthFunctions.cpp
M Source/WebCore/platform/LengthFunctions.h
M Source/WebCore/platform/RectEdges.h
M Source/WebCore/platform/Theme.cpp
M Source/WebCore/platform/Theme.h
M Source/WebCore/platform/mac/ThemeMac.h
M Source/WebCore/platform/mac/ThemeMac.mm
M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
M Source/WebCore/rendering/PositionedLayoutConstraints.cpp
M Source/WebCore/rendering/PositionedLayoutConstraints.h
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderBlockFlow.cpp
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderBoxModelObject.cpp
M Source/WebCore/rendering/RenderBoxModelObject.h
M Source/WebCore/rendering/RenderBoxModelObjectInlines.h
M Source/WebCore/rendering/RenderButton.cpp
M Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
M Source/WebCore/rendering/RenderElement.cpp
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderFlexibleBox.h
M Source/WebCore/rendering/RenderGrid.cpp
M Source/WebCore/rendering/RenderInline.cpp
M Source/WebCore/rendering/RenderListMarker.cpp
M Source/WebCore/rendering/RenderMenuList.cpp
M Source/WebCore/rendering/RenderReplaced.cpp
M Source/WebCore/rendering/RenderScrollbarPart.cpp
M Source/WebCore/rendering/RenderTable.cpp
M Source/WebCore/rendering/RenderTextInlines.h
M Source/WebCore/rendering/RenderTheme.cpp
M Source/WebCore/rendering/RenderTheme.h
M Source/WebCore/rendering/adwaita/RenderThemeAdwaita.cpp
M Source/WebCore/rendering/adwaita/RenderThemeAdwaita.h
M Source/WebCore/rendering/ios/RenderThemeIOS.h
M Source/WebCore/rendering/ios/RenderThemeIOS.mm
M Source/WebCore/rendering/mac/RenderThemeMac.h
M Source/WebCore/rendering/mac/RenderThemeMac.mm
M Source/WebCore/rendering/style/RenderStyle.cpp
M Source/WebCore/rendering/style/RenderStyle.h
M Source/WebCore/rendering/style/RenderStyleInlines.h
M Source/WebCore/rendering/style/RenderStyleSetters.h
M Source/WebCore/rendering/style/StyleRareNonInheritedData.h
M Source/WebCore/rendering/style/StyleSurroundData.cpp
M Source/WebCore/rendering/style/StyleSurroundData.h
M Source/WebCore/rendering/updating/RenderTreeUpdaterViewTransition.cpp
M Source/WebCore/style/StyleAdjuster.cpp
M Source/WebCore/style/StyleBuilderConverter.h
M Source/WebCore/style/StyleBuilderCustom.h
M Source/WebCore/style/StyleExtractorConverter.h
M Source/WebCore/style/StyleExtractorCustom.h
M Source/WebCore/style/StyleExtractorSerializer.h
M Source/WebCore/style/StyleInterpolationFunctions.h
M Source/WebCore/style/StyleInterpolationWrappers.h
M Source/WebCore/style/values/StyleValueTypes.h
M Source/WebCore/style/values/borders/StyleBoxShadow.cpp
M Source/WebCore/style/values/borders/StyleBoxShadow.h
M Source/WebCore/style/values/borders/StyleCornerShapeValue.h
A Source/WebCore/style/values/box/StyleMargin.cpp
A Source/WebCore/style/values/box/StyleMargin.h
A Source/WebCore/style/values/box/StylePadding.cpp
A Source/WebCore/style/values/box/StylePadding.h
M Source/WebCore/style/values/color/StyleColor.cpp
M Source/WebCore/style/values/color/StyleDynamicRangeLimit.h
A Source/WebCore/style/values/position/StyleInset.cpp
A Source/WebCore/style/values/position/StyleInset.h
M
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Blending.h
M Source/WebCore/style/values/scroll-snap/StyleScrollMargin.cpp
M Source/WebCore/style/values/scroll-snap/StyleScrollMargin.h
M Source/WebCore/style/values/scroll-snap/StyleScrollPadding.cpp
M Source/WebCore/style/values/scroll-snap/StyleScrollPadding.h
M Source/WebCore/style/values/text-decoration/StyleTextShadow.cpp
M Source/WebCore/style/values/text-decoration/StyleTextShadow.h
Log Message:
-----------
[Style] Use strong Style value types for inset, margin and padding
https://bugs.webkit.org/show_bug.cgi?id=293907
Reviewed by Darin Adler.
Adds types to represent inset, margins and padding:
Style::InsetEdge (wraps WebCore::Length)
Style::InsetBox (minimally serializing group of Style::InsetEdges)
Style::MarginEdge (wraps WebCore::Length)
Style::MarginBox (minimally serializing group of Style::MarginEdges)
Style::PaddingEdge (wraps WebCore::Length)
Style::PaddingBox (minimally serializing group of Style::PaddingEdges)
The edge types are purely zero-cost wrappers of `WebCore::Length`, meaning there
should be no runtime overhead here. The goal of the types is to enforce what
keywords (e.g. 'auto') and value ranges (all or nonnegative) are allowed.
Additionally, instead of allowing direct access to the underlying
`WebCore::Length`
or to `WebCore::Length::value()`, the numeric value can be accessed via
functions
like `tryFixed()` which return `std::optional<Style::Length<R>>`. This means the
old idiomatic way for getting the value:
```
if (edge.isFixed())
useValue(edge.value());
```
is now replaced with:
```
if (auto fixedValue = edge.tryFixed())
useValue(fixedValue->value);
```
This ensures that the numeric value is not used without checking the type.
To make these new types possible, a few infrastructure changes were needed:
- `Style::Blending` was enhanced to add a new
`requiresInterpolationForAccumulativeIteration`
function to allow delegating
`Style::Interpolation::WrapperBase::requiresInterpolationForAccumulativeIteration`.
- `Style::Blending` was enhanced so that `canBlend` and the new
`requiresInterpolationForAccumulativeIteration`
are optional and have default values if not provided.
- `Style::Blending` was enhanced so that the dispatch functions now check which
versions of
the functions are implemented on the specializations allowing types to only
implement the
most advanced version they actually need.
- `Theme::controlPadding` was moved to `RenderTheme` to allow use of
`Style::PaddingBox`.
It is only called from `RenderTheme`.
There is quite a bit of duplication between the `*Edge` types that can and
should be reduced
in follow on changes.
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/animation/ViewTimeline.cpp:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/values/CSSValueAggregates.h:
* Source/WebCore/dom/Document.cpp:
* Source/WebCore/layout/Verification.cpp:
* Source/WebCore/layout/formattingContexts/FormattingGeometry.cpp:
* Source/WebCore/layout/formattingContexts/FormattingGeometry.h:
* Source/WebCore/layout/formattingContexts/block/BlockMarginCollapse.cpp:
* Source/WebCore/layout/integration/LayoutIntegrationBoxGeometryUpdater.cpp:
* Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp:
* Source/WebCore/page/PrintContext.cpp:
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:
* Source/WebCore/platform/Length.h:
* Source/WebCore/platform/LengthFunctions.cpp:
* Source/WebCore/platform/LengthFunctions.h:
* Source/WebCore/platform/RectEdges.h:
* Source/WebCore/platform/Theme.cpp:
* Source/WebCore/platform/Theme.h:
* Source/WebCore/platform/mac/ThemeMac.h:
* Source/WebCore/platform/mac/ThemeMac.mm:
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
* Source/WebCore/rendering/PositionedLayoutConstraints.cpp:
* Source/WebCore/rendering/PositionedLayoutConstraints.h:
* Source/WebCore/rendering/RenderBlock.cpp:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
* Source/WebCore/rendering/RenderBox.cpp:
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
* Source/WebCore/rendering/RenderBoxModelObject.h:
* Source/WebCore/rendering/RenderBoxModelObjectInlines.h:
* Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:
* Source/WebCore/rendering/RenderElement.cpp:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
* Source/WebCore/rendering/RenderFlexibleBox.h:
* Source/WebCore/rendering/RenderGrid.cpp:
* Source/WebCore/rendering/RenderInline.cpp:
* Source/WebCore/rendering/RenderListMarker.cpp:
* Source/WebCore/rendering/RenderMenuList.cpp:
* Source/WebCore/rendering/RenderReplaced.cpp:
* Source/WebCore/rendering/RenderScrollbarPart.cpp:
* Source/WebCore/rendering/RenderTable.cpp:
* Source/WebCore/rendering/RenderTextInlines.h:
* Source/WebCore/rendering/RenderTheme.cpp:
* Source/WebCore/rendering/RenderTheme.h:
* Source/WebCore/rendering/adwaita/RenderThemeAdwaita.cpp:
* Source/WebCore/rendering/adwaita/RenderThemeAdwaita.h:
* Source/WebCore/rendering/ios/RenderThemeIOS.h:
* Source/WebCore/rendering/ios/RenderThemeIOS.mm:
* Source/WebCore/rendering/mac/RenderThemeMac.h:
* Source/WebCore/rendering/mac/RenderThemeMac.mm:
* Source/WebCore/rendering/style/RenderStyle.cpp:
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
* Source/WebCore/rendering/style/RenderStyleSetters.h:
* Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
* Source/WebCore/rendering/style/StyleSurroundData.cpp:
* Source/WebCore/rendering/style/StyleSurroundData.h:
* Source/WebCore/style/StyleAdjuster.cpp:
* Source/WebCore/style/StyleBuilderConverter.h:
* Source/WebCore/style/StyleBuilderCustom.h:
* Source/WebCore/style/StyleExtractorConverter.h:
* Source/WebCore/style/StyleExtractorCustom.h:
* Source/WebCore/style/StyleExtractorSerializer.h:
* Source/WebCore/style/StyleInterpolationFunctions.h:
* Source/WebCore/style/StyleInterpolationWrappers.h:
* Source/WebCore/style/values/StyleValueTypes.h:
* Source/WebCore/style/values/borders/StyleBoxShadow.cpp:
* Source/WebCore/style/values/borders/StyleBoxShadow.h:
* Source/WebCore/style/values/borders/StyleCornerShapeValue.h:
* Source/WebCore/style/values/box/StyleMargin.cpp: Added.
* Source/WebCore/style/values/box/StyleMargin.h: Added.
* Source/WebCore/style/values/box/StylePadding.cpp: Added.
* Source/WebCore/style/values/box/StylePadding.h: Added.
* Source/WebCore/style/values/color/StyleColor.cpp:
* Source/WebCore/style/values/color/StyleDynamicRangeLimit.h:
* Source/WebCore/style/values/position/StyleInset.cpp: Added.
* Source/WebCore/style/values/position/StyleInset.h: Added.
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Blending.h:
* Source/WebCore/style/values/scroll-snap/StyleScrollMargin.cpp:
* Source/WebCore/style/values/scroll-snap/StyleScrollMargin.h:
* Source/WebCore/style/values/scroll-snap/StyleScrollPadding.cpp:
* Source/WebCore/style/values/scroll-snap/StyleScrollPadding.h:
* Source/WebCore/style/values/text-decoration/StyleTextShadow.cpp:
* Source/WebCore/style/values/text-decoration/StyleTextShadow.h:
Canonical link: https://commits.webkit.org/295835@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes