WebKit Bugzilla
Attachment 347572 Details for
Bug 188767
: Use VisiblePosition to calculate selection ranges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188767-20180820165219.patch (text/plain), 4.16 KB, created by
Megan Gardner
on 2018-08-20 16:52:20 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2018-08-20 16:52:20 PDT
Size:
4.16 KB
patch
obsolete
>Subversion Revision: 234817 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 91b71f7bfc9b73f757f8b74ae88fbfcb4b4f3d2a..9bd547354d9f5e01175df26daeed865666e23d39 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2018-08-20 Megan Gardner <megan_gardner@apple.com> >+ >+ Use VisiblePosition to calculate selection ranges >+ https://bugs.webkit.org/show_bug.cgi?id=188767 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Switches to using VisiblePosition, instead of Position. This code used to use VisiblePosiiton, >+ but it has been changed a lot lately, and using Position causes issues with next and previous >+ when trying to snap a selection. VisiblePosition gives us the correct information, and does not >+ result is collapsed ranges. >+ >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::rangeForPointInRootViewCoordinates): >+ > 2018-08-13 Wenson Hsieh <wenson_hsieh@apple.com> > > [WK2] [macOS] Implement a mechanism to test drag and drop >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index a9cadce820488f8c3645d1c26dbaa653d98c80be..ec73fec99907b0f2c817a829d8ef583a820eb8f0 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -1218,7 +1218,7 @@ 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); >- Position result; >+ VisiblePosition result; > RefPtr<Range> range; > > HitTestResult hitTest = frame.eventHandler().hitTestResultAtPoint(pointInDocument, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent); >@@ -1228,23 +1228,25 @@ static RefPtr<Range> rangeForPointInRootViewCoordinates(Frame& frame, const IntP > result = frame.visiblePositionForPoint(pointInDocument).deepEquivalent(); > > VisibleSelection existingSelection = frame.selection().selection(); >- Position selectionStart = existingSelection.visibleStart().deepEquivalent(); >- Position selectionEnd = existingSelection.visibleEnd().deepEquivalent(); >+ VisiblePosition selectionStart = existingSelection.visibleStart(); >+ VisiblePosition selectionEnd = existingSelection.visibleEnd(); > > if (baseIsStart) { >- if (comparePositions(result, selectionStart) <= 0) >+ if (comparePositions(result.deepEquivalent(), selectionStart.deepEquivalent()) <= 0) > result = selectionStart.next(); >- else if (&selectionStart.anchorNode()->treeScope() != &hitTest.targetNode()->treeScope()) >- result = VisibleSelection::adjustPositionForEnd(result, selectionStart.containerNode()); >+ else if (&selectionStart.deepEquivalent().anchorNode()->treeScope() != &hitTest.targetNode()->treeScope()) >+ result = VisibleSelection::adjustPositionForEnd(result.deepEquivalent(), selectionStart.deepEquivalent().containerNode()); >+ > if (result.isNotNull()) > range = Range::create(*frame.document(), selectionStart, result); > } else { >- if (comparePositions(selectionEnd, result) <= 0) >+ if (comparePositions(selectionEnd.deepEquivalent(), result.deepEquivalent()) <= 0) > result = selectionEnd.previous(); >- else if (&hitTest.targetNode()->treeScope() != &selectionEnd.anchorNode()->treeScope()) >- result = VisibleSelection::adjustPositionForStart(result, selectionEnd.containerNode()); >+ else if (&hitTest.targetNode()->treeScope() != &selectionEnd.deepEquivalent().anchorNode()->treeScope()) >+ result = VisibleSelection::adjustPositionForStart(result.deepEquivalent(), selectionEnd.deepEquivalent().containerNode()); >+ > if (result.isNotNull()) >- range = Range::create(*frame.document(), result, selectionEnd); >+ range = Range::create(*frame.document(), result.deepEquivalent(), selectionEnd); > } > > return range;
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 188767
:
347572
|
347639
|
347696