Diff
Modified: branches/safari-611.1.4-branch/Source/WTF/ChangeLog (269195 => 269196)
--- branches/safari-611.1.4-branch/Source/WTF/ChangeLog 2020-10-30 17:42:31 UTC (rev 269195)
+++ branches/safari-611.1.4-branch/Source/WTF/ChangeLog 2020-10-30 17:42:34 UTC (rev 269196)
@@ -1,3 +1,48 @@
+2020-10-29 Alan Coon <[email protected]>
+
+ Cherry-pick r269082. rdar://problem/70831193
+
+ Adopt the UIPointerInteraction API
+ https://bugs.webkit.org/show_bug.cgi?id=218266
+ <rdar://problem/70732850>
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebKit:
+
+ No new tests, just moving from deprecated SPI to API.
+
+ * Platform/spi/ios/UIKitSPI.h:
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView setUpInteraction]):
+ (-[WKContentView cleanUpInteraction]):
+ (-[WKContentView setUpPointerInteraction]):
+ (-[WKContentView _pointerInteraction:regionForRequest:defaultRegion:completion:]):
+ (-[WKContentView pointerRegionForPositionInformation:point:]):
+ (-[WKContentView pointerInteraction:styleForRegion:]):
+ (-[WKContentView setUpCursorInteraction]): Deleted.
+ (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]): Deleted.
+ (-[WKContentView cursorRegionForPositionInformation:point:]): Deleted.
+ (-[WKContentView cursorInteraction:styleForRegion:modifiers:]): Deleted.
+
+ Source/WTF:
+
+ * wtf/PlatformHave.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-27 Tim Horton <[email protected]>
+
+ Adopt the UIPointerInteraction API
+ https://bugs.webkit.org/show_bug.cgi?id=218266
+ <rdar://problem/70732850>
+
+ Reviewed by Wenson Hsieh.
+
+ * wtf/PlatformHave.h:
+
2020-10-22 Alan Coon <[email protected]>
Revert r268616. rdar://problem/70578639
Modified: branches/safari-611.1.4-branch/Source/WTF/wtf/PlatformHave.h (269195 => 269196)
--- branches/safari-611.1.4-branch/Source/WTF/wtf/PlatformHave.h 2020-10-30 17:42:31 UTC (rev 269195)
+++ branches/safari-611.1.4-branch/Source/WTF/wtf/PlatformHave.h 2020-10-30 17:42:34 UTC (rev 269196)
@@ -441,7 +441,7 @@
#endif
#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130400)
-#define HAVE_UI_CURSOR_INTERACTION 1
+#define HAVE_UI_POINTER_INTERACTION 1
#endif
#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130400) || PLATFORM(WATCHOS) || PLATFORM(APPLETV)
Modified: branches/safari-611.1.4-branch/Source/WebKit/ChangeLog (269195 => 269196)
--- branches/safari-611.1.4-branch/Source/WebKit/ChangeLog 2020-10-30 17:42:31 UTC (rev 269195)
+++ branches/safari-611.1.4-branch/Source/WebKit/ChangeLog 2020-10-30 17:42:34 UTC (rev 269196)
@@ -1,5 +1,64 @@
2020-10-29 Alan Coon <[email protected]>
+ Cherry-pick r269082. rdar://problem/70831193
+
+ Adopt the UIPointerInteraction API
+ https://bugs.webkit.org/show_bug.cgi?id=218266
+ <rdar://problem/70732850>
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebKit:
+
+ No new tests, just moving from deprecated SPI to API.
+
+ * Platform/spi/ios/UIKitSPI.h:
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView setUpInteraction]):
+ (-[WKContentView cleanUpInteraction]):
+ (-[WKContentView setUpPointerInteraction]):
+ (-[WKContentView _pointerInteraction:regionForRequest:defaultRegion:completion:]):
+ (-[WKContentView pointerRegionForPositionInformation:point:]):
+ (-[WKContentView pointerInteraction:styleForRegion:]):
+ (-[WKContentView setUpCursorInteraction]): Deleted.
+ (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]): Deleted.
+ (-[WKContentView cursorRegionForPositionInformation:point:]): Deleted.
+ (-[WKContentView cursorInteraction:styleForRegion:modifiers:]): Deleted.
+
+ Source/WTF:
+
+ * wtf/PlatformHave.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-27 Tim Horton <[email protected]>
+
+ Adopt the UIPointerInteraction API
+ https://bugs.webkit.org/show_bug.cgi?id=218266
+ <rdar://problem/70732850>
+
+ Reviewed by Wenson Hsieh.
+
+ No new tests, just moving from deprecated SPI to API.
+
+ * Platform/spi/ios/UIKitSPI.h:
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView setUpInteraction]):
+ (-[WKContentView cleanUpInteraction]):
+ (-[WKContentView setUpPointerInteraction]):
+ (-[WKContentView _pointerInteraction:regionForRequest:defaultRegion:completion:]):
+ (-[WKContentView pointerRegionForPositionInformation:point:]):
+ (-[WKContentView pointerInteraction:styleForRegion:]):
+ (-[WKContentView setUpCursorInteraction]): Deleted.
+ (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]): Deleted.
+ (-[WKContentView cursorRegionForPositionInformation:point:]): Deleted.
+ (-[WKContentView cursorInteraction:styleForRegion:modifiers:]): Deleted.
+
+2020-10-29 Alan Coon <[email protected]>
+
Cherry-pick r268878. rdar://problem/70831133
UIClient isn't notified when page muted state changes
Modified: branches/safari-611.1.4-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h (269195 => 269196)
--- branches/safari-611.1.4-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2020-10-30 17:42:31 UTC (rev 269195)
+++ branches/safari-611.1.4-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2020-10-30 17:42:34 UTC (rev 269196)
@@ -126,11 +126,9 @@
#import <UIKit/UITargetedPreview_Private.h>
#endif
-#if HAVE(UI_CURSOR_INTERACTION)
-#import <UIKit/_UICursorInteraction.h>
-#import <UIKit/_UICursorInteraction_ForWebKitOnly.h>
-#import <UIKit/_UICursorStyle.h>
-#import <UIKit/_UICursorStyle_Private.h>
+#if HAVE(UI_POINTER_INTERACTION)
+#import <UIKit/UIPointerInteraction_ForWebKitOnly.h>
+#import <UIKit/UIPointerStyle_Private.h>
#endif
#else // USE(APPLE_INTERNAL_SDK)
@@ -1204,29 +1202,19 @@
@property (readonly) BOOL isLowConfidence;
@end
-@protocol _UICursorInteractionDelegate
+@interface UIPointerStyle ()
++ (instancetype)_systemPointerStyle;
@end
-@interface _UICursorInteraction : NSObject <UIInteraction>
-- (instancetype)initWithDelegate:(id <_UICursorInteractionDelegate>)delegate;
-- (void)invalidate;
-@property (nonatomic, assign, getter=_pausesCursorUpdatesWhilePanning, setter=_setPausesCursorUpdatesWhilePanning:) BOOL pausesCursorUpdatesWhilePanning;
+@interface UIPointerInteraction ()
+@property (nonatomic, assign, getter=_pausesPointerUpdatesWhilePanning, setter=_setPausesPointerUpdatesWhilePanning:) BOOL pausesPointerUpdatesWhilePanning;
@end
-@interface _UICursorRegion : NSObject <NSCopying>
-+ (instancetype)regionWithIdentifier:(id <NSObject>)identifier rect:(CGRect)rect;
-- (id <NSObject>)identifier;
+@protocol UIPointerInteractionDelegate_ForWebKitOnly <UIPointerInteractionDelegate>
+@optional
+- (void)_pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion completion:(void(^)(UIPointerRegion *region))completion;
@end
-@interface _UICursor : NSObject
-+ (instancetype)beamWithPreferredLength:(CGFloat)length axis:(UIAxis)axis;
-+ (instancetype)linkCursor;
-@end
-
-@interface _UICursorStyle : NSObject
-+ (instancetype)styleWithCursor:(_UICursor *)cursor constrainedAxes:(UIAxis)axes;
-@end
-
#if PLATFORM(WATCHOS)
@interface UIStatusBar : UIView
@end
Modified: branches/safari-611.1.4-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (269195 => 269196)
--- branches/safari-611.1.4-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-10-30 17:42:31 UTC (rev 269195)
+++ branches/safari-611.1.4-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-10-30 17:42:34 UTC (rev 269196)
@@ -110,8 +110,8 @@
@class WKTextRange;
@class _WKTextInputContext;
+@class UIPointerInteraction;
@class UITargetedPreview;
-@class _UICursorInteraction;
@class _UILookupGestureRecognizer;
@class _UIHighlightView;
@@ -248,10 +248,10 @@
RetainPtr<UIIndirectScribbleInteraction> _scribbleInteraction;
#endif
-#if HAVE(UI_CURSOR_INTERACTION)
- RetainPtr<_UICursorInteraction> _cursorInteraction;
- BOOL _hasOutstandingCursorInteractionRequest;
- Optional<std::pair<WebKit::InteractionInformationRequest, BlockPtr<void(_UICursorRegion *)>>> _deferredCursorInteractionRequest;
+#if HAVE(UI_POINTER_INTERACTION)
+ RetainPtr<UIPointerInteraction> _pointerInteraction;
+ BOOL _hasOutstandingPointerInteractionRequest;
+ Optional<std::pair<WebKit::InteractionInformationRequest, BlockPtr<void(UIPointerRegion *)>>> _deferredPointerInteractionRequest;
#endif
RetainPtr<UIWKTextInteractionAssistant> _textInteractionAssistant;
Modified: branches/safari-611.1.4-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (269195 => 269196)
--- branches/safari-611.1.4-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-10-30 17:42:31 UTC (rev 269195)
+++ branches/safari-611.1.4-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-10-30 17:42:34 UTC (rev 269196)
@@ -167,11 +167,11 @@
static NSString * const webkitShowLinkPreviewsPreferenceKey = @"WebKitShowLinkPreviews";
#endif
-#if HAVE(UI_CURSOR_INTERACTION)
-static NSString * const cursorRegionIdentifier = @"WKCursorRegion";
-static NSString * const editableCursorRegionIdentifier = @"WKEditableCursorRegion";
+#if HAVE(UI_POINTER_INTERACTION)
+static NSString * const pointerRegionIdentifier = @"WKPointerRegion";
+static NSString * const editablePointerRegionIdentifier = @"WKEditablePointerRegion";
-@interface WKContentView (WKUICursorInteractionDelegate) <_UICursorInteractionDelegate>
+@interface WKContentView (WKUIPointerInteractionDelegate) <UIPointerInteractionDelegate_ForWebKitOnly>
@end
#endif
@@ -827,8 +827,8 @@
[self setUpDragAndDropInteractions];
#endif
-#if HAVE(UI_CURSOR_INTERACTION)
- [self setUpCursorInteraction];
+#if HAVE(UI_POINTER_INTERACTION)
+ [self setUpPointerInteraction];
#endif
#if HAVE(PENCILKIT_TEXT_INPUT)
@@ -994,9 +994,9 @@
[self teardownDragAndDropInteractions];
#endif
-#if HAVE(UI_CURSOR_INTERACTION)
- [self removeInteraction:_cursorInteraction.get()];
- _cursorInteraction = nil;
+#if HAVE(UI_POINTER_INTERACTION)
+ [self removeInteraction:_pointerInteraction.get()];
+ _pointerInteraction = nil;
#endif
#if HAVE(PENCILKIT_TEXT_INPUT)
@@ -8657,20 +8657,20 @@
#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT)
-#if HAVE(UI_CURSOR_INTERACTION)
+#if HAVE(UI_POINTER_INTERACTION)
-- (void)setUpCursorInteraction
+- (void)setUpPointerInteraction
{
- _cursorInteraction = adoptNS([[_UICursorInteraction alloc] initWithDelegate:self]);
- [_cursorInteraction _setPausesCursorUpdatesWhilePanning:NO];
+ _pointerInteraction = adoptNS([[UIPointerInteraction alloc] initWithDelegate:self]);
+ [_pointerInteraction _setPausesPointerUpdatesWhilePanning:NO];
- [self addInteraction:_cursorInteraction.get()];
+ [self addInteraction:_pointerInteraction.get()];
}
-- (void)_cursorInteraction:(_UICursorInteraction *)interaction regionForLocation:(CGPoint)location defaultRegion:(_UICursorRegion *)defaultRegion completion:(void(^)(_UICursorRegion *region))completion
+- (void)_pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion completion:(void(^)(UIPointerRegion *region))completion
{
WebKit::InteractionInformationRequest interactionInformationRequest;
- interactionInformationRequest.point = WebCore::roundedIntPoint(location);
+ interactionInformationRequest.point = WebCore::roundedIntPoint(request.location);
interactionInformationRequest.includeCaretContext = true;
interactionInformationRequest.includeHasDoubleClickHandler = false;
@@ -8677,22 +8677,22 @@
BOOL didSynchronouslyReplyWithApproximation = false;
if (![self _currentPositionInformationIsValidForRequest:interactionInformationRequest] && self.webView._editable && !_positionInformation.shouldNotUseIBeamInEditableContent) {
didSynchronouslyReplyWithApproximation = true;
- completion([_UICursorRegion regionWithIdentifier:editableCursorRegionIdentifier rect:self.bounds]);
+ completion([UIPointerRegion regionWithRect:self.bounds identifier:editablePointerRegionIdentifier]);
}
// If we already have an outstanding interaction information request, defer this one until
// we hear back, so that requests don't pile up if the Web Content process is slow.
- if (_hasOutstandingCursorInteractionRequest) {
- _deferredCursorInteractionRequest = std::make_pair(interactionInformationRequest, makeBlockPtr(completion));
+ if (_hasOutstandingPointerInteractionRequest) {
+ _deferredPointerInteractionRequest = std::make_pair(interactionInformationRequest, makeBlockPtr(completion));
return;
}
- _hasOutstandingCursorInteractionRequest = YES;
+ _hasOutstandingPointerInteractionRequest = YES;
- __block BlockPtr<void(WebKit::InteractionInformationAtPosition, void(^)(_UICursorRegion *))> replyHandler;
- replyHandler = ^(WebKit::InteractionInformationAtPosition interactionInformation, void(^completion)(_UICursorRegion *region)) {
- if (!_deferredCursorInteractionRequest)
- _hasOutstandingCursorInteractionRequest = NO;
+ __block BlockPtr<void(WebKit::InteractionInformationAtPosition, void(^)(UIPointerRegion *))> replyHandler;
+ replyHandler = ^(WebKit::InteractionInformationAtPosition interactionInformation, void(^completion)(UIPointerRegion *region)) {
+ if (!_deferredPointerInteractionRequest)
+ _hasOutstandingPointerInteractionRequest = NO;
if (didSynchronouslyReplyWithApproximation) {
[interaction invalidate];
@@ -8699,10 +8699,10 @@
return;
}
- completion([self cursorRegionForPositionInformation:interactionInformation point:location]);
+ completion([self pointerRegionForPositionInformation:interactionInformation point:request.location]);
- if (_deferredCursorInteractionRequest) {
- auto deferredRequest = std::exchange(_deferredCursorInteractionRequest, WTF::nullopt);
+ if (_deferredPointerInteractionRequest) {
+ auto deferredRequest = std::exchange(_deferredPointerInteractionRequest, WTF::nullopt);
[self doAfterPositionInformationUpdate:^(WebKit::InteractionInformationAtPosition interactionInformation) {
replyHandler(interactionInformation, deferredRequest->second.get());
} forRequest:deferredRequest->first];
@@ -8715,7 +8715,7 @@
} forRequest:interactionInformationRequest];
}
-- (_UICursorRegion *)cursorRegionForPositionInformation:(WebKit::InteractionInformationAtPosition&)interactionInformation point:(CGPoint)location
+- (UIPointerRegion *)pointerRegionForPositionInformation:(WebKit::InteractionInformationAtPosition&)interactionInformation point:(CGPoint)location
{
WebCore::FloatRect expandedLineRect = enclosingIntRect(interactionInformation.lineCaretExtent);
@@ -8726,26 +8726,26 @@
if (interactionInformation.cursor) {
WebCore::Cursor::Type cursorType = interactionInformation.cursor->type();
if (cursorType == WebCore::Cursor::Hand)
- return [_UICursorRegion regionWithIdentifier:cursorRegionIdentifier rect:interactionInformation.bounds];
+ return [UIPointerRegion regionWithRect:interactionInformation.bounds identifier:pointerRegionIdentifier];
if (cursorType == WebCore::Cursor::IBeam && expandedLineRect.contains(location))
- return [_UICursorRegion regionWithIdentifier:cursorRegionIdentifier rect:expandedLineRect];
+ return [UIPointerRegion regionWithRect:expandedLineRect identifier:pointerRegionIdentifier];
}
if (self.webView._editable) {
if (expandedLineRect.contains(location))
- return [_UICursorRegion regionWithIdentifier:cursorRegionIdentifier rect:expandedLineRect];
- return [_UICursorRegion regionWithIdentifier:editableCursorRegionIdentifier rect:self.bounds];
+ return [UIPointerRegion regionWithRect:expandedLineRect identifier:pointerRegionIdentifier];
+ return [UIPointerRegion regionWithRect:self.bounds identifier:editablePointerRegionIdentifier];
}
return nil;
}
-- (_UICursorStyle *)cursorInteraction:(_UICursorInteraction *)interaction styleForRegion:(_UICursorRegion *)region modifiers:(UIKeyModifierFlags)modifiers
+- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region
{
double scaleFactor = self._contentZoomScale;
- _UICursorStyle *(^iBeamCursor)(void) = ^{
+ UIPointerStyle *(^iBeamCursor)(void) = ^{
float beamLength = _positionInformation.caretHeight * scaleFactor;
UIAxis iBeamConstraintAxes = UIAxisVertical;
@@ -8754,10 +8754,10 @@
iBeamConstraintAxes = UIAxisNeither;
// If the region is the size of the view, we should not apply any magnetism.
- if ([region.identifier isEqual:editableCursorRegionIdentifier])
+ if ([region.identifier isEqual:editablePointerRegionIdentifier])
iBeamConstraintAxes = UIAxisNeither;
- return [_UICursorStyle styleWithCursor:[_UICursor beamWithPreferredLength:beamLength axis:UIAxisVertical] constrainedAxes:iBeamConstraintAxes];
+ return [UIPointerStyle styleWithShape:[UIPointerShape beamWithPreferredLength:beamLength axis:UIAxisVertical] constrainedAxes:iBeamConstraintAxes];
};
if (self.webView._editable) {
@@ -8766,11 +8766,11 @@
return iBeamCursor();
}
- if (_positionInformation.cursor && [region.identifier isEqual:cursorRegionIdentifier]) {
+ if (_positionInformation.cursor && [region.identifier isEqual:pointerRegionIdentifier]) {
WebCore::Cursor::Type cursorType = _positionInformation.cursor->type();
if (cursorType == WebCore::Cursor::Hand)
- return [_UICursorStyle styleWithCursor:[_UICursor linkCursor] constrainedAxes:UIAxisNeither];
+ return [UIPointerStyle _systemPointerStyle];
if (cursorType == WebCore::Cursor::IBeam && _positionInformation.lineCaretExtent.contains(_positionInformation.request.point))
return iBeamCursor();
@@ -8780,7 +8780,7 @@
return nil;
}
-#endif // HAVE(UI_CURSOR_INTERACTION)
+#endif // HAVE(UI_POINTER_INTERACTION)
#if HAVE(PENCILKIT_TEXT_INPUT)