Skip to content

[CSS Zoom] Fix zoom factor for inherited letter-spacing#51906

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
vitorroriz:eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing
Oct 9, 2025
Merged

[CSS Zoom] Fix zoom factor for inherited letter-spacing#51906
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
vitorroriz:eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing

Conversation

@vitorroriz
Copy link
Copy Markdown
Contributor

@vitorroriz vitorroriz commented Oct 7, 2025

a3cf1b7

[CSS Zoom] Fix zoom factor for inherited letter-spacing
rdar://162085369
https://bugs.webkit.org/show_bug.cgi?id=300278

Reviewed by Antti Koivisto.

We want to store the unzoomed letter-spacing value at RenderStyle
and the zoomeed value at FontCascade.

Test: imported/w3c/web-platform-tests/css/css-text/parsing/letter-spacing-inherited-computed.html
* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/letter-spacing-inherited-computed-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/letter-spacing-inherited-computed.html: Added.
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::updateFontForSizeChange):
* Source/WebCore/style/values/text/StyleLetterSpacing.cpp:
(WebCore::Style::CSSValueConversion<LetterSpacing>::operator):
* Source/WebCore/style/values/text/StyleLetterSpacing.h:

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

6104906

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
🧪 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

@vitorroriz vitorroriz self-assigned this Oct 7, 2025
@vitorroriz vitorroriz added the Text For bugs in text layout and rendering, including international text support. label Oct 7, 2025
@vitorroriz vitorroriz requested review from nullhook and weinig October 7, 2025 05:33
@vitorroriz vitorroriz marked this pull request as ready for review October 7, 2025 20:43
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 7, 2025
@vitorroriz vitorroriz removed the merging-blocked Applied to prevent a change from being merged label Oct 7, 2025
Comment on lines +42 to 45
auto usedZoom = shouldUseEvaluationTimeZoom(state) ? 1.0f : state.style().usedZoom();
return usedZoom * textZoomFactor;
}
return state.cssToLengthConversionData().zoom();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the else branch here does not seem to respect the shouldUseEvaluationTimeZoom

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to produce an observable test that exercises this branch. I've tried playing with a detached doc but I couldn't observe its layout properties.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the code here is being overly defensive. we can't enter style-resolution without a frame. so, that else branch looks meaningless.

@@ -1,3 +1,4 @@
<!-- webkit-test-runner [ EvaluationTimeZoomEnabled=true ] -->
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer needed after the other PRs

@vitorroriz vitorroriz force-pushed the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch from 654223d to b438655 Compare October 8, 2025 23:14
@vitorroriz
Copy link
Copy Markdown
Contributor Author

zoom/letter-spacing.html will be failing until gets merged #52027

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 9, 2025
@weinig
Copy link
Copy Markdown
Contributor

weinig commented Oct 9, 2025

Like with the others, this needs tests for the useSVGZoomRulesForLength cases.

@weinig
Copy link
Copy Markdown
Contributor

weinig commented Oct 9, 2025

Would also like to see tests to make sure getComputedValue continues to produce the unzoomed value for the various inheritance cases.

@vitorroriz
Copy link
Copy Markdown
Contributor Author

Like with the others, this needs tests for the useSVGZoomRulesForLength cases.
@weinig
I've created a test that mimics LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/letter-spacing.html. for SVG. We scale it wrong (different from other browsers) due to unrelated reasons to this PR, which I believe is related to RenderSVGInlineText::computeNewScaledFontForStyle and RenderSVGInlineText::computeScalingFactorForRenderer and should be fixed apart.

@vitorroriz
Copy link
Copy Markdown
Contributor Author

Would also like to see tests to make sure getComputedValue continues to produce the unzoomed value for the various inheritance cases.

I can create a new WPT test for that but we do apply the unzoomed value to RenderStyle and the zoomed value to FontCascade

@vitorroriz vitorroriz removed the merging-blocked Applied to prevent a change from being merged label Oct 9, 2025
@vitorroriz vitorroriz force-pushed the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch from b438655 to 0c1def0 Compare October 9, 2025 01:47
@vitorroriz vitorroriz force-pushed the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch from 0c1def0 to eda344f Compare October 9, 2025 02:37
@vitorroriz vitorroriz force-pushed the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch from eda344f to 02356eb Compare October 9, 2025 02:48
@vitorroriz vitorroriz requested a review from anttijk October 9, 2025 17:02
Copy link
Copy Markdown
Contributor

@nullhook nullhook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

computed tests should be housed under ...css/css-viewport/zoom/parsing/ otherwise lgtm.

@vitorroriz vitorroriz force-pushed the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch from 02356eb to 6104906 Compare October 9, 2025 17:32
@vitorroriz vitorroriz added the merge-queue Applied to send a pull request to merge-queue label Oct 9, 2025
rdar://162085369
https://bugs.webkit.org/show_bug.cgi?id=300278

Reviewed by Antti Koivisto.

We want to store the unzoomed letter-spacing value at RenderStyle
and the zoomeed value at FontCascade.

Test: imported/w3c/web-platform-tests/css/css-text/parsing/letter-spacing-inherited-computed.html
* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/letter-spacing-inherited-computed-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/letter-spacing-inherited-computed.html: Added.
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::updateFontForSizeChange):
* Source/WebCore/style/values/text/StyleLetterSpacing.cpp:
(WebCore::Style::CSSValueConversion<LetterSpacing>::operator):
* Source/WebCore/style/values/text/StyleLetterSpacing.h:

Canonical link: https://commits.webkit.org/301269@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch from 6104906 to a3cf1b7 Compare October 9, 2025 18:53
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 301269@main (a3cf1b7): https://commits.webkit.org/301269@main

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

@webkit-commit-queue webkit-commit-queue merged commit a3cf1b7 into WebKit:main Oct 9, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Oct 9, 2025
@vitorroriz vitorroriz deleted the eng/CSS-Zoom-Fix-zoom-factor-for-inherited-letter-spacing branch November 4, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Text For bugs in text layout and rendering, including international text support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants