- Revision
- 268847
- Author
- [email protected]
- Date
- 2020-10-21 17:40:55 -0700 (Wed, 21 Oct 2020)
Log Message
Stop gap patch fix for regression in r267329.
https://bugs.webkit.org/show_bug.cgi?id=218020
Source/WebCore:
<rdar://problem/69542459>
Reviewed by Darin Adler.
The refactoring in https://bugs.webkit.org/show_bug.cgi?id=216739 caused selections to
expand in both directions after a double-click and drag to expand on mac. This behavior
was not observed on iOS. This removes the error-prone calculation.
Note that this bug does not occur if only testing immediatly moving the drag point to the
end of the selection. Dragging across all the words as a real user would needs to be emulated.
Test: editing/selection/double-click-and-drag-over-anchor-to-select.html
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::validate):
LayoutTests:
Reviewed by Darin Adler.
* editing/selection/double-click-and-drag-over-anchor-to-select-expected.txt: Added.
* editing/selection/double-click-and-drag-over-anchor-to-select.html: Added.
* resources/ui-helper.js:
(window.UIHelper.doubleClickAtMouseDown):
(window.UIHelper.mouseUp):
(window.UIHelper.dragMouseAcrossElement):
(window.UIHelper.doubleClickElementMouseDown):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (268846 => 268847)
--- trunk/LayoutTests/ChangeLog 2020-10-21 23:36:25 UTC (rev 268846)
+++ trunk/LayoutTests/ChangeLog 2020-10-22 00:40:55 UTC (rev 268847)
@@ -1,3 +1,18 @@
+2020-10-21 Megan Gardner <[email protected]>
+
+ Stop gap patch fix for regression in r267329.
+ https://bugs.webkit.org/show_bug.cgi?id=218020
+
+ Reviewed by Darin Adler.
+
+ * editing/selection/double-click-and-drag-over-anchor-to-select-expected.txt: Added.
+ * editing/selection/double-click-and-drag-over-anchor-to-select.html: Added.
+ * resources/ui-helper.js:
+ (window.UIHelper.doubleClickAtMouseDown):
+ (window.UIHelper.mouseUp):
+ (window.UIHelper.dragMouseAcrossElement):
+ (window.UIHelper.doubleClickElementMouseDown):
+
2020-10-21 Karl Rackler <[email protected]>
REGRESSION(iOS 14): imported/w3c/web-platform-tests/mathml/relations/html5-tree/dynamic-childlist-001.html is a constant failure
Added: trunk/LayoutTests/editing/mac/selection/double-click-and-drag-over-anchor-to-select-expected.txt (0 => 268847)
--- trunk/LayoutTests/editing/mac/selection/double-click-and-drag-over-anchor-to-select-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/mac/selection/double-click-and-drag-over-anchor-to-select-expected.txt 2020-10-22 00:40:55 UTC (rev 268847)
@@ -0,0 +1,56 @@
+
+Before extending the selection:
+| "
+ "
+| <p>
+| "The "
+| <span>
+| id="end"
+| "quick"
+| " "
+| <span>
+| id="middle3"
+| "brown"
+| " "
+| <span>
+| id="middle2"
+| "fox"
+| " "
+| <span>
+| id="middle1"
+| "jumped"
+| " "
+| <span>
+| id="start"
+| "over"
+| " the lazy dog. And then there was another sentence."
+| "
+"
+
+quick brown fox jumped over:
+| "
+ "
+| <p>
+| "The "
+| <span>
+| id="end"
+| "<#selection-focus>quick"
+| " "
+| <span>
+| id="middle3"
+| "brown"
+| " "
+| <span>
+| id="middle2"
+| "fox"
+| " "
+| <span>
+| id="middle1"
+| "jumped"
+| " "
+| <span>
+| id="start"
+| "over<#selection-anchor>"
+| " the lazy dog. And then there was another sentence."
+| "
+"
Added: trunk/LayoutTests/editing/mac/selection/double-click-and-drag-over-anchor-to-select.html (0 => 268847)
--- trunk/LayoutTests/editing/mac/selection/double-click-and-drag-over-anchor-to-select.html (rev 0)
+++ trunk/LayoutTests/editing/mac/selection/double-click-and-drag-over-anchor-to-select.html 2020-10-22 00:40:55 UTC (rev 268847)
@@ -0,0 +1,52 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script src=""
+<script src=""
+<style>
+p {
+ font-size: 20px;
+}
+
+p + p {
+ margin-top: 100px;
+}
+
+#start {
+ border: 1px solid blue;
+}
+
+#end {
+ padding-right: 2px;
+ border: 1px solid tomato;
+}
+</style>
+</head>
+<body>
+<div>This test verifies that double-clicking and then dragging over the selection anchor point (in LTR languages, this is dragging left) to extend the text selection does not extend the selection from the original selection focus as well (in LRT languages, the selection should not extent to the right as well while dragging left). To test manually, load the page and double click on 'over' and drag to 'quick'. The text 'quick brown fox jumped over' should be selected, and nothing else.</div>
+<div id="container">
+ <p>The <span id="end">quick</span> <span id="middle3">brown</span> <span id="middle2">fox</span> <span id="middle1">jumped</span> <span id="start">over</span> the lazy dog. And then there was another sentence.</p>
+</div>
+<script>
+
+(async function () {
+ if (!window.testRunner)
+ return;
+
+ internals.settings.setEditingBehavior("Mac");
+ Markup.dump(document.getElementById("container"), "Before extending the selection");
+
+ UIHelper.doubleClickElementMouseDown(document.getElementById("start"));
+ UIHelper.dragMouseAcrossElement(document.getElementById("middle1"));
+ UIHelper.dragMouseAcrossElement(document.getElementById("middle2"));
+ UIHelper.dragMouseAcrossElement(document.getElementById("middle3"));
+ UIHelper.dragMouseAcrossElement(document.getElementById("end"));
+ UIHelper.mouseUp();
+
+ Markup.dump(document.getElementById("container"), document.getSelection().toString());
+ Markup.notifyDone();
+})();
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/resources/ui-helper.js (268846 => 268847)
--- trunk/LayoutTests/resources/ui-helper.js 2020-10-21 23:36:25 UTC (rev 268846)
+++ trunk/LayoutTests/resources/ui-helper.js 2020-10-22 00:40:55 UTC (rev 268847)
@@ -19,6 +19,19 @@
eventSender.mouseUp();
}
+ static doubleClickAtMouseDown(x1, y1)
+ {
+ eventSender.mouseMoveTo(x1, y1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseDown();
+ }
+
+ static mouseUp()
+ {
+ eventSender.mouseUp();
+ }
+
static doubleClickAtThenDragTo(x1, y1, x2, y2)
{
eventSender.mouseMoveTo(x1, y1);
@@ -29,6 +42,28 @@
eventSender.mouseUp();
}
+ static dragMouseAcrossElement(element)
+ {
+ const x1 = element.offsetLeft + element.offsetWidth;
+ const x2 = element.offsetLeft + element.offsetWidth * .75;
+ const x3 = element.offsetLeft + element.offsetWidth / 2;
+ const x4 = element.offsetLeft + element.offsetWidth / 4;
+ const x5 = element.offsetLeft;
+ const y = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(x1, y);
+ eventSender.mouseMoveTo(x2, y);
+ eventSender.mouseMoveTo(x3, y);
+ eventSender.mouseMoveTo(x4, y);
+ eventSender.mouseMoveTo(x5, y);
+ }
+
+ static doubleClickElementMouseDown(element1)
+ {
+ const x1 = element1.offsetLeft + element1.offsetWidth / 2;
+ const y1 = element1.offsetTop + element1.offsetHeight / 2;
+ return UIHelper.doubleClickAtMouseDown(x1, y1);
+ }
+
static async moveMouseAndWaitForFrame(x, y)
{
eventSender.mouseMoveTo(x, y);
Modified: trunk/Source/WebCore/ChangeLog (268846 => 268847)
--- trunk/Source/WebCore/ChangeLog 2020-10-21 23:36:25 UTC (rev 268846)
+++ trunk/Source/WebCore/ChangeLog 2020-10-22 00:40:55 UTC (rev 268847)
@@ -1,3 +1,22 @@
+2020-10-21 Megan Gardner <[email protected]>
+
+ Stop gap patch fix for regression in r267329.
+ https://bugs.webkit.org/show_bug.cgi?id=218020
+ <rdar://problem/69542459>
+
+ Reviewed by Darin Adler.
+
+ The refactoring in https://bugs.webkit.org/show_bug.cgi?id=216739 caused selections to
+ expand in both directions after a double-click and drag to expand on mac. This behavior
+ was not observed on iOS. This removes the error-prone calculation.
+ Note that this bug does not occur if only testing immediatly moving the drag point to the
+ end of the selection. Dragging across all the words as a real user would needs to be emulated.
+
+ Test: editing/selection/double-click-and-drag-over-anchor-to-select.html
+
+ * editing/VisibleSelection.cpp:
+ (WebCore::VisibleSelection::validate):
+
2020-10-21 Alex Christensen <[email protected]>
Implement ISO-2022-JP encoder step 3
Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (268846 => 268847)
--- trunk/Source/WebCore/editing/VisibleSelection.cpp 2020-10-21 23:36:25 UTC (rev 268846)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp 2020-10-22 00:40:55 UTC (rev 268847)
@@ -386,8 +386,8 @@
adjustSelectionToAvoidCrossingEditingBoundaries();
updateSelectionType();
- bool shouldUpdateAnchor = m_start != startBeforeAdjustments;
- bool shouldUpdateFocus = m_end != endBeforeAdjustments;
+ bool shouldUpdateAnchor = false; // Set to false because of <rdar://problem/69542459>. Can be returned to original logic when this problem is fully fixed.
+ bool shouldUpdateFocus = false; // Ditto.
if (isRange()) {
// "Constrain" the selection to be the smallest equivalent range of nodes.