Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: a42d8d1b580267a1428d6056c315e7cf3853ee50 https://github.com/WebKit/WebKit/commit/a42d8d1b580267a1428d6056c315e7cf3853ee50 Author: Richard Robinson <richard_robins...@apple.com> Date: 2024-08-12 (Mon, 12 Aug 2024)
Changed paths: M Source/WebCore/page/ChromeClient.h M Source/WebCore/page/Page.cpp M Source/WebCore/page/Page.h M Source/WebCore/page/writing-tools/WritingToolsController.h M Source/WebCore/page/writing-tools/WritingToolsController.mm M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm M Source/WebKit/UIProcess/PageClient.h M Source/WebKit/UIProcess/WebPageProxy.h M Source/WebKit/UIProcess/WebPageProxy.messages.in M Source/WebKit/UIProcess/mac/WKTextAnimationManager.mm M Source/WebKit/UIProcess/mac/WebViewImpl.h M Source/WebKit/UIProcess/mac/WebViewImpl.mm M Source/WebKit/WebKitSwift/TextAnimation/TextAnimationManager.swift M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h M Source/WebKit/WebProcess/WebPage/Cocoa/TextAnimationController.h M Source/WebKit/WebProcess/WebPage/Cocoa/TextAnimationController.mm M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm M Source/WebKit/WebProcess/WebPage/WebPage.cpp M Source/WebKit/WebProcess/WebPage/WebPage.h M Source/WebKit/WebProcess/WebPage/WebPage.messages.in Log Message: ----------- [Writing Tools] macOS: Selection should be hidden when the pondering animation begins, stay hidden until all animations complete https://bugs.webkit.org/show_bug.cgi?id=277873 rdar://130995812 Reviewed by Wenson Hsieh. Clear the selection when a session begins, and reveal it when the session replacement animation is completely done. To facilitate the latter, the UI process now maintains a counter of ongoing intelligence text animations. There are several distinct sequence of events that should cause the selection to be revealed, assuming a replacement is done in multiple pieces; 1) The sequence a. `didReceive` [finished=false] b. animation 1 starts c. animation 1 ends d. `didReceive` [finished=false] e. animation 2 starts f. animation 2 ends g. `didReceive` [finished=true]. In this case, all animations are complete before `finished` is true. Therefore, by (g), the counter will be 0, and the call from `didReceive` with `finished = true` can reveal the selection. 2) The sequence a. `didReceive` [finished=false] b. `didReceive` [finished=false] c. `didReceive` [finished=true]. d. animation 1 starts e. animation 1 ends f. animation 2 starts g. animation 2 ends In this case, the call from `didReceive` where `finished = true` happens prior to all the animations finishing. In this case, the UI process notes that the replacement is finished. Then, in the text animation manager, when the last animation finishes (which is known via maintaining the counter of animations), then `finished` will be true, and the selection will be revealed. Drive-by fix: Fix and improve some formatting across various files. * Source/WebCore/page/ChromeClient.h: (WebCore::ChromeClient::addSourceTextAnimation): (WebCore::ChromeClient::addDestinationTextAnimation): * Source/WebCore/page/Page.cpp: (WebCore::Page::showSelectionForWritingToolsSessionWithID const): * Source/WebCore/page/Page.h: * Source/WebCore/page/writing-tools/WritingToolsController.h: * Source/WebCore/page/writing-tools/WritingToolsController.mm: (WebCore::WritingToolsController::willBeginWritingToolsSession): (WebCore::WritingToolsController::showSelectionForWritingToolsSessionWithID const): (WebCore::WritingToolsController::compositionSessionDidFinishReplacement): (WebCore::WritingToolsController::compositionSessionDidReceiveTextWithReplacementRangeAsync): * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _addTextAnimationForAnimationID:withData:]): (-[WKWebView _removeTextAnimationForAnimationID:]): (-[WKWebView _deferIntelligenceTextAnimation]): (-[WKWebView willBeginWritingToolsSession:requestContexts:]): (-[WKWebView compositionSession:didReceiveText:replacementRange:inContext:finished:]): * Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h: * Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h: * Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::deferIntelligenceTextAnimation): * Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::enableSourceTextAnimationAfterElementWithID): (WebKit::WebPageProxy::getTextIndicatorForID): (WebKit::WebPageProxy::updateUnderlyingTextVisibilityForTextAnimationID): (WebKit::WebPageProxy::showSelectionForWritingToolsSessionAssociatedWithAnimationID): (WebKit::WebPageProxy::showSelectionForWritingToolsSessionWithID): (WebKit::WebPageProxy::deferIntelligenceTextAnimation): * Source/WebKit/UIProcess/PageClient.h: * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/WebPageProxy.messages.in: * Source/WebKit/UIProcess/mac/WKTextAnimationManager.mm: (-[WKTextAnimationManager addTextAnimationForAnimationID:withData:]): * Source/WebKit/UIProcess/mac/WebViewImpl.h: * Source/WebKit/UIProcess/mac/WebViewImpl.mm: (WebKit::WebViewImpl::hasContentRelativeChildViews const): (WebKit::WebViewImpl::suppressContentRelativeChildViews): (WebKit::WebViewImpl::restoreContentRelativeChildViews): (WebKit::WebViewImpl::addTextAnimationForAnimationID): (WebKit::WebViewImpl::removeTextAnimationForAnimationID): (WebKit::WebViewImpl::writingToolsSessionWillBegin): (WebKit::WebViewImpl::writingToolsCompositionSessionDidReceiveReplacements): (WebKit::WebViewImpl::isWritingToolsTextReplacementsFinished const): (WebKit::WebViewImpl::isIntelligenceTextPonderingAnimationFinished const): (WebKit::WebViewImpl::willBeginPartialIntelligenceTextPonderingAnimation): (WebKit::WebViewImpl::didEndPartialIntelligenceTextPonderingAnimation): * Source/WebKit/WebKitSwift/TextAnimation/TextAnimationManager.swift: (TextAnimationManager.targetedPreview(for:)): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::addSourceTextAnimation): (WebKit::WebChromeClient::addDestinationTextAnimation): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h: * Source/WebKit/WebProcess/WebPage/Cocoa/TextAnimationController.h: * Source/WebKit/WebProcess/WebPage/Cocoa/TextAnimationController.mm: (WebKit::remainingCharacterRange): (WebKit::TextAnimationController::addSourceTextAnimation): (WebKit::TextAnimationController::addDestinationTextAnimation): (WebKit::TextAnimationController::showSelectionForWritingToolsSessionAssociatedWithAnimationID): (WebKit::TextAnimationController::updateUnderlyingTextVisibilityForTextAnimationID): * Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::addTextAnimationForAnimationID): (WebKit::WebPage::removeTextAnimationForAnimationID): (WebKit::WebPage::removeTransparentMarkersForSessionID): (WebKit::WebPage::removeInitialTextAnimation): (WebKit::WebPage::addInitialTextAnimation): (WebKit::WebPage::addSourceTextAnimation): (WebKit::WebPage::addDestinationTextAnimation): (WebKit::WebPage::clearAnimationsForSessionID): (WebKit::WebPage::showSelectionForWritingToolsSessionAssociatedWithAnimationID): (WebKit::WebPage::showSelectionForWritingToolsSessionWithID): (WebKit::WebPage::deferIntelligenceTextAnimation): * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::addTextAnimationForAnimationID): Deleted. (WebKit::WebPage::removeTextAnimationForAnimationID): Deleted. (WebKit::WebPage::removeTransparentMarkersForSessionID): Deleted. (WebKit::WebPage::removeInitialTextAnimation): Deleted. (WebKit::WebPage::addInitialTextAnimation): Deleted. (WebKit::WebPage::addSourceTextAnimation): Deleted. (WebKit::WebPage::addDestinationTextAnimation): Deleted. (WebKit::WebPage::clearAnimationsForSessionID): Deleted. * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/WebPage.messages.in: Canonical link: https://commits.webkit.org/282125@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