LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Jun 2006 00:12:49 +0000 (00:12 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Jun 2006 00:12:49 +0000 (00:12 +0000)
        Reviewed by levi

        <rdar://problem/4439248>
        REGRESSION(412-417): [RTL] Serious problem with RTL signatures in Mail.app in 10.4.4 (7766)

        * editing/pasteboard/copy-paste-bidi-expected.checksum: Added.
        * editing/pasteboard/copy-paste-bidi-expected.png: Added.
        * editing/pasteboard/copy-paste-bidi-expected.txt: Added.
        * editing/pasteboard/copy-paste-bidi.html: Added.

WebCore:

        Reviewed by levi

        <rdar://problem/4439248>
        REGRESSION(412-417): [RTL] Serious problem with RTL signatures in Mail.app in 10.4.4 (7766)

        * editing/markup.cpp:
        (WebCore::renderedText): Use plainText so that we'll pull rendered text but in DOM order.

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

LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/copy-paste-bidi-expected.checksum [new file with mode: 0644]
LayoutTests/editing/pasteboard/copy-paste-bidi-expected.png [new file with mode: 0644]
LayoutTests/editing/pasteboard/copy-paste-bidi-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/copy-paste-bidi.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/markup.cpp

index 2d26bcd774368768f9f95153c221dfff96ec0975..dff1207b5f3f91f9db5785279ed01e4e6ccc1fd8 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-14  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by levi
+        
+        <rdar://problem/4439248>
+        REGRESSION(412-417): [RTL] Serious problem with RTL signatures in Mail.app in 10.4.4 (7766)
+
+        * editing/pasteboard/copy-paste-bidi-expected.checksum: Added.
+        * editing/pasteboard/copy-paste-bidi-expected.png: Added.
+        * editing/pasteboard/copy-paste-bidi-expected.txt: Added.
+        * editing/pasteboard/copy-paste-bidi.html: Added.
+
 2006-06-14  Levi Weintraub  <lweintraub@apple.com>
 
         Reviewed by justin
diff --git a/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.checksum b/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.checksum
new file mode 100644 (file)
index 0000000..aeaafcc
--- /dev/null
@@ -0,0 +1 @@
+a089ccd85605aa3fc0f54369c8519ea7
\ No newline at end of file
diff --git a/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.png b/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.png
new file mode 100644 (file)
index 0000000..7b78345
Binary files /dev/null and b/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.png differ
diff --git a/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.txt b/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.txt
new file mode 100644 (file)
index 0000000..d5bb3cb
--- /dev/null
@@ -0,0 +1,51 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 5 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+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 {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 774x18
+          text run at (0,0) width 774: "These tests to see if bidi text with a base writing direction of right to left is put onto the paste board in logical (DOM) order."
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderText {#text} at (712,0) size 72x18
+          text run at (712,0) width 40 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}:"
+          text run at (752,0) width 32: "1234"
+      RenderBlock {DIV} at (0,52) size 784x36
+        RenderBlock {DIV} at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 72x18
+            text run at (0,0) width 32: "1234"
+            text run at (32,0) width 36 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}"
+            text run at (68,0) width 4: ":"
+        RenderBlock {DIV} at (0,18) size 784x18
+          RenderText {#text} at (712,0) size 72x18
+            text run at (712,0) width 40 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}:"
+            text run at (752,0) width 32: "1234"
+caret: position 9 of child 0 {#text} of child 2 {DIV} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/pasteboard/copy-paste-bidi.html b/LayoutTests/editing/pasteboard/copy-paste-bidi.html
new file mode 100644 (file)
index 0000000..3648e62
Binary files /dev/null and b/LayoutTests/editing/pasteboard/copy-paste-bidi.html differ
index b57f2f3d1dcf0b071fbb25f7177eeb15e07e3d85..dc6614bc63c52c98c1cc7aa4de4ccd10d9aada88 100644 (file)
@@ -1,3 +1,13 @@
+2006-06-14  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by levi
+
+        <rdar://problem/4439248>
+        REGRESSION(412-417): [RTL] Serious problem with RTL signatures in Mail.app in 10.4.4 (7766)
+
+        * editing/markup.cpp:
+        (WebCore::renderedText): Use plainText so that we'll pull rendered text but in DOM order.
+
 2006-06-14  Levi Weintraub  <lweintraub@apple.com>
 
         Reviewed by justin
index a0ebaa4d57116678433e87edff2e6cb700c51e6e..3e5cbe9c309b350c4490c00a5b433a7c8c3fd05a 100644 (file)
@@ -40,6 +40,7 @@
 #include "Range.h"
 #include "htmlediting.h"
 #include "visible_units.h"
+#include "TextIterator.h"
 
 using namespace std;
 
@@ -88,17 +89,11 @@ static String stringValueForRange(const Node *node, const Range *range)
 
 static DeprecatedString renderedText(const Node *node, const Range *range)
 {
-    RenderObject *r = node->renderer();
-    if (!r)
-        return DeprecatedString();
-    
     if (!node->isTextNode())
         return DeprecatedString();
 
-    DeprecatedString result = "";
-
     ExceptionCode ec;
-    const Text *textNode = static_cast<const Text*>(node);
+    const TexttextNode = static_cast<const Text*>(node);
     unsigned startOffset = 0;
     unsigned endOffset = textNode->length();
 
@@ -107,44 +102,10 @@ static DeprecatedString renderedText(const Node *node, const Range *range)
     if (range && node == range->endContainer(ec))
         endOffset = range->endOffset(ec);
     
-    RenderText *textRenderer = static_cast<RenderText*>(r);
-    DeprecatedString str = node->nodeValue().deprecatedString();
-    for (InlineTextBox *box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
-        unsigned start = box->m_start;
-        unsigned end = box->m_start + box->m_len;
-        if (endOffset < start)
-            break;
-        if (startOffset <= end) {
-            unsigned s = max(start, startOffset);
-            unsigned e = min(end, endOffset);
-            result.append(str.mid(s, e-s));
-            if (e == end) {
-                // now add in collapsed-away spaces if at the end of the line
-                InlineTextBox *nextBox = box->nextTextBox();
-                if (nextBox && box->root() != nextBox->root()) {
-                    const char nonBreakingSpace = '\xa0';
-                    // count the number of characters between the end of the
-                    // current box and the start of the next box.
-                    int collapsedStart = e;
-                    int collapsedPastEnd = min((unsigned)nextBox->m_start, endOffset + 1);
-                    bool addNextNonNBSP = true;
-                    for (int i = collapsedStart; i < collapsedPastEnd; i++) {
-                        if (str[i] == nonBreakingSpace) {
-                            result.append(str[i]);
-                            addNextNonNBSP = true;
-                        }
-                        else if (addNextNonNBSP) {
-                            result.append(str[i]);
-                            addNextNonNBSP = false;
-                        }
-                    }
-                }
-            }
-        }
-
-    }
-    
-    return result;
+    Position start(const_cast<Node*>(node), startOffset);
+    Position end(const_cast<Node*>(node), endOffset);
+    Range r(node->document(), start, end);
+    return plainText(&r);
 }
 
 static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnotateForInterchange annotate, CSSMutableStyleDeclaration *defaultStyle)