-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 1cb03ba. rdar://120743391
[iOS] -[WKContentView hasText] is incorrect when initially focusing an editable element https://bugs.webkit.org/show_bug.cgi?id=267729 rdar://120743391 Reviewed by Aditya Keerthi. Currently, `-hasText` is based entirely on the last cached `EditorState`'s post layout data. In the case where we've just started showing the keyboard for a focused editable element in `-[WKContentView _elementDidFocus:…:userObject:]`, we're still waiting for a new `EditorState` to arrive, so this result ends up being invalid (either `false` if we haven't received any post-layout editor state yet, or stale editor state data). To avoid this, we add a `hasPlainText` flag to `FocusedElementInformation` that represents whether or not the focused element initially had non-empty text content upon focus; if we're currently in the process of focusing (or are waiting for post-layout data) in `-hasText`, then use this initial value instead of the `EditorState`. Test: KeyboardInputTests.HasTextAfterFocusingTextField * Source/WebKit/Shared/FocusedElementInformation.h: * Source/WebKit/Shared/FocusedElementInformation.serialization.in: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasText]): * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::focusedElementInformation): For text fields and text areas, instead of using `hasPlainText` (which relies on `TextIterator`), simply check whether the `value` is non-empty instead to avoid any extra performance cost. * Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: Canonical link: https://commits.webkit.org/273211@main Identifier: 272448.528@safari-7618.1.15.10-branch
- Loading branch information
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters