Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 052c7b2a782b865f1922a7c9a691799aa815d306 https://github.com/WebKit/WebKit/commit/052c7b2a782b865f1922a7c9a691799aa815d306 Author: Richard Robinson <richard_robins...@apple.com> Date: 2024-04-09 (Tue, 09 Apr 2024)
Changed paths: M LayoutTests/platform/ios/TestExpectations M LayoutTests/platform/mac-wk2/TestExpectations M Source/WebCore/WebCore.xcodeproj/project.pbxproj M Source/WebCore/css/CSSPseudoSelectors.json M Source/WebCore/css/CSSSelector.cpp M Source/WebCore/css/html.css M Source/WebCore/cssjit/SelectorCompiler.cpp A Source/WebCore/dom/WritingSuggestionData.h M Source/WebCore/editing/Editor.cpp M Source/WebCore/editing/Editor.h M Source/WebCore/editing/InsertTextCommand.cpp M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp M Source/WebCore/rendering/style/RenderStyleConstants.cpp M Source/WebCore/rendering/style/RenderStyleConstants.h M Source/WebCore/rendering/updating/RenderTreeUpdater.cpp M Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp M Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.h M Source/WebKit/UIProcess/WebPageProxy.cpp M Source/WebKit/UIProcess/WebPageProxy.h M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm M Source/WebKit/UIProcess/mac/WebViewImpl.mm M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h M Source/WebKit/WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp M Source/WebKit/WebProcess/WebPage/WebPage.cpp M Source/WebKit/WebProcess/WebPage/WebPage.h M Source/WebKit/WebProcess/WebPage/WebPage.messages.in M Source/WebKitLegacy/mac/WebView/WebFrame.mm M Source/WebKitLegacy/mac/WebView/WebHTMLView.mm M Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl M Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp M Tools/WebKitTestRunner/InjectedBundle/TextInputController.h Log Message: ----------- Typing into Bitbucket comment fields is sometimes dropping characters/sending editing back to the start of the field https://bugs.webkit.org/show_bug.cgi?id=271842 rdar://125039472 Reviewed by Ryosuke Niwa and Antti Koivisto. The original implementation of writing suggestions aka inline text predictions relied on using the same code path as IME marked text has historically used; i.e., inserting the suggestion directly into the DOM. While this worked for trivial, simple cases, this proved to be incompatible from a web-compatibility perspective, since sites were not expecting this type of mutation to ever be happening in the DOM. Because of the combination of the conflicting selection changes that both the web engine and the site do, as well as the specific event handlers that a site may have, this resulted in erratic behavior when inserting and editing text. To fix, re-implement this feature using a different and significantly safer implementation; instead of inserting the suggestion into the DON, simply render it as a pseudo-element while it is being suggested, and only actually insert it into the DOM once the user accepts it. This significantly improves web compatibility, and also reduces risk in general by not doing unexpected things that the site can detect. * LayoutTests/platform/ios/TestExpectations: * LayoutTests/platform/mac-wk2/TestExpectations: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/css/CSSPseudoSelectors.json: * Source/WebCore/css/CSSSelector.cpp: (WebCore::CSSSelector::pseudoId): * Source/WebCore/css/html.css: (::-internal-writing-suggestions): * Source/WebCore/cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::constructFragmentsInternal): * Source/WebCore/dom/Element.cpp: (WebCore::Element::writingSuggestionData const): (WebCore::Element::setWritingSuggestionData): * Source/WebCore/dom/Element.h: * Source/WebCore/dom/ElementRareData.cpp: * Source/WebCore/dom/ElementRareData.h: (WebCore::ElementRareData::writingSuggestionData const): (WebCore::ElementRareData::setWritingSuggestionData): * Source/WebCore/dom/WritingSuggestionData.h: Copied from Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl. (WebCore::WritingSuggestionData::WritingSuggestionData): (WebCore::WritingSuggestionData::content const): (WebCore::WritingSuggestionData::offset const): * Source/WebCore/editing/Editor.cpp: (WebCore::Editor::selectedElement): (WebCore::Editor::removeWritingSuggestionIfNeeded): (WebCore::Editor::confirmComposition): (WebCore::Editor::cancelComposition): (WebCore::Editor::setWritingSuggestion): (WebCore::Editor::setComposition): * Source/WebCore/editing/Editor.h: * Source/WebCore/rendering/RenderElement.cpp: (WebCore::RenderElement::writingSuggestionsRenderer const): (WebCore::RenderElement::setWritingSuggestionsRenderer): * Source/WebCore/rendering/RenderElement.h: * Source/WebCore/rendering/RenderObject.h: * Source/WebCore/rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * Source/WebCore/rendering/style/RenderStyleConstants.h: * Source/WebCore/rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateAfterDescendants): * Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updateWritingSuggestionsRenderer): * Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setCompositionAsync): (WebKit::WebPageProxy::setWritingSuggestion): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _setMarkedText:underlines:highlights:selectedRange:]): * Source/WebKit/UIProcess/mac/WebViewImpl.mm: (WebKit::WebViewImpl::setMarkedText): (WebKit::compositionAnnotations): Deleted. * Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): * Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: * Source/WebKit/WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp: (WebKit::WebEditorClient::didDispatchInputMethodKeydown): * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setCompositionForTesting): (WebKit::WebPage::setCompositionAsync): (WebKit::WebPage::setWritingSuggestion): * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/WebPage.messages.in: * Source/WebKitLegacy/mac/WebView/WebFrame.mm: (-[WebFrame setMarkedText:selectedRange:]): (-[WebFrame setMarkedText:forCandidates:]): * Source/WebKitLegacy/mac/WebView/WebHTMLView.mm: (-[WebHTMLView setMarkedText:selectedRange:]): * Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl: * Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp: (WTR::TextInputController::setMarkedText): (WTR::createCompositionAnnotationData): Deleted. * Tools/WebKitTestRunner/InjectedBundle/TextInputController.h: Canonical link: https://commits.webkit.org/277282@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes