Skip to content

[Style] Switch all Length conversion to use Style::BuilderConverter helpers #46977

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 20, 2025

24a0d87

[Style] Switch all Length conversion to use Style::BuilderConverter helpers
https://bugs.webkit.org/show_bug.cgi?id=294742

Reviewed by Darin Adler.

Replace all uses of CSSPrimitiveValue::convertToLength with BuilderConverter::convertLength
(except in TransformOperationsBuilder.cpp where a slight variation of that function is needed
to maintain existing clamping behavior) and its ilk.

This allows us to handle invalid length-percentage values in a consistent manner.

* Source/WebCore/css/CSSPrimitiveValue.cpp:
* Source/WebCore/css/CSSPrimitiveValue.h:
* Source/WebCore/css/CSSPrimitiveValueMappings.h:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/CSSToStyleMap.cpp:
* Source/WebCore/style/StyleBuilderConverter.h:
* Source/WebCore/style/StyleBuilderCustom.h:
* Source/WebCore/style/TransformOperationsBuilder.cpp:
* Source/WebCore/style/values/transforms/StyleTranslate.cpp:

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

551bb04

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 20, 2025
@weinig weinig added the CSS Cascading Style Sheets implementation label Jun 20, 2025
@webkit-early-warning-system

This comment was marked as outdated.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 20, 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/length-conversion-via-builder-converter branch from 8b680e7 to 3ce5f41 Compare June 26, 2025 18:27
@webkit-early-warning-system

This comment was marked as outdated.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@weinig weinig removed the merging-blocked Applied to prevent a change from being merged label Jun 27, 2025
@weinig weinig force-pushed the eng/length-conversion-via-builder-converter branch from 3ce5f41 to 4ee8f56 Compare June 27, 2025 02:37
@weinig weinig requested review from anttijk and darinadler and removed request for anttijk June 27, 2025 14:59
@weinig weinig marked this pull request as ready for review June 27, 2025 14:59
@weinig weinig requested a review from anttijk June 27, 2025 15:02
@weinig weinig added the merge-queue Applied to send a pull request to merge-queue label Jun 27, 2025
…elpers

https://bugs.webkit.org/show_bug.cgi?id=294742

Reviewed by Darin Adler.

Replace all uses of CSSPrimitiveValue::convertToLength with BuilderConverter::convertLength
(except in TransformOperationsBuilder.cpp where a slight variation of that function is needed
to maintain existing clamping behavior) and its ilk.

This allows us to handle invalid length-percentage values in a consistent manner.

* Source/WebCore/css/CSSPrimitiveValue.cpp:
* Source/WebCore/css/CSSPrimitiveValue.h:
* Source/WebCore/css/CSSPrimitiveValueMappings.h:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/CSSToStyleMap.cpp:
* Source/WebCore/style/StyleBuilderConverter.h:
* Source/WebCore/style/StyleBuilderCustom.h:
* Source/WebCore/style/TransformOperationsBuilder.cpp:
* Source/WebCore/style/values/transforms/StyleTranslate.cpp:

Canonical link: https://commits.webkit.org/296743@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/length-conversion-via-builder-converter branch from 551bb04 to 24a0d87 Compare June 27, 2025 19:24
@webkit-commit-queue
Copy link
Collaborator

Committed 296743@main (24a0d87): https://commits.webkit.org/296743@main

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

@webkit-commit-queue webkit-commit-queue merged commit 24a0d87 into WebKit:main Jun 27, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 27, 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