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

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9456>
        REGRESSION (417.9.2-420+): Cmd-G doesn't work in Safari after double-click and Cmd-E

        * editing/execCommand/findString-2-expected.checksum: Added.
        * editing/execCommand/findString-2-expected.png: Added.
        * editing/execCommand/findString-2-expected.txt: Added.
        * editing/execCommand/findString-2.html: Added.

WebCore:

        Reviewed by harrison

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9456>
        REGRESSION (417.9.2-420+): Cmd-G doesn't work in Safari after double-click and Cmd-E

        * page/Frame.cpp:
        (WebCore::Frame::findString): When comparing the found range with
        what's currently selected a) build a selection with the found
        range to remove collapsed whitespace and b) compare ranges
        instead of selection objects to ignore the way that the
        current selection was made (to ignore the base and extent).

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

LayoutTests/ChangeLog
LayoutTests/editing/execCommand/findString-2-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/findString-2-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/findString-2-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/findString-2.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/Frame.cpp

index dff1207b5f3f91f9db5785279ed01e4e6ccc1fd8..55ef21b1c5648fdd1834470321b2daa7372c290e 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-15  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9456>
+        REGRESSION (417.9.2-420+): Cmd-G doesn't work in Safari after double-click and Cmd-E
+
+        * editing/execCommand/findString-2-expected.checksum: Added.
+        * editing/execCommand/findString-2-expected.png: Added.
+        * editing/execCommand/findString-2-expected.txt: Added.
+        * editing/execCommand/findString-2.html: Added.
+
 2006-06-14  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by levi
diff --git a/LayoutTests/editing/execCommand/findString-2-expected.checksum b/LayoutTests/editing/execCommand/findString-2-expected.checksum
new file mode 100644 (file)
index 0000000..9f20973
--- /dev/null
@@ -0,0 +1 @@
+cfa8686340a7caf631f9b91a6e139fd4
\ No newline at end of file
diff --git a/LayoutTests/editing/execCommand/findString-2-expected.png b/LayoutTests/editing/execCommand/findString-2-expected.png
new file mode 100644 (file)
index 0000000..8806ca7
Binary files /dev/null and b/LayoutTests/editing/execCommand/findString-2-expected.png differ
diff --git a/LayoutTests/editing/execCommand/findString-2-expected.txt b/LayoutTests/editing/execCommand/findString-2-expected.txt
new file mode 100644 (file)
index 0000000..86f997a
--- /dev/null
@@ -0,0 +1,24 @@
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 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: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 765x36
+          text run at (0,0) width 765: "This tests to see if Find will get stuck when searching for a word that is currently selected, and was selected with a double"
+          text run at (0,18) width 34: "click."
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 25x18
+          text run at (0,0) width 25: "foo "
+        RenderInline {SPAN} at (0,0) size 20x18
+          RenderText {#text} at (25,0) size 20x18
+            text run at (25,0) width 20: "bar"
+        RenderText {#text} at (45,0) size 101x18
+          text run at (45,0) width 101: " baz foo bar baz"
+selection start: position 9 of child 2 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 12 of child 2 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/execCommand/findString-2.html b/LayoutTests/editing/execCommand/findString-2.html
new file mode 100644 (file)
index 0000000..0346d65
--- /dev/null
@@ -0,0 +1,18 @@
+<p>This tests to see if Find will get stuck when searching for a word that is currently selected, and was selected with a double click.</p>
+
+<div>foo <span id="selectme">bar</span> baz foo bar baz</div>
+
+<script>
+if (window.layoutTestController) {
+    var e = document.getElementById("selectme");
+    var x = e.offsetParent.offsetLeft + e.offsetLeft + e.offsetWidth / 2;
+    var y = e.offsetParent.offsetTop + e.offsetTop + e.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    
+    document.execCommand("FindString", false, "bar");
+}
+</script>
\ No newline at end of file
index 18ea92381502dc0075ae116db3b745e5db3d0e8e..eedb6979eaa4a05b7239c2c87f3951433b17f75f 100644 (file)
@@ -1,3 +1,17 @@
+2006-06-15  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9456>
+        REGRESSION (417.9.2-420+): Cmd-G doesn't work in Safari after double-click and Cmd-E
+        
+        * page/Frame.cpp:
+        (WebCore::Frame::findString): When comparing the found range with
+        what's currently selected a) build a selection with the found
+        range to remove collapsed whitespace and b) compare ranges 
+        instead of selection objects to ignore the way that the 
+        current selection was made (to ignore the base and extent).
+
 2006-06-15  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by mjs.
index 1ff7c44511e829b22ce885dc262cf5cf53814479..aeae08f2f98f02782df0fdae5a0c5436ea3bcacf 100644 (file)
@@ -3381,8 +3381,10 @@ bool Frame::findString(const String& target, bool forward, bool caseFlag, bool w
     }
     RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, forward, caseFlag));
     Selection sel = selection().selection();
-    // If the found range is one that's already selected, find again.
-    if (!sel.isNone() && Selection(resultRange.get()) == sel) {
+    // If the found range is already selected, find again.
+    // Build a selection with the found range to remove collapsed whitespace.
+    // Compare ranges instead of selection objects to ignore the way that the current selection was made.
+    if (!sel.isNone() && *Selection(resultRange.get()).toRange() == *sel.toRange()) {
         searchRange = rangeOfContents(document());
         if (forward)
             setStart(searchRange.get(), VisiblePosition(sel.end(), sel.affinity()));