-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix font-size-adjust toggling font sizes for 'system-ui' font.
https://bugs.webkit.org/show_bug.cgi?id=259895 rdar://111709567 Reviewed by Tim Nguyen. When using 'system-ui' font, we will end up calling FontFamilySpecificationCoreText::fontRanges for obtaining FontRanges with an appended font. Before this patch, ::fontRanges() was updating the font's size for the font-size-adjust everytime fontRange was called. The update would mutate the font that is cached. After the page is refreshed and this function was called again, we would retrieve the cached font, and execute the size adjustment again, what would cause the bug. This patch moves the call to updateSizeWithFontSizeAdjust to the lambda function invoked when the Font is being cached, guaranteeing it will be called just once. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-size-adjust-reload-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-size-adjust-reload-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-size-adjust-reload.html: Added. * Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: (WebCore::FontFamilySpecificationCoreText::fontRanges const): Canonical link: https://commits.webkit.org/266771@main
- Loading branch information
1 parent
b94dfac
commit 04c2e0b
Showing
4 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...Tests/imported/w3c/web-platform-tests/css/css-fonts/font-size-adjust-reload-expected.html
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,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz"> | ||
<link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop"> | ||
<style> | ||
html { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
body { | ||
font-family: system-ui; | ||
font-size: 100px; | ||
font-size-adjust: 0.528; | ||
border: 0; | ||
padding: 0; | ||
margin: 0; | ||
height: 200px; | ||
width: 200px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="target">A</div> | ||
</body> | ||
</html> |
26 changes: 26 additions & 0 deletions
26
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-size-adjust-reload-ref.html
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,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz"> | ||
<link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop"> | ||
<style> | ||
html { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
body { | ||
font-family: system-ui; | ||
font-size: 100px; | ||
font-size-adjust: 0.528; | ||
border: 0; | ||
padding: 0; | ||
margin: 0; | ||
height: 200px; | ||
width: 200px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="target">A</div> | ||
</body> | ||
</html> |
25 changes: 25 additions & 0 deletions
25
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-size-adjust-reload.html
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,25 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<head> | ||
<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz"> | ||
<link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop"> | ||
<link rel="match" href="font-size-adjust-reload-ref.html"> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<iframe id="iframe" width=400 height=400 frameBorder=0 src="font-size-adjust-reload-ref.html"></iframe> | ||
</body> | ||
<script> | ||
const iframe = document.getElementById('iframe'); | ||
// Forcing reload | ||
iframe.src += ''; | ||
iframe.contentWindow.onload = function(){ | ||
document.documentElement.classList.remove("reftest-wait"); | ||
}; | ||
</script> | ||
</html> |
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