WebKit Bugzilla
Attachment 347696 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 for landing
bug-188767-20180821143343.patch (text/plain), 5.42 KB, created by
Megan Gardner
on 2018-08-21 14:33:44 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2018-08-21 14:33:44 PDT
Size:
5.42 KB
patch
obsolete
>Subversion Revision: 235136 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2ff909029ebf2bfe7f6d759c32421367736652cc..16c110ac30a17c163fb89cfa24abe27b0f229c29 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-21 Megan Gardner <megan_gardner@apple.com> >+ >+ Use VisiblePosition to calculate selection ranges >+ https://bugs.webkit.org/show_bug.cgi?id=188767 >+ <rdar://problem/43577166> >+ >+ Reviewed by Ryosuke Niwa. >+ >+ Exposing comparePositions. >+ >+ * editing/Editing.h: >+ > 2018-08-21 Brent Fulgham <bfulgham@apple.com> > > Remove experimental affiliated domain code now that StorageAccess API is available >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 1e9a303ead1a52d2a59928a2de9c6f75ae0fa280..6d8972f2aabe3920579f25a627ae5d50de2920bd 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-21 Megan Gardner <megan_gardner@apple.com> >+ >+ Use VisiblePosition to calculate selection ranges >+ https://bugs.webkit.org/show_bug.cgi?id=188767 >+ <rdar://problem/43577166> >+ >+ Reviewed by Ryosuke Niwa. >+ >+ 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 in collapsed ranges. >+ >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::rangeForPointInRootViewCoordinates): >+ > 2018-08-21 Alex Christensen <achristensen@webkit.org> > > Increment NetworkCache::Storage::lastStableVersion after r233742 >diff --git a/Source/WebCore/editing/Editing.h b/Source/WebCore/editing/Editing.h >index ade431035536c7ad7e2f5170819ffebbf2779ace..5fbf1e96f8d51ad48e34d220881a7a3a1125d243 100644 >--- a/Source/WebCore/editing/Editing.h >+++ b/Source/WebCore/editing/Editing.h >@@ -142,7 +142,7 @@ VisiblePosition visiblePositionAfterNode(Node&); > > bool lineBreakExistsAtVisiblePosition(const VisiblePosition&); > >-int comparePositions(const VisiblePosition&, const VisiblePosition&); >+WEBCORE_EXPORT int comparePositions(const VisiblePosition&, const VisiblePosition&); > > WEBCORE_EXPORT int indexForVisiblePosition(const VisiblePosition&, RefPtr<ContainerNode>& scope); > int indexForVisiblePosition(Node&, const VisiblePosition&, bool forSelectionPreservation); >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 26186fb9870e17e45056bca0392baaf485bfff61..030113f65af0a7dce8f911736cedf00feb6faddd 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) > 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) > 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