Title: [97102] trunk
Revision
97102
Author
[email protected]
Date
2011-10-10 16:09:12 -0700 (Mon, 10 Oct 2011)

Log Message

REGRESSION(r96870): editing/pasteboard/smart-paste-008.html fails on non-Mac
https://bugs.webkit.org/show_bug.cgi?id=69587

Reviewed by Enrica Casucci.

Source/WebCore: 

Insert a space at the correct offset when startNode is a text node.

* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):

LayoutTests: 

Unskip the test. Also rebaseline a test for a nbsp/sp change.

* platform/win/Skipped:
* platform/win/fast/events/ondragenter-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97101 => 97102)


--- trunk/LayoutTests/ChangeLog	2011-10-10 22:54:05 UTC (rev 97101)
+++ trunk/LayoutTests/ChangeLog	2011-10-10 23:09:12 UTC (rev 97102)
@@ -1,3 +1,15 @@
+2011-10-10  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r96870): editing/pasteboard/smart-paste-008.html fails on non-Mac
+        https://bugs.webkit.org/show_bug.cgi?id=69587
+
+        Reviewed by Enrica Casucci.
+
+        Unskip the test. Also rebaseline a test for a nbsp/sp change.
+
+        * platform/win/Skipped:
+        * platform/win/fast/events/ondragenter-expected.txt:
+
 2011-09-20  Jer Noble  <[email protected]>
 
         MediaControlSeekButtonElement should support seeking by changing the playback rate.

Modified: trunk/LayoutTests/platform/win/Skipped (97101 => 97102)


--- trunk/LayoutTests/platform/win/Skipped	2011-10-10 22:54:05 UTC (rev 97101)
+++ trunk/LayoutTests/platform/win/Skipped	2011-10-10 23:09:12 UTC (rev 97102)
@@ -1419,7 +1419,3 @@
 
 # https://bugs.webkit.org/show_bug.cgi?id=66773
 http/tests/loading/progress-finished-callback.html
-
-# REGRESSION(r96870): editing/pasteboard/smart-paste-008.html fails on non-Mac
-# https://bugs.webkit.org/show_bug.cgi?id=69587
-editing/pasteboard/smart-paste-008.html

Copied: trunk/LayoutTests/platform/win/editing/pasteboard/smart-paste-008-expected.txt (from rev 97101, trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-008-expected.txt) (0 => 97102)


--- trunk/LayoutTests/platform/win/editing/pasteboard/smart-paste-008-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/editing/pasteboard/smart-paste-008-expected.txt	2011-10-10 23:09:12 UTC (rev 97102)
@@ -0,0 +1,21 @@
+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 784x36
+        RenderText {#text} at (0,0) size 773x36
+          text run at (0,0) width 394: "There was a bug in paste's smart replace whitespace handling. "
+          text run at (394,0) width 379: "In some cases, it used information gathered at the start of the"
+          text run at (0,18) width 722: "selection being pasted into to decide whether or not a space needed to be added to the end of the incoming content."
+      RenderBlock {P} at (0,52) size 784x36
+        RenderText {#text} at (0,0) size 765x36
+          text run at (0,0) width 548: "A smart paste is performed into a selection starting in one block and ending in another. "
+          text run at (548,0) width 217: "Spaces should surround the pasted"
+          text run at (0,18) width 37: "word."
+      RenderBlock {DIV} at (0,104) size 784x18
+        RenderBlock {DIV} at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 54x18
+            text run at (0,0) width 54: "f foo bar"
+        RenderBlock (anonymous) at (0,18) size 784x0
+caret: position 5 of child 0 {#text} of child 0 {DIV} of child 4 {DIV} of body

Copied: trunk/LayoutTests/platform/win/fast/events/ondragenter-expected.txt (from rev 97101, trunk/LayoutTests/fast/events/ondragenter-expected.txt) (0 => 97102)


--- trunk/LayoutTests/platform/win/fast/events/ondragenter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/events/ondragenter-expected.txt	2011-10-10 23:09:12 UTC (rev 97102)
@@ -0,0 +1,3 @@
+
+Success: Text
+This automated layout test checks to see that ondragenter events are being sent.

Modified: trunk/Source/WebCore/ChangeLog (97101 => 97102)


--- trunk/Source/WebCore/ChangeLog	2011-10-10 22:54:05 UTC (rev 97101)
+++ trunk/Source/WebCore/ChangeLog	2011-10-10 23:09:12 UTC (rev 97102)
@@ -1,3 +1,15 @@
+2011-10-10  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r96870): editing/pasteboard/smart-paste-008.html fails on non-Mac
+        https://bugs.webkit.org/show_bug.cgi?id=69587
+
+        Reviewed by Enrica Casucci.
+
+        Insert a space at the correct offset when startNode is a text node.
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
+
 2011-09-20  Jer Noble  <[email protected]>
 
         MediaControlSeekButtonElement should support seeking by changing the playback rate.

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (97101 => 97102)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-10-10 22:54:05 UTC (rev 97101)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-10-10 23:09:12 UTC (rev 97102)
@@ -1149,17 +1149,18 @@
 
     Position startDownstream = startOfInsertedContent.deepEquivalent().downstream();
     Node* startNode = startDownstream.computeNodeAfterPosition();
-    if (startDownstream.anchorType() == Position::PositionIsOffsetInAnchor)
+    unsigned startOffset = 0;
+    if (startDownstream.anchorType() == Position::PositionIsOffsetInAnchor) {
         startNode = startDownstream.containerNode();
+        startOffset = startDownstream.offsetInContainerNode();
+    }
 
     bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isCharacterSmartReplaceExempt(startOfInsertedContent.previous().characterAfter(), true);
     if (needsLeadingSpace && startNode) {
         bool collapseWhiteSpace = !startNode->renderer() || startNode->renderer()->style()->collapseWhiteSpace();
         if (startNode->isTextNode()) {
-            Text* text = static_cast<Text*>(startNode);
-            // FIXME: we shouldn't always be inserting the space at the beginning
-            insertTextIntoNode(text, 0, collapseWhiteSpace ? nonBreakingSpaceString() : " ");
-            if (m_endOfInsertedContent.containerNode() == text && m_endOfInsertedContent.offsetInContainerNode())
+            insertTextIntoNode(static_cast<Text*>(startNode), startOffset, collapseWhiteSpace ? nonBreakingSpaceString() : " ");
+            if (m_endOfInsertedContent.containerNode() == startNode && m_endOfInsertedContent.offsetInContainerNode())
                 m_endOfInsertedContent.moveToOffset(m_endOfInsertedContent.offsetInContainerNode() + 1);
         } else {
             RefPtr<Node> node = document()->createEditingTextNode(collapseWhiteSpace ? nonBreakingSpaceString() : " ");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to