Diff
Modified: trunk/Source/WebCore/PAL/ChangeLog (279401 => 279402)
--- trunk/Source/WebCore/PAL/ChangeLog 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebCore/PAL/ChangeLog 2021-06-30 07:30:04 UTC (rev 279402)
@@ -1,3 +1,15 @@
+2021-06-28 Antoine Quint <[email protected]>
+
+ [Model] [iOS] Add support for manipulating <model> inline
+ https://bugs.webkit.org/show_bug.cgi?id=227448
+ <rdar://problem/79863579>
+
+ Reviewed by Tim Horton.
+
+ Declare additional ASVInlinePreview methods.
+
+ * pal/spi/ios/SystemPreviewSPI.h:
+
2021-06-29 Antoine Quint <[email protected]>
WebKit_iosmac build failure: SystemPreviewSPI.h:29:9: fatal error: 'AssetViewer/ARQuickLookWebKitItem.h' file not found
Modified: trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h (279401 => 279402)
--- trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h 2021-06-30 07:30:04 UTC (rev 279402)
@@ -83,6 +83,10 @@
- (void)setupRemoteConnectionWithCompletionHandler:(void (^)(NSError * _Nullable error))handler;
- (void)preparePreviewOfFileAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable error))handler;
- (void)updateFrame:(CGRect)newFrame completionHandler:(void (^)(CAFenceHandle * _Nullable fenceHandle, NSError * _Nullable error))handler;
+- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
+- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
+- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
+- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
@end
Modified: trunk/Source/WebKit/ChangeLog (279401 => 279402)
--- trunk/Source/WebKit/ChangeLog 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebKit/ChangeLog 2021-06-30 07:30:04 UTC (rev 279402)
@@ -1,3 +1,35 @@
+2021-06-28 Antoine Quint <[email protected]>
+
+ [Model] [iOS] Add support for manipulating <model> inline
+ https://bugs.webkit.org/show_bug.cgi?id=227448
+ <rdar://problem/79863579>
+
+ Reviewed by Tim Horton.
+
+ ASVInlinePreview instances allow for UITouch and UIEvent objects to be forwarded in order to manipulate
+ the object inline. We create a UIGestureRecognizer subclass that is attached to WKModelView and forwards
+ touchesBegan: and similar UIResponder messages over to the ASVInlinePreview managed by the WKModelView.
+ This allows multiple <model> elements to be manipulated at once.
+
+ We will add support for disallowing such interaction with an attribute and/or a call to preventDefault()
+ at a later time.
+
+ * SourcesCocoa.txt:
+ * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
+ * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
+ (WebKit::collectDescendantViewsAtPoint):
+ (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
+ * UIProcess/ios/WKModelInteractionGestureRecognizer.h: Added.
+ * UIProcess/ios/WKModelInteractionGestureRecognizer.mm: Added.
+ (-[WKModelInteractionGestureRecognizer touchesBegan:withEvent:]):
+ (-[WKModelInteractionGestureRecognizer touchesMoved:withEvent:]):
+ (-[WKModelInteractionGestureRecognizer touchesEnded:withEvent:]):
+ (-[WKModelInteractionGestureRecognizer touchesCancelled:withEvent:]):
+ * UIProcess/ios/WKModelView.h:
+ * UIProcess/ios/WKModelView.mm:
+ (-[WKModelView initWithModel:]):
+ * WebKit.xcodeproj/project.pbxproj:
+
2021-06-29 Cameron McCormack <[email protected]>
Don't null check destination in the RemoteRenderingBackend::nextDestinationImageBufferAfterApply main loop
Modified: trunk/Source/WebKit/SourcesCocoa.txt (279401 => 279402)
--- trunk/Source/WebKit/SourcesCocoa.txt 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2021-06-30 07:30:04 UTC (rev 279402)
@@ -489,6 +489,7 @@
UIProcess/ios/WKHighlightLongPressGestureRecognizer.mm
UIProcess/ios/WKImageAnalysisGestureRecognizer.mm
UIProcess/ios/WKKeyboardScrollingAnimator.mm
+UIProcess/ios/WKModelInteractionGestureRecognizer.mm
UIProcess/ios/WKModelView.mm
UIProcess/ios/WKMouseDeviceObserver.mm
UIProcess/ios/WKMouseGestureRecognizer.mm
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm (279401 => 279402)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm 2021-06-30 07:30:04 UTC (rev 279402)
@@ -69,6 +69,9 @@
if (![view pointInside:subviewPoint withEvent:event])
return false;
+ if ([view conformsToProtocol:@protocol(WKNativelyInteractible)])
+ return true;
+
if (![view isKindOfClass:[WKCompositingView class]])
return true;
auto* node = RemoteLayerTreeNode::forCALayer(view.layer);
Added: trunk/Source/WebKit/UIProcess/ios/WKModelInteractionGestureRecognizer.h (0 => 279402)
--- trunk/Source/WebKit/UIProcess/ios/WKModelInteractionGestureRecognizer.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/WKModelInteractionGestureRecognizer.h 2021-06-30 07:30:04 UTC (rev 279402)
@@ -0,0 +1,33 @@
+/*
+ * 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(ARKIT_INLINE_PREVIEW_IOS)
+
+#import "UIKitSPI.h"
+
+@interface WKModelInteractionGestureRecognizer : UIGestureRecognizer
+@end
+
+#endif
Added: trunk/Source/WebKit/UIProcess/ios/WKModelInteractionGestureRecognizer.mm (0 => 279402)
--- trunk/Source/WebKit/UIProcess/ios/WKModelInteractionGestureRecognizer.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/WKModelInteractionGestureRecognizer.mm 2021-06-30 07:30:04 UTC (rev 279402)
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+#import "WKModelInteractionGestureRecognizer.h"
+
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
+
+#import "RemoteLayerTreeViews.h"
+#import "WKModelView.h"
+#import <UIKit/UIGestureRecognizerSubclass.h>
+#import <pal/spi/ios/SystemPreviewSPI.h>
+
+@implementation WKModelInteractionGestureRecognizer
+
+- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
+{
+ ASSERT([event touchesForGestureRecognizer:self].count);
+
+ if (![self.view isKindOfClass:[WKModelView class]]) {
+ [self setState:UIGestureRecognizerStateFailed];
+ return;
+ }
+
+ [((WKModelView *)self.view).preview touchesBegan:touches withEvent:event];
+}
+
+- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
+{
+ [self setState:UIGestureRecognizerStateChanged];
+
+ [((WKModelView *)self.view).preview touchesMoved:touches withEvent:event];
+}
+
+- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
+{
+ auto finalTouchesEnded = [touches isEqualToSet:[event touchesForGestureRecognizer:self]];
+ [self setState:finalTouchesEnded ? UIGestureRecognizerStateEnded : UIGestureRecognizerStateChanged];
+
+ [((WKModelView *)self.view).preview touchesEnded:touches withEvent:event];
+}
+
+- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
+{
+ auto finalTouchesCancelled = [touches isEqualToSet:[event touchesForGestureRecognizer:self]];
+ [self setState:finalTouchesCancelled ? UIGestureRecognizerStateCancelled : UIGestureRecognizerStateChanged];
+
+ [((WKModelView *)self.view).preview touchesCancelled:touches withEvent:event];
+}
+
+@end
+
+#endif
Modified: trunk/Source/WebKit/UIProcess/ios/WKModelView.h (279401 => 279402)
--- trunk/Source/WebKit/UIProcess/ios/WKModelView.h 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebKit/UIProcess/ios/WKModelView.h 2021-06-30 07:30:04 UTC (rev 279402)
@@ -33,7 +33,7 @@
OBJC_CLASS ASVInlinePreview;
-@interface WKModelView : WKCompositingView
+@interface WKModelView : WKCompositingView <WKNativelyInteractible>
- (instancetype)initWithModel:(WebCore::Model&)model NS_DESIGNATED_INITIALIZER;
Modified: trunk/Source/WebKit/UIProcess/ios/WKModelView.mm (279401 => 279402)
--- trunk/Source/WebKit/UIProcess/ios/WKModelView.mm 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebKit/UIProcess/ios/WKModelView.mm 2021-06-30 07:30:04 UTC (rev 279402)
@@ -30,6 +30,7 @@
#import "Logging.h"
#import "RemoteLayerTreeViews.h"
+#import "WKModelInteractionGestureRecognizer.h"
#import "WebsiteDataStore.h"
#import <WebCore/Model.h>
#import <pal/spi/cocoa/QuartzCoreSPI.h>
@@ -45,6 +46,7 @@
@implementation WKModelView {
RetainPtr<ASVInlinePreview> _preview;
+ RetainPtr<WKModelInteractionGestureRecognizer> _modelInteractionGestureRecognizer;
String _filePath;
CGRect _lastBounds;
}
@@ -95,6 +97,9 @@
}];
}];
+ _modelInteractionGestureRecognizer = adoptNS([[WKModelInteractionGestureRecognizer alloc] init]);
+ [self addGestureRecognizer:_modelInteractionGestureRecognizer.get()];
+
return self;
}
@@ -156,6 +161,14 @@
}];
}
+- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
+{
+ // The layer of this view is empty and the sublayer is rendered remotely, so the basic implementation
+ // of hitTest:withEvent: will return nil due to ignoring empty subviews. So we can simply check whether
+ // the hit-testing point is within bounds.
+ return [self pointInside:point withEvent:event] ? self : nil;
+}
+
@end
#endif
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (279401 => 279402)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-06-30 05:37:56 UTC (rev 279401)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-06-30 07:30:04 UTC (rev 279402)
@@ -1321,6 +1321,7 @@
6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h */; };
6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
711725A9228D564300018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 711725A8228D563A00018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h */; };
+ 7134A3DA2603B92500624BD3 /* WKModelInteractionGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7134A3D92603B80E00624BD3 /* WKModelInteractionGestureRecognizer.h */; };
71A676A622C62325007D6295 /* WKTouchActionGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */; };
71BAA73325FFD09800D7CD5D /* WKModelView.h in Headers */ = {isa = PBXBuildFile; fileRef = 71BAA73125FFCCBA00D7CD5D /* WKModelView.h */; };
71FB810B2260627E00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */; };
@@ -4570,6 +4571,8 @@
6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb.in; path = WebProcess/com.apple.WebProcess.sb.in; sourceTree = "<group>"; };
6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; };
711725A8228D563A00018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteLegacyOverflowScrollingTouchPolicy.h; sourceTree = "<group>"; };
+ 7134A3D82603B80E00624BD3 /* WKModelInteractionGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKModelInteractionGestureRecognizer.mm; path = ios/WKModelInteractionGestureRecognizer.mm; sourceTree = "<group>"; };
+ 7134A3D92603B80E00624BD3 /* WKModelInteractionGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKModelInteractionGestureRecognizer.h; path = ios/WKModelInteractionGestureRecognizer.h; sourceTree = "<group>"; };
71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTouchActionGestureRecognizer.h; path = ios/WKTouchActionGestureRecognizer.h; sourceTree = "<group>"; };
71A676A522C62318007D6295 /* WKTouchActionGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTouchActionGestureRecognizer.mm; path = ios/WKTouchActionGestureRecognizer.mm; sourceTree = "<group>"; };
71BAA73125FFCCBA00D7CD5D /* WKModelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKModelView.h; path = ios/WKModelView.h; sourceTree = "<group>"; };
@@ -7786,6 +7789,8 @@
933DF82F1B3BC0B400AEA9E3 /* WKImagePreviewViewController.mm */,
2DD5E127210ADC7A00DB6012 /* WKKeyboardScrollingAnimator.h */,
2DD5E126210ADC7A00DB6012 /* WKKeyboardScrollingAnimator.mm */,
+ 7134A3D92603B80E00624BD3 /* WKModelInteractionGestureRecognizer.h */,
+ 7134A3D82603B80E00624BD3 /* WKModelInteractionGestureRecognizer.mm */,
71BAA73125FFCCBA00D7CD5D /* WKModelView.h */,
71BAA73225FFCCBA00D7CD5D /* WKModelView.mm */,
950F287E252414E900B74F1C /* WKMouseDeviceObserver.h */,
@@ -12832,6 +12837,7 @@
5CABDC8622C40FDE001EDE8E /* WKMessageListener.h in Headers */,
C11E1694212B87C500985FF6 /* WKMockDisplay.h in Headers */,
411A8DDB20DDD1AC0060D34F /* WKMockMediaDevice.h in Headers */,
+ 7134A3DA2603B92500624BD3 /* WKModelInteractionGestureRecognizer.h in Headers */,
71BAA73325FFD09800D7CD5D /* WKModelView.h in Headers */,
950F2880252414EA00B74F1C /* WKMouseDeviceObserver.h in Headers */,
2DB94299234E7A7F00E776AD /* WKMouseGestureRecognizer.h in Headers */,