Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add WKHoverPlatter and some knobs to tweak its appearance
https://bugs.webkit.org/show_bug.cgi?id=227735 <rdar://problem/79198262> Reviewed by Sam Weinig. Source/WebCore/PAL: * pal/spi/cocoa/QuartzCoreSPI.h: Source/WebKit: * Configurations/WebKit.xcconfig: * Platform/spi/ios/PrototypeToolsSPI.h: Added. * SourcesCocoa.txt: * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView rootContentView]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): Install and uninstall the platter alongside the gestures that drive it. (-[WKContentView mouseGestureRecognizerChanged:]): (-[WKContentView hoverGestureRecognizerChanged:]): When the gesture recognizers fire, also update the hover point. (-[WKContentView positionInformationForHoverPlatter:withRequest:completionHandler:]): * UIProcess/ios/WKHoverPlatter.h: Added. * UIProcess/ios/WKHoverPlatter.mm: Added. (createBaseAnimation): (addAnimation): (setAdditionalPlatterLayerProperties): (addAdditionalIncomingAnimations): (addAdditionalDismissalAnimations): (-[WKHoverPlatter initWithView:delegate:]): (-[WKHoverPlatter invalidate]): (-[WKHoverPlatter hoverPoint]): (-[WKHoverPlatter setHoverPoint:]): (-[WKHoverPlatter requestPositionInformationForCurrentHoverPoint]): (-[WKHoverPlatter didReceivePositionInformation:]): (-[WKHoverPlatter dismissPlatterWithAnimation:]): (-[WKHoverPlatter didFinishAnimationForShadow:]): (-[WKHoverPlatter clearLayers]): Animate the platter in and out, and optionally between states, as the hover point moves. Use the TextIndicator's geometry information, but not its snapshot; we use a CAPortalLayer for the platter instead. A future patch will avoid taking the snapshot entirely, since we call setHoverPoint (and thus generate a TextIndicator) a *lot* when moving the mouse around, and all those snapshots add up. * UIProcess/ios/WKHoverPlatterParameters.h: Added. * UIProcess/ios/WKHoverPlatterParameters.mm: Added. (-[PTSliderRow integerMinValue:maxValue:]): (-[WKHoverPlatterParameters setDefaultValues]): (+[WKHoverPlatterParameters settingsControllerModule]): (+[WKHoverPlatterDomain rootSettings]): (+[WKHoverPlatterDomain domainGroupName]): (+[WKHoverPlatterDomain domainName]): (+[WKHoverPlatterDomain rootSettingsClass]): Add some knobs, with reasonable defaults, for experimentation. * WebKit.xcodeproj/project.pbxproj: WebKitLibraries: * WebKitPrivateFrameworkStubs/appletvos/14/PrototypeTools.framework/PrototypeTools.tbd: Added. * WebKitPrivateFrameworkStubs/appletvos/15/PrototypeTools.framework/PrototypeTools.tbd: Added. * WebKitPrivateFrameworkStubs/iOS/14/PrototypeTools.framework/PrototypeTools.tbd: Added. * WebKitPrivateFrameworkStubs/iOS/15/PrototypeTools.framework/PrototypeTools.tbd: Added. * WebKitPrivateFrameworkStubs/watchos/7/PrototypeTools.framework/PrototypeTools.tbd: Added. * WebKitPrivateFrameworkStubs/watchos/8/PrototypeTools.framework/PrototypeTools.tbd: Added. Canonical link: https://commits.webkit.org/239503@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279711 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
1b304f9
commit 5ce1ea4
Showing
22 changed files
with
881 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#if USE(APPLE_INTERNAL_SDK) | ||
|
||
#import <PrototypeTools/PrototypeTools.h> | ||
|
||
#else | ||
|
||
@interface PTSettings : NSObject <NSCopying> | ||
- (void)setDefaultValues; | ||
@end | ||
|
||
@interface PTDomain : NSObject | ||
+ (__kindof PTSettings *)rootSettings; | ||
@end | ||
|
||
@interface PTSection : NSObject | ||
@end | ||
|
||
@interface PTModule : NSObject | ||
+ (instancetype)moduleWithTitle:(NSString *)title contents:(NSArray *)contents; | ||
+ (PTSection *)sectionWithRows:(NSArray *)rows title:(NSString *)title; | ||
+ (PTSection *)sectionWithRows:(NSArray *)rows; | ||
@end | ||
|
||
@interface PTRow : NSObject <NSCopying, NSSecureCoding> | ||
+ (instancetype)rowWithTitle:(NSString *)staticTitle valueKeyPath:(NSString *)keyPath; | ||
- (id)valueValidator:(id(^)(id proposedValue, id settings))validator; | ||
- (id)condition:(NSPredicate *)condition; | ||
@end | ||
|
||
@interface PTSRow : PTRow | ||
@end | ||
|
||
@interface PTSwitchRow : PTSRow | ||
@end | ||
|
||
@interface PTSliderRow : PTSRow | ||
- (id)minValue:(CGFloat)minValue maxValue:(CGFloat)maxValue; | ||
@end | ||
|
||
@interface PTEditFloatRow : PTSRow | ||
@end | ||
|
||
@interface PTRowAction : NSObject | ||
@end | ||
|
||
@interface PTRestoreDefaultSettingsRowAction : PTRowAction | ||
+ (instancetype)action; | ||
@end | ||
|
||
@interface PTButtonRow : PTSRow | ||
+ (instancetype)rowWithTitle:(NSString *)staticTitle action:(PTRowAction *)action; | ||
@end | ||
|
||
#endif |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) || ENABLE(HOVER_GESTURE_RECOGNIZER) | ||
|
||
@class WKHoverPlatter; | ||
|
||
@protocol WKHoverPlatterDelegate | ||
|
||
@required | ||
- (void)positionInformationForHoverPlatter:(WKHoverPlatter *)hoverPlatter withRequest:(WebKit::InteractionInformationRequest&)request completionHandler:(void (^)(WebKit::InteractionInformationAtPosition))completionHandler; | ||
|
||
@end | ||
|
||
@interface WKHoverPlatter : NSObject | ||
|
||
- (instancetype)initWithView:(UIView *)view delegate:(id <WKHoverPlatterDelegate>)delegate; | ||
|
||
- (void)dismissPlatterWithAnimation:(BOOL)withAnimation; | ||
|
||
- (void)invalidate; | ||
|
||
@property (nonatomic, assign) WebCore::FloatPoint hoverPoint; | ||
|
||
@end | ||
|
||
#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT) || ENABLE(HOVER_GESTURE_RECOGNIZER) |
Oops, something went wrong.