-
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.
Font’s fast code path doesn’t handle partial runs correctly when kern…
…ing or ligatures are enabled https://bugs.webkit.org/show_bug.cgi?id=100050 Reviewed by Antti Koivisto. Source/WebCore: Always let WidthIterator iterate over an entire TextRun to avoid problems with pixel rounding or shaping on partial runs. This fix is necessary for Qt because the complex font-path can not disable shaping, leading to the complex path painting slighly different from the fast path, which messes up selection painting. No change in functionality, no new tests. * platform/graphics/Font.cpp: (WebCore::Font::drawText): (WebCore::Font::drawEmphasisMarks): (WebCore::Font::selectionRectForText): (WebCore::Font::offsetForPosition): * platform/graphics/FontFastPath.cpp: (WebCore::Font::getGlyphsAndAdvancesForSimpleText): (WebCore::Font::selectionRectForSimpleText): (WebCore::Font::offsetForPositionForSimpleText): * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::add): (GlyphBuffer): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: (WidthIterator): Removed now unused advanceOneCharacter method. LayoutTests: * fast/text/resources/PTS55F-webfont.ttf: Added. * fast/text/partial-textruns-expected.html: Added. * fast/text/partial-textruns.html: Added. Canonical link: https://commits.webkit.org/138048@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
10 changed files
with
195 additions
and
78 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,37 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@font-face { | ||
font-family: PTSans; | ||
src: url('resources/PTS55F-webfont.ttf') format("truetype"); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
#sandbox { position: absolute; width: 400px; } | ||
article { | ||
width: 400px; | ||
font-family: PTSans; | ||
font-size: 24px; | ||
-webkit-font-kerning: normal; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id=sandbox> | ||
<article> | ||
This test is meant <span id=selection>to test if font metrics change when partially rendered. To test select multiple lines with the begin</span> or end line being only partially selected. The test succedes if none of the letters in the partially selected lines shift compared to when they are not selected or the line fully selected. | ||
</article> | ||
</div> | ||
|
||
<script> | ||
var selection = window.getSelection(); | ||
if (selection.rangeCount > 0) | ||
selection.removeAllRanges(); | ||
var selectionNode = document.getElementById("selection"); | ||
var range = document.createRange(); | ||
range.selectNode(selectionNode); | ||
selection.addRange(range); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@font-face { | ||
font-family: PTSans; | ||
src: url('resources/PTS55F-webfont.ttf') format("truetype"); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
#sandbox { position: absolute; width: 400px; } | ||
article { | ||
width: 400px; | ||
font-family: PTSans; | ||
font-size: 24px; | ||
-webkit-font-kerning: normal; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id=sandbox> | ||
<article id=article>This test is meant to test if font metrics change when partially rendered. To test select multiple lines with the begin or end line being only partially selected. The test succedes if none of the letters in the partially selected lines shift compared to when they are not selected or the line fully selected.</article> | ||
</div> | ||
<script> | ||
var selection = window.getSelection(); | ||
if (selection.rangeCount > 0) | ||
selection.removeAllRanges(); | ||
var article = document.getElementById("article"); | ||
var range = document.createRange(); | ||
range.setStart(article.firstChild, 19); | ||
range.setEnd(article.firstChild, 119); | ||
selection.addRange(range); | ||
</script> | ||
|
||
</body> | ||
</html> |
Binary file not shown.
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
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
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
Oops, something went wrong.