Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ComplexTextController: Control characters should be rendered as visib…
…le glyphs https://bugs.webkit.org/show_bug.cgi?id=271869 Reviewed by Vitor Roriz. Control characters weren't rendered as visible glyphs in the complex text code path in some condition. The spec <https://www.w3.org/TR/css-text-3/#white-space-processing> says: > Control characters (Unicode category Cc)—other than tabs (U+0009), > line feeds (U+000A), carriage returns (U+000D) and sequences that form > a segment break—must be rendered as a visible glyph https://webkit.org/b/149128 fixed the simple text code path. https://webkit.org/b/153941 fixed a part of the complex text code path. We need one more fix. ComplexTextController constructor is using FontCascade::isCharacterWhoseGlyphsShouldBeDeletedForTextRendering to determine a character is visible. It returned false for control characters. Changed isCharacterWhoseGlyphsShouldBeDeletedForTextRendering to return false for control characters other than tabs, line feeds, and carriage returns. WidthIterator::applyCSSVisibilityRules is also using isCharacterWhoseGlyphsShouldBeDeletedForTextRendering. Changed it to keep the original behavior. * LayoutTests/fast/text/control-characters/complex-1-expected.txt: Added. * LayoutTests/fast/text/control-characters/complex-1.html: Added. * Source/WebCore/platform/graphics/FontCascade.h: (WebCore::FontCascade::isCharacterWhoseGlyphsShouldBeDeletedForTextRendering): * Source/WebCore/platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::applyCSSVisibilityRules): Canonical link: https://commits.webkit.org/277574@main
- Loading branch information
Showing
4 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
LayoutTests/fast/text/control-characters/complex-1-expected.txt
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,12 @@ | ||
A control character should be rendered as a visible glyph. "ਅ\u0001ਆ" should be longer than "ਅਆ" | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS target.clientWidth is > ref.clientWidth | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
ਅਆ | ||
ਅਆ | ||
|
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,20 @@ | ||
<!DOCTYPE html> | ||
<script src="../../../resources/js-test.js"></script> | ||
<style> | ||
#ref, #target { | ||
background: lightblue; | ||
display: inline-block; | ||
font-size: 100px; | ||
} | ||
</style> | ||
<body> | ||
<span id="target"></span><br> | ||
<span id="ref"></span><br> | ||
<script> | ||
description('A control character should be rendered as a visible glyph. "\u0A05\\u0001\u0A06" should be longer than "\u0A05\u0A06"'); | ||
document.getElementById("target").textContent = '\u0A05\u0001\u0A06'; | ||
document.getElementById("ref").textContent = '\u0A05\u0A06'; | ||
shouldBeGreaterThan("target.clientWidth", "ref.clientWidth"); | ||
</script> | ||
</body> | ||
</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
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