[webkit-changes] [WebKit/WebKit] bf519d: Treat 'rem' and 'rlh' as absolute units for font size
Tim Nguyen
noreply at github.com
Sat Oct 15 15:50:17 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bf519d1022247b0b33a3ce7f4c283da6fd74abff
https://github.com/WebKit/WebKit/commit/bf519d1022247b0b33a3ce7f4c283da6fd74abff
Author: Tim Nguyen <ntim at apple.com>
Date: 2022-10-15 (Sat, 15 Oct 2022)
Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/rlh-in-monospace-expected.html
A LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/rlh-in-monospace-ref.html
A LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/rlh-in-monospace.html
M Source/WebCore/css/CSSPrimitiveValue.h
M Source/WebCore/style/StyleBuilderCustom.h
Log Message:
-----------
Treat 'rem' and 'rlh' as absolute units for font size
https://bugs.webkit.org/show_bug.cgi?id=246566
rdar://101209364
Reviewed by Darin Adler.
Ported Chromium revision from: https://chromium.googlesource.com/chromium/src/+/17ea96288ad2c9abb048f5b50e02097d20c283d9 by Xiaocheng Hu <xiaochengh at chromium.org>
StyleBuilderCustom does a size adjustment for monospace that, for all elements
using monospace font family and relative font sizes (em, ex, ch etc),
their computed font-size values are scaled by a fixed factor. To make
sure this doesn't affect non-monospace children using relative font
sizes, we also divide the childrens' font sizes by the same factor.
See usages of FontCascadeDescription::useFixedDefaultSize().
However, this causes children using 'rem' to be also scaled, because
'rem' is also considered a font-relative length unit, even though it
doesn't depend on the parent font size.
Therefore, we fix it by treating 'rem' an absolute unit for font size.
This also applies to the rlh unit, which the Chromium fix did not cover, this revision adds a WPT for it.
* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/rlh-in-monospace-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/rlh-in-monospace-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/rlh-in-monospace.html: Added.
* Source/WebCore/css/CSSPrimitiveValue.h:
* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueFontSize):
Canonical link: https://commits.webkit.org/255594@main
More information about the webkit-changes
mailing list