WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2008 05:38:52 +0000 (05:38 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2008 05:38:52 +0000 (05:38 +0000)
        Reviewed by John Sullivan.

        - fix <rdar://problem/5607547> Single letter surrounded by soft hyphens can disappear

        Test: fast/text/soft-hyphen-2.html

        * rendering/bidi.cpp:
        (WebCore::chopMidpointsAt): Changed to iterate midpoints backwards, so
        that if there are two midpoints at the given position, only the last one
        will be chopped off.

LayoutTests:

        Reviewed by John Sullivan.

        - test for <rdar://problem/5607547> Single letter surrounded by soft hyphens can disappear

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

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

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

index 300704fb2f249eac841b299544b7592eacc7c80f..a948116c0210f3eaa16111ae39aca431226734a5 100644 (file)
@@ -1,3 +1,14 @@
+2008-02-27  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - test for <rdar://problem/5607547> Single letter surrounded by soft hyphens can disappear
+
+        * fast/text/soft-hyphen-2.html: Added.
+        * platform/mac/fast/text/soft-hyphen-2-expected.checksum: Added.
+        * platform/mac/fast/text/soft-hyphen-2-expected.png: Added.
+        * platform/mac/fast/text/soft-hyphen-2-expected.txt: Added.
+
 2008-02-27  Brady Eidson  <beidson@apple.com>
 
         Updated resource used in the layout test I landed yesterday.
diff --git a/LayoutTests/fast/text/soft-hyphen-2.html b/LayoutTests/fast/text/soft-hyphen-2.html
new file mode 100644 (file)
index 0000000..540aa90
--- /dev/null
@@ -0,0 +1,12 @@
+<style>
+    div { font-family: Ahem; font-size: 20px; width: 100px; background-color: red; color: green; }
+</style>
+<div>
+    hen&shy;a&shy;tion.
+</div>
+<div>
+    hena&shy;tion.
+</div>
+<div>
+    5x5sq
+</div>
diff --git a/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.checksum b/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.checksum
new file mode 100644 (file)
index 0000000..a6be0ea
--- /dev/null
@@ -0,0 +1 @@
+ddd99d7fcf5910569482a0d5bd143be2
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.png b/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.png
new file mode 100644 (file)
index 0000000..8b82481
Binary files /dev/null and b/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.txt b/LayoutTests/platform/mac/fast/text/soft-hyphen-2-expected.txt
new file mode 100644 (file)
index 0000000..b326dc5
--- /dev/null
@@ -0,0 +1,17 @@
+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 784x584
+      RenderBlock {DIV} at (0,0) size 100x40 [color=#008000] [bgcolor=#FF0000]
+        RenderText {#text} at (0,0) size 100x40
+          text run at (0,0) width 60: "hen"
+          text run at (60,0) width 40: "a\x{AD}"
+          text run at (0,20) width 100: "tion."
+      RenderBlock {DIV} at (0,40) size 100x40 [color=#008000] [bgcolor=#FF0000]
+        RenderText {#text} at (0,0) size 100x40
+          text run at (0,0) width 100: "hena\x{AD}"
+          text run at (0,20) width 100: "tion."
+      RenderBlock {DIV} at (0,80) size 100x20 [color=#008000] [bgcolor=#FF0000]
+        RenderText {#text} at (0,0) size 100x20
+          text run at (0,0) width 100: "5x5sq"
index 1c3c4975b417f0267998a4c9ffeff8ea7a628317..648e627b10a91ac7870b22a5782a53b07fa40810 100644 (file)
@@ -1,3 +1,16 @@
+2008-02-27  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - fix <rdar://problem/5607547> Single letter surrounded by soft hyphens can disappear
+
+        Test: fast/text/soft-hyphen-2.html
+
+        * rendering/bidi.cpp:
+        (WebCore::chopMidpointsAt): Changed to iterate midpoints backwards, so
+        that if there are two midpoints at the given position, only the last one
+        will be chopped off.
+
 2008-02-27  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler.
index bd175ec926c6874b6e04ddfca7404ae5d3dff766..152aaa2638a3bc28cb9ed637f342c582ba88c2fc 100644 (file)
@@ -325,7 +325,7 @@ static void chopMidpointsAt(RenderObject* obj, unsigned pos)
     if (!sNumMidpoints)
         return;
     BidiIterator* midpoints = smidpoints->data();
-    for (unsigned i = 0; i < sNumMidpoints; i++) {
+    for (int i = sNumMidpoints - 1; i >= 0; i--) {
         const BidiIterator& point = midpoints[i];
         if (point.obj == obj && point.pos == pos) {
             sNumMidpoints = i;