⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 279312 in webkit


Ignore:
Timestamp:
Jun 27, 2021, 1:55:52 AM (5 years ago)
Author:
graouts@webkit.org
Message:

[Model] [iOS] Add support for rendering model resources
​https://bugs.webkit.org/show_bug.cgi?id=227392
<rdar://problem/79770136>

Reviewed by Tim Horton.

Source/WebCore:

Ensure the anchor point is set correctly for model content layers, otherwise the preview layer shows
its center at the corner of the parent layer's origin.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::setContentsToModel):

Source/WebCore/PAL:

Declare the ASVInlinePreview class.

  • pal/spi/ios/SystemPreviewSPI.h:

Source/WebKit:

Add a new WKModelView class which manages an ASVInlinePreview and displays its layer.
The current incarnation of the ASVInlinePreview SPI requires a URL to a file to specify
the resource, so we write a file to the temporary directory added in 279267 with the data
wrapped in the Model object passed through the remote layer tree. Ultimately we will be
able to use an SPI that does not require a file and instead will allow data to be passed
directly, this is purely for a temporary experimentation.

  • Platform/Logging.h:
  • SourcesCocoa.txt:
  • UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:

(WebKit::RemoteLayerTreeHost::makeNode):

  • UIProcess/ios/WKModelView.h: Added.
  • UIProcess/ios/WKModelView.mm: Added.

(-[WKModelView preview]):
(-[WKModelView initWithFrame:]):
(-[WKModelView initWithCoder:]):
(-[WKModelView initWithModel:]):
(-[WKModelView createFileForModel:]):
(-[WKModelView layoutSubviews]):
(-[WKModelView updateBounds]):

  • WebKit.xcodeproj/project.pbxproj:

Source/WTF:

Add a new compile-time flag indicating the availability of the ASVInlinePreview SPI on iOS.
We only define it when the header itself is present for now to avoid issues with older iOS
15 SDKs, but ultimately we will only use the iOS version check.

  • wtf/PlatformHave.h:
Location:
trunk/Source
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r279297 r279312  
     12021-06-27  Antoine Quint  <graouts@webkit.org>
     2
     3        [Model] [iOS] Add support for rendering model resources
     4        https://bugs.webkit.org/show_bug.cgi?id=227392
     5        <rdar://problem/79770136>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add a new compile-time flag indicating the availability of the ASVInlinePreview SPI on iOS.
     10        We only define it when the header itself is present for now to avoid issues with older iOS
     11        15 SDKs, but ultimately we will only use the iOS version check.
     12
     13        * wtf/PlatformHave.h:
     14
    1152021-06-25  Kenneth Russell  <kbr@chromium.org>
    216
  • trunk/Source/WTF/wtf/PlatformHave.h

    r279184 r279312  
    10111011#endif
    10121012
     1013#if defined __has_include && __has_include(<AssetViewer/ASVInlinePreview.h>)
     1014#if (PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000
     1015#define HAVE_ARKIT_INLINE_PREVIEW_IOS 1
     1016#endif
     1017#endif
     1018
    10131019#if PLATFORM(IOS) || PLATFORM(MACCATALYST) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
    10141020#define HAVE_NSURLPROTOCOL_WITH_SKIPAPPSSO 1
  • trunk/Source/WebCore/ChangeLog

    r279311 r279312  
     12021-06-27  Antoine Quint  <graouts@webkit.org>
     2
     3        [Model] [iOS] Add support for rendering model resources
     4        https://bugs.webkit.org/show_bug.cgi?id=227392
     5        <rdar://problem/79770136>
     6
     7        Reviewed by Tim Horton.
     8
     9        Ensure the anchor point is set correctly for model content layers, otherwise the preview layer shows
     10        its center at the corner of the parent layer's origin.
     11
     12        * platform/graphics/ca/GraphicsLayerCA.cpp:
     13        (WebCore::GraphicsLayerCA::setContentsToModel):
     14
    1152021-06-26  Joonghun Park  <jh718.park@samsung.com>
    216
  • trunk/Source/WebCore/PAL/ChangeLog

    r279298 r279312  
     12021-06-27  Antoine Quint  <graouts@webkit.org>
     2
     3        [Model] [iOS] Add support for rendering model resources
     4        https://bugs.webkit.org/show_bug.cgi?id=227392
     5        <rdar://problem/79770136>
     6
     7        Reviewed by Tim Horton.
     8
     9        Declare the ASVInlinePreview class.
     10
     11        * pal/spi/ios/SystemPreviewSPI.h:
     12
    1132021-06-22  Dean Jackson  <dino@apple.com>
    214
  • trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h

    r249958 r279312  
    3131
    3232#import <AssetViewer/ASVThumbnailView.h>
     33
     34#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     35#import <AssetViewer/ASVInlinePreview.h>
     36#endif
    3337
    3438#else
    … …  
    6569#endif
    6670
     71#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     72
     73@class ASVInlinePreview;
     74
     75@interface ASVInlinePreview : NSObject
     76@property (nonatomic, readonly) CALayer *layer;
     77
     78- (instancetype)initWithFrame:(CGRect)frame;
     79- (void)setupRemoteConnectionWithCompletionHandler:(void (^)(NSError * _Nullable error))handler;
     80- (void)preparePreviewOfFileAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable error))handler;
     81- (void)updateFrame:(CGRect)newFrame completionHandler:(void (^)(CAFenceHandle * _Nullable fenceHandle, NSError * _Nullable error))handler;
     82
     83@end
     84
    6785#endif
     86
     87#endif
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r278566 r279312  
    12861286#endif
    12871287
     1288        m_contentsLayer->setAnchorPoint({ });
    12881289        m_contentsLayerPurpose = ContentsLayerPurpose::Model;
    12891290        contentsLayerChanged = true;
  • trunk/Source/WebKit/ChangeLog

    r279310 r279312  
     12021-06-27  Antoine Quint  <graouts@webkit.org>
     2
     3        [Model] [iOS] Add support for rendering model resources
     4        https://bugs.webkit.org/show_bug.cgi?id=227392
     5        <rdar://problem/79770136>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add a new WKModelView class which manages an ASVInlinePreview and displays its layer.
     10        The current incarnation of the ASVInlinePreview SPI requires a URL to a file to specify
     11        the resource, so we write a file to the temporary directory added in 279267 with the data
     12        wrapped in the Model object passed through the remote layer tree. Ultimately we will be
     13        able to use an SPI that does not require a file and instead will allow data to be passed
     14        directly, this is purely for a temporary experimentation.
     15
     16        * Platform/Logging.h:
     17        * SourcesCocoa.txt:
     18        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
     19        (WebKit::RemoteLayerTreeHost::makeNode):
     20        * UIProcess/ios/WKModelView.h: Added.
     21        * UIProcess/ios/WKModelView.mm: Added.
     22        (-[WKModelView preview]):
     23        (-[WKModelView initWithFrame:]):
     24        (-[WKModelView initWithCoder:]):
     25        (-[WKModelView initWithModel:]):
     26        (-[WKModelView createFileForModel:]):
     27        (-[WKModelView layoutSubviews]):
     28        (-[WKModelView updateBounds]):
     29        * WebKit.xcodeproj/project.pbxproj:
     30
    1312021-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
    232
  • trunk/Source/WebKit/Platform/Logging.h

    r278877 r279312  
    7171    M(Media) \
    7272    M(MemoryPressure) \
     73    M(ModelElement) \
    7374    M(MouseHandling) \
    7475    M(Network) \
  • trunk/Source/WebKit/SourcesCocoa.txt

    r279133 r279312  
    490490UIProcess/ios/WKImageAnalysisGestureRecognizer.mm
    491491UIProcess/ios/WKKeyboardScrollingAnimator.mm
     492UIProcess/ios/WKModelView.mm
    492493UIProcess/ios/WKMouseDeviceObserver.mm
    493494UIProcess/ios/WKMouseGestureRecognizer.mm
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm

    r274302 r279312  
    3535#import <UIKit/UIScrollView.h>
    3636#import <pal/spi/cocoa/QuartzCoreSPI.h>
     37
     38#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     39#import "WKModelView.h"
     40#endif
    3741
    3842namespace WebKit {
    … …  
    96100#if ENABLE(SEPARATED_MODEL)
    97101        return makeWithView(adoptNS([[WKSeparatedModelView alloc] initWithModel:*properties.model]));
     102#elif HAVE(ARKIT_INLINE_PREVIEW_IOS)
     103        return makeWithView(adoptNS([[WKModelView alloc] initWithModel:*properties.model]));
    98104#else
    99105        return makeWithView(adoptNS([[WKCompositingView alloc] init]));
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r279164 r279312  
    13231323                711725A9228D564300018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 711725A8228D563A00018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h */; };
    13241324                71A676A622C62325007D6295 /* WKTouchActionGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */; };
     1325                71BAA73325FFD09800D7CD5D /* WKModelView.h in Headers */ = {isa = PBXBuildFile; fileRef = 71BAA73125FFCCBA00D7CD5D /* WKModelView.h */; };
    13251326                71FB810B2260627E00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */; };
    13261327                728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; };
    … …  
    45814582                71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTouchActionGestureRecognizer.h; path = ios/WKTouchActionGestureRecognizer.h; sourceTree = "<group>"; };
    45824583                71A676A522C62318007D6295 /* WKTouchActionGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTouchActionGestureRecognizer.mm; path = ios/WKTouchActionGestureRecognizer.mm; sourceTree = "<group>"; };
     4584                71BAA73125FFCCBA00D7CD5D /* WKModelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKModelView.h; path = ios/WKModelView.h; sourceTree = "<group>"; };
     4585                71BAA73225FFCCBA00D7CD5D /* WKModelView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKModelView.mm; path = ios/WKModelView.mm; sourceTree = "<group>"; };
    45834586                71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteSimulatedMouseEventsDispatchPolicy.h; sourceTree = "<group>"; };
    45844587                7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBufferProxy.h; sourceTree = "<group>"; };
    … …  
    77937796                                2DD5E127210ADC7A00DB6012 /* WKKeyboardScrollingAnimator.h */,
    77947797                                2DD5E126210ADC7A00DB6012 /* WKKeyboardScrollingAnimator.mm */,
     7798                                71BAA73125FFCCBA00D7CD5D /* WKModelView.h */,
     7799                                71BAA73225FFCCBA00D7CD5D /* WKModelView.mm */,
    77957800                                950F287E252414E900B74F1C /* WKMouseDeviceObserver.h */,
    77967801                                950F287F252414EA00B74F1C /* WKMouseDeviceObserver.mm */,
    … …  
    1284612851                                C11E1694212B87C500985FF6 /* WKMockDisplay.h in Headers */,
    1284712852                                411A8DDB20DDD1AC0060D34F /* WKMockMediaDevice.h in Headers */,
     12853                                71BAA73325FFD09800D7CD5D /* WKModelView.h in Headers */,
    1284812854                                950F2880252414EA00B74F1C /* WKMouseDeviceObserver.h in Headers */,
    1284912855                                2DB94299234E7A7F00E776AD /* WKMouseGestureRecognizer.h in Headers */,
    … …  
    1412914135                                C1A152D724E5A29A00978C8B /* HandleXPCEndpointMessages.mm in Sources */,
    1413014136                                2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */,
    14131                                 CDF1B91B267025550007EC10 /* WebKitSwiftSoftLink.mm in Sources */,
    1413214137                                2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */,
    1413314138                                9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */,
    … …  
    1447314478                                2D92A78B212B6AB100F493FD /* WebKit2Initialize.cpp in Sources */,
    1447414479                                A181A79821ACC74B0059A316 /* WebKitAdditions.mm in Sources */,
     14480                                CDF1B91B267025550007EC10 /* WebKitSwiftSoftLink.mm in Sources */,
    1447514481                                51F060E11654318500F3282F /* WebMDNSRegisterMessageReceiver.cpp in Sources */,
    1447614482                                2D92A78C212B6AB100F493FD /* WebMouseEvent.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.