[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

mitz at apple.com mitz at apple.com
Thu Apr 8 00:56:20 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit fa13fccdf589aacd98f4b5eaeef71d8fab854075
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 7 01:41:32 2010 +0000

    <rdar://problem/7488126> With text-rendering: optimizelegibility, sometimes lines run too long
    https://bugs.webkit.org/show_bug.cgi?id=32794
    
    Reviewed by Sam Weinig.
    
    WebCore:
    
    Test: platform/mac/fast/text/line-breaking-with-kerning.html
    
    * rendering/RenderBlockLineLayout.cpp:
    (WebCore::RenderBlock::findNextLineBreak): When kerning is enabled, include
    the trailing space when measuring a word, then subtract its width. This
    accounts for kerning between the last glyph of the word and the following space.
    
    LayoutTests:
    
    * platform/mac/fast/text/line-breaking-with-kerning-expected.checksum: Added.
    * platform/mac/fast/text/line-breaking-with-kerning-expected.png: Added.
    * platform/mac/fast/text/line-breaking-with-kerning-expected.txt: Added.
    * platform/mac/fast/text/line-breaking-with-kerning.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52889 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c9c808d..70613b6 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-06  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/7488126> With text-rendering: optimizelegibility, sometimes lines run too long
+        https://bugs.webkit.org/show_bug.cgi?id=32794
+
+        * platform/mac/fast/text/line-breaking-with-kerning-expected.checksum: Added.
+        * platform/mac/fast/text/line-breaking-with-kerning-expected.png: Added.
+        * platform/mac/fast/text/line-breaking-with-kerning-expected.txt: Added.
+        * platform/mac/fast/text/line-breaking-with-kerning.html: Added.
+
 2010-01-06  Eric Seidel  <eric at webkit.org>
 
         No review.
diff --git a/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.checksum b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.checksum
new file mode 100644
index 0000000..2c40d40
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.checksum
@@ -0,0 +1 @@
+7280887d18297aeb59691625fd6bad2a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.png b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.png
new file mode 100644
index 0000000..bc96f58
Binary files /dev/null and b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.txt b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.txt
new file mode 100644
index 0000000..87a360c
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning-expected.txt
@@ -0,0 +1,45 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x582
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {I} at (0,0) size 759x36
+          RenderInline {A} at (0,0) size 307x18 [color=#0000EE]
+            RenderText {#text} at (53,0) size 307x18
+              text run at (53,0) width 307: "https://bugs.webkit.org/show_bug.cgi?id=32794"
+          RenderText {#text} at (360,0) size 759x36
+            text run at (360,0) width 4: " "
+            text run at (364,0) width 395: "With text-rendering: optimizelegibility, sometimes lines run too"
+            text run at (0,18) width 28: "long"
+        RenderText {#text} at (28,18) size 4x18
+          text run at (28,18) width 4: "."
+      RenderBlock {P} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 572x18
+          text run at (0,0) width 422: "Text should not overflow any of these boxes. The terminal of the f "
+          text run at (422,0) width 150: "may overlap the border."
+      RenderBlock {DIV} at (0,86) size 251x42 [border: (3px solid #0000FF)]
+        RenderText {#text} at (3,3) size 245x36
+          text run at (3,3) width 245: "maintenance of the balance of power"
+          text run at (3,21) width 13: "in"
+      RenderBlock {DIV} at (0,138) size 251x42 [border: (3px solid #FF0000)]
+        RenderText {#text} at (3,3) size 245x36
+          text run at (3,3) width 245: "maintenance of the balance of"
+          text run at (3,21) width 57: "power in"
+      RenderBlock {DIV} at (0,190) size 251x42 [border: (3px solid #0000FF)]
+        RenderText {#text} at (3,3) size 242x36
+          text run at (3,3) width 242: "maintenance of the balance of power"
+          text run at (3,21) width 13: "in"
+      RenderBlock {DIV} at (0,242) size 251x42 [border: (3px solid #FF0000)]
+        RenderText {#text} at (3,3) size 201x36
+          text run at (3,3) width 201: "maintenance of the balance of"
+          text run at (3,21) width 57: "power in"
+      RenderBlock {DIV} at (0,294) size 251x24 [border: (3px solid #0000FF)]
+        RenderText {#text} at (3,3) size 244x18
+          text run at (3,3) width 244: "f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f"
+      RenderBlock {DIV} at (0,328) size 251x42 [border: (3px solid #FF0000)]
+        RenderText {#text} at (3,3) size 235x36
+          text run at (3,3) width 235: "f f f f f f f f f f f f f f f f f f f f f f"
+          text run at (3,21) width 92: "f f f f f f f f f"
diff --git a/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning.html b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning.html
new file mode 100644
index 0000000..99edf91
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/text/line-breaking-with-kerning.html
@@ -0,0 +1,26 @@
+<style>
+    div {
+        font-family: baskerville;
+        width: 245px;
+        border: solid blue;
+        margin: 10px 0;
+    }
+    div.optimizelegibility {
+        text-rendering: optimizelegibility;
+        border-color: red;
+    }
+</style>
+<p>
+    Test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=32794">https://bugs.webkit.org/show_bug.cgi?id=32794</a>
+    With text-rendering: optimizelegibility, sometimes lines run too long</i>.
+</p>
+<p>
+    Text should not overflow any of these boxes. The terminal of the f
+    may overlap the border.
+</p>
+<div style="text-align: justify;">maintenance of the balance of power in</div>
+<div class="optimizelegibility" style="text-align: justify;">maintenance of the balance of power in</div>
+<div>maintenance of the balance of power in</div>
+<div class="optimizelegibility">maintenance of the balance of power in</div>
+<div>f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f</div>
+<div class="optimizelegibility">f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f</div>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1f00b1d..a709d3a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-06  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/7488126> With text-rendering: optimizelegibility, sometimes lines run too long
+        https://bugs.webkit.org/show_bug.cgi?id=32794
+
+        Test: platform/mac/fast/text/line-breaking-with-kerning.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::findNextLineBreak): When kerning is enabled, include
+        the trailing space when measuring a word, then subtract its width. This
+        accounts for kerning between the last glyph of the word and the following space.
+
 2010-01-06  Kevin Decker  <kdecker at apple.com>
 
         Reviewed by Simon Fraser
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index 8e2c49f..015981e 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -1804,6 +1804,11 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
             int wordSpacing = o->style()->wordSpacing();
             int lastSpaceWordSpacing = 0;
 
+            TextRenderingMode textRenderingMode = f.fontDescription().textRenderingMode();
+            // Non-zero only when kerning is enabled, in which case we measure words with their trailing
+            // space, then subtract its width.
+            int wordTrailingSpaceWidth = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? f.spaceWidth() + wordSpacing : 0;
+
             int wrapW = tmpW + inlineWidth(o, !appliedStartWidth, true);
             int charWidth = 0;
             bool breakNBSP = autoWrap && o->style()->nbspMode() == SPACE;
@@ -1898,7 +1903,11 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
                         }
                     }
 
-                    int additionalTmpW = textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
+                    int additionalTmpW;
+                    if (wordTrailingSpaceWidth && currentCharacterIsSpace)
+                        additionalTmpW = textWidth(t, lastSpace, pos + 1 - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) - wordTrailingSpaceWidth + lastSpaceWordSpacing;
+                    else
+                        additionalTmpW = textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
                     tmpW += additionalTmpW;
                     if (!appliedStartWidth) {
                         tmpW += inlineWidth(o, true, false);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list