Title: [129284] trunk
- Revision
- 129284
- Author
- [email protected]
- Date
- 2012-09-21 18:00:01 -0700 (Fri, 21 Sep 2012)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (129283 => 129284)
--- trunk/LayoutTests/ChangeLog 2012-09-22 00:53:53 UTC (rev 129283)
+++ trunk/LayoutTests/ChangeLog 2012-09-22 01:00:01 UTC (rev 129284)
@@ -1,3 +1,13 @@
+2012-09-21 Dan Bernstein <[email protected]>
+
+ 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 <[email protected]>
instanceof should not get the prototype for non-default HasInstance
Added: trunk/LayoutTests/fast/text/kerning-with-TextLayout-expected.html (0 => 129284)
--- trunk/LayoutTests/fast/text/kerning-with-TextLayout-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/kerning-with-TextLayout-expected.html 2012-09-22 01:00:01 UTC (rev 129284)
@@ -0,0 +1,3 @@
+<div style="width: 80px; border: solid blue; font-size: 56px; -webkit-font-kerning: normal;">
+.<br>W
+</div>
Added: trunk/LayoutTests/fast/text/kerning-with-TextLayout.html (0 => 129284)
--- trunk/LayoutTests/fast/text/kerning-with-TextLayout.html (rev 0)
+++ trunk/LayoutTests/fast/text/kerning-with-TextLayout.html 2012-09-22 01:00:01 UTC (rev 129284)
@@ -0,0 +1,3 @@
+<div style="width: 80px; border: solid blue; font-size: 56px; -webkit-font-kerning: normal;">
+. W
+</div>
Modified: trunk/Source/WebCore/ChangeLog (129283 => 129284)
--- trunk/Source/WebCore/ChangeLog 2012-09-22 00:53:53 UTC (rev 129283)
+++ trunk/Source/WebCore/ChangeLog 2012-09-22 01:00:01 UTC (rev 129284)
@@ -1,3 +1,24 @@
+2012-09-21 Dan Bernstein <[email protected]>
+
+ 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 <[email protected]>
Simplify and optimize ChildListMutationScope
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (129283 => 129284)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2012-09-22 00:53:53 UTC (rev 129283)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2012-09-22 01:00:01 UTC (rev 129284)
@@ -2414,10 +2414,6 @@
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 @@
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;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes