Title: [137494] trunk
Revision
137494
Author
rob...@webkit.org
Date
2012-12-12 11:43:45 -0800 (Wed, 12 Dec 2012)

Log Message

White space between inline blocks should be affected by word-spacing property
https://bugs.webkit.org/show_bug.cgi?id=69072

Reviewed by Levi Weintraub.

Source/WebCore:

Allow word-spacing to get added to the spaces between inline blocks in placeBoxesInInlineDirection by setting
needsWordSpacing to true each time an inline block is encountered. This ensures that the next space encountered
in a text run will be treated as a space between two words and will get word-spacing added to it if it is present
in the style.

Tests: fast/css/word-spacing-between-blocks.html
       fast/css/word-spacing-between-inlines.html

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):

LayoutTests:

* fast/css/word-spacing-between-blocks-expected.html: Added.
* fast/css/word-spacing-between-blocks.html: Added.
* fast/css/word-spacing-between-inlines-expected.html: Added.
* fast/css/word-spacing-between-inlines.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (137493 => 137494)


--- trunk/LayoutTests/ChangeLog	2012-12-12 19:39:42 UTC (rev 137493)
+++ trunk/LayoutTests/ChangeLog	2012-12-12 19:43:45 UTC (rev 137494)
@@ -1,3 +1,15 @@
+2012-12-12  Robert Hogan  <rob...@webkit.org>
+
+        White space between inline blocks should be affected by word-spacing property
+        https://bugs.webkit.org/show_bug.cgi?id=69072
+
+        Reviewed by Levi Weintraub.
+
+        * fast/css/word-spacing-between-blocks-expected.html: Added.
+        * fast/css/word-spacing-between-blocks.html: Added.
+        * fast/css/word-spacing-between-inlines-expected.html: Added.
+        * fast/css/word-spacing-between-inlines.html: Added.
+
 2012-12-12  Adam Klein  <ad...@chromium.org>
 
         Mark calendar-picker-appearance tests as ImageOnlyFailures on cr-mac after r137473

Added: trunk/LayoutTests/fast/css/word-spacing-between-blocks-expected.html (0 => 137494)


--- trunk/LayoutTests/fast/css/word-spacing-between-blocks-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/word-spacing-between-blocks-expected.html	2012-12-12 19:43:45 UTC (rev 137494)
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>White space processing</title>
+    <meta name="flags" content="ahem">
+    <link rel="help" href="" title="16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing' properties">
+    <link rel="author" title="Robert Hogan">
+    <style type="text/css">
+        .wordspacing {
+            margin:.2em 0;
+            word-spacing:-.5em;
+            font:18px Ahem,sans-serif;
+        }
+        .test {
+            margin:.2em 0;
+            font:18px Ahem,sans-serif;
+        }
+        .wordspacing>span,
+        .wordspacing-letters>span {
+            display:inline-block;
+        }
+    </style>
+</head>
+
+<body>
+
+<p> White space between inline blocks should be affected by the word-spacing property.
+     https://bugs.webkit.org/show_bug.cgi?id=69072 </p>
+
+<p>The following strings must be the same:</p>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+
+<p>The following strings must be the same:</p>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+
+<p>The following strings must be the same:</p>
+<div class="test">xxx</div>
+<div class="test">xxx</div>
+<div class="test">xxx</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/word-spacing-between-blocks.html (0 => 137494)


--- trunk/LayoutTests/fast/css/word-spacing-between-blocks.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/word-spacing-between-blocks.html	2012-12-12 19:43:45 UTC (rev 137494)
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>White space processing</title>
+    <meta name="flags" content="ahem">
+    <link rel="help" href="" title="16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing' properties">
+    <link rel="author" title="Robert Hogan">
+    <style type="text/css">
+        .wordspacing {
+            margin:.2em 0;
+            word-spacing:-.5em;
+            font:18px Ahem,sans-serif;
+        }
+        .nowordspacing {
+            font:18px Ahem,sans-serif;
+            margin:.2em 0;
+        }
+        .wordspacing>span,
+        .wordspacing-letters>span {
+            display:inline-block;
+        }
+    </style>
+</head>
+
+<body>
+
+<p> White space between inline blocks should be affected by the word-spacing property.
+     https://bugs.webkit.org/show_bug.cgi?id=69072 </p>
+
+<p>The following strings must be the same:</p>
+<div class="wordspacing">x x x</div>
+
+<div class="wordspacing">
+    <span>x</span>
+    <span>x</span>
+    <span>x</span>
+</div>
+
+<div class="wordspacing"><span>x</span> <span>x</span> <span>x</span></div>
+
+<div class="wordspacing"><span>x</span>  <span>x</span>  <span>x</span></div>
+
+<div class="wordspacing"><span>x</span> <span>x <span>x</span> </span></div>
+
+<div class="wordspacing"><span>x </span>  <span>x</span>  <span>x</span></div>
+
+<div class="wordspacing"> <span> x </span>  <span>x</span>  <span>x</span></div>
+
+<div class="wordspacing">
+    <span>x</span> 
+    <span>x <span>x</span> </span>
+</div>
+
+<div class="wordspacing">
+    <span>x</span> 
+    <span>x 
+        <span>x</span> 
+    </span>
+</div>
+
+<p>The following strings must be the same:</p>
+<div class="nowordspacing">x x x</div>
+
+<div class="nowordspacing">
+    <span>x</span>
+    <span>x</span>
+    <span>x</span>
+</div>
+
+<div class="nowordspacing"><span>x</span> <span>x</span> <span>x</span></div>
+
+<div class="nowordspacing"><span>x</span> <span>x <span>x</span> </span></div>
+
+<div class="nowordspacing"><span>x</span> <span>x <span>x</span> </span></div>
+
+<div class="nowordspacing">
+    <span>x</span> 
+    <span>x <span>x</span> </span>
+</div>
+
+<div class="nowordspacing">
+    <span>x</span> 
+    <span>x 
+        <span>x</span> 
+    </span>
+</div>
+
+<p>The following strings must be the same:</p>
+<div class="wordspacing">xxx</div>
+<div class="wordspacing"><span>x</span><span>x</span><span>x</span></div>
+<div class="nowordspacing"><span>x</span><span>x</span><span>x</span></div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/word-spacing-between-inlines-expected.html (0 => 137494)


--- trunk/LayoutTests/fast/css/word-spacing-between-inlines-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/word-spacing-between-inlines-expected.html	2012-12-12 19:43:45 UTC (rev 137494)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>White space processing</title>
+    <meta name="flags" content="ahem">
+    <link rel="help" href="" title="16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing' properties">
+    <link rel="author" title="Robert Hogan">
+    <style type="text/css">
+        .wordspacing {
+            margin:.2em 0;
+            word-spacing:-.5em;
+            font:18px Ahem,sans-serif;
+        }
+        .test {
+            margin:.2em 0;
+            font:18px Ahem,sans-serif;
+        }
+        .wordspacing>span {
+            display:inline;
+        }
+    </style>
+</head>
+
+<body>
+
+<p> White space between inline blocks should be affected by the word-spacing property.
+     https://bugs.webkit.org/show_bug.cgi?id=69072 </p>
+
+<p>The following strings must be the same:</p>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+<div class="wordspacing">x x x</div>
+
+<p>The following strings must be the same:</p>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+<div class="test">x x x</div>
+
+<p>The following strings must be the same:</p>
+<div class="test">xxx</div>
+<div class="test">xxx</div>
+<div class="test">xxx</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/word-spacing-between-inlines.html (0 => 137494)


--- trunk/LayoutTests/fast/css/word-spacing-between-inlines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/word-spacing-between-inlines.html	2012-12-12 19:43:45 UTC (rev 137494)
@@ -0,0 +1,81 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>White space processing</title>
+    <meta name="flags" content="ahem">
+    <link rel="help" href="" title="16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing' properties">
+    <link rel="author" title="Robert Hogan">
+    <style type="text/css">
+        .wordspacing {
+            margin:.2em 0;
+            word-spacing:-.5em;
+            font:18px Ahem,sans-serif;
+        }
+        .nowordspacing {
+            font:18px Ahem,sans-serif;
+            margin:.2em 0;
+        }
+        .wordspacing>span,
+        .wordspacing-letters>span {
+            display:inline;
+        }
+    </style>
+</head>
+
+<body>
+
+<p> White space between inline blocks should be affected by the word-spacing property.
+     https://bugs.webkit.org/show_bug.cgi?id=69072 </p>
+
+<p>The following strings must be the same:</p>
+<div class="wordspacing">x x x</div>
+
+<div class="wordspacing">
+    <span>x</span>
+    <span>x</span>
+    <span>x</span>
+</div>
+<div class="wordspacing"><span>x</span> <span>x</span> <span>x</span></div>
+<div class="wordspacing"><span>x</span>  <span>x</span>  <span>x</span></div>
+
+<div class="wordspacing"><span>x</span> <span>x <span>x</span> </span></div>
+<div class="wordspacing">
+    <span>x</span> 
+    <span>x <span>x</span> </span>
+</div>
+<div class="wordspacing">
+    <span>x</span> 
+    <span>x 
+        <span>x</span> 
+    </span>
+</div>
+
+<p>The following strings must be the same:</p>
+<div class="nowordspacing">x x x</div>
+<div class="nowordspacing">
+    <span>x</span>
+    <span>x</span>
+    <span>x</span>
+</div>
+<div class="nowordspacing"><span>x</span> <span>x</span> <span>x</span></div>
+<div class="nowordspacing"><span>x</span> <span>x <span>x</span> </span></div>
+<div class="nowordspacing"><span>x</span> <span>x <span>x</span> </span></div>
+<div class="nowordspacing">
+    <span>x</span> 
+    <span>x <span>x</span> </span>
+</div>
+<div class="nowordspacing">
+    <span>x</span> 
+    <span>x 
+        <span>x</span> 
+    </span>
+</div>
+
+<p>The following strings must be the same:</p>
+<div class="wordspacing">xxx</div>
+<div class="wordspacing"><span>x</span><span>x</span><span>x</span></div>
+<div class="nowordspacing"><span>x</span><span>x</span><span>x</span></div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (137493 => 137494)


--- trunk/Source/WebCore/ChangeLog	2012-12-12 19:39:42 UTC (rev 137493)
+++ trunk/Source/WebCore/ChangeLog	2012-12-12 19:43:45 UTC (rev 137494)
@@ -1,3 +1,21 @@
+2012-12-12  Robert Hogan  <rob...@webkit.org>
+
+        White space between inline blocks should be affected by word-spacing property
+        https://bugs.webkit.org/show_bug.cgi?id=69072
+
+        Reviewed by Levi Weintraub.
+
+        Allow word-spacing to get added to the spaces between inline blocks in placeBoxesInInlineDirection by setting
+        needsWordSpacing to true each time an inline block is encountered. This ensures that the next space encountered
+        in a text run will be treated as a space between two words and will get word-spacing added to it if it is present
+        in the style.
+
+        Tests: fast/css/word-spacing-between-blocks.html
+               fast/css/word-spacing-between-inlines.html
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):
+
 2012-12-12  Xianzhu Wang  <wangxian...@chromium.org>
 
         Pre-painting should not paint out-of-view fixed position elements

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (137493 => 137494)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-12-12 19:39:42 UTC (rev 137493)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-12-12 19:43:45 UTC (rev 137494)
@@ -435,6 +435,8 @@
                 if (knownToHaveNoOverflow())
                     maxLogicalRight = max(logicalLeft, maxLogicalRight);
                 logicalLeft += logicalRightMargin;
+                // If we encounter any space after this inline block then ensure it is treated as the space between two words.
+                needsWordSpacing = true;
             }
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to