Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bce5c33463ffcb67f5e49eb045078745e8ce25f3
https://github.com/WebKit/WebKit/commit/bce5c33463ffcb67f5e49eb045078745e8ce25f3
Author: Wenson Hsieh <[email protected]>
Date: 2024-12-20 (Fri, 20 Dec 2024)
Changed paths:
M Source/WebKit/WebProcess/Plugins/PluginView.h
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm
M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
Log Message:
-----------
[UnifiedPDF] [iOS] REGRESSION (288149@main): Text isn't selected in a PDF
document until after the first tap or click
https://bugs.webkit.org/show_bug.cgi?id=285041
rdar://141841951
Reviewed by Abrar Rahman Protyasha and Tim Horton.
After the changes in 288149@main, we only surface editor states derived from
the selection state in
PDF documents, if the plugin element (`embed`) has focus. However, if the user
only tries to select
text by long pressing in a PDF document (and hasn't tapped or clicked in the
document beforehand),
nothing ensures that the PDF plugin element has focus, so we end up not
selecting any text in the
PDF.
Fix this by focusing the plugin element, in the case where we're long pressing
(or otherwise moving
the selection) into the PDF plugin.
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::updateFocusBeforeSelectingTextAtLocation):
Rename `setFocusedFrameBeforeSelectingTextAtLocation` to
`updateFocusBeforeSelectingTextAtLocation`,
to better reflect its new purpose in the case where the user is selecting text
inside of a PDF.
(WebKit::WebPage::setSelectionRange):
(WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm:
(TestWebKitAPI::UNIFIED_PDF_TEST):
Add an API test, `UnifiedPDF.CopySelectedText`, that exercises this bug by
simulating text selection
in a PDF, programmatically triggering a `-copy:`, and verifying that the
selected word ("Test") is
written to the pasteboard.
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView selectTextInGranularity:atPoint:]):
Add a testing helper that calls into
`-selectTextInGranularity:atPoint:completionHandler:` (i.e. the
same method that's invoked when long pressing in a web view).
Canonical link: https://commits.webkit.org/288201@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes