Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b86307c97d1abc50ea819a0d102be09f3b04a73e
https://github.com/WebKit/WebKit/commit/b86307c97d1abc50ea819a0d102be09f3b04a73e
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-07 (Fri, 07 Aug 2026)
Changed paths:
A LayoutTests/fast/canvas/canvas-font-size-larger-smaller-expected.txt
A LayoutTests/fast/canvas/canvas-font-size-larger-smaller.html
M Source/WebCore/style/StyleResolveForFont.cpp
Log Message:
-----------
REGRESSION(283572@main): Canvas ctx.font keywords larger and smaller scale by
1.02 instead of ~1.2
https://bugs.webkit.org/show_bug.cgi?id=321261
rdar://184312611
Reviewed by Sam Weinig.
The relative-size keywords may be resolved either through the absolute size
keyword mapping table or
by a simple ratio, and of the latter the specification says "The specific ratio
is unspecified, but
should be around 1.2-1.5" [1].
Canvas used 1.02, which is not in that range, so `ctx.font = "larger
sans-serif"` on a canvas whose
font-size is 20px produced 20.4px rather than 24px, making both keywords very
nearly no-ops. CSS
resolution is unaffected and uses 1.2 (BuilderCustom::largerFontSize).
The value was a transcription typo. 283572@main moved this logic into
StyleResolveForFontRaw.cpp
while replacing eager evaluation of calc() in the font consumers, and turned
`parentSize * 1.2f` into
`parentSize * 1.02f` in a change that was otherwise a pure refactor. 1.02f
appears nowhere else in
the tree.
The new test asserts the two things the specification actually constrains
rather than hard coding
WebKit's ratio: that the ratio falls in the 1.2-1.5 range, and that canvas
agrees with CSS resolution
for the same parent font-size.
[1] https://drafts.csswg.org/css-fonts-4/#typedef-relative-size
Test: fast/canvas/canvas-font-size-larger-smaller.html
* LayoutTests/fast/canvas/canvas-font-size-larger-smaller-expected.txt: Added.
* LayoutTests/fast/canvas/canvas-font-size-larger-smaller.html: Added.
* Source/WebCore/style/StyleResolveForFont.cpp:
(WebCore::Style::fontSizeFromUnresolvedFontSize):
Canonical link: https://commits.webkit.org/318798@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications