Title: [169399] trunk
Revision
169399
Author
mmaxfi...@apple.com
Date
2014-05-27 14:14:20 -0700 (Tue, 27 May 2014)

Log Message

Caret's screen position does not update during an overflow scroll
https://bugs.webkit.org/show_bug.cgi?id=133256

Reviewed by Simon Fraser.

Source/WebCore:
During a scroll, we set a flag which caret position is gated on, but we never
actually invalidate the caret's position. This patch does so.

Test: editing/input/caret-position-during-scroll.html

* editing/FrameSelection.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):

LayoutTests:
This test places the caret, inspects its position, scrolls, and then immediately inspects its
position again. The two positions should be different.

* editing/input/caret-position-during-scroll-expected.txt: Added.
* editing/input/caret-position-during-scroll.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169398 => 169399)


--- trunk/LayoutTests/ChangeLog	2014-05-27 20:45:21 UTC (rev 169398)
+++ trunk/LayoutTests/ChangeLog	2014-05-27 21:14:20 UTC (rev 169399)
@@ -1,3 +1,16 @@
+2014-05-23  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Caret's screen position does not update during an overflow scroll
+        https://bugs.webkit.org/show_bug.cgi?id=133256
+
+        Reviewed by Simon Fraser.
+
+        This test places the caret, inspects its position, scrolls, and then immediately inspects its
+        position again. The two positions should be different.
+
+        * editing/input/caret-position-during-scroll-expected.txt: Added.
+        * editing/input/caret-position-during-scroll.html: Added.
+
 2014-05-27  David Hyatt  <hy...@apple.com>
 
         REGRESSION: Audio volume scrubber does not show volume level thumb

Added: trunk/LayoutTests/editing/input/caret-position-during-scroll-expected.txt (0 => 169399)


--- trunk/LayoutTests/editing/input/caret-position-during-scroll-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/input/caret-position-during-scroll-expected.txt	2014-05-27 21:14:20 UTC (rev 169399)
@@ -0,0 +1,34 @@
+This test places the caret, inspects its position, scrolls, and immediately inspects the caret's position again. The two positions should be different. If this test passes, "Result: Pass" will be printed below the list of numbers.
+Scrolling with the mouse does not cause the caret's screen position to be recomputed
+00
+01
+02
+03
+04
+05
+06
+07
+08
+09
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+Result: PASS

Added: trunk/LayoutTests/editing/input/caret-position-during-scroll.html (0 => 169399)


--- trunk/LayoutTests/editing/input/caret-position-during-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/editing/input/caret-position-during-scroll.html	2014-05-27 21:14:20 UTC (rev 169399)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<head>
+<script type="text/_javascript_" src=""
+</head>
+<body>
+<div>This test places the caret, inspects its position, scrolls, and immediately inspects the caret's position again.
+The two positions should be different. If this test passes, "Result: Pass" will be printed below the list of numbers.</div>
+<div>Scrolling with the mouse does not cause the caret's screen position to be recomputed</div>
+<span style="position:absolute; visibility:hidden" id="single-digit">0</span>
+<div style="border:thin solid black; overflow:scroll" contenteditable="true" id="input-contenteditable"></div>
+Result: <span id="console"></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+var contentEditable = document.getElementById("input-contenteditable");
+contentEditable.innerHTML = generateNumbers(0, 30, 2, "<br>");
+var singleDigitHeight = document.getElementById("single-digit").clientHeight;
+var contentEditableSize = 10;
+contentEditable.style.height = (singleDigitHeight * contentEditableSize) + "px";
+contentEditable.focus();
+var child = contentEditable.firstChild;
+for (var i = 0; i < 36; ++i)
+    child = child.nextSibling;
+getSelection().collapse(child, 0);
+var before;
+if (window.internals)
+    before = internals.absoluteCaretBounds(document).top;
+if (window.eventSender) {
+    var input = document.getElementById('input-contenteditable');
+    var x = contentEditable.offsetLeft + contentEditable.offsetWidth / 2;
+    var y = contentEditable.offsetTop + contentEditable.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseScrollBy(0, -50);
+}
+var after;
+if (window.internals)
+    after = internals.absoluteCaretBounds(document).top;
+var result = "FAIL";
+if (before != after)
+    result = "PASS";
+document.getElementById("console").textContent = result;
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (169398 => 169399)


--- trunk/Source/WebCore/ChangeLog	2014-05-27 20:45:21 UTC (rev 169398)
+++ trunk/Source/WebCore/ChangeLog	2014-05-27 21:14:20 UTC (rev 169399)
@@ -1,3 +1,19 @@
+2014-05-23  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Caret's screen position does not update during an overflow scroll
+        https://bugs.webkit.org/show_bug.cgi?id=133256
+
+        Reviewed by Simon Fraser.
+
+        During a scroll, we set a flag which caret position is gated on, but we never
+        actually invalidate the caret's position. This patch does so.
+
+        Test: editing/input/caret-position-during-scroll.html
+
+        * editing/FrameSelection.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollTo):
+
 2014-05-27  Timothy Horton  <timothy_hor...@apple.com>
 
         Turn on the LayerPool for iOS

Modified: trunk/Source/WebCore/editing/FrameSelection.h (169398 => 169399)


--- trunk/Source/WebCore/editing/FrameSelection.h	2014-05-27 20:45:21 UTC (rev 169398)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2014-05-27 21:14:20 UTC (rev 169399)
@@ -269,6 +269,8 @@
     bool shouldShowBlockCursor() const { return m_shouldShowBlockCursor; }
     void setShouldShowBlockCursor(bool);
 
+    void invalidateCaretRect();
+
 private:
     enum EPositionType { START, END, BASE, EXTENT };
 
@@ -311,7 +313,6 @@
 
     void setCaretVisibility(CaretVisibility);
     bool recomputeCaretRect();
-    void invalidateCaretRect();
 
     bool dispatchSelectStart();
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (169398 => 169399)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-05-27 20:45:21 UTC (rev 169398)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-05-27 21:14:20 UTC (rev 169399)
@@ -2294,7 +2294,7 @@
     Frame& frame = renderer().frame();
     RenderLayerModelObject* repaintContainer = renderer().containerForRepaint();
     // The caret rect needs to be invalidated after scrolling
-    frame.selection().setCaretRectNeedsUpdate();
+    frame.selection().invalidateCaretRect();
 
     FloatQuad quadForFakeMouseMoveEvent = FloatQuad(m_repaintRect);
     if (repaintContainer)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to