Reviewed and landed by Darin.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Aug 2005 05:01:53 +0000 (05:01 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Aug 2005 05:01:53 +0000 (05:01 +0000)
        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3429
          Text transformed with text-transform does not copy with transform applied

        Test cases added:
        * layout-tests/editing/pasteboard/paste-text-019-expected.txt: Added.
        * layout-tests/editing/pasteboard/paste-text-019.html: Added.

        * khtml/editing/visible_text.cpp:
        (khtml::TextIterator::handleTextNode): Use the DOMString from the RenderText, not the DOM text node.
        (khtml::TextIterator::handleTextBox): Ditto.

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

LayoutTests/editing/pasteboard/paste-text-019-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/paste-text-019.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/visible_text.cpp

diff --git a/LayoutTests/editing/pasteboard/paste-text-019-expected.txt b/LayoutTests/editing/pasteboard/paste-text-019-expected.txt
new file mode 100644 (file)
index 0000000..9b9b020
--- /dev/null
@@ -0,0 +1,59 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertText:Bar replacingDOMRange:range from 4 of #text > SPAN > DIV > BODY > HTML > #document to 4 of #text > SPAN > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderCanvas 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 784x288 [border: (2px solid #0000FF)]
+        RenderBlock {DIV} at (14,14) size 756x84
+          RenderText {TEXT} at (0,0) size 67x28
+            text run at (0,0) width 67: "Tests: "
+          RenderBR {BR} at (0,0) size 0x0
+          RenderText {TEXT} at (0,28) size 162x28
+            text run at (0,28) width 162: "Fix for this bug: "
+          RenderInline {A} at (0,0) size 557x28 [color=#0000EE]
+            RenderText {TEXT} at (162,28) size 557x28
+              text run at (162,28) width 557: "<http://bugzilla.opendarwin.org/show_bug.cgi?id=3429>"
+          RenderText {TEXT} at (0,56) size 729x28
+            text run at (0,56) width 729: "Text transformed with text-transform does not copy with transform applied"
+        RenderBlock {DIV} at (14,114) size 756x160
+          RenderBlock (anonymous) at (0,0) size 756x56
+            RenderText {TEXT} at (0,0) size 189x28
+              text run at (0,0) width 189: "Expected Results: "
+            RenderBR {BR} at (0,0) size 0x0
+            RenderText {TEXT} at (0,28) size 202x28
+              text run at (0,28) width 202: "Should see the string"
+          RenderBlock {PRE} at (0,80) size 756x28
+            RenderText {TEXT} at (0,0) size 210x28
+              text run at (0,0) width 210: "Foo Bar baz Bar"
+          RenderBlock (anonymous) at (0,132) size 756x28
+            RenderText {TEXT} at (0,0) size 155x28
+              text run at (0,0) width 155: "(case sensitive)."
+      RenderBlock {DIV} at (0,312) size 784x32 [border: (2px solid #FF0000)]
+        RenderInline {SPAN} at (0,0) size 153x28
+          RenderInline {SPAN} at (0,0) size 78x28
+            RenderText {TEXT} at (2,2) size 78x28
+              text run at (2,2) width 78: "Foo Bar"
+          RenderText {TEXT} at (80,2) size 40x28
+            text run at (80,2) width 40: " baz"
+          RenderText {TEXT} at (120,2) size 35x28
+            text run at (120,2) width 35: "Bar"
+        RenderText {TEXT} at (0,0) size 0x0
+caret: position 3 of child 2 {TEXT} of child 1 {SPAN} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/pasteboard/paste-text-019.html b/LayoutTests/editing/pasteboard/paste-text-019.html
new file mode 100644 (file)
index 0000000..28ec1b5
--- /dev/null
@@ -0,0 +1,62 @@
+<html> 
+<head>
+
+<style>
+.editing { 
+    border: 2px solid red; 
+    font-size: 24px; 
+}
+.explanation { 
+    border: 2px solid blue; 
+    padding: 12px; 
+    font-size: 24px; 
+    margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+    for (i = 0; i < 4; i++)
+        moveSelectionForwardByCharacterCommand();
+    for (i = 0; i < 3; i++)
+        extendSelectionForwardByCharacterCommand();
+    copyCommand();
+    for (i = 0; i < 4; i++)
+        moveSelectionForwardByCharacterCommand();
+    moveSelectionForwardByCharacterCommand();
+    pasteAndMatchStyleCommand();
+}
+
+</script>
+
+<title>Editing Test</title> 
+</head> 
+<body>
+<div class="explanation">
+<div class="scenario">
+Tests: 
+<br>
+Fix for this bug: 
+<a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3429">&lt;http://bugzilla.opendarwin.org/show_bug.cgi?id=3429&gt;</a> Text transformed with text-transform does not copy with transform applied
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+Should see the string <pre>Foo Bar baz Bar</pre> (case sensitive).
+</div>
+</div>
+<div contenteditable id="root" class="editing">
+<span id="test"><span style="text-transform: capitalize;">foo bar</span> baz</span>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
index 22260fcbe136fcc50d74d45d803eb83a9c7153c0..6ba17d202d4fd25f4eb18ac7e752bfd7550166c4 100644 (file)
@@ -1,3 +1,18 @@
+2005-08-14  Andrew Wellington  <proton@wiretapped.net>
+
+        Reviewed and landed by Darin.
+
+        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3429
+          Text transformed with text-transform does not copy with transform applied
+
+        Test cases added:
+        * layout-tests/editing/pasteboard/paste-text-019-expected.txt: Added.
+        * layout-tests/editing/pasteboard/paste-text-019.html: Added.
+
+        * khtml/editing/visible_text.cpp:
+        (khtml::TextIterator::handleTextNode): Use the DOMString from the RenderText, not the DOM text node.
+        (khtml::TextIterator::handleTextBox): Ditto.
+
 2005-08-14  Darin Adler  <darin@apple.com>
 
         - fixed build of some unit tests
 2005-08-14  Darin Adler  <darin@apple.com>
 
         - fixed build of some unit tests
index 1e2526d59837c011920f9479a8b215856346eff1..307c5e4e586afb48ca078869ffda5af5e6ca5cee 100644 (file)
@@ -216,7 +216,7 @@ bool TextIterator::handleTextNode()
     m_lastTextNode = m_node;
 
     RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
     m_lastTextNode = m_node;
 
     RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
-    DOMString str = m_node->nodeValue();
+    DOMString str = renderer->string();
 
     // handle pre-formatted text
     if (renderer->style()->whiteSpace() == khtml::PRE) {
 
     // handle pre-formatted text
     if (renderer->style()->whiteSpace() == khtml::PRE) {
@@ -266,7 +266,7 @@ bool TextIterator::handleTextNode()
 void TextIterator::handleTextBox()
 {    
     RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
 void TextIterator::handleTextBox()
 {    
     RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
-    DOMString str = m_node->nodeValue();
+    DOMString str = renderer->string();
     long start = m_offset;
     long end = (m_node == m_endContainer) ? m_endOffset : LONG_MAX;
     while (m_textBox) {
     long start = m_offset;
     long end = (m_node == m_endContainer) ? m_endOffset : LONG_MAX;
     while (m_textBox) {