haikuwebkit/Source/WebCore/page/cocoa/WebTextIndicatorLayer.h

57 lines
2.2 KiB
C
Raw Permalink Normal View History

/*
* Copyright (C) 2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#import "TextIndicator.h"
#import <wtf/Noncopyable.h>
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
#import <wtf/RunLoop.h>
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: Canonical link: https://commits.webkit.org/237701@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-13 21:57:45 +00:00
WEBCORE_EXPORT @interface WebTextIndicatorLayer : CALayer {
RefPtr<WebCore::TextIndicator> _textIndicator;
RetainPtr<NSArray> _bounceLayers;
CGSize _margin;
bool _hasCompletedAnimation;
BOOL _fadingOut;
}
- (instancetype)initWithFrame:(CGRect)frame textIndicator:(WebCore::TextIndicator&)textIndicator margin:(CGSize)margin offset:(CGPoint)offset;
- (bool)indicatorWantsManualAnimation:(const WebCore::TextIndicator&)indicator;
- (bool)indicatorWantsBounce:(const WebCore::TextIndicator&)indicator;
- (void)present;
- (void)hideWithCompletionHandler:(void(^)(void))completionHandler;
- (void)setAnimationProgress:(float)progress;
- (BOOL)hasCompletedAnimation;
@property (nonatomic, getter=isFadingOut) BOOL fadingOut;
@end
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: Canonical link: https://commits.webkit.org/237701@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-13 21:57:45 +00:00