Diff
Modified: trunk/LayoutTests/ChangeLog (278410 => 278411)
--- trunk/LayoutTests/ChangeLog 2021-06-03 17:25:28 UTC (rev 278410)
+++ trunk/LayoutTests/ChangeLog 2021-06-03 17:53:13 UTC (rev 278411)
@@ -1,3 +1,14 @@
+2021-06-03 Alan Bujtas <[email protected]>
+
+ Incorrect text selection when crossing flex item boundary
+ https://bugs.webkit.org/show_bug.cgi?id=226518
+ <rdar://59487603>
+
+ Reviewed by Simon Fraser.
+
+ * editing/selection/selecting-content-by-overshooting-the-container-expected.txt: Added.
+ * editing/selection/selecting-content-by-overshooting-the-container.html: Added.
+
2021-06-03 Youenn Fablet <[email protected]>
Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
Added: trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container-expected.txt (0 => 278411)
--- trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container-expected.txt 2021-06-03 17:53:13 UTC (rev 278411)
@@ -0,0 +1,2 @@
+[foobar] select -> [this] word and expand the selection to [foobar] by moving the cursor to the left over to the blue area. PASS if selection covers both [foobar] and [this].
+PASS
Added: trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container.html (0 => 278411)
--- trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container.html (rev 0)
+++ trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container.html 2021-06-03 17:53:13 UTC (rev 278411)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="background-color: blue; width: 400px; font-size: 12px">
+ <div style="display: -webkit-box; width: 300px; margin-left: 100px; background-color: green;">
+ <div id=container>[foobar] select -> [this] word and expand the selection to [foobar] by moving the cursor to the left over to the blue area. PASS if selection covers both [foobar] and [this].</div>
+ <div style="width: 100px; height: 100px;"></div>
+ </div>
+</div>
+
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+if (window.eventSender) {
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(container.offsetLeft + 110, container.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(container.offsetLeft - 10, container.offsetTop + 5);
+ eventSender.mouseUp();
+ if (getSelection() == "[foobar] select -> [this]")
+ document.write("PASS");
+ else
+ document.write("FAIL");
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-flex-container-expected.txt (0 => 278411)
--- trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-flex-container-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-flex-container-expected.txt 2021-06-03 17:53:13 UTC (rev 278411)
@@ -0,0 +1,2 @@
+[foobar] select -> [this] word and expand the selection to [foobar] by moving the cursor to the left over to the blue area. PASS if selection covers both [foobar] and [this].
+PASS
Added: trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-flex-container.html (0 => 278411)
--- trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-flex-container.html (rev 0)
+++ trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-flex-container.html 2021-06-03 17:53:13 UTC (rev 278411)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="background-color: blue; width: 400px; font-size: 12px">
+ <div style="display: flex; width: 300px; margin-left: 100px; background-color: green;">
+ <div id=container>[foobar] select -> [this] word and expand the selection to [foobar] by moving the cursor to the left over to the blue area. PASS if selection covers both [foobar] and [this].</div>
+ <div style="width: 100px; height: 100px;"></div>
+ </div>
+</div>
+
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+if (window.eventSender) {
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(container.offsetLeft + 110, container.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(container.offsetLeft - 10, container.offsetTop + 5);
+ eventSender.mouseUp();
+ if (getSelection() == "[foobar] select -> [this]")
+ document.write("PASS");
+ else
+ document.write("FAIL");
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-grid-container-expected.txt (0 => 278411)
--- trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-grid-container-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-grid-container-expected.txt 2021-06-03 17:53:13 UTC (rev 278411)
@@ -0,0 +1,2 @@
+[foobar] select -> [this] word and expand the selection to [foobar] by moving the cursor to the left over to the blue area. PASS if selection covers both [foobar] and [this].
+PASS
Added: trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-grid-container.html (0 => 278411)
--- trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-grid-container.html (rev 0)
+++ trunk/LayoutTests/editing/selection/selecting-content-by-overshooting-the-grid-container.html 2021-06-03 17:53:13 UTC (rev 278411)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="background-color: blue; width: 400px; font-size: 12px">
+ <div style="display: grid; grid: 100px / auto-flow; width: 300px; margin-left: 100px; background-color: green;">
+ <div id=container>[foobar] select -> [this] word and expand the selection to [foobar] by moving the cursor to the left over to the blue area. PASS if selection covers both [foobar] and [this].</div>
+ <div style="width: 100px; height: 100px;"></div>
+ </div>
+</div>
+
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+if (window.eventSender) {
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(container.offsetLeft + 110, container.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(container.offsetLeft - 10, container.offsetTop + 5);
+ eventSender.mouseUp();
+ if (getSelection() == "[foobar] select -> [this]")
+ document.write("PASS");
+ else
+ document.write("FAIL");
+}
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (278410 => 278411)
--- trunk/LayoutTests/platform/ios/TestExpectations 2021-06-03 17:25:28 UTC (rev 278410)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2021-06-03 17:53:13 UTC (rev 278411)
@@ -403,6 +403,9 @@
editing/selection/user-select-all-with-shift.html [ Skip ]
editing/selection/user-select-all-with-single-click.html [ Skip ]
editing/selection/select-out-of-floated-non-editable-13.html [ Skip ]
+editing/selection/selecting-content-by-overshooting-the-flex-container.html [ Skip ]
+editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container.html [ Skip ]
+editing/selection/selecting-content-by-overshooting-the-grid-container.html [ Skip ]
editing/spelling/context-menu-suggestions-multiword-selection.html [ Skip ]
editing/spelling/context-menu-suggestions-subword-selection.html [ Skip ]
editing/spelling/context-menu-suggestions.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (278410 => 278411)
--- trunk/Source/WebCore/ChangeLog 2021-06-03 17:25:28 UTC (rev 278410)
+++ trunk/Source/WebCore/ChangeLog 2021-06-03 17:53:13 UTC (rev 278411)
@@ -1,3 +1,19 @@
+2021-06-03 Alan Bujtas <[email protected]>
+
+ Incorrect text selection when crossing flex item boundary
+ https://bugs.webkit.org/show_bug.cgi?id=226518
+ <rdar://59487603>
+
+ Reviewed by Simon Fraser.
+
+ Let's use the more sophisticated "which child is closer to the hit point" logic in RenderBox for the flex (and grid) content.
+ The rest of the RenderBlock::positionForPoint is meant to deal with BFC content where block level boxes are positioned in block direction, after each other.
+
+ Test: editing/selection/selecting-content-by-overshooting-the-container.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::positionForPoint):
+
2021-06-03 Antti Koivisto <[email protected]>
Remove TrailingFloatsRootInlineBox
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (278410 => 278411)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2021-06-03 17:25:28 UTC (rev 278410)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2021-06-03 17:53:13 UTC (rev 278411)
@@ -2197,7 +2197,9 @@
return createVisiblePosition(caretMinOffset(), Affinity::Downstream);
if (pointLogicalTop >= logicalHeight() || (pointLogicalTop >= 0 && pointLogicalLeft >= logicalWidth()))
return createVisiblePosition(caretMaxOffset(), Affinity::Downstream);
- }
+ }
+ if (isFlexibleBoxIncludingDeprecated() || isRenderGrid())
+ return RenderBox::positionForPoint(point, fragment);
LayoutPoint pointInContents = point;
offsetForContents(pointInContents);