WebKit Bugzilla
Attachment 347741 Details for
Bug 188826
: Change Selection modification to not snap the grabber when selecting above or below the selection anchor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-188826-20180821173733.patch (text/plain), 6.34 KB, created by
Megan Gardner
on 2018-08-21 17:37:34 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2018-08-21 17:37:34 PDT
Size:
6.34 KB
patch
obsolete
>Subversion Revision: 235143 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index fe4f30c091b3f68d6bdbf7ebf4de96a6379f6b8d..3c92a5d97ae75850fa8a34d28aa80ba0645f7552 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-21 Megan Gardner <megan_gardner@apple.com> >+ >+ Change Selection modification to not snap the grabber when selecting above or below the selection anchor >+ https://bugs.webkit.org/show_bug.cgi?id=188826 >+ >+ Reviewed by Tim Horton. >+ >+ Selecting single lines is sometimes difficult because we currently snap selections to single >+ characters if we move past the position of the other anchor in our selection. This patch changes >+ this behaviour to reflect the behaviour in the rest of this system, which snaps the selection >+ to the position on the line of the other anchor, rather than snapping it all the way a single >+ character. >+ >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::rangeForPointInRootViewCoordinates): >+ > 2018-08-21 Megan Gardner <megan_gardner@apple.com> > > Use VisiblePosition to calculate selection ranges >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 030113f65af0a7dce8f911736cedf00feb6faddd..b0235134d07c0731bdff4844ffa83fdd72771ef2 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -1217,7 +1217,25 @@ void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uin > > static RefPtr<Range> rangeForPointInRootViewCoordinates(Frame& frame, const IntPoint& pointInRootViewCoordinates, bool baseIsStart) > { >- IntPoint pointInDocument = frame.view()->rootViewToContents(pointInRootViewCoordinates); >+ VisibleSelection existingSelection = frame.selection().selection(); >+ VisiblePosition selectionStart = existingSelection.visibleStart(); >+ VisiblePosition selectionEnd = existingSelection.visibleEnd(); >+ >+ IntPoint adjustedPoint = pointInRootViewCoordinates; >+ >+ if (baseIsStart) { >+ IntRect caret = existingSelection.visibleStart().absoluteCaretBounds(); >+ int startY = caret.center().y(); >+ if (adjustedPoint.y() < startY) >+ adjustedPoint.setY(startY); >+ } else { >+ IntRect caret = existingSelection.visibleEnd().absoluteCaretBounds(); >+ int endY = caret.center().y(); >+ if (adjustedPoint.y() > endY) >+ adjustedPoint.setY(endY); >+ } >+ >+ IntPoint pointInDocument = frame.view()->rootViewToContents(adjustedPoint); > VisiblePosition result; > RefPtr<Range> range; > >@@ -1227,10 +1245,6 @@ static RefPtr<Range> rangeForPointInRootViewCoordinates(Frame& frame, const IntP > else > result = frame.visiblePositionForPoint(pointInDocument).deepEquivalent(); > >- VisibleSelection existingSelection = frame.selection().selection(); >- VisiblePosition selectionStart = existingSelection.visibleStart(); >- VisiblePosition selectionEnd = existingSelection.visibleEnd(); >- > if (baseIsStart) { > if (comparePositions(result, selectionStart) <= 0) > result = selectionStart.next(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index b54f89ec9ec11605cccaaa5fe035bd400cba76f7..7f19b61725116881c1b2cb5db49216f6961fe168 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-21 Megan Gardner <megan_gardner@apple.com> >+ >+ Change Selection modification to not snap the grabber when selecting above or below the selection anchor >+ https://bugs.webkit.org/show_bug.cgi?id=188826 >+ >+ Reviewed by Tim Horton. >+ >+ Selecting single lines is sometimes difficult because we currently snap selections to single >+ characters if we move past the position of the other anchor in our selection. This patch changes >+ this behaviour to reflect the behaviour in the rest of this system, which snaps the selection >+ to the position on the line of the other anchor, rather than snapping it all the way a single >+ character. This updates the tests to reflect this new behaviour. >+ >+ * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html: >+ * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html: >+ > 2018-08-21 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > Support "name" option for dedicated workers >diff --git a/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html b/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html >index b98d7c183e21b210f34452d26be698dab845aa4d..dc124f0972faf4fa11f7d0d2c30d2bc7cc22d7cc 100644 >--- a/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html >+++ b/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html >@@ -63,7 +63,7 @@ > output += '<br>'; > > var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4); >- if (document.getSelection().toString() == "s") >+ if (document.getSelection().toString() == "sed") > output += 'PASS: Correct Selection'; > else > output += 'FAIL: failed to reduce selection to a single character by dragging up. Incorrect Selection: ' + document.getSelection().toString(); >diff --git a/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html b/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html >index 193eddfcf80531ca972eeb9615caa6c21ca67d83..1f289ff41cef74d6a229cee27c30629c91e29a4e 100644 >--- a/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html >+++ b/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html >@@ -63,7 +63,7 @@ > output += '<br>'; > > var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4); >- if (document.getSelection().toString() == "t") >+ if (document.getSelection().toString() == "ut") > output += 'PASS: Correct Selection'; > else > output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188826
:
347724
| 347741