Title: [277453] trunk/Source
Revision
277453
Author
timothy_hor...@apple.com
Date
2021-05-13 14:57:45 -0700 (Thu, 13 May 2021)

Log Message

Add textIndicator bounce for AppHighlights on scroll.
https://bugs.webkit.org/show_bug.cgi?id=225727

Reviewed by Tim Horton.

* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::setTextIndicator const):
* loader/EmptyClients.h:
* page/ChromeClient.h:
* page/TextIndicator.h:
* page/cocoa/WebTextIndicatorLayer.h:
* page/cocoa/WebTextIndicatorLayer.mm:
(-[WebTextIndicatorLayer initWithFrame:textIndicator:margin:offset:]):
(createBounceAnimation):
(-[WebTextIndicatorLayer _animationDuration]):
* page/mac/TextIndicatorWindow.h:
* page/mac/TextIndicatorWindow.mm:
(WebCore::TextIndicatorWindow::~TextIndicatorWindow):
(WebCore::TextIndicatorWindow::clearTextIndicator):
(WebCore::TextIndicatorWindow::setTextIndicator):

Use factored out textIndicator code to add a bounce to an appHighlight
when it is scrolled to.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKWindowVisibilityObserver _dictionaryLookupPopoverWillClose:]):
(WebKit::WebViewImpl::setTextIndicator):
(WebKit::WebViewImpl::clearTextIndicatorWithAnimation):
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsWithAnimationFromViewOnly):
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setTextIndicator):
(WebKit::WebPageProxy::clearTextIndicator):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::setTextIndicator):
(WebKit::PageClientImpl::clearTextIndicator):
(WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpTextIndicator:]):
(-[WKContentView clearTextIndicator:]):
(-[WKContentView setTextIndicatorAnimationProgress:]):
(-[WKContentView teardownTextIndicatorLayer]):
(-[WKContentView startFadeOut]):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::setTextIndicator):
(WebKit::PageClientImpl::clearTextIndicator):
(WebKit::PageClientImpl::didPerformDictionaryLookup):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _animationControllerForText]):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setTextIndicator const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindIndicator):

* WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277452 => 277453)


--- trunk/Source/WebCore/ChangeLog	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/ChangeLog	2021-05-13 21:57:45 UTC (rev 277453)
@@ -1,3 +1,28 @@
+2021-05-13  Megan Gardner  <megan_gard...@apple.com>
+
+        Add textIndicator bounce for AppHighlights on scroll.
+        https://bugs.webkit.org/show_bug.cgi?id=225727
+
+        Reviewed by Tim Horton.
+
+        * Modules/highlight/AppHighlightStorage.cpp:
+        (WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
+        * loader/EmptyClients.cpp:
+        (WebCore::EmptyChromeClient::setTextIndicator const):
+        * loader/EmptyClients.h:
+        * page/ChromeClient.h:
+        * page/TextIndicator.h:
+        * page/cocoa/WebTextIndicatorLayer.h:
+        * page/cocoa/WebTextIndicatorLayer.mm:
+        (-[WebTextIndicatorLayer initWithFrame:textIndicator:margin:offset:]):
+        (createBounceAnimation):
+        (-[WebTextIndicatorLayer _animationDuration]):
+        * page/mac/TextIndicatorWindow.h:
+        * page/mac/TextIndicatorWindow.mm:
+        (WebCore::TextIndicatorWindow::~TextIndicatorWindow):
+        (WebCore::TextIndicatorWindow::clearTextIndicator):
+        (WebCore::TextIndicatorWindow::setTextIndicator):
+
 2021-05-13  Aditya Keerthi  <akeer...@apple.com>
 
         REGRESSION (r276945): [iOS] Focus rings are too large

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp (277452 => 277453)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-05-13 21:57:45 UTC (rev 277453)
@@ -30,6 +30,7 @@
 #include "AppHighlight.h"
 #include "AppHighlightRangeData.h"
 #include "Chrome.h"
+#include "ChromeClient.h"
 #include "Document.h"
 #include "DocumentMarkerController.h"
 #include "Editor.h"
@@ -40,6 +41,7 @@
 #include "RenderedDocumentMarker.h"
 #include "SimpleRange.h"
 #include "StaticRange.h"
+#include "TextIndicator.h"
 #include "TextIterator.h"
 
 namespace WebCore {
@@ -260,8 +262,13 @@
     
     strongDocument->appHighlightRegister().addAppHighlight(StaticRange::create(*range));
     
-    if (scroll == ScrollToHighlight::Yes)
+    if (scroll == ScrollToHighlight::Yes) {
+        auto textIndicator = TextIndicator::createWithRange(range.value(), { TextIndicatorOption::DoNotClipToVisibleRect }, WebCore::TextIndicatorPresentationTransition::Bounce);
+        if (textIndicator)
+            m_document->page()->chrome().client().setTextIndicator(textIndicator->data());
+        
         TemporarySelectionChange selectionChange(*strongDocument, { range.value() }, { TemporarySelectionOption::RevealSelection, TemporarySelectionOption::SmoothScroll, TemporarySelectionOption::OverrideSmoothScrollFeatureEnablment });
+    }
 
     return true;
 }

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (277452 => 277453)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2021-05-13 21:57:45 UTC (rev 277453)
@@ -555,6 +555,10 @@
 }
 #endif
 
+void EmptyChromeClient::setTextIndicator(const TextIndicatorData&) const
+{
+}
+
 DisplayRefreshMonitorFactory* EmptyChromeClient::displayRefreshMonitorFactory() const
 {
     return EmptyDisplayRefreshMonitorFactory::sharedEmptyDisplayRefreshMonitorFactory();

Modified: trunk/Source/WebCore/loader/EmptyClients.h (277452 => 277453)


--- trunk/Source/WebCore/loader/EmptyClients.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -149,6 +149,8 @@
     void storeAppHighlight(AppHighlight&&) const final;
 #endif
 
+    void setTextIndicator(const TextIndicatorData&) const final;
+
     DisplayRefreshMonitorFactory* displayRefreshMonitorFactory() const final;
 
     void runOpenPanel(Frame&, FileChooser&) final;

Modified: trunk/Source/WebCore/page/ChromeClient.h (277452 => 277453)


--- trunk/Source/WebCore/page/ChromeClient.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/page/ChromeClient.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -125,6 +125,7 @@
 struct GraphicsDeviceAdapter;
 struct MockWebAuthenticationConfiguration;
 struct ShareDataWithParsedURL;
+struct TextIndicatorData;
 struct ViewportArguments;
 struct WindowFeatures;
 
@@ -315,6 +316,8 @@
     virtual void storeAppHighlight(WebCore::AppHighlight&&) const = 0;
 #endif
 
+    virtual void setTextIndicator(const TextIndicatorData&) const = 0;
+
     virtual void runOpenPanel(Frame&, FileChooser&) = 0;
     virtual void showShareSheet(ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback) { callback(false); }
     virtual void showContactPicker(const ContactsRequestData&, WTF::CompletionHandler<void(Optional<Vector<ContactInfo>>&&)>&& callback) { callback(WTF::nullopt); }

Modified: trunk/Source/WebCore/page/TextIndicator.h (277452 => 277453)


--- trunk/Source/WebCore/page/TextIndicator.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/page/TextIndicator.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -30,6 +30,7 @@
 #include <wtf/EnumTraits.h>
 #include <wtf/OptionSet.h>
 #include <wtf/RefCounted.h>
+#include <wtf/Seconds.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -39,6 +40,25 @@
 
 struct SimpleRange;
 
+constexpr float dropShadowBlurRadius = 2;
+constexpr float rimShadowBlurRadius = 1;
+constexpr Seconds bounceAnimationDuration = 0.12_s;
+constexpr Seconds timeBeforeFadeStarts = bounceAnimationDuration + 0.2_s;
+constexpr float midBounceScale = 1.25;
+
+enum class TextIndicatorLifetime : uint8_t {
+    // The TextIndicator should indicate the text until dismissed.
+    Permanent,
+
+    // The TextIndicator should briefly indicate the text and then automatically dismiss.
+    Temporary
+};
+
+enum class TextIndicatorDismissalAnimation : uint8_t {
+    None,
+    FadeOut
+};
+
 // FIXME: Move PresentationTransition to TextIndicatorWindow, because it's about presentation.
 enum class TextIndicatorPresentationTransition : uint8_t {
     None,

Modified: trunk/Source/WebCore/page/cocoa/WebTextIndicatorLayer.h (277452 => 277453)


--- trunk/Source/WebCore/page/cocoa/WebTextIndicatorLayer.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/page/cocoa/WebTextIndicatorLayer.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -31,7 +31,7 @@
 #import <wtf/RetainPtr.h>
 #import <wtf/RunLoop.h>
 
-@interface WebTextIndicatorLayer : CALayer {
+WEBCORE_EXPORT @interface WebTextIndicatorLayer : CALayer {
     RefPtr<WebCore::TextIndicator> _textIndicator;
     RetainPtr<NSArray> _bounceLayers;
     CGSize _margin;
@@ -53,3 +53,4 @@
 @property (nonatomic, getter=isFadingOut) BOOL fadingOut;
 
 @end
+

Modified: trunk/Source/WebCore/page/cocoa/WebTextIndicatorLayer.mm (277452 => 277453)


--- trunk/Source/WebCore/page/cocoa/WebTextIndicatorLayer.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/page/cocoa/WebTextIndicatorLayer.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -30,6 +30,7 @@
 #import "GraphicsContext.h"
 #import "PathUtilities.h"
 #import "TextIndicator.h"
+#import "TextIndicatorWindow.h"
 #import "WebActionDisablingCALayerDelegate.h"
 #import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
@@ -38,19 +39,14 @@
 #import <pal/spi/cocoa/NSColorSPI.h>
 #endif
 
-constexpr CFTimeInterval bounceAnimationDuration = 0.12;
 constexpr CFTimeInterval bounceWithCrossfadeAnimationDuration = 0.3;
 constexpr CFTimeInterval fadeInAnimationDuration = 0.15;
-constexpr CFTimeInterval timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
 constexpr CFTimeInterval fadeOutAnimationDuration = 0.3;
 
-constexpr CGFloat midBounceScale = 1.25;
 constexpr CGFloat borderWidth = 0;
 constexpr CGFloat cornerRadius = 0;
 constexpr CGFloat dropShadowOffsetX = 0;
 constexpr CGFloat dropShadowOffsetY = 1;
-constexpr CGFloat dropShadowBlurRadius = 2;
-constexpr CGFloat rimShadowBlurRadius = 1;
 
 constexpr NSString * const textLayerKey = @"TextLayer";
 constexpr NSString * const dropShadowLayerKey = @"DropShadowLayer";
@@ -132,13 +128,12 @@
     if (!(self = [super init]))
         return nil;
     
+    self.anchorPoint = CGPointZero;
     self.frame = frame;
 
     _textIndicator = &textIndicator;
     _margin = margin;
 
-    self.anchorPoint = CGPointZero;
-
     RefPtr<WebCore::NativeImage> contentsImage;
     WebCore::FloatSize contentsImageLogicalSize { 1, 1 };
     if (auto* contentImage = _textIndicator->contentImage()) {
@@ -192,7 +187,7 @@
         RetainPtr<CALayer> dropShadowLayer = adoptNS([[CALayer alloc] init]);
         [dropShadowLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
         [dropShadowLayer setShadowColor:dropShadowColor.get()];
-        [dropShadowLayer setShadowRadius:dropShadowBlurRadius];
+        [dropShadowLayer setShadowRadius:WebCore::dropShadowBlurRadius];
         [dropShadowLayer setShadowOffset:CGSizeMake(dropShadowOffsetX, dropShadowOffsetY)];
         [dropShadowLayer setShadowPath:translatedPath.platformPath()];
         [dropShadowLayer setShadowOpacity:1];
@@ -204,7 +199,7 @@
         [rimShadowLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
         [rimShadowLayer setFrame:yellowHighlightRect];
         [rimShadowLayer setShadowColor:rimShadowColor.get()];
-        [rimShadowLayer setShadowRadius:rimShadowBlurRadius];
+        [rimShadowLayer setShadowRadius:WebCore::rimShadowBlurRadius];
         [rimShadowLayer setShadowPath:translatedPath.platformPath()];
         [rimShadowLayer setShadowOffset:CGSizeZero];
         [rimShadowLayer setShadowOpacity:1];
@@ -245,7 +240,7 @@
     RetainPtr<CAKeyframeAnimation> bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
     [bounceAnimation setValues:@[
         [NSValue valueWithCATransform3D:CATransform3DIdentity],
-        [NSValue valueWithCATransform3D:CATransform3DMakeScale(midBounceScale, midBounceScale, 1)],
+        [NSValue valueWithCATransform3D:CATransform3DMakeScale(WebCore::midBounceScale, WebCore::midBounceScale, 1)],
         [NSValue valueWithCATransform3D:CATransform3DIdentity]
         ]];
     [bounceAnimation setDuration:duration];
@@ -294,7 +289,7 @@
     if ([self indicatorWantsBounce:*_textIndicator]) {
         if (indicatorWantsContentCrossfade(*_textIndicator))
             return bounceWithCrossfadeAnimationDuration;
-        return bounceAnimationDuration;
+        return WebCore::bounceAnimationDuration.value();
     }
 
     return fadeInAnimationDuration;

Modified: trunk/Source/WebCore/page/mac/TextIndicatorWindow.h (277452 => 277453)


--- trunk/Source/WebCore/page/mac/TextIndicatorWindow.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/page/mac/TextIndicatorWindow.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -36,19 +36,6 @@
 
 namespace WebCore {
 
-enum class TextIndicatorWindowLifetime : uint8_t {
-    // The TextIndicator should indicate the text until dismissed.
-    Permanent,
-
-    // The TextIndicator should briefly indicate the text and then automatically dismiss.
-    Temporary
-};
-
-enum class TextIndicatorWindowDismissalAnimation : uint8_t {
-    None,
-    FadeOut
-};
-
 #if PLATFORM(MAC)
 
 class TextIndicatorWindow {
@@ -59,8 +46,8 @@
     WEBCORE_EXPORT explicit TextIndicatorWindow(NSView *);
     WEBCORE_EXPORT ~TextIndicatorWindow();
 
-    WEBCORE_EXPORT void setTextIndicator(Ref<TextIndicator>, CGRect contentRect, TextIndicatorWindowLifetime);
-    WEBCORE_EXPORT void clearTextIndicator(TextIndicatorWindowDismissalAnimation);
+    WEBCORE_EXPORT void setTextIndicator(Ref<TextIndicator>, CGRect contentRect, TextIndicatorLifetime);
+    WEBCORE_EXPORT void clearTextIndicator(TextIndicatorDismissalAnimation);
 
     WEBCORE_EXPORT void setAnimationProgress(float);
 
@@ -81,3 +68,5 @@
 #endif // PLATFORM(MAC)
 
 } // namespace WebCore
+
+

Modified: trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm (277452 => 277453)


--- trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -38,12 +38,6 @@
 #import <pal/spi/cocoa/NSColorSPI.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
-const CFTimeInterval bounceAnimationDuration = 0.12;
-const CFTimeInterval timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
-
-const CGFloat midBounceScale = 1.25;
-const CGFloat dropShadowBlurRadius = 2;
-
 using namespace WebCore;
 
 namespace WebCore {
@@ -56,7 +50,7 @@
 
 TextIndicatorWindow::~TextIndicatorWindow()
 {
-    clearTextIndicator(TextIndicatorWindowDismissalAnimation::FadeOut);
+    clearTextIndicator(WebCore::TextIndicatorDismissalAnimation::FadeOut);
 }
 
 void TextIndicatorWindow::setAnimationProgress(float progress)
@@ -67,7 +61,7 @@
     [m_textIndicatorLayer setAnimationProgress:progress];
 }
 
-void TextIndicatorWindow::clearTextIndicator(TextIndicatorWindowDismissalAnimation animation)
+void TextIndicatorWindow::clearTextIndicator(WebCore::TextIndicatorDismissalAnimation animation)
 {
     RefPtr<TextIndicator> textIndicator = WTFMove(m_textIndicator);
 
@@ -74,7 +68,7 @@
     if ([m_textIndicatorLayer isFadingOut])
         return;
 
-    if (textIndicator && [m_textIndicatorLayer indicatorWantsManualAnimation:*textIndicator] && [m_textIndicatorLayer hasCompletedAnimation] && animation == TextIndicatorWindowDismissalAnimation::FadeOut) {
+    if (textIndicator && [m_textIndicatorLayer indicatorWantsManualAnimation:*textIndicator] && [m_textIndicatorLayer hasCompletedAnimation] && animation == WebCore::TextIndicatorDismissalAnimation::FadeOut) {
         startFadeOut();
         return;
     }
@@ -82,7 +76,7 @@
     closeWindow();
 }
 
-void TextIndicatorWindow::setTextIndicator(Ref<TextIndicator> textIndicator, CGRect textBoundingRectInScreenCoordinates, TextIndicatorWindowLifetime lifetime)
+void TextIndicatorWindow::setTextIndicator(Ref<TextIndicator> textIndicator, CGRect textBoundingRectInScreenCoordinates, TextIndicatorLifetime lifetime)
 {
     if (m_textIndicator == textIndicator.ptr())
         return;
@@ -95,8 +89,8 @@
     CGFloat verticalMargin = dropShadowBlurRadius * 2 + TextIndicator::defaultVerticalMargin;
     
     if ([m_textIndicatorLayer indicatorWantsBounce:*m_textIndicator]) {
-        horizontalMargin = std::max(horizontalMargin, textBoundingRectInScreenCoordinates.size.width * (midBounceScale - 1) + horizontalMargin);
-        verticalMargin = std::max(verticalMargin, textBoundingRectInScreenCoordinates.size.height * (midBounceScale - 1) + verticalMargin);
+        horizontalMargin = std::max(horizontalMargin, textBoundingRectInScreenCoordinates.size.width * (WebCore::midBounceScale - 1) + horizontalMargin);
+        verticalMargin = std::max(verticalMargin, textBoundingRectInScreenCoordinates.size.height * (WebCore::midBounceScale - 1) + verticalMargin);
     }
 
     horizontalMargin = CGCeiling(horizontalMargin);
@@ -125,8 +119,8 @@
     if (m_textIndicator->presentationTransition() != TextIndicatorPresentationTransition::None)
         [m_textIndicatorLayer present];
 
-    if (lifetime == TextIndicatorWindowLifetime::Temporary)
-        m_temporaryTextIndicatorTimer.startOneShot(1_s * timeBeforeFadeStarts);
+    if (lifetime == TextIndicatorLifetime::Temporary)
+        m_temporaryTextIndicatorTimer.startOneShot(WebCore::timeBeforeFadeStarts);
 }
 
 void TextIndicatorWindow::closeWindow()

Modified: trunk/Source/WebKit/ChangeLog (277452 => 277453)


--- trunk/Source/WebKit/ChangeLog	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/ChangeLog	2021-05-13 21:57:45 UTC (rev 277453)
@@ -1,3 +1,50 @@
+2021-05-13  Megan Gardner  <megan_gard...@apple.com>
+
+        Add textIndicator bounce for AppHighlights on scroll.
+        https://bugs.webkit.org/show_bug.cgi?id=225727
+
+        Reviewed by Tim Horton.
+
+        Use factored out textIndicator code to add a bounce to an appHighlight
+        when it is scrolled to.
+
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (-[WKWindowVisibilityObserver _dictionaryLookupPopoverWillClose:]):
+        (WebKit::WebViewImpl::setTextIndicator):
+        (WebKit::WebViewImpl::clearTextIndicatorWithAnimation):
+        (WebKit::WebViewImpl::dismissContentRelativeChildWindowsWithAnimationFromViewOnly):
+        (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setTextIndicator):
+        (WebKit::WebPageProxy::clearTextIndicator):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::setTextIndicator):
+        (WebKit::PageClientImpl::clearTextIndicator):
+        (WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setUpTextIndicator:]):
+        (-[WKContentView clearTextIndicator:]):
+        (-[WKContentView setTextIndicatorAnimationProgress:]):
+        (-[WKContentView teardownTextIndicatorLayer]):
+        (-[WKContentView startFadeOut]):
+        * UIProcess/mac/PageClientImplMac.h:
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::setTextIndicator):
+        (WebKit::PageClientImpl::clearTextIndicator):
+        (WebKit::PageClientImpl::didPerformDictionaryLookup):
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _animationControllerForText]):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::setTextIndicator const):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::updateFindIndicator):
+
 2021-05-13  Sam Weinig  <wei...@apple.com>
 
         Split pixel buffer format data out into a new PixelBufferFormat struct

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -411,8 +411,8 @@
 
     void preferencesDidChange();
 
-    void setTextIndicator(WebCore::TextIndicator&, WebCore::TextIndicatorWindowLifetime = WebCore::TextIndicatorWindowLifetime::Permanent);
-    void clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation);
+    void setTextIndicator(WebCore::TextIndicator&, WebCore::TextIndicatorLifetime = WebCore::TextIndicatorLifetime::Permanent);
+    void clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation);
     void setTextIndicatorAnimationProgress(float);
     void dismissContentRelativeChildWindowsFromViewOnly();
     void dismissContentRelativeChildWindowsWithAnimation(bool);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -423,7 +423,7 @@
 #if !ENABLE(REVEAL)
 - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
 {
-    _impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
+    _impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation::None);
 }
 #endif
 
@@ -3495,7 +3495,7 @@
         updateWindowAndViewFrames();
 }
 
-void WebViewImpl::setTextIndicator(WebCore::TextIndicator& textIndicator, WebCore::TextIndicatorWindowLifetime lifetime)
+void WebViewImpl::setTextIndicator(WebCore::TextIndicator& textIndicator, WebCore::TextIndicatorLifetime lifetime)
 {
     if (!m_textIndicatorWindow)
         m_textIndicatorWindow = makeUnique<WebCore::TextIndicatorWindow>(m_view.getAutoreleased());
@@ -3504,7 +3504,7 @@
     m_textIndicatorWindow->setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), lifetime);
 }
 
-void WebViewImpl::clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation animation)
+void WebViewImpl::clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation animation)
 {
     if (m_textIndicatorWindow)
         m_textIndicatorWindow->clearTextIndicator(animation);
@@ -3527,7 +3527,7 @@
     // Calling _clearTextIndicatorWithAnimation here will win out over the animated clear in dismissContentRelativeChildWindowsFromViewOnly.
     // We can't invert these because clients can override (and have overridden) _dismissContentRelativeChildWindows, so it needs to be called.
     // For this same reason, this can't be moved to WebViewImpl without care.
-    clearTextIndicatorWithAnimation(animate ? WebCore::TextIndicatorWindowDismissalAnimation::FadeOut : WebCore::TextIndicatorWindowDismissalAnimation::None);
+    clearTextIndicatorWithAnimation(animate ? WebCore::TextIndicatorDismissalAnimation::FadeOut : WebCore::TextIndicatorDismissalAnimation::None);
     [m_view _web_dismissContentRelativeChildWindows];
 }
 
@@ -3544,7 +3544,7 @@
             [[getDDActionsManagerClass() sharedManager] requestBubbleClosureUnanchorOnFailure:YES];
     }
 
-    clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::FadeOut);
+    clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation::FadeOut);
 
     [m_immediateActionController dismissContentRelativeChildWindows];
 

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -106,8 +106,8 @@
 enum class MouseEventPolicy : uint8_t;
 enum class RouteSharingPolicy : uint8_t;
 enum class ScrollbarStyle : uint8_t;
-enum class TextIndicatorWindowLifetime : uint8_t;
-enum class TextIndicatorWindowDismissalAnimation : uint8_t;
+enum class TextIndicatorLifetime : uint8_t;
+enum class TextIndicatorDismissalAnimation : uint8_t;
 enum class DOMPasteAccessResponse : uint8_t;
 
 struct AppHighlight;
@@ -385,8 +385,8 @@
 #endif
 
 #if PLATFORM(COCOA)
-    virtual void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) = 0;
-    virtual void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) = 0;
+    virtual void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorLifetime) = 0;
+    virtual void clearTextIndicator(WebCore::TextIndicatorDismissalAnimation) = 0;
     virtual void setTextIndicatorAnimationProgress(float) = 0;
     
     virtual void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&) = 0;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-05-13 21:57:45 UTC (rev 277453)
@@ -218,7 +218,6 @@
 #include <WebCore/AttributedString.h>
 #include <WebCore/RunLoopObserver.h>
 #include <WebCore/SystemBattery.h>
-#include <WebCore/TextIndicatorWindow.h>
 #include <WebCore/VersionChecks.h>
 #include <wtf/MachSendRight.h>
 #include <wtf/cocoa/Entitlements.h>
@@ -6534,7 +6533,7 @@
 {
     // FIXME: Make TextIndicatorWindow a platform-independent presentational thing ("TextIndicatorPresentation"?).
 #if PLATFORM(COCOA)
-    pageClient().setTextIndicator(TextIndicator::create(indicatorData), static_cast<TextIndicatorWindowLifetime>(lifetime));
+    pageClient().setTextIndicator(TextIndicator::create(indicatorData), static_cast<WebCore::TextIndicatorLifetime>(lifetime));
 #else
     ASSERT_NOT_REACHED();
 #endif
@@ -6543,7 +6542,7 @@
 void WebPageProxy::clearTextIndicator()
 {
 #if PLATFORM(COCOA)
-    pageClient().clearTextIndicator(TextIndicatorWindowDismissalAnimation::FadeOut);
+    pageClient().clearTextIndicator(WebCore::TextIndicatorDismissalAnimation::FadeOut);
 #else
     ASSERT_NOT_REACHED();
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -1152,7 +1152,7 @@
     void countStringMatches(const String&, OptionSet<FindOptions>, unsigned maxMatchCount);
     void replaceMatches(Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&&);
     void didCountStringMatches(const String&, uint32_t matchCount);
-    void setTextIndicator(const WebCore::TextIndicatorData&, uint64_t /* WebCore::TextIndicatorWindowLifetime */ lifetime = 0 /* Permanent */);
+    void setTextIndicator(const WebCore::TextIndicatorData&, uint64_t /* WebCore::TextIndicatorLifetime */ lifetime = 0 /* Permanent */);
     void setTextIndicatorAnimationProgress(float);
     void clearTextIndicator();
 

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -138,8 +138,8 @@
     RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) final;
 #endif
 
-    void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
-    void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;
+    void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorLifetime) override;
+    void clearTextIndicator(WebCore::TextIndicatorDismissalAnimation) override;
     void setTextIndicatorAnimationProgress(float) override;
 
     void showSafeBrowsingWarning(const SafeBrowsingWarning&, CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, URL>&&)>&&) override;

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -479,16 +479,19 @@
     return nullptr;
 }
 
-void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, TextIndicatorWindowLifetime)
+void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, WebCore::TextIndicatorLifetime)
 {
+    [m_contentView setUpTextIndicator:textIndicator];
 }
 
-void PageClientImpl::clearTextIndicator(TextIndicatorWindowDismissalAnimation)
+void PageClientImpl::clearTextIndicator(WebCore::TextIndicatorDismissalAnimation dismissalAnimation)
 {
+    [m_contentView clearTextIndicator:dismissalAnimation];
 }
 
-void PageClientImpl::setTextIndicatorAnimationProgress(float)
+void PageClientImpl::setTextIndicatorAnimationProgress(float animationProgress)
 {
+    [m_contentView setTextIndicatorAnimationProgress:animationProgress];
 }
 
 void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -89,6 +89,7 @@
 enum class DOMPasteAccessResponse : uint8_t;
 enum class MouseEventPolicy : uint8_t;
 enum class RouteSharingPolicy : uint8_t;
+enum class TextIndicatorDismissalAnimation : uint8_t;
 
 #if ENABLE(DRAG_SUPPORT)
 struct DragItem;
@@ -104,6 +105,7 @@
 }
 
 @class WebEvent;
+@class WebTextIndicatorLayer;
 @class WKActionSheetAssistant;
 @class WKContextMenuElementInfo;
 @class WKDataListSuggestionsControl;
@@ -331,6 +333,9 @@
     RetainPtr<UIPreviewItemController> _previewItemController;
 #endif
 
+    RefPtr<WebCore::TextIndicator> _textIndicator;
+    RetainPtr<WebTextIndicatorLayer> _textIndicatorLayer;
+
 #if USE(UICONTEXTMENU)
     RetainPtr<UITargetedPreview> _contextMenuInteractionTargetedPreview;
 #endif
@@ -670,6 +675,10 @@
 - (void)_didStartProvisionalLoadForMainFrame;
 - (void)_didCommitLoadForMainFrame;
 
+- (void)setUpTextIndicator:(Ref<WebCore::TextIndicator>)textIndicator;
+- (void)setTextIndicatorAnimationProgress:(float)NSAnimationProgress;
+- (void)clearTextIndicator:(WebCore::TextIndicatorDismissalAnimation)animation;
+
 @property (nonatomic, readonly) BOOL _shouldUseContextMenus;
 @property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange;
 @property (nonatomic, readonly) BOOL _shouldAvoidScrollingWhenFocusedContentIsVisible;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -116,11 +116,13 @@
 #import <WebCore/ShareData.h>
 #import <WebCore/TextAlternativeWithRange.h>
 #import <WebCore/TextIndicator.h>
+#import <WebCore/TextIndicatorWindow.h>
 #import <WebCore/TouchAction.h>
 #import <WebCore/UTIUtilities.h>
 #import <WebCore/VersionChecks.h>
 #import <WebCore/VisibleSelection.h>
 #import <WebCore/WebEvent.h>
+#import <WebCore/WebTextIndicatorLayer.h>
 #import <WebCore/WritingDirection.h>
 #import <WebKit/WebSelectionRect.h> // FIXME: WebKit should not include WebKitLegacy headers!
 #import <pal/spi/cg/CoreGraphicsSPI.h>
@@ -9582,6 +9584,67 @@
 
 #endif // ENABLE(IMAGE_EXTRACTION)
 
+- (void)setUpTextIndicator:(Ref<WebCore::TextIndicator>)textIndicator
+{
+    if (_textIndicator == textIndicator.ptr())
+        return;
+    
+    [self teardownTextIndicatorLayer];
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startFadeOut) object:nil];
+    
+    _textIndicator = textIndicator.ptr();
+
+    CGRect frame = _textIndicator->textBoundingRectInRootViewCoordinates();
+    _textIndicatorLayer = adoptNS([[WebTextIndicatorLayer alloc] initWithFrame:frame
+        textIndicator:textIndicator margin:CGSizeZero offset:CGPointZero]);
+    
+    [[self layer] addSublayer:_textIndicatorLayer.get()];
+
+    if (_textIndicator->presentationTransition() != WebCore::TextIndicatorPresentationTransition::None)
+        [_textIndicatorLayer present];
+    
+    [self performSelector:@selector(startFadeOut) withObject:self afterDelay:WebCore::timeBeforeFadeStarts.value()];
+}
+
+- (void)clearTextIndicator:(WebCore::TextIndicatorDismissalAnimation)animation
+{
+    RefPtr<WebCore::TextIndicator> textIndicator = WTFMove(_textIndicator);
+    
+    if ([_textIndicatorLayer isFadingOut])
+        return;
+
+    if (textIndicator && [_textIndicatorLayer indicatorWantsManualAnimation:*textIndicator] && [_textIndicatorLayer hasCompletedAnimation] && animation == WebCore::TextIndicatorDismissalAnimation::FadeOut) {
+        [self startFadeOut];
+        return;
+    }
+
+    [self teardownTextIndicatorLayer];
+}
+
+- (void)setTextIndicatorAnimationProgress:(float)animationProgress
+{
+    if (!_textIndicator)
+        return;
+
+    [_textIndicatorLayer setAnimationProgress:animationProgress];
+}
+
+- (void)teardownTextIndicatorLayer
+{
+    [_textIndicatorLayer removeFromSuperlayer];
+    _textIndicatorLayer = nil;
+}
+
+- (void)startFadeOut
+{
+    [_textIndicatorLayer setFadingOut:YES];
+        
+    [_textIndicatorLayer hideWithCompletionHandler:[weakSelf = WeakObjCPtr<WKContentView>(self)] {
+        auto strongSelf = weakSelf.get();
+        [strongSelf teardownTextIndicatorLayer];
+    }];
+}
+
 #if USE(APPLE_INTERNAL_SDK)
 #import <WebKitAdditions/WKContentViewInteractionAdditionsAfter.mm>
 #endif

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -156,8 +156,8 @@
 
     Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
 
-    void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
-    void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;
+    void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorLifetime) override;
+    void clearTextIndicator(WebCore::TextIndicatorDismissalAnimation) override;
     void setTextIndicatorAnimationProgress(float) override;
 
     void enterAcceleratedCompositingMode(const LayerTreeContext&) override;

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -569,12 +569,12 @@
     m_impl->clearSafeBrowsingWarningIfForMainFrameNavigation();
 }
 
-void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, WebCore::TextIndicatorWindowLifetime lifetime)
+void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, WebCore::TextIndicatorLifetime lifetime)
 {
     m_impl->setTextIndicator(textIndicator.get(), lifetime);
 }
 
-void PageClientImpl::clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation dismissalAnimation)
+void PageClientImpl::clearTextIndicator(WebCore::TextIndicatorDismissalAnimation dismissalAnimation)
 {
     m_impl->clearTextIndicatorWithAnimation(dismissalAnimation);
 }
@@ -672,9 +672,9 @@
     m_impl->prepareForDictionaryLookup();
 
     DictionaryLookup::showPopup(dictionaryPopupInfo, m_view, [this](TextIndicator& textIndicator) {
-        m_impl->setTextIndicator(textIndicator, TextIndicatorWindowLifetime::Permanent);
+        m_impl->setTextIndicator(textIndicator, WebCore::TextIndicatorLifetime::Permanent);
     }, nullptr, [this]() {
-        m_impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
+        m_impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation::None);
     });
 }
 

Modified: trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm (277452 => 277453)


--- trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -490,9 +490,9 @@
     _viewImpl->prepareForDictionaryLookup();
 
     return WebCore::DictionaryLookup::animationControllerForPopup(dictionaryPopupInfo, _view, [self](WebCore::TextIndicator& textIndicator) {
-        _viewImpl->setTextIndicator(textIndicator, WebCore::TextIndicatorWindowLifetime::Permanent);
+        _viewImpl->setTextIndicator(textIndicator, WebCore::TextIndicatorLifetime::Permanent);
     }, nullptr, [self]() {
-        _viewImpl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
+        _viewImpl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation::None);
     });
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (277452 => 277453)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-05-13 21:57:45 UTC (rev 277453)
@@ -88,6 +88,7 @@
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/Settings.h>
+#include <WebCore/TextIndicator.h>
 
 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 #include "PlaybackSessionManager.h"
@@ -1271,6 +1272,11 @@
 }
 #endif
 
+void WebChromeClient::setTextIndicator(const WebCore::TextIndicatorData& indicatorData) const
+{
+    m_page.send(Messages::WebPageProxy::SetTextIndicator(indicatorData, static_cast<uint64_t>(WebCore::TextIndicatorLifetime::Temporary)));
+}
+
 String WebChromeClient::signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL& url) const
 {
     String result;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (277452 => 277453)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -353,6 +353,8 @@
     void storeAppHighlight(WebCore::AppHighlight&&) const final;
 #endif
 
+    void setTextIndicator(const WebCore::TextIndicatorData&) const final;
+
 #if ENABLE(WEB_CRYPTO)
     bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;
     bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;

Modified: trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp (277452 => 277453)


--- trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp	2021-05-13 21:57:45 UTC (rev 277453)
@@ -380,7 +380,7 @@
 
     m_findIndicatorRect = enclosingIntRect(indicator->selectionRectInRootViewCoordinates());
 #if PLATFORM(COCOA)
-    m_webPage->send(Messages::WebPageProxy::SetTextIndicator(indicator->data(), static_cast<uint64_t>(isShowingOverlay ? TextIndicatorWindowLifetime::Permanent : TextIndicatorWindowLifetime::Temporary)));
+    m_webPage->send(Messages::WebPageProxy::SetTextIndicator(indicator->data(), static_cast<uint64_t>(isShowingOverlay ? WebCore::TextIndicatorLifetime::Permanent : WebCore::TextIndicatorLifetime::Temporary)));
 #endif
     m_isShowingFindIndicator = true;
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-05-13 21:57:45 UTC (rev 277453)
@@ -1,3 +1,32 @@
+2021-05-13  Megan Gardner  <megan_gard...@apple.com>
+
+        Add textIndicator bounce for AppHighlights on scroll.
+        https://bugs.webkit.org/show_bug.cgi?id=225727
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::setTextIndicator const):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView quickLookWithEvent:]):
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController webView:didHandleScrollWheel:]):
+        (-[WebImmediateActionController _cancelImmediateAction]):
+        (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+        (-[WebImmediateActionController _defaultAnimationController]):
+        (-[WebImmediateActionController menuItemDidClose:]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedLink]):
+        * WebView/WebView.mm:
+        (-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
+        (-[WebView _setTextIndicator:]):
+        (-[WebView _setTextIndicator:withLifetime:]):
+        (-[WebView _clearTextIndicatorWithAnimation:]):
+        (-[WebView _showDictionaryLookupPopup:]):
+        (-[WebView _dictionaryLookupPopoverWillClose:]):
+        * WebView/WebViewInternal.h:
+
 2021-05-12  Chris Dumez  <cdu...@apple.com>
 
         Notification.requestPermission() should return a Promise

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -155,6 +155,8 @@
     void storeAppHighlight(WebCore::AppHighlight&&) const final;
 #endif
 
+    void setTextIndicator(const WebCore::TextIndicatorData&) const final;
+
 #if ENABLE(POINTER_LOCK)
     bool requestPointerLock() final;
     void requestPointerUnlock() final;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -720,6 +720,10 @@
 }
 #endif
 
+void WebChromeClient::setTextIndicator(const WebCore::TextIndicatorData& indicatorData) const
+{
+}
+
 #if ENABLE(POINTER_LOCK)
 bool WebChromeClient::requestPointerLock()
 {

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -5953,7 +5953,7 @@
 
 - (void)quickLookWithEvent:(NSEvent *)event
 {
-    [[self _webView] _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+    [[self _webView] _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
     [super quickLookWithEvent:event];
 }
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -122,7 +122,7 @@
 {
     [_currentQLPreviewMenuItem close];
     [self _clearImmediateActionState];
-    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::None];
+    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::None];
 }
 
 - (NSImmediateActionGestureRecognizer *)immediateActionRecognizer
@@ -139,7 +139,7 @@
     }
 
     [self _clearImmediateActionState];
-    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
 }
 
 - (void)_clearImmediateActionState
@@ -251,7 +251,7 @@
 
     [_webView _setTextIndicatorAnimationProgress:0];
     [self _clearImmediateActionState];
-    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::None];
+    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::None];
     [_webView _setMaintainsInactiveSelection:NO];
 }
 
@@ -293,7 +293,7 @@
             auto linkRange = makeRangeSelectingNodeContents(*_hitTestResult.URLElement());
             auto indicator = WebCore::TextIndicator::createWithRange(linkRange, { WebCore::TextIndicatorOption::UseBoundingRectAndPaintAllContentForComplexRanges }, WebCore::TextIndicatorPresentationTransition::FadeIn);
             if (indicator)
-                [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
+                [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorLifetime::Permanent];
 
             QLPreviewMenuItem *item = [NSMenuItem standardQuickLookMenuItem];
             item.previewStyle = QLPreviewStylePopover;
@@ -379,7 +379,7 @@
 - (void)menuItemDidClose:(NSMenuItem *)menuItem
 {
     [self _clearImmediateActionState];
-    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+    [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
 }
 
 static WebCore::IntRect elementBoundingBoxInWindowCoordinatesFromNode(WebCore::Node* node)
@@ -464,9 +464,9 @@
     _currentActionContext = [detectedItem->actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
     } interactionChangedHandler:^() {
         if (indicator)
-            [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
+            [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorLifetime::Permanent];
     } interactionStoppedHandler:^() {
-        [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+        [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
     }];
 
     [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:detectedItem->boundingBox]];
@@ -497,9 +497,9 @@
     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
     } interactionChangedHandler:^() {
         if (indicator)
-            [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
+            [_webView _setTextIndicator:*indicator withLifetime:WebCore::TextIndicatorLifetime::Permanent];
     } interactionStoppedHandler:^() {
-        [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+        [_webView _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
     }];
 
     [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:elementBoundingBoxInWindowCoordinatesFromNode(_hitTestResult.URLElement())]];

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2021-05-13 21:57:45 UTC (rev 277453)
@@ -9100,11 +9100,11 @@
     [self _prepareForDictionaryLookup];
 
     return WebCore::DictionaryLookup::animationControllerForPopup(dictionaryPopupInfo, self, [self](WebCore::TextIndicator& textIndicator) {
-        [self _setTextIndicator:textIndicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
+        [self _setTextIndicator:textIndicator withLifetime:WebCore::TextIndicatorLifetime::Permanent];
     }, [self](WebCore::FloatRect rectInRootViewCoordinates) {
         return [self _convertRectFromRootView:rectInRootViewCoordinates];
     }, [self]() {
-        [self _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+        [self _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
     });
 }
 
@@ -9120,10 +9120,10 @@
 
 - (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator
 {
-    [self _setTextIndicator:textIndicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
+    [self _setTextIndicator:textIndicator withLifetime:WebCore::TextIndicatorLifetime::Permanent];
 }
 
-- (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator withLifetime:(WebCore::TextIndicatorWindowLifetime)lifetime
+- (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator withLifetime:(WebCore::TextIndicatorLifetime)lifetime
 {
     if (!_private->textIndicatorWindow)
         _private->textIndicatorWindow = makeUnique<WebCore::TextIndicatorWindow>(self);
@@ -9133,10 +9133,10 @@
     _private->textIndicatorWindow->setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), lifetime);
 }
 
-- (void)_clearTextIndicatorWithAnimation:(WebCore::TextIndicatorWindowDismissalAnimation)animation
+- (void)_clearTextIndicatorWithAnimation:(WebCore::TextIndicatorDismissalAnimation)animation
 {
     if (_private->textIndicatorWindow)
-        _private->textIndicatorWindow->clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation::FadeOut);
+        _private->textIndicatorWindow->clearTextIndicator(WebCore::TextIndicatorDismissalAnimation::FadeOut);
     _private->textIndicatorWindow = nullptr;
 }
 
@@ -9168,11 +9168,11 @@
     [self _prepareForDictionaryLookup];
 
     WebCore::DictionaryLookup::showPopup(dictionaryPopupInfo, self, [self](WebCore::TextIndicator& textIndicator) {
-        [self _setTextIndicator:textIndicator withLifetime:WebCore::TextIndicatorWindowLifetime::Permanent];
+        [self _setTextIndicator:textIndicator withLifetime:WebCore::TextIndicatorLifetime::Permanent];
     }, [self](WebCore::FloatRect rectInRootViewCoordinates) {
         return [self _convertRectFromRootView:rectInRootViewCoordinates];
     }, [weakSelf = WeakObjCPtr<WebView>(self)]() {
-        [weakSelf.get() _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+        [weakSelf.get() _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
     });
 }
 
@@ -9179,7 +9179,7 @@
 #if !ENABLE(REVEAL)
 - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
 {
-    [self _clearTextIndicatorWithAnimation:WebCore::TextIndicatorWindowDismissalAnimation::FadeOut];
+    [self _clearTextIndicatorWithAnimation:WebCore::TextIndicatorDismissalAnimation::FadeOut];
 }
 #endif // ENABLE(REVEAL)
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h (277452 => 277453)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -319,8 +319,8 @@
 
 #if PLATFORM(MAC) && defined(__cplusplus)
 - (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator;
-- (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator withLifetime:(WebCore::TextIndicatorWindowLifetime)lifetime;
-- (void)_clearTextIndicatorWithAnimation:(WebCore::TextIndicatorWindowDismissalAnimation)animation;
+- (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator withLifetime:(WebCore::TextIndicatorLifetime)lifetime;
+- (void)_clearTextIndicatorWithAnimation:(WebCore::TextIndicatorDismissalAnimation)animation;
 - (void)_setTextIndicatorAnimationProgress:(float)progress;
 - (void)_showDictionaryLookupPopup:(const WebCore::DictionaryPopupInfo&)dictionaryPopupInfo;
 - (id)_animationControllerForDictionaryLookupPopupInfo:(const WebCore::DictionaryPopupInfo&)dictionaryPopupInfo;

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (277452 => 277453)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-05-13 21:57:45 UTC (rev 277453)
@@ -1,3 +1,12 @@
+2021-05-13  Megan Gardner  <megan_gard...@apple.com>
+
+        Add textIndicator bounce for AppHighlights on scroll.
+        https://bugs.webkit.org/show_bug.cgi?id=225727
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebChromeClient.h:
+
 2021-05-13  Chris Dumez  <cdu...@apple.com>
 
         Rename FileSystem::directoryName() to FileSystem::parentPath()

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h (277452 => 277453)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h	2021-05-13 21:53:00 UTC (rev 277452)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h	2021-05-13 21:57:45 UTC (rev 277453)
@@ -169,6 +169,8 @@
 
     void wheelEventHandlersChanged(bool) final { }
 
+    void setTextIndicator(const WebCore::TextIndicatorData&) const final { }
+
     WebView* webView() { return m_webView; }
 
     void AXStartFrameLoad() final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to