Title: [135884] trunk
Revision
135884
Author
[email protected]
Date
2012-11-27 11:15:04 -0800 (Tue, 27 Nov 2012)

Log Message

REGRESSION (r125578): word-wrapping in absolute position with nbsp, word-spacing and custom font
https://bugs.webkit.org/show_bug.cgi?id=101443

Reviewed by David Hyatt.

Source/WebCore:

Leading non-breaking space in a text run should always get word-spacing applied. When RenderText
calculates the preferred with of a run of text it breaks it up into word segments that contain
no breaking spaces and calculates the width of each. So when calculating the width of ' b'
it needs to add word-spacing to the leading non-breaking space as it does not get collapsed away.

Test: fast/text/word-space-nbsp.html

* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):

LayoutTests:

* fast/text/word-space-nbsp-expected.html: Added.
* fast/text/word-space-nbsp.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (135883 => 135884)


--- trunk/LayoutTests/ChangeLog	2012-11-27 19:08:05 UTC (rev 135883)
+++ trunk/LayoutTests/ChangeLog	2012-11-27 19:15:04 UTC (rev 135884)
@@ -1,3 +1,13 @@
+2012-11-27  Robert Hogan  <[email protected]>
+
+        REGRESSION (r125578): word-wrapping in absolute position with nbsp, word-spacing and custom font
+        https://bugs.webkit.org/show_bug.cgi?id=101443
+
+        Reviewed by David Hyatt.
+
+        * fast/text/word-space-nbsp-expected.html: Added.
+        * fast/text/word-space-nbsp.html: Added.
+
 2012-11-27  Tony Chang  <[email protected]>
 
         Unreviewed gardening, fixing lint errors in TestExpectations.

Added: trunk/LayoutTests/fast/text/word-space-nbsp-expected.html (0 => 135884)


--- trunk/LayoutTests/fast/text/word-space-nbsp-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/word-space-nbsp-expected.html	2012-11-27 19:15:04 UTC (rev 135884)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style type="text/css">
+            div {
+              word-spacing: 20px;
+              float: left;
+              border: solid;
+              clear: both;
+            }
+        </style>
+    </head>
+    <body>
+        <p>The lines below should be the same width.</p>
+        <div>a&nbsp;&nbsp;b</div>
+        <div>a&nbsp;&nbsp;b</div>
+  </body>
+</html>
+

Added: trunk/LayoutTests/fast/text/word-space-nbsp.html (0 => 135884)


--- trunk/LayoutTests/fast/text/word-space-nbsp.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/word-space-nbsp.html	2012-11-27 19:15:04 UTC (rev 135884)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style type="text/css">
+            div {
+              word-spacing: 20px;
+              float: left;
+              border: solid;
+              clear: both;
+            }
+        </style>
+    </head>
+    <body>
+        <p>The lines below should be the same width.</p>
+        <div>a &nbsp;b</div>
+        <div>a&nbsp;&nbsp;b</div>
+  </body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (135883 => 135884)


--- trunk/Source/WebCore/ChangeLog	2012-11-27 19:08:05 UTC (rev 135883)
+++ trunk/Source/WebCore/ChangeLog	2012-11-27 19:15:04 UTC (rev 135884)
@@ -1,3 +1,20 @@
+2012-11-27  Robert Hogan  <[email protected]>
+
+        REGRESSION (r125578): word-wrapping in absolute position with nbsp, word-spacing and custom font
+        https://bugs.webkit.org/show_bug.cgi?id=101443
+
+        Reviewed by David Hyatt.
+
+        Leading non-breaking space in a text run should always get word-spacing applied. When RenderText
+        calculates the preferred with of a run of text it breaks it up into word segments that contain
+        no breaking spaces and calculates the width of each. So when calculating the width of '&nbsp;b' 
+        it needs to add word-spacing to the leading non-breaking space as it does not get collapsed away.
+
+        Test: fast/text/word-space-nbsp.html
+
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::advanceInternal):
+
 2012-11-27  Yong Li  <[email protected]>
 
         [BlackBerry] EventLoop should end when WebKit thread is exiting

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (135883 => 135884)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2012-11-27 19:08:05 UTC (rev 135883)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2012-11-27 19:15:04 UTC (rev 135884)
@@ -241,7 +241,7 @@
 
                 // Account for word spacing.
                 // We apply additional space between "words" by adding width to the space character.
-                if (treatAsSpace && (character != '\t' || !m_run.allowTabs()) && textIterator.currentCharacter() && m_font->wordSpacing())
+                if (treatAsSpace && (character != '\t' || !m_run.allowTabs()) && (textIterator.currentCharacter() || character == noBreakSpace) && m_font->wordSpacing())
                     width += m_font->wordSpacing();
             } else
                 m_isAfterExpansion = false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to