LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2006 23:52:15 +0000 (23:52 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2006 23:52:15 +0000 (23:52 +0000)
        Reviewed by harrison

        <rdar://problem/4774354>
        REGRESSION: In Gmail, caret reappears when dragging a selection over some text in the message body

        * fast/repaint/4774354-expected.checksum: Added.
        * fast/repaint/4774354-expected.png: Added.
        * fast/repaint/4774354-expected.txt: Added.
        * fast/repaint/4774354.html: Added.
        * fast/repaint/resources/contenteditable-iframe-src.html: Added.

WebCore:

        Reviewed by harrison

        <rdar://problem/4774354>
        REGRESSION: In Gmail, caret reappears when dragging a selection over some text in the message body

        Functions call recomputCaretRect to see if the caret rect has changed,
        and, if it has, they invalidate (repaint) it.  recomputeCaretRect was
        returning false if the caret turned into a range selection or was blown
        away.

        * editing/SelectionController.cpp:
        (WebCore::SelectionController::recomputeCaretRect): Don't early return if
        !isCaret().  Obtain the FrameView* using the m_frame pointer, because m_sel
        may now be null.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/4774354-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/4774354-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/4774354-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/4774354.html [new file with mode: 0644]
LayoutTests/fast/repaint/resources/contenteditable-iframe-src.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/SelectionController.cpp

index 2fe9a4b74f0c9881d5ce5054c5fb2d33e94ee58e..ec28d0d6c8aa56e754a83291b690bb465f2bb931 100644 (file)
@@ -1,3 +1,16 @@
+2006-10-17  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/4774354>
+        REGRESSION: In Gmail, caret reappears when dragging a selection over some text in the message body
+
+        * fast/repaint/4774354-expected.checksum: Added.
+        * fast/repaint/4774354-expected.png: Added.
+        * fast/repaint/4774354-expected.txt: Added.
+        * fast/repaint/4774354.html: Added.
+        * fast/repaint/resources/contenteditable-iframe-src.html: Added.
+
 2006-10-17  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by sullivan
diff --git a/LayoutTests/fast/repaint/4774354-expected.checksum b/LayoutTests/fast/repaint/4774354-expected.checksum
new file mode 100644 (file)
index 0000000..ca28d12
--- /dev/null
@@ -0,0 +1 @@
+880c8befe324d3f8ff20cd55676a182b
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/4774354-expected.png b/LayoutTests/fast/repaint/4774354-expected.png
new file mode 100644 (file)
index 0000000..cddc731
Binary files /dev/null and b/LayoutTests/fast/repaint/4774354-expected.png differ
diff --git a/LayoutTests/fast/repaint/4774354-expected.txt b/LayoutTests/fast/repaint/4774354-expected.txt
new file mode 100644 (file)
index 0000000..8742634
--- /dev/null
@@ -0,0 +1,21 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 1 of BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document toDOMRange:range from 40 of #text > BODY > HTML > #document to 40 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+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
+      RenderPartObject {IFRAME} at (0,0) size 300x150
+        layer at (0,0) size 300x150
+          RenderView at (0,0) size 300x150
+        layer at (0,0) size 300x150
+          RenderBlock {HTML} at (0,0) size 300x150
+            RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
+              RenderText {#text} at (0,0) size 240x18
+                text run at (0,0) width 240: "You should not see a caret in this text."
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/fast/repaint/4774354.html b/LayoutTests/fast/repaint/4774354.html
new file mode 100644 (file)
index 0000000..b7c438c
--- /dev/null
@@ -0,0 +1,41 @@
+<script src="repaint.js" type="text/javascript"></script>
+<script type="text/javascript">
+
+function step1() {
+    if (window.layoutTestController)
+        window.layoutTestController.waitUntilDone();
+    // Wait for the frame to load.
+    window.setTimeout(step2, 100);
+}
+
+function step2() {
+    var frame = frames[0];
+    var doc = frame.document;
+    var body = doc.body;
+    var sel = frame.getSelection();
+    frame.focus();
+    sel.setPosition(body, 0);
+    doc.execCommand("InsertText", false, "You should not see a caret in this text.");
+    var text = body.firstChild;
+    sel.setPosition(text, text.length);
+    // Wait for the caret to paint.
+    window.setTimeout(runRepaintTest, 100);
+}
+
+function repaintTest() {
+    var frame = frames[0];
+    var doc = frame.document;
+    var body = doc.body;
+    var text = body.firstChild;
+    var sel = frame.getSelection();
+    
+    sel.setBaseAndExtent(text, 5, text, text.length);
+    
+    if (window.layoutTestController)
+        window.layoutTestController.notifyDone();
+}
+</script>
+
+<body onload="step1();">
+<iframe src="resources/contenteditable-iframe-src.html"></iframe>
+</body>
diff --git a/LayoutTests/fast/repaint/resources/contenteditable-iframe-src.html b/LayoutTests/fast/repaint/resources/contenteditable-iframe-src.html
new file mode 100644 (file)
index 0000000..44e2e17
--- /dev/null
@@ -0,0 +1 @@
+<body bgcolor="lightyellow" contenteditable></body>
\ No newline at end of file
index d1f16ea99c48288fa1766912b545bd62ded89969..0dc8fa51418341b7a14063803a71fc30a4c4d5ea 100644 (file)
@@ -1,3 +1,20 @@
+2006-10-17  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/4774354>
+        REGRESSION: In Gmail, caret reappears when dragging a selection over some text in the message body
+
+        Functions call recomputCaretRect to see if the caret rect has changed, 
+        and, if it has, they invalidate (repaint) it.  recomputeCaretRect was 
+        returning false if the caret turned into a range selection or was blown 
+        away.
+
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::recomputeCaretRect): Don't early return if
+        !isCaret().  Obtain the FrameView* using the m_frame pointer, because m_sel 
+        may now be null.
+
 2006-10-17  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Brady.
index 781c48d8db299113e59fafa93d7ac027eb4b2071..5bbabdc8eb78bdc37f2ab3be81725e51ed779529 100644 (file)
@@ -791,10 +791,10 @@ IntRect SelectionController::caretRepaintRect() const
 
 bool SelectionController::recomputeCaretRect()
 {
-    if (!isCaret())
+    if (!m_frame || !m_frame->document())
         return false;
-
-    FrameView* v = m_sel.start().node()->document()->view();
+        
+    FrameView* v = m_frame->document()->view();
     if (!v)
         return false;