Changeset 279451 in webkit
- Timestamp:
- Jun 30, 2021 11:32:12 PM (13 months ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 26 edited
- 1 copied
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/PlatformHave.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/model-element/HTMLModelElement.cpp (modified) (3 diffs)
-
WebCore/Modules/model-element/HTMLModelElement.h (modified) (4 diffs)
-
WebCore/Modules/model-element/HTMLModelElementCocoa.mm (added)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/PAL.xcodeproj/project.pbxproj (modified) (4 diffs)
-
WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h (copied) (copied from trunk/Source/WebKit/UIProcess/ModelElementController.h) (1 diff)
-
WebCore/SourcesCocoa.txt (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
WebCore/loader/EmptyClients.cpp (modified) (1 diff)
-
WebCore/loader/EmptyClients.h (modified) (1 diff)
-
WebCore/page/ChromeClient.h (modified) (2 diffs)
-
WebCore/platform/Logging.h (modified) (1 diff)
-
WebCore/rendering/RenderLayerBacking.cpp (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm (modified) (3 diffs)
-
WebKit/UIProcess/ModelElementController.h (modified) (1 diff)
-
WebKit/UIProcess/PageClient.h (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r279444 r279451 1 2021-06-30 Antoine Quint <graouts@webkit.org> 2 3 [Model] [macOS] Add support for rendering model resources 4 https://bugs.webkit.org/show_bug.cgi?id=227530 5 <rdar://problem/79968206> 6 7 Reviewed by Dean Jackson. 8 9 Add a new compile-time flag indicating the availability of the ASVInlinePreview SPI on macOS. 10 We only define it when the header itself is present for now to avoid issues with older macOS 11 12 SDKs, but ultimately we will only use the macOS version check. 12 13 * wtf/PlatformHave.h: 14 1 15 2021-06-30 Megan Gardner <megan_gardner@apple.com> 2 16 -
trunk/Source/WTF/wtf/PlatformHave.h
r279407 r279451 1015 1015 #define HAVE_ARKIT_INLINE_PREVIEW_IOS 1 1016 1016 #endif 1017 1018 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000 1019 #define HAVE_ARKIT_INLINE_PREVIEW_MAC 1 1020 #endif 1017 1021 #endif 1018 1022 -
trunk/Source/WebCore/ChangeLog
r279444 r279451 1 2021-06-30 Antoine Quint <graouts@webkit.org> 2 3 [Model] [macOS] Add support for rendering model resources 4 https://bugs.webkit.org/show_bug.cgi?id=227530 5 <rdar://problem/79968206> 6 7 Reviewed by Dean Jackson. 8 9 On macOS, ASVInlinePreview requires an instance in both the WebProcess and the UIProcess to exist with a matching UUID. 10 11 On the WebCore side, in the WebProcess, after writing the model resource as a file to disk, we create an instance when a 12 <model> element is created and message the UIProcess through the ChromeClient providing the UUID generated for it. When 13 the UIProcess is done processing this message, it will reply with another message which calls into 14 HTMLModelElement::inlinePreviewDidObtainContextId() with the matching UUID and a context ID for the remote context. 15 We can then set that remote context ID on our ASVInlinePreview instance. 16 17 We also introduce a HTMLModelElement::platformLayer() method such that RenderLayerBacking::updateConfiguration() can call 18 it to host the ASVInlinePreview layer. 19 20 * Modules/model-element/HTMLModelElement.cpp: 21 (WebCore::HTMLModelElement::~HTMLModelElement): 22 (WebCore::HTMLModelElement::setSourceURL): 23 (WebCore::HTMLModelElement::notifyFinished): 24 * Modules/model-element/HTMLModelElement.h: 25 * Modules/model-element/HTMLModelElementCocoa.mm: Added. 26 (WebCore::HTMLModelElement::createFile): 27 (WebCore::HTMLModelElement::clearFile): 28 (WebCore::HTMLModelElement::modelDidChange): 29 (WebCore::HTMLModelElement::inlinePreviewDidObtainContextId): 30 (WebCore::HTMLModelElement::platformLayer const): 31 * SourcesCocoa.txt: 32 * WebCore.xcodeproj/project.pbxproj: 33 * loader/EmptyClients.cpp: 34 (WebCore::EmptyChromeClient::modelElementDidCreatePreview const): 35 * loader/EmptyClients.h: 36 * page/ChromeClient.h: 37 (WebCore::ChromeClient::modelElementDidCreatePreview const): 38 * platform/Logging.h: 39 * rendering/RenderLayerBacking.cpp: 40 (WebCore::RenderLayerBacking::updateConfiguration): 41 1 42 2021-06-30 Megan Gardner <megan_gardner@apple.com> 2 43 -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp
r279420 r279451 70 70 m_resource = nullptr; 71 71 } 72 73 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 74 clearFile(); 75 #endif 72 76 } 73 77 … … 132 136 m_readyPromise = makeUniqueRef<ReadyPromise>(*this, &HTMLModelElement::readyPromiseResolve); 133 137 134 if (m_sourceURL.isEmpty()) 135 return; 138 if (m_sourceURL.isEmpty()) { 139 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 140 clearFile(); 141 #endif 142 return; 143 } 136 144 137 145 ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions(); … … 225 233 226 234 m_readyPromise->resolve(*this); 235 236 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 237 modelDidChange(); 238 #endif 227 239 } 228 240 -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h
r279420 r279451 36 36 #include <wtf/UniqueRef.h> 37 37 38 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 39 #include "PlatformLayer.h" 40 OBJC_CLASS ASVInlinePreview; 41 #endif 42 38 43 namespace WebCore { 39 44 … … 60 65 WEBCORE_EXPORT static const String& modelElementCacheDirectory(); 61 66 67 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 68 PlatformLayer* platformLayer() const; 69 WEBCORE_EXPORT void inlinePreviewDidObtainContextId(const String& uuid, uint32_t contextId); 70 #endif 71 62 72 void enterFullscreen(); 63 73 … … 67 77 void setSourceURL(const URL&); 68 78 HTMLModelElement& readyPromiseResolve(); 79 80 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 81 void clearFile(); 82 void createFile(); 83 void modelDidChange(); 84 #endif 69 85 70 86 // DOM overrides. … … 84 100 UniqueRef<ReadyPromise> m_readyPromise; 85 101 bool m_dataComplete { false }; 102 103 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 104 String m_filePath; 105 RetainPtr<ASVInlinePreview> m_inlinePreview; 106 #endif 86 107 }; 87 108 -
trunk/Source/WebCore/PAL/ChangeLog
r279420 r279451 1 2021-06-30 Antoine Quint <graouts@webkit.org> 2 3 [Model] [macOS] Add support for rendering model resources 4 https://bugs.webkit.org/show_bug.cgi?id=227530 5 <rdar://problem/79968206> 6 7 Reviewed by Dean Jackson. 8 9 Declare the ASVInlinePreview class for macOS. 10 11 * PAL.xcodeproj/project.pbxproj: 12 * pal/spi/mac/SystemPreviewSPI.h: Added. 13 1 14 2021-06-30 Antoine Quint <graouts@webkit.org> 2 15 -
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
r279030 r279451 149 149 5C7C787623AC3E850065F47E /* ManagedConfigurationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C787523AC3E850065F47E /* ManagedConfigurationSPI.h */; }; 150 150 63C7EDC721AFAE04006A7B99 /* NSProgressSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 63E369F921AFA83F001C14BC /* NSProgressSPI.h */; }; 151 71B1142026823ACD004D6701 /* SystemPreviewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 71B1141F26823ACD004D6701 /* SystemPreviewSPI.h */; }; 151 152 72E5BE972679A80A00ADBFA9 /* VideoToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 72E5BE962679A80900ADBFA9 /* VideoToolboxSPI.h */; }; 152 153 7A36D0F9223AD9AB00B0522E /* CommonCryptoSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */; }; … … 368 369 5C7C787523AC3E850065F47E /* ManagedConfigurationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagedConfigurationSPI.h; sourceTree = "<group>"; }; 369 370 63E369F921AFA83F001C14BC /* NSProgressSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSProgressSPI.h; sourceTree = "<group>"; }; 371 71B1141F26823ACD004D6701 /* SystemPreviewSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemPreviewSPI.h; sourceTree = "<group>"; }; 370 372 72E5BE962679A80900ADBFA9 /* VideoToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoToolboxSPI.h; sourceTree = "<group>"; }; 371 373 7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptoSPI.h; sourceTree = "<group>"; }; … … 629 631 0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */, 630 632 A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */, 633 71B1141F26823ACD004D6701 /* SystemPreviewSPI.h */, 631 634 0C7785881F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h */, 632 635 ); … … 991 994 A1175B491F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h in Headers */, 992 995 0C5AF9211F43A4C7002EAC02 /* SQLite3SPI.h in Headers */, 996 71B1142026823ACD004D6701 /* SystemPreviewSPI.h in Headers */, 993 997 31308B1420A21705003FB929 /* SystemPreviewSPI.h in Headers */, 994 998 A3AB6E581F3D1DDB009C14B1 /* SystemSleepListener.h in Headers */, -
trunk/Source/WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h
r279450 r279451 24 24 */ 25 25 26 #pragma once 27 28 #if ENABLE(MODEL_ELEMENT) 29 30 #include <WebCore/ElementContext.h> 31 #include <WebCore/GraphicsLayer.h> 32 #include <wtf/RetainPtr.h> 33 #include <wtf/URL.h> 34 #include <wtf/WeakPtr.h> 26 #if USE(APPLE_INTERNAL_SDK) 35 27 36 28 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 37 OBJC_CLASS ASVInlinePreview; 29 #import <AssetViewer/ASVInlinePreview.h> 38 30 #endif 39 31 40 namespace WebKit { 32 #else 41 33 42 class WebPageProxy; 34 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 43 35 44 class ModelElementController : public CanMakeWeakPtr<ModelElementController> { 45 WTF_MAKE_FAST_ALLOCATED; 46 public: 47 explicit ModelElementController(WebPageProxy&); 36 @class ASVInlinePreview; 48 37 49 WebPageProxy& page() { return m_webPageProxy; } 38 @interface ASVInlinePreview : NSObject 39 @property (nonatomic, readonly) NSUUID *uuid; 40 @property (nonatomic, readonly) CALayer *layer; 41 @property (nonatomic, readonly) uint32_t contextId; 50 42 51 #if HAVE(ARKIT_INLINE_PREVIEW_IOS) 52 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId); 43 - (instancetype)initWithFrame:(CGRect)frame; 44 - (instancetype)initWithFrame:(CGRect)frame UUID:(NSUUID *)uuid; 45 - (void)setupRemoteConnectionWithCompletionHandler:(void (^)(NSError * _Nullable error))handler; 46 - (void)preparePreviewOfFileAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable error))handler; 47 - (void)setRemoteContext:(uint32_t)contextId; 48 49 @end 50 53 51 #endif 54 52 55 private:56 WebPageProxy& m_webPageProxy;57 };58 59 }60 61 53 #endif -
trunk/Source/WebCore/SourcesCocoa.txt
r279102 r279451 100 100 Modules/async-clipboard/mac/ClipboardImageReaderMac.mm 101 101 Modules/mediastream/RTCRtpSFrameTransformerCocoa.cpp 102 Modules/model-element/HTMLModelElementCocoa.mm 102 103 Modules/plugins/QuickTimePluginReplacement.mm 103 104 Modules/plugins/YouTubePluginReplacement.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r279355 r279451 10294 10294 71C5BB1B1FB611EA0007A2AE /* Animatable.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Animatable.idl; sourceTree = "<group>"; }; 10295 10295 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInterfaceLayoutDirection.h; sourceTree = "<group>"; }; 10296 71CAA3D9268D0BF900F25410 /* HTMLModelElementCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLModelElementCocoa.mm; sourceTree = "<group>"; }; 10296 10297 71CE2C512209DC7F00C494BD /* MouseEventIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseEventIOS.cpp; sourceTree = "<group>"; }; 10297 10298 71D02D901DB55C4E00DD5CF5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; }; … … 23123 23124 71A3D17D2562B8240064E2A6 /* HTMLModelElement.h */, 23124 23125 71A3D17F2562B8240064E2A6 /* HTMLModelElement.idl */, 23126 71CAA3D9268D0BF900F25410 /* HTMLModelElementCocoa.mm */, 23125 23127 ); 23126 23128 path = "model-element"; -
trunk/Source/WebCore/loader/EmptyClients.cpp
r279420 r279451 580 580 581 581 #if ENABLE(MODEL_ELEMENT) 582 582 583 void EmptyChromeClient::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const 583 584 { 584 585 } 586 587 void EmptyChromeClient::modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const 588 { 589 } 590 585 591 #endif 586 592 -
trunk/Source/WebCore/loader/EmptyClients.h
r279420 r279451 222 222 223 223 RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; } 224 225 #if ENABLE(MODEL_ELEMENT) 226 void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const final; 227 #endif 224 228 }; 225 229 -
trunk/Source/WebCore/page/ChromeClient.h
r279420 r279451 79 79 #endif 80 80 81 #if ENABLE(MODEL_ELEMENT) 82 class HTMLModelElement; 83 #endif 84 81 85 #if ENABLE(WEBXR) 82 86 #include "PlatformXR.h" … … 599 603 #if ENABLE(MODEL_ELEMENT) 600 604 virtual void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const { } 605 virtual void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const { }; 601 606 #endif 602 607 -
trunk/Source/WebCore/platform/Logging.h
r278007 r279451 85 85 M(MemoryPressure) \ 86 86 M(MessagePorts) \ 87 M(ModelElement) \ 87 88 M(Network) \ 88 89 M(NotYetImplemented) \ -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r278883 r279451 1076 1076 else if (is<RenderModel>(renderer())) { 1077 1077 auto element = downcast<HTMLModelElement>(renderer().element()); 1078 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 1079 if (auto* platformLayer = element->platformLayer()) 1080 m_graphicsLayer->setContentsToPlatformLayer(platformLayer, GraphicsLayer::ContentsLayerPurpose::Model); 1081 #else 1078 1082 if (auto model = element->model()) 1079 1083 m_graphicsLayer->setContentsToModel(WTFMove(model)); 1084 #endif 1080 1085 1081 1086 layerConfigChanged = true; -
trunk/Source/WebKit/ChangeLog
r279450 r279451 1 2021-06-30 Antoine Quint <graouts@webkit.org> 2 3 [Model] [macOS] Add support for rendering model resources 4 https://bugs.webkit.org/show_bug.cgi?id=227530 5 <rdar://problem/79968206> 6 7 Reviewed by Dean Jackson. 8 9 On macOS, ASVInlinePreview requires an instance in both the WebProcess and the UIProcess to exist with a matching UUID. 10 11 On the WebKit side, in the UIProcess, we receive a message from the WebProcess when the ASVInlinePreview in that process 12 was created with its generated UUID. We provide this to the ModelElementController, set the remote connection up and load 13 the file. When those tasks complete successfully we message back the WebProcess with the UUID and the provided ElementContext 14 to talk back to the HTMLModelElement instance that initiated the message to the UIProcess in the first place. 15 16 * UIProcess/Cocoa/ModelElementControllerCocoa.mm: 17 (WebKit::ModelElementController::modelElementDidCreatePreview): 18 * UIProcess/ModelElementController.h: 19 * UIProcess/PageClient.h: 20 * UIProcess/WebPageProxy.cpp: 21 (WebKit::WebPageProxy::modelElementDidCreatePreview): 22 (WebKit::WebPageProxy::modelElementPreviewDidObtainContextId): 23 * UIProcess/WebPageProxy.h: 24 * UIProcess/WebPageProxy.messages.in: 25 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 26 (WebKit::WebChromeClient::modelElementDidCreatePreview const): 27 * WebProcess/WebCoreSupport/WebChromeClient.h: 28 * WebProcess/WebPage/WebPage.cpp: 29 (WebKit::WebPage::modelElementDidCreatePreview): 30 (WebKit::WebPage::modelElementPreviewDidObtainContextId): 31 * WebProcess/WebPage/WebPage.h: 32 * WebProcess/WebPage/WebPage.messages.in: 33 1 34 2021-06-30 Chris Dumez <cdumez@apple.com> 2 35 -
trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm
r279420 r279451 29 29 #if ENABLE(MODEL_ELEMENT) 30 30 31 #import "Logging.h" 32 #import "WebPageProxy.h" 33 34 #if HAVE(ARKIT_INLINE_PREVIEW_IOS) 31 35 #import "APIUIClient.h" 32 #import "Logging.h"33 36 #import "RemoteLayerTreeDrawingAreaProxy.h" 34 37 #import "RemoteLayerTreeHost.h" 35 38 #import "RemoteLayerTreeViews.h" 36 39 #import "WKModelView.h" 37 #import "WebPageProxy.h"38 40 #import <pal/spi/cocoa/QuartzCoreSPI.h> 39 #if HAVE(ARKIT_INLINE_PREVIEW_IOS)40 41 #import <pal/spi/ios/SystemPreviewSPI.h> 42 #endif 43 44 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 45 #import <pal/spi/mac/SystemPreviewSPI.h> 46 #import <wtf/MainThread.h> 41 47 #endif 42 48 … … 47 53 48 54 #if HAVE(ARKIT_INLINE_PREVIEW_IOS) 55 49 56 void ModelElementController::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) 50 57 { … … 110 117 }]; 111 118 } 119 120 #endif 121 122 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 123 124 void ModelElementController::modelElementDidCreatePreview(const WebCore::ElementContext& context, const URL& fileURL, const String& uuid, const WebCore::FloatSize& size) 125 { 126 auto preview = adoptNS([allocASVInlinePreviewInstance() initWithFrame:CGRectMake(0, 0, size.width(), size.height()) UUID:[[NSUUID alloc] initWithUUIDString:uuid]]); 127 128 LOG(ModelElement, "Created remote preview with UUID %s.", uuid.utf8().data()); 129 130 auto iterator = m_inlinePreviews.find(uuid); 131 if (iterator == m_inlinePreviews.end()) 132 m_inlinePreviews.set(uuid, preview); 133 else 134 iterator->value = preview; 135 136 RELEASE_ASSERT(isMainRunLoop()); 137 auto weakThis = makeWeakPtr(*this); 138 auto elementContextCopy = context; 139 auto uuidCopy = uuid; 140 NSURL *url = [NSURL fileURLWithPath:fileURL.fileSystemPath()]; 141 [preview setupRemoteConnectionWithCompletionHandler:^(NSError * _Nullable contextError) { 142 if (contextError) { 143 LOG(ModelElement, "Unable to create remote connection for uuid %s: %@.", uuidCopy.utf8().data(), [contextError localizedDescription]); 144 return; 145 } 146 147 LOG(ModelElement, "Established remote connection with UUID %s.", uuidCopy.utf8().data()); 148 149 [preview preparePreviewOfFileAtURL:url completionHandler:^(NSError * _Nullable loadError) { 150 if (loadError) { 151 LOG(ModelElement, "Unable to load file for uuid %s: %@.", uuidCopy.utf8().data(), [loadError localizedDescription]); 152 return; 153 } 154 155 LOG(ModelElement, "Loaded file with UUID %s.", uuidCopy.utf8().data()); 156 157 callOnMainRunLoop([weakThis, elementContextCopy, uuidCopy, contextId = [preview contextId]]() mutable { 158 weakThis->m_webPageProxy.modelElementPreviewDidObtainContextId(elementContextCopy, uuidCopy, contextId); 159 }); 160 }]; 161 }]; 162 } 163 112 164 #endif 113 165 -
trunk/Source/WebKit/UIProcess/ModelElementController.h
r279420 r279451 53 53 #endif 54 54 55 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 56 void modelElementDidCreatePreview(const WebCore::ElementContext&, const URL&, const String&, const WebCore::FloatSize&); 57 #endif 58 55 59 private: 56 60 WebPageProxy& m_webPageProxy; 61 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 62 HashMap<String, RetainPtr<ASVInlinePreview>> m_inlinePreviews; 63 #endif 57 64 }; 58 65 -
trunk/Source/WebKit/UIProcess/PageClient.h
r279164 r279451 133 133 struct TranslationContextMenuInfo; 134 134 #endif 135 136 #if ENABLE(MODEL_ELEMENT) 137 struct ElementContext; 138 #endif 135 139 } 136 140 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r279420 r279451 10690 10690 10691 10691 #if ENABLE(MODEL_ELEMENT) 10692 10692 10693 void WebPageProxy::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) 10693 10694 { … … 10696 10697 #endif 10697 10698 } 10699 10700 void WebPageProxy::modelElementDidCreatePreview(const WebCore::ElementContext& context, const URL& url, const String& uuid, const FloatSize& size) 10701 { 10702 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 10703 modelElementController()->modelElementDidCreatePreview(context, url, uuid, size); 10704 #endif 10705 } 10706 10707 void WebPageProxy::modelElementPreviewDidObtainContextId(const WebCore::ElementContext& context, const String& uuid, uint32_t contextId) 10708 { 10709 if (hasRunningProcess()) 10710 send(Messages::WebPage::ModelElementPreviewDidObtainContextId(context, uuid, contextId)); 10711 } 10712 10698 10713 #endif 10699 10714 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r279420 r279451 577 577 ModelElementController* modelElementController() { return m_modelElementController.get(); } 578 578 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId); 579 void modelElementDidCreatePreview(const WebCore::ElementContext&, const URL&, const String&, const WebCore::FloatSize&); 580 void modelElementPreviewDidObtainContextId(const WebCore::ElementContext&, const String&, uint32_t); 579 581 #endif 580 582 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r279420 r279451 596 596 #if ENABLE(MODEL_ELEMENT) 597 597 TakeModelElementFullscreen(uint64_t contentLayerID) 598 ModelElementDidCreatePreview(struct WebCore::ElementContext elementContext, URL url, String uuid, WebCore::FloatSize size) 598 599 #endif 599 600 } -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r279420 r279451 1517 1517 1518 1518 #if ENABLE(MODEL_ELEMENT) 1519 1519 1520 void WebChromeClient::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) const 1520 1521 { 1521 1522 m_page.takeModelElementFullscreen(contentLayerId); 1522 1523 } 1524 1525 void WebChromeClient::modelElementDidCreatePreview(WebCore::HTMLModelElement& element, const URL& url, const String& uuid, const WebCore::FloatSize& size) const 1526 { 1527 m_page.modelElementDidCreatePreview(element, url, uuid, size); 1528 } 1529 1523 1530 #endif 1524 1531 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r279420 r279451 455 455 #if ENABLE(MODEL_ELEMENT) 456 456 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) const final; 457 void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const final; 457 458 #endif 458 459 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r279450 r279451 270 270 #endif 271 271 272 #if ENABLE(MODEL_ELEMENT) 273 #include <WebCore/HTMLModelElement.h> 274 #endif 275 272 276 #if ENABLE(DATA_DETECTION) 273 277 #include "DataDetectionResult.h" … … 7676 7680 7677 7681 #if ENABLE(MODEL_ELEMENT) 7682 7678 7683 void WebPage::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) 7679 7684 { 7680 7685 send(Messages::WebPageProxy::TakeModelElementFullscreen(contentLayerId)); 7686 } 7687 7688 void WebPage::modelElementDidCreatePreview(WebCore::HTMLModelElement& element, const URL& url, const String& uuid, const WebCore::FloatSize& size) 7689 { 7690 if (auto elementContext = contextForElement(element)) 7691 send(Messages::WebPageProxy::ModelElementDidCreatePreview(*elementContext, url, uuid, size)); 7692 } 7693 7694 void WebPage::modelElementPreviewDidObtainContextId(const WebCore::ElementContext& elementContext, const String& uuid, uint32_t contextId) 7695 { 7696 #if HAVE(ARKIT_INLINE_PREVIEW_MAC) 7697 auto element = elementForContext(elementContext); 7698 if (is<WebCore::HTMLModelElement>(element)) 7699 downcast<WebCore::HTMLModelElement>(*element).inlinePreviewDidObtainContextId(uuid, contextId); 7700 #else 7701 UNUSED_PARAM(elementContext); 7702 UNUSED_PARAM(uuid); 7703 UNUSED_PARAM(contextId); 7704 #endif 7681 7705 } 7682 7706 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r279420 r279451 211 211 class VisiblePosition; 212 212 213 #if ENABLE(MODEL_ELEMENT) 214 class HTMLModelElement; 215 #endif 216 213 217 enum SyntheticClickType : int8_t; 214 218 enum class CreateNewGroupForHighlight : bool; … … 1464 1468 #if ENABLE(MODEL_ELEMENT) 1465 1469 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId); 1470 void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&); 1471 void modelElementPreviewDidObtainContextId(const WebCore::ElementContext&, const String&, uint32_t); 1466 1472 #endif 1467 1473 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r278880 r279451 644 644 UpdateWithTextRecognitionResult(struct WebCore::TextRecognitionResult result, struct WebCore::ElementContext element, WebCore::FloatPoint location) -> (enum:uint8_t WebKit::TextRecognitionUpdateResult result) Async 645 645 #endif 646 647 #if ENABLE(MODEL_ELEMENT) 648 ModelElementPreviewDidObtainContextId(struct WebCore::ElementContext elementContext, String uuid, uint32_t contextId) 649 #endif 646 650 }
Note: See TracChangeset
for help on using the changeset viewer.