commit | 2747c8edf86bcccf85d8f91c16dedeae7f5efeb7 | [log] [tgz] |
---|---|---|
author | Wenson Hsieh <wenson_hsieh@apple.com> | Tue Dec 17 22:10:05 2024 |
committer | Dan Robson <dtr_bugzilla@apple.com> | Tue Dec 17 22:10:05 2024 |
tree | c490713dc184cbe48250991a2417fbc286b34357 | |
parent | 890a3dadda42be471399f96a24bcc617460be50d [diff] |
Cherry-pick abdb8d25bff5. rdar://141233042 [iOS] [Mail Compose] Unable to tap to put text cursor at end of line if last word was autocorrected https://bugs.webkit.org/show_bug.cgi?id=283304 rdar://129961069 Reviewed by Abrar Rahman Protyasha and Richard Robinson. Currently, it's possible to get stuck in a state where you can't move the text cursor to the end of a line by tapping after the end of the word, if the last word on the line was autocorrected. This is because UIKit's text interaction tap gesture tells us to `-selectWordForReplacement` when tapping after the end of the autocorrected word, which we (currently) always honor. To mitigate this, we prevent the same autocorrected word range from being selected multiple times in a row, as long as the selection is still inside of the word range. This allows the user to toggle between selecting the autocorrected word and setting the selection to the end of the line, which matches platform behavior in Notes. * LayoutTests/editing/caret/ios/place-caret-after-autocorrected-word-expected.txt: Added. * LayoutTests/editing/caret/ios/place-caret-after-autocorrected-word.html: Added. Add a new layout test to exercise this change, by calling into `-selectWordForReplacement` from a new testing hook. I couldn't reliably get UIKit's text interactions to exhibit this same behavior in a testing environment purely by tapping to set the selection, but we can still simulate UIKit behavior at the API boundary using this approach. * LayoutTests/resources/ui-helper.js: (window.UIHelper.selectWordForReplacement): (window.UIHelper.applyAutocorrection): Add an `underline` argument to this testing helper, to determine whether or not we should add blue autocorrection underlines. * Source/WebCore/dom/SimpleRange.h: (WebCore::makeBoundaryPointHelper): (WebCore::makeSimpleRangeHelper): (WebCore::makeSimpleRange): Add a helper method to convert from `WeakSimpleRange` to `std::optional<SimpleRange>`. This returns `nullopt` if either of the boundary points are invalidated. * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChangeSelection): (WebKit::WebPage::didCommitLoad): * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::extendSelectionForReplacement): See above for more details. (WebKit::WebPage::resetLastSelectedReplacementRangeIfNeeded): Clear out `m_lastSelectedReplacementRange` when the selection moves outside of the range. * Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * Tools/TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::selectWordForReplacement): (WTR::UIScriptController::applyAutocorrection): * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h: * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptControllerIOS::selectWordForReplacement): (WTR::UIScriptControllerIOS::applyAutocorrection): Canonical link: https://commits.webkit.org/286757@main Canonical link: https://commits.webkit.org/283286.603@safari-7620-branch
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, Apple Books, and many other applications. For more information about WebKit, see the WebKit project website.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
Run the following command to clone WebKit's Git repository:
git clone https://github.com/WebKit/WebKit.git WebKit
You can enable git fsmonitor to make many git commands faster (such as git status
) with git config core.fsmonitor true
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a macOS debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
To build for an embedded platform like iOS, tvOS, or watchOS, pass a platform argument to build-webkit
.
For example, to build a debug build with debugging symbols and assertions for embedded simulators:
Tools/Scripts/build-webkit --debug --<platform>-simulator
or embedded devices:
Tools/Scripts/build-webkit --debug --<platform>-device
where platform
is ios
, tvos
or watchos
.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode. Select the “Everything up to WebKit + Tools” scheme to build the entire project.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the WebKit on Windows page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser
script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.