Title: [197024] trunk
Revision
197024
Author
carlo...@webkit.org
Date
2016-02-24 02:41:11 -0800 (Wed, 24 Feb 2016)

Log Message

REGRESSION(r195949): [GTK] Test /webkit2/WebKitWebView/insert/link is failing since r195949
https://bugs.webkit.org/show_bug.cgi?id=153747

Reviewed by Michael Catanzaro.

Source/WebCore:

Do not return early when reaching a boundary if there's a range
selection. In that case, the selection will be cleared and
accessibility will be notified.

Test: editing/selection/move-to-line-boundary-clear-selection.html

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::modify):

LayoutTests:

Add test to check that moving to line boundary clears the
selection even if the cursor is already at the boundary.

* editing/selection/move-to-line-boundary-clear-selection-expected.txt: Added.
* editing/selection/move-to-line-boundary-clear-selection.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197023 => 197024)


--- trunk/LayoutTests/ChangeLog	2016-02-24 10:12:54 UTC (rev 197023)
+++ trunk/LayoutTests/ChangeLog	2016-02-24 10:41:11 UTC (rev 197024)
@@ -1,3 +1,16 @@
+2016-02-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r195949): [GTK] Test /webkit2/WebKitWebView/insert/link is failing since r195949
+        https://bugs.webkit.org/show_bug.cgi?id=153747
+
+        Reviewed by Michael Catanzaro.
+
+        Add test to check that moving to line boundary clears the
+        selection even if the cursor is already at the boundary.
+
+        * editing/selection/move-to-line-boundary-clear-selection-expected.txt: Added.
+        * editing/selection/move-to-line-boundary-clear-selection.html: Added.
+
 2016-02-23  Sergio Villar Senin  <svil...@igalia.com>
 
         [css-grid] Swap the order of columns/rows in grid-gap shorthand

Added: trunk/LayoutTests/editing/selection/move-to-line-boundary-clear-selection-expected.txt (0 => 197024)


--- trunk/LayoutTests/editing/selection/move-to-line-boundary-clear-selection-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-to-line-boundary-clear-selection-expected.txt	2016-02-24 10:41:11 UTC (rev 197024)
@@ -0,0 +1,3 @@
+PASS getSelection().toString() is ''
+PASS getSelection().toString() is ''
+webkit

Added: trunk/LayoutTests/editing/selection/move-to-line-boundary-clear-selection.html (0 => 197024)


--- trunk/LayoutTests/editing/selection/move-to-line-boundary-clear-selection.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/move-to-line-boundary-clear-selection.html	2016-02-24 10:41:11 UTC (rev 197024)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<pre id="console"></pre>
+<script>
+function log(s) {
+    document.getElementById("console").innerHTML += s + "\n";
+}
+
+</script>
+<div contenteditable><span id="span">webkit</span></div>
+<script>
+var span = document.getElementById("span");
+getSelection().setPosition(span, 0);
+getSelection().modify("extend", "forward", "line");
+if (window.testRunner)
+    testRunner.execCommand("MoveToEndOfLine");
+shouldBe('getSelection().toString()', "''");
+getSelection().empty();
+getSelection().setPosition(span, 5);
+getSelection().modify("extend", "backward", "line");
+if (window.testRunner)
+    testRunner.execCommand("MoveToBeginningOfLine");
+shouldBe('getSelection().toString()', "''");
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (197023 => 197024)


--- trunk/Source/WebCore/ChangeLog	2016-02-24 10:12:54 UTC (rev 197023)
+++ trunk/Source/WebCore/ChangeLog	2016-02-24 10:41:11 UTC (rev 197024)
@@ -1,3 +1,19 @@
+2016-02-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r195949): [GTK] Test /webkit2/WebKitWebView/insert/link is failing since r195949
+        https://bugs.webkit.org/show_bug.cgi?id=153747
+
+        Reviewed by Michael Catanzaro.
+
+        Do not return early when reaching a boundary if there's a range
+        selection. In that case, the selection will be cleared and
+        accessibility will be notified.
+
+        Test: editing/selection/move-to-line-boundary-clear-selection.html
+
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::modify):
+
 2016-02-24  Alejandro G. Castro  <a...@igalia.com>
 
         [Gstreamer] Mediaplayer should observe the tracks and not the source

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (197023 => 197024)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2016-02-24 10:12:54 UTC (rev 197023)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2016-02-24 10:41:11 UTC (rev 197024)
@@ -1252,14 +1252,14 @@
 
     willBeModified(alter, direction);
 
-    bool shouldNotify = false;
+    bool reachedBoundary = false;
     bool wasRange = m_selection.isRange();
     Position originalStartPosition = m_selection.start();
     VisiblePosition position;
     switch (direction) {
     case DirectionRight:
         if (alter == AlterationMove)
-            position = modifyMovingRight(granularity, &shouldNotify);
+            position = modifyMovingRight(granularity, &reachedBoundary);
         else
             position = modifyExtendingRight(granularity);
         break;
@@ -1267,11 +1267,11 @@
         if (alter == AlterationExtend)
             position = modifyExtendingForward(granularity);
         else
-            position = modifyMovingForward(granularity, &shouldNotify);
+            position = modifyMovingForward(granularity, &reachedBoundary);
         break;
     case DirectionLeft:
         if (alter == AlterationMove)
-            position = modifyMovingLeft(granularity, &shouldNotify);
+            position = modifyMovingLeft(granularity, &reachedBoundary);
         else
             position = modifyExtendingLeft(granularity);
         break;
@@ -1279,11 +1279,11 @@
         if (alter == AlterationExtend)
             position = modifyExtendingBackward(granularity);
         else
-            position = modifyMovingBackward(granularity, &shouldNotify);
+            position = modifyMovingBackward(granularity, &reachedBoundary);
         break;
     }
-    
-    if (shouldNotify && userTriggered == UserTriggered && m_frame && AXObjectCache::accessibilityEnabled()) {
+
+    if (reachedBoundary && !isRange() && userTriggered == UserTriggered && m_frame && AXObjectCache::accessibilityEnabled()) {
         notifyAccessibilityForSelectionChange({ AXTextStateChangeTypeSelectionBoundary, textSelectionWithDirectionAndGranularity(direction, granularity) });
         return true;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to