Skip to content

[Style] Convert border-radius to use strong style types #47196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

weinig
Copy link
Contributor

@weinig weinig commented Jun 25, 2025

0104cc3

[Style] Convert border-radius to use strong style types
https://bugs.webkit.org/show_bug.cgi?id=294982

Reviewed by Darin Adler.

Converts border radius in BorderData to use a strong style type, taking
advantage of the existing work done for the radii of CSS shapes, tweaking
it a bit by adopting RectCorners directly.

To allow forward declaring style primitive types, we now have
them declared in a new minimal "StylePrimitiveNumeric+Forward.h"
which can be included in headers without bloat.

Fixes issue with path shrink-wrapping code that assumed border-radius
was always fixed.

* LayoutTests/fast/css/shrink-wrap-border-radius-with-calc-crash-expected.txt: Added.
* LayoutTests/fast/css/shrink-wrap-border-radius-with-calc-crash.html: Added.
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/values/CSSValueAggregates.h:
* Source/WebCore/platform/graphics/PathUtilities.cpp:
* Source/WebCore/platform/graphics/PathUtilities.h:
* Source/WebCore/rendering/BorderPainter.cpp:
* Source/WebCore/rendering/BorderShape.cpp:
* Source/WebCore/rendering/RenderElement.cpp:
* Source/WebCore/rendering/adwaita/RenderThemeAdwaita.cpp:
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm:
* Source/WebCore/rendering/ios/RenderThemeIOS.mm:
* Source/WebCore/rendering/mac/RenderThemeMac.mm:
* Source/WebCore/rendering/shapes/LayoutShape.cpp:
* Source/WebCore/rendering/style/BorderData.cpp:
* Source/WebCore/rendering/style/BorderData.h:
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
* Source/WebCore/rendering/style/RenderStyleSetters.h:
* 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/StyleInterpolationWrappers.h:
* Source/WebCore/style/values/StyleValueTypes.h:
* Source/WebCore/style/values/borders/StyleBorderRadius.cpp:
* Source/WebCore/style/values/borders/StyleBorderRadius.h:
* Source/WebCore/style/values/borders/StyleCornerShapeValue.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumeric+Forward.h: Added.
* Source/WebCore/style/values/primitives/StylePrimitiveNumeric.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+CSSValueConversion.h: Added.
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h:
* Source/WebCore/style/values/primitives/StyleUnevaluatedCalculation.cpp:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/ios/WKTapHighlightView.mm:
* Source/WebKitLegacy/ios/Misc/WebUIKitSupport.mm:

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

6d78adc

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
❌ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@weinig weinig self-assigned this Jun 25, 2025
@weinig weinig added the CSS Cascading Style Sheets implementation label Jun 25, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 25, 2025
@weinig weinig removed the merging-blocked Applied to prevent a change from being merged label Jun 25, 2025
@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from dcc8818 to 74ee280 Compare June 25, 2025 19:02
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 25, 2025
@weinig weinig removed the merging-blocked Applied to prevent a change from being merged label Jun 25, 2025
@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from 74ee280 to 4cf04bd Compare June 25, 2025 20:02
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 25, 2025
@weinig weinig removed the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from 4cf04bd to a117bb9 Compare June 26, 2025 03:45
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41638 (a117bb9)

❌ Found 1 failing file with 3 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@weinig weinig removed the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from a117bb9 to 2c9aa1c Compare June 26, 2025 16:08
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41691 (2c9aa1c)

❌ Found 1 failing file with 3 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from 2c9aa1c to 7b24a1c Compare June 26, 2025 17:55
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41710 (7b24a1c)

❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@weinig weinig removed the merging-blocked Applied to prevent a change from being merged label Jun 27, 2025
@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from 7b24a1c to afebce5 Compare June 27, 2025 15:28
@weinig weinig marked this pull request as ready for review June 27, 2025 15:29
@weinig weinig requested a review from a team as a code owner June 27, 2025 15:29
@weinig weinig requested a review from cdumez as a code owner June 27, 2025 15:29
@weinig weinig requested review from anttijk and darinadler June 27, 2025 15:29
@weinig weinig force-pushed the eng/strong-style-types-for-border-radii branch from afebce5 to 6d78adc Compare June 28, 2025 03:08
@weinig weinig added the merge-queue Applied to send a pull request to merge-queue label Jun 28, 2025
https://bugs.webkit.org/show_bug.cgi?id=294982

Reviewed by Darin Adler.

Converts border radius in BorderData to use a strong style type, taking
advantage of the existing work done for the radii of CSS shapes, tweaking
it a bit by adopting RectCorners directly.

To allow forward declaring style primitive types, we now have
them declared in a new minimal "StylePrimitiveNumeric+Forward.h"
which can be included in headers without bloat.

Fixes issue with path shrink-wrapping code that assumed border-radius
was always fixed.

* LayoutTests/fast/css/shrink-wrap-border-radius-with-calc-crash-expected.txt: Added.
* LayoutTests/fast/css/shrink-wrap-border-radius-with-calc-crash.html: Added.
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/values/CSSValueAggregates.h:
* Source/WebCore/platform/graphics/PathUtilities.cpp:
* Source/WebCore/platform/graphics/PathUtilities.h:
* Source/WebCore/rendering/BorderPainter.cpp:
* Source/WebCore/rendering/BorderShape.cpp:
* Source/WebCore/rendering/RenderElement.cpp:
* Source/WebCore/rendering/adwaita/RenderThemeAdwaita.cpp:
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm:
* Source/WebCore/rendering/ios/RenderThemeIOS.mm:
* Source/WebCore/rendering/mac/RenderThemeMac.mm:
* Source/WebCore/rendering/shapes/LayoutShape.cpp:
* Source/WebCore/rendering/style/BorderData.cpp:
* Source/WebCore/rendering/style/BorderData.h:
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
* Source/WebCore/rendering/style/RenderStyleSetters.h:
* 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/StyleInterpolationWrappers.h:
* Source/WebCore/style/values/StyleValueTypes.h:
* Source/WebCore/style/values/borders/StyleBorderRadius.cpp:
* Source/WebCore/style/values/borders/StyleBorderRadius.h:
* Source/WebCore/style/values/borders/StyleCornerShapeValue.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumeric+Forward.h: Added.
* Source/WebCore/style/values/primitives/StylePrimitiveNumeric.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+CSSValueConversion.h: Added.
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h:
* Source/WebCore/style/values/primitives/StyleUnevaluatedCalculation.cpp:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/ios/WKTapHighlightView.mm:
* Source/WebKitLegacy/ios/Misc/WebUIKitSupport.mm:

Canonical link: https://commits.webkit.org/296770@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/strong-style-types-for-border-radii branch from 6d78adc to 0104cc3 Compare June 28, 2025 15:08
@webkit-commit-queue
Copy link
Collaborator

Committed 296770@main (0104cc3): https://commits.webkit.org/296770@main

Reviewed commits have been landed. Closing PR #47196 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 0104cc3 into WebKit:main Jun 28, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Cascading Style Sheets implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants