haikuwebkit/LayoutTests/fast/text/ellipsis-text-rtl-expected....

20 lines
250 B
HTML
Raw Permalink Normal View History

REGRESSION (r222670 and r222732): RTL truncated text may not be drawn https://bugs.webkit.org/show_bug.cgi?id=178278 <rdar://problem/34982818> Reviewed by Darin Adler. Source/WebCore: Revert r222732 and partially revert r222670. The underlying font rendering machinery implements text truncation by taking a TextRun object that represents all of the text in the line fragment and a subrange of the glyphs to render from this fragment. Only the glyphs in this subrange are drawn and they are drawn in the same position they would be in had the entire line fragment been drawn. Following r222670 InlineTextBox applies the truncation to the TextRun in InlineTextBox::text(). Together with r222732, which assumed that the number of glyphs to draw is equal to the length of the TextRun, a truncated text run would be drawn at the wrong position on screen and could give the impression that the text is not drawn. Instead InlineTextBox::text() should always return the text for the entire line fragment without considering truncation and when calling TextPainter::paint() we need to pass the truncated length of the line fragment. Test: fast/text/ellipsis-text-rtl.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paint): Compute the truncated length (number of glyphs) and pass this to TextPainter::paint() (WebCore::InlineTextBox::text const): Do not apply truncation to the text run. Truncation is implemented by telling the underlying font rendering machinery to paint the subrange of the text run that represents the non-truncated (visible) text. * rendering/InlineTextBox.h: * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): Pass the entire length of the text run as we did prior to r222732. * rendering/TextPainter.cpp: (WebCore::TextPainter::paint): Take a length that represents the number of glyphs to draw from the text run as we use to take prior to r222732. * rendering/TextPainter.h: LayoutTests: Add a test to ensure that we draw right-to-left truncated text correctly. * fast/text/ellipsis-text-rtl-expected.html: Added. * fast/text/ellipsis-text-rtl.html: Added. Canonical link: https://commits.webkit.org/194614@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-17 17:04:51 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: "Ahem";
src: url("../../resources/Ahem.ttf");
}
#expected {
font: 20px/1 "Ahem";
overflow: hidden;
}
</style>
</head>
<body>
<div id="expected">ab</div>
</body>
</html>