<rdar://problem/12645085> REGRESSION (r130851): With kerning enabled, a white-space...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2012 19:43:24 +0000 (19:43 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2012 19:43:24 +0000 (19:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103541

Reviewed by Anders Carlsson.

Source/WebCore:

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

When kerning is enabled, words are measured with their trailing space, then the width of a
space is subtracted. The logic to do this was incorrectly being invoked even when the
trailing whitespace character was a tab or a newline.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Changed to check only for the space
character, not other space-like characters.

LayoutTests:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136034 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/tab-with-kerning-expected.html [new file with mode: 0644]
LayoutTests/fast/text/tab-with-kerning.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlockLineLayout.cpp

index f5ffe1a..f0dd51b 100644 (file)
@@ -1,3 +1,13 @@
+2012-11-28  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/12645085> REGRESSION (r130851): With kerning enabled, a white-space: pre-wrap inline starting with tab+space has the wrong width
+        https://bugs.webkit.org/show_bug.cgi?id=103541
+
+        Reviewed by Anders Carlsson.
+
+        * fast/text/tab-with-kerning-expected.html: Added.
+        * fast/text/tab-with-kerning.html: Added.
+
 2012-11-28  Nate Chapin  <japhet@chromium.org>
 
         Move empty loading to DocumentLoader, simplify FrameLoader::init()
diff --git a/LayoutTests/fast/text/tab-with-kerning-expected.html b/LayoutTests/fast/text/tab-with-kerning-expected.html
new file mode 100644 (file)
index 0000000..26c3791
--- /dev/null
@@ -0,0 +1,3 @@
+<div style="font: 20px ahem; -webkit-font-smoothing: none; color: orange; -webkit-font-kerning: none;">
+    .<span style="white-space: pre-wrap; background-color: blue;">&#9; ab</span>ef
+</div>
diff --git a/LayoutTests/fast/text/tab-with-kerning.html b/LayoutTests/fast/text/tab-with-kerning.html
new file mode 100644 (file)
index 0000000..000703e
--- /dev/null
@@ -0,0 +1,3 @@
+<div style="font: 20px ahem; -webkit-font-smoothing: none; color: orange; -webkit-font-kerning: auto;">
+    .<span style="white-space: pre-wrap; background-color: blue;">&#9; ab</span>ef
+</div>
index c0b489c..da3092c 100644 (file)
@@ -1,3 +1,20 @@
+2012-11-28  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/12645085> REGRESSION (r130851): With kerning enabled, a white-space: pre-wrap inline starting with tab+space has the wrong width
+        https://bugs.webkit.org/show_bug.cgi?id=103541
+
+        Reviewed by Anders Carlsson.
+
+        Test: fast/text/tab-with-kerning.html
+
+        When kerning is enabled, words are measured with their trailing space, then the width of a
+        space is subtracted. The logic to do this was incorrectly being invoked even when the
+        trailing whitespace character was a tab or a newline.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::LineBreaker::nextLineBreak): Changed to check only for the space
+        character, not other space-like characters.
+
 2012-11-28  Nate Chapin  <japhet@chromium.org>
 
         Move empty loading to DocumentLoader, simplify FrameLoader::init()
index 442c010..970fbc3 100644 (file)
@@ -2636,7 +2636,7 @@ InlineIterator RenderBlock::LineBreaker::nextLineBreak(InlineBidiResolver& resol
                     wordMeasurement.startOffset = lastSpace;
                     
                     float additionalTmpW;
-                    if (wordTrailingSpaceWidth && currentCharacterIsSpace)
+                    if (wordTrailingSpaceWidth && c == ' ')
                         additionalTmpW = textWidth(t, lastSpace, current.m_pos + 1 - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
                     else
                         additionalTmpW = textWidth(t, lastSpace, current.m_pos - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);