Commit 8520cd8c authored by mitz@apple.com's avatar mitz@apple.com
Browse files

REGRESSION (r129176): Incorrect line breaking when kerning occurs between a...

REGRESSION (r129176): Incorrect line breaking when kerning occurs between a space and the following character
https://bugs.webkit.org/show_bug.cgi?id=97377

Reviewed by Enrica Casucci.

Source/WebCore: 

Test: fast/text/kerning-with-TextLayout.html

When kerning is enabled, the last character in a word may have its advance shortened because
of its trailing space. To account for that, words are measured along with the trailing space,
then the width of a space is subtracted from the result. This doesn’t work when the trailing
space itself has its advance shortened due to the character following it, which can happen
when using the TextLayout optimization. However, when the optimization is used, the advance
of the last character of the word is already adjusted for the trailing space, so there is no
need to measure with that space and subtract its advance.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Changed to not use the trailingSpaceWidth
mechanism when TextLayout is being used.

LayoutTests: 

* fast/text/kerning-with-TextLayout-expected.html: Added.
* fast/text/kerning-with-TextLayout.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129284 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6bf757dd
2012-09-21 Dan Bernstein <mitz@apple.com>
REGRESSION (r129176): Incorrect line breaking when kerning occurs between a space and the following character
https://bugs.webkit.org/show_bug.cgi?id=97377
Reviewed by Enrica Casucci.
* fast/text/kerning-with-TextLayout-expected.html: Added.
* fast/text/kerning-with-TextLayout.html: Added.
2012-09-21 Gavin Barraclough <barraclough@apple.com>
 
instanceof should not get the prototype for non-default HasInstance
<div style="width: 80px; border: solid blue; font-size: 56px; -webkit-font-kerning: normal;">
.<br>W
</div>
<div style="width: 80px; border: solid blue; font-size: 56px; -webkit-font-kerning: normal;">
. W
</div>
2012-09-21 Dan Bernstein <mitz@apple.com>
REGRESSION (r129176): Incorrect line breaking when kerning occurs between a space and the following character
https://bugs.webkit.org/show_bug.cgi?id=97377
Reviewed by Enrica Casucci.
Test: fast/text/kerning-with-TextLayout.html
When kerning is enabled, the last character in a word may have its advance shortened because
of its trailing space. To account for that, words are measured along with the trailing space,
then the width of a space is subtracted from the result. This doesn’t work when the trailing
space itself has its advance shortened due to the character following it, which can happen
when using the TextLayout optimization. However, when the optimization is used, the advance
of the last character of the word is already adjusted for the trailing space, so there is no
need to measure with that space and subtract its advance.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Changed to not use the trailingSpaceWidth
mechanism when TextLayout is being used.
2012-09-21 Adam Klein <adamk@chromium.org>
 
Simplify and optimize ChildListMutationScope
......@@ -2414,10 +2414,6 @@ InlineIterator RenderBlock::LineBreaker::nextLineBreak(InlineBidiResolver& resol
float wordSpacing = currentStyle->wordSpacing();
float lastSpaceWordSpacing = 0;
// Non-zero only when kerning is enabled, in which case we measure words with their trailing
// space, then subtract its width.
float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(constructTextRun(t, f, &space, 1, style)) + wordSpacing : 0;
float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true);
float charWidth = 0;
bool breakNBSP = autoWrap && currentStyle->nbspMode() == SPACE;
......@@ -2447,6 +2443,10 @@ InlineIterator RenderBlock::LineBreaker::nextLineBreak(InlineBidiResolver& resol
TextLayout* textLayout = renderTextInfo.m_layout.get();
// Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
// words with their trailing space, then subtract its width.
float wordTrailingSpaceWidth = (f.typesettingFeatures() & Kerning) && !textLayout ? f.width(constructTextRun(t, f, &space, 1, style)) + wordSpacing : 0;
for (; current.m_pos < t->textLength(); current.fastIncrementInTextNode()) {
bool previousCharacterIsSpace = currentCharacterIsSpace;
bool previousCharacterIsWS = currentCharacterIsWS;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment