WebCore:
authormitz <mitz@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Oct 2007 16:21:34 +0000 (16:21 +0000)
committermitz <mitz@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Oct 2007 16:21:34 +0000 (16:21 +0000)
        Reviewed by Nikolas Zimmermann.

        - fix http://bugs.webkit.org/show_bug.cgi?id=15367
          Assertion failure inspecting a document including soft hyphen code (0xad)

        Test: fast/text/word-break-soft-hyphen.html

        * rendering/RenderText.cpp:
        (WebCore::RenderText::calcPrefWidths): Changed to treat soft hyphens as
        word boundaries. This fixes the bug and is consistent with the fact that
        run rounding does occur at soft hyphens.

LayoutTests:

        Reviewed by Nikolas Zimmermann.

        - test for http://bugs.webkit.org/show_bug.cgi?id=15367
          Assertion failure inspecting a document including soft hyphen code (0xad)

        * fast/text/word-break-soft-hyphen.html: Added.
        * platform/mac/fast/text/word-break-soft-hyphen-expected.checksum: Added.
        * platform/mac/fast/text/word-break-soft-hyphen-expected.png: Added.
        * platform/mac/fast/text/word-break-soft-hyphen-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/text/word-break-soft-hyphen.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderText.cpp

index fcd93a879bf53ad13651ea045e07edc374723fbf..26b15036c78ae4a32878f9badde03c5f0c50e3ed 100644 (file)
@@ -1,3 +1,15 @@
+2007-10-18  Dan Bernstein  <dan.bernstein@apple.com>
+
+        Reviewed by Nikolas Zimmermann.
+
+        - test for http://bugs.webkit.org/show_bug.cgi?id=15367
+          Assertion failure inspecting a document including soft hyphen code (0xad)
+
+        * fast/text/word-break-soft-hyphen.html: Added.
+        * platform/mac/fast/text/word-break-soft-hyphen-expected.checksum: Added.
+        * platform/mac/fast/text/word-break-soft-hyphen-expected.png: Added.
+        * platform/mac/fast/text/word-break-soft-hyphen-expected.txt: Added.
+
 2007-10-18  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Anders.
diff --git a/LayoutTests/fast/text/word-break-soft-hyphen.html b/LayoutTests/fast/text/word-break-soft-hyphen.html
new file mode 100644 (file)
index 0000000..4bc4893
--- /dev/null
@@ -0,0 +1,10 @@
+<p>
+    Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=15367">http://bugs.webkit.org/show_bug.cgi?id=15367</a>
+    Assertion failure inspecting a document including soft hyphen code (0xad)</i>.
+</p>
+<p>
+    The following text should not wrap and the border should fit tightly around it.
+</p>
+<div style="border: solid; position: absolute; word-break: break-all;">
+    Two soft&shy;hyp&shy;hens
+</div>
diff --git a/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.checksum b/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.checksum
new file mode 100644 (file)
index 0000000..cc75307
--- /dev/null
@@ -0,0 +1 @@
+45c23c90d21c45db31544dbca7f5846f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.png b/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.png
new file mode 100644 (file)
index 0000000..8dc02d4
Binary files /dev/null and b/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.txt b/LayoutTests/platform/mac/fast/text/word-break-soft-hyphen-expected.txt
new file mode 100644 (file)
index 0000000..1943ee0
--- /dev/null
@@ -0,0 +1,27 @@
+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 784x576
+      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 781x36
+          RenderInline {A} at (0,0) size 301x18 [color=#0000EE]
+            RenderText {#text} at (53,0) size 301x18
+              text run at (53,0) width 301: "http://bugs.webkit.org/show_bug.cgi?id=15367"
+          RenderText {#text} at (354,0) size 781x36
+            text run at (354,0) width 4: " "
+            text run at (358,0) width 423: "Assertion failure inspecting a document including soft hyphen code"
+            text run at (0,18) width 41: "(0xad)"
+        RenderText {#text} at (41,18) size 4x18
+          text run at (41,18) width 4: "."
+      RenderBlock {P} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 489x18
+          text run at (0,0) width 489: "The following text should not wrap and the border should fit tightly around it."
+layer at (8,94) size 116x24
+  RenderBlock (positioned) {DIV} at (8,94) size 116x24 [border: (3px solid #000000)]
+    RenderText {#text} at (3,3) size 110x18
+      text run at (3,3) width 57: "Two soft"
+      text run at (60,3) width 24: "hyp"
+      text run at (84,3) width 29: "hens"
index 6d5c7989fa176a9e388384256930f81315854396..e53af7676e37fa79b3d6293022982303899e6960 100644 (file)
@@ -1,3 +1,17 @@
+2007-10-18  Dan Bernstein  <dan.bernstein@apple.com>
+
+        Reviewed by Nikolas Zimmermann.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=15367
+          Assertion failure inspecting a document including soft hyphen code (0xad)
+
+        Test: fast/text/word-break-soft-hyphen.html
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::calcPrefWidths): Changed to treat soft hyphens as 
+        word boundaries. This fixes the bug and is consistent with the fact that
+        run rounding does occur at soft hyphens.
+
 2007-10-18  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Anders.
index dcef4876e30448055901c9cf2b912e7057a35f87..838e48a66b31de89146a6ecfb06bf2730071893f 100644 (file)
@@ -582,10 +582,14 @@ void RenderText::calcPrefWidths(int leadWidth)
             ignoringSpaces = false;
 
         // Ignore spaces and soft hyphens
-        if (ignoringSpaces || c == softHyphen) {
+        if (ignoringSpaces) {
             ASSERT(lastWordBoundary == i);
             lastWordBoundary++;
             continue;
+        } else if (c == softHyphen) {
+            currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth);
+            lastWordBoundary = i + 1;
+            continue;
         }
 
         bool hasBreak = breakAll || isBreakable(txt, i, len, nextBreakable, breakNBSP);