Title: [129068] trunk
Revision
129068
Author
[email protected]
Date
2012-09-19 16:37:36 -0700 (Wed, 19 Sep 2012)

Log Message

When kerning is enabled, word spacing is doubly accounted for in RenderText::computePreferredLogicalWidths
https://bugs.webkit.org/show_bug.cgi?id=97146

Reviewed by Anders Carlsson.

Source/WebCore: 

Test: fast/text/word-space-with-kerning.html

* rendering/RenderText.cpp:
(WebCore::RenderText::computePreferredLogicalWidths): When kerning is enabled, words are
measured with their trailing space, if there is one, then the width of a space is subtracted.
Changed that width, stored in the local variable wordTrailingSpaceWidth, to include the
word spacing, since it is included in the result of widthFromCache().

LayoutTests: 

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129067 => 129068)


--- trunk/LayoutTests/ChangeLog	2012-09-19 23:29:41 UTC (rev 129067)
+++ trunk/LayoutTests/ChangeLog	2012-09-19 23:37:36 UTC (rev 129068)
@@ -1,3 +1,13 @@
+2012-09-19  Dan Bernstein  <[email protected]>
+
+        When kerning is enabled, word spacing is doubly accounted for in RenderText::computePreferredLogicalWidths
+        https://bugs.webkit.org/show_bug.cgi?id=97146
+
+        Reviewed by Anders Carlsson.
+
+        * fast/text/word-space-with-kerning-expected.html: Added.
+        * fast/text/word-space-with-kerning.html: Added.
+
 2012-09-19  Dirk Pranke  <[email protected]>
 
         Fix lines missed (??) in mac-wk2/TestExpectations

Added: trunk/LayoutTests/fast/text/word-space-with-kerning-expected.html (0 => 129068)


--- trunk/LayoutTests/fast/text/word-space-with-kerning-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/word-space-with-kerning-expected.html	2012-09-19 23:37:36 UTC (rev 129068)
@@ -0,0 +1,8 @@
+<div style="font-size: 20px; font-family: ahem; -webkit-font-smoothing: none;">
+    <div>
+        <span style="word-spacing: 60px">a b c d </span> e
+    </div>
+    <div>
+        <span style="word-spacing: 60px">a b c d </span> e
+    </div>
+</div>

Added: trunk/LayoutTests/fast/text/word-space-with-kerning.html (0 => 129068)


--- trunk/LayoutTests/fast/text/word-space-with-kerning.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/word-space-with-kerning.html	2012-09-19 23:37:36 UTC (rev 129068)
@@ -0,0 +1,8 @@
+<div style="font-size: 20px; font-family: ahem; -webkit-font-smoothing: none;">
+    <div>
+        <span style="word-spacing: 60px">a b c d </span> e
+    </div>
+    <div style="-webkit-font-kerning: normal;">
+        <span style="word-spacing: 60px">a b c d </span> e
+    </div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (129067 => 129068)


--- trunk/Source/WebCore/ChangeLog	2012-09-19 23:29:41 UTC (rev 129067)
+++ trunk/Source/WebCore/ChangeLog	2012-09-19 23:37:36 UTC (rev 129068)
@@ -1,3 +1,18 @@
+2012-09-19  Dan Bernstein  <[email protected]>
+
+        When kerning is enabled, word spacing is doubly accounted for in RenderText::computePreferredLogicalWidths
+        https://bugs.webkit.org/show_bug.cgi?id=97146
+
+        Reviewed by Anders Carlsson.
+
+        Test: fast/text/word-space-with-kerning.html
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::computePreferredLogicalWidths): When kerning is enabled, words are
+        measured with their trailing space, if there is one, then the width of a space is subtracted.
+        Changed that width, stored in the local variable wordTrailingSpaceWidth, to include the
+        word spacing, since it is included in the result of widthFromCache().
+
 2012-09-19  Joshua Bell  <[email protected]>
 
         IndexedDB: Remove "current transaction" concept from backing store

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (129067 => 129068)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2012-09-19 23:29:41 UTC (rev 129067)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2012-09-19 23:37:36 UTC (rev 129068)
@@ -966,7 +966,7 @@
 
     // 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(RenderBlock::constructTextRun(this, f, &space, 1, styleToUse)) : 0;
+    float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, styleToUse)) + wordSpacing : 0;
 
     // If automatic hyphenation is allowed, we keep track of the width of the widest word (or word
     // fragment) encountered so far, and only try hyphenating words that are wider.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to