WebKit Bugzilla
Attachment 373253 Details for
Bug 199366
: [iOS] REGRESSION (r246757): Unable to select non-editable text in subframes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199366-20190701134418.patch (text/plain), 4.95 KB, created by
Wenson Hsieh
on 2019-07-01 13:44:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-07-01 13:44:18 PDT
Size:
4.95 KB
patch
obsolete
>Subversion Revision: 247013 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index c4a9acc71316eac20e11be74a28399792d941eb5..84092a3bdcdb9900fffbbf657f89c978b3356209 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,33 @@ >+2019-07-01 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] REGRESSION (r246757): Unable to select non-editable text in subframes >+ https://bugs.webkit.org/show_bug.cgi?id=199366 >+ <rdar://problem/52460509> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ r246757 removed logic in selectionPositionInformation responsible for setting the focused frame when handling a >+ position information request. As the FIXME formerly in InteractionInformationRequest.h alluded to, text >+ selection gestures on iOS were dependent on this behavior when selecting text in subframes, since text selection >+ helpers in WebPageIOS.mm assume that the focused frame already contains the selection being set. >+ >+ Rather than calling setFocusedFrame when requesting position information, we can fix this by making >+ WebPage::selectWithGesture and WebPage::selectTextWithGranularityAtPoint both set the focused frame if needed >+ before extending or moving text selections. >+ >+ Covered by layout tests that began to fail after r246757: >+ - editing/selection/ios/selection-handles-in-iframe.html >+ - editing/selection/ios/selection-handle-clamping-in-iframe.html >+ >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::selectWithGesture): >+ >+ Only call the new helper method, setFocusedFrameBeforeSelectingTextAtLocation, at the start of the gesture. >+ >+ (WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation): >+ (WebKit::WebPage::selectTextWithGranularityAtPoint): >+ > 2019-07-01 Wenson Hsieh <wenson_hsieh@apple.com> > > iOS: REGRESSION(async scroll): Caret doesn't scroll when scrolling textarea >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 15bcb90f5d929b764b1ca508f682f5cb43f2fc04..7d79a78afa38ccf8cca392b1cfc29b730eb6151d 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1245,6 +1245,7 @@ private: > void resetIdempotentTextAutosizingIfNeeded(double previousInitialScale); > WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement); > RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement); >+ void setFocusedFrameBeforeSelectingTextAtLocation(const WebCore::IntPoint&); > void dispatchSyntheticMouseEventsForSelectionGesture(SelectionTouch, const WebCore::IntPoint&); > > void sendPositionInformation(InteractionInformationAtPosition&&); >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 7718368a84b4b5c0e62899bf0aec2b9d007955a5..af050d2dd96c03cb3f70e7041bd50fe8e28c5887 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -1303,6 +1303,9 @@ static IntRect selectionBoxForRange(WebCore::Range* range) > > void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithFocusedElement, CallbackID callbackID) > { >+ if (static_cast<GestureRecognizerState>(gestureState) == GestureRecognizerState::Began) >+ setFocusedFrameBeforeSelectingTextAtLocation(point); >+ > auto& frame = m_page->focusController().focusedOrMainFrame(); > VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithFocusedElement); > >@@ -2022,8 +2025,18 @@ static inline bool rectIsTooBigForSelection(const IntRect& blockRect, const Fram > return blockRect.height() > frame.view()->unobscuredContentRect().height() * factor; > } > >+void WebPage::setFocusedFrameBeforeSelectingTextAtLocation(const IntPoint& point) >+{ >+ auto result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent | HitTestRequest::AllowChildFrameContent); >+ auto* hitNode = result.innerNode(); >+ if (hitNode && hitNode->renderer()) >+ m_page->focusController().setFocusedFrame(result.innerNodeFrame()); >+} >+ > void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID callbackID) > { >+ setFocusedFrameBeforeSelectingTextAtLocation(point); >+ > auto& frame = m_page->focusController().focusedOrMainFrame(); > RefPtr<Range> range = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithFocusedElement); > if (!isInteractingWithFocusedElement) {
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 199366
: 373253