Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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@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
- Loading branch information
Showing
6 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<p>The following two lines should look exactly the same.</p> | ||
|
||
<div style="font-family: sans-serif; font-size: 1rlh"> | ||
Text. | ||
</div> | ||
|
||
<div style="font-family: sans-serif; font-size: 1rlh"> | ||
Text. | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<p>The following two lines should look exactly the same.</p> | ||
|
||
<div style="font-family: sans-serif; font-size: 1rlh"> | ||
Text. | ||
</div> | ||
|
||
<div style="font-family: sans-serif; font-size: 1rlh"> | ||
Text. | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-size-prop"> | ||
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=623842"> | ||
<link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=246566"> | ||
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> | ||
<link rel="match" href="rlh-in-monospace-ref.html"> | ||
|
||
<p>The following two lines should look exactly the same.</p> | ||
|
||
<div style="font-family: monospace; font-size: 1.5em"> | ||
<div style="font-family: sans-serif; font-size: 1rlh"> | ||
Text. | ||
</div> | ||
</div> | ||
|
||
<div style="font-family: sans-serif; font-size: 1rlh"> | ||
Text. | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters