Diff
Modified: trunk/Source/WebCore/ChangeLog (235650 => 235651)
--- trunk/Source/WebCore/ChangeLog 2018-09-05 00:22:43 UTC (rev 235650)
+++ trunk/Source/WebCore/ChangeLog 2018-09-05 00:50:33 UTC (rev 235651)
@@ -1,3 +1,20 @@
+2018-09-04 Dean Jackson <[email protected]>
+
+ Post review Weinig fix-ups
+ https://bugs.webkit.org/show_bug.cgi?id=189288
+
+ Reviewed by Sam Weinig.
+
+ Fix-ups from https://bugs.webkit.org/show_bug.cgi?id=189252
+
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::MIMETypeRegistry::getSystemPreviewMIMETypes):
+ (WebCore::initializeSystemPreviewMIMETypes): Deleted.
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::arKitBundle):
+ (WebCore::loadARKitPDFPage):
+ (WebCore::systemPreviewLogo):
+
2018-09-04 Ryosuke Niwa <[email protected]>
slotchange event doesn't get fired when inserting, removing, or renaming slot elements
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (235650 => 235651)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2018-09-05 00:22:43 UTC (rev 235650)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2018-09-05 00:50:33 UTC (rev 235651)
@@ -64,10 +64,6 @@
static HashSet<String, ASCIICaseInsensitiveHash>* pdfMIMETypes;
static HashSet<String, ASCIICaseInsensitiveHash>* unsupportedTextMIMETypes;
-#if USE(SYSTEM_PREVIEW)
-static HashSet<String, ASCIICaseInsensitiveHash>* systemPreviewMIMETypes;
-#endif
-
static void initializeSupportedImageMIMETypes()
{
supportedImageResourceMIMETypes = new HashSet<String, ASCIICaseInsensitiveHash>;
@@ -705,9 +701,9 @@
}
#if USE(SYSTEM_PREVIEW)
-static void initializeSystemPreviewMIMETypes()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSystemPreviewMIMETypes()
{
- const char* const types[] = {
+ static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> systemPreviewMIMETypes = std::initializer_list<String> {
// The official type: https://www.iana.org/assignments/media-types/model/vnd.usdz+zip
"model/vnd.usdz+zip",
// Unofficial, but supported because we documented them.
@@ -714,19 +710,9 @@
"model/usd",
"model/vnd.pixar.usd"
};
-
- systemPreviewMIMETypes = new HashSet<String, ASCIICaseInsensitiveHash>;
- for (auto& type : types)
- systemPreviewMIMETypes->add(type);
+ return systemPreviewMIMETypes;
}
-const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSystemPreviewMIMETypes()
-{
- if (!systemPreviewMIMETypes)
- initializeSystemPreviewMIMETypes();
- return *systemPreviewMIMETypes;
-}
-
bool MIMETypeRegistry::isSystemPreviewMIMEType(const String& mimeType)
{
if (mimeType.isEmpty())
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (235650 => 235651)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2018-09-05 00:22:43 UTC (rev 235650)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2018-09-05 00:50:33 UTC (rev 235651)
@@ -1855,16 +1855,14 @@
#if USE(SYSTEM_PREVIEW)
static NSBundle *arKitBundle()
{
- static NSBundle *arKitBundle;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
+ static NSBundle *arKitBundle = []() {
#if PLATFORM(IOS_SIMULATOR)
dlopen("/System/Library/PrivateFrameworks/AssetViewer.framework/AssetViewer", RTLD_NOW);
- arKitBundle = [NSBundle bundleForClass:NSClassFromString(@"ASVThumbnailView")];
+ return [NSBundle bundleForClass:NSClassFromString(@"ASVThumbnailView")];
#else
- arKitBundle = [NSBundle bundleWithURL:[NSURL fileURLWithPath:@"/System/Library/PrivateFrameworks/AssetViewer.framework"]];
+ return [NSBundle bundleWithURL:[NSURL fileURLWithPath:@"/System/Library/PrivateFrameworks/AssetViewer.framework"]];
#endif
- });
+ }();
return arKitBundle;
}
@@ -1884,18 +1882,13 @@
return nullptr;
return CGPDFDocumentGetPage(document.get(), 1);
-};
+}
static CGPDFPageRef systemPreviewLogo()
{
- static CGPDFPageRef logoPage;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- logoPage = loadARKitPDFPage(@"ARKitBadge").leakRef();
- });
-
+ static CGPDFPageRef logoPage = loadARKitPDFPage(@"ARKitBadge").leakRef();
return logoPage;
-};
+}
void RenderThemeIOS::paintSystemPreviewBadge(Image& image, const PaintInfo& paintInfo, const FloatRect& rect)
{
Modified: trunk/Source/WebKit/ChangeLog (235650 => 235651)
--- trunk/Source/WebKit/ChangeLog 2018-09-05 00:22:43 UTC (rev 235650)
+++ trunk/Source/WebKit/ChangeLog 2018-09-05 00:50:33 UTC (rev 235651)
@@ -1,3 +1,20 @@
+2018-09-04 Dean Jackson <[email protected]>
+
+ Post review Weinig fix-ups
+ https://bugs.webkit.org/show_bug.cgi?id=189288
+
+ Reviewed by Sam Weinig.
+
+ Fix-ups from https://bugs.webkit.org/show_bug.cgi?id=189252
+
+ * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
+ (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
+ (getUTIForMIMEType): Deleted.
+ * UIProcess/ios/WKSystemPreviewView.mm:
+ (getUTIForSystemPreviewMIMEType):
+ (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
+ (getUTIForMIMEType): Deleted.
+
2018-09-04 Wenson Hsieh <[email protected]>
Populate "text/uri-list" with multiple URLs when the pasteboard contains multiple URLs
Modified: trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm (235650 => 235651)
--- trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm 2018-09-05 00:22:43 UTC (rev 235650)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm 2018-09-05 00:50:33 UTC (rev 235651)
@@ -42,18 +42,6 @@
SOFT_LINK_CLASS(QuickLook, QLPreviewController);
SOFT_LINK_CLASS(QuickLook, QLItem);
-// FIXME: At the moment we only have one supported UTI, but
-// if we start supporting more types, then we'll need a table.
-static String getUTIForMIMEType(const String& mimeType)
-{
- static const NeverDestroyed<String> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, CFSTR("usdz"), nil)).get();
-
- if (!WebCore::MIMETypeRegistry::isSystemPreviewMIMEType(mimeType))
- return emptyString();
-
- return uti;
-}
-
@interface _WKPreviewControllerDataSource : NSObject <QLPreviewControllerDataSource> {
RetainPtr<NSItemProvider> _itemProvider;
RetainPtr<QLItem> _item;
@@ -95,8 +83,10 @@
_itemProvider = adoptNS([[NSItemProvider alloc] init]);
// FIXME: We are launching the preview controller before getting a response from the resource, which
- // means we don't actually know the real MIME type yet. Assume it is one of those that we registered.
- NSString *contentType = getUTIForMIMEType(*WebCore::MIMETypeRegistry::getSystemPreviewMIMETypes().begin());
+ // means we don't actually know the real MIME type yet.
+ // FIXME: At the moment we only have one supported UTI, but if we start supporting more types,
+ // then we'll need a table.
+ static NSString *contentType = (__bridge NSString *) UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, CFSTR("usdz"), nil);
_item = adoptNS([allocQLItemInstance() initWithPreviewItemProvider:_itemProvider.get() contentType:contentType previewTitle:@"Preview" fileSize:@(0)]);
[_item setUseLoadingTimeout:NO];
Modified: trunk/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm (235650 => 235651)
--- trunk/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm 2018-09-05 00:22:43 UTC (rev 235650)
+++ trunk/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm 2018-09-05 00:50:33 UTC (rev 235651)
@@ -50,12 +50,12 @@
// FIXME: At the moment we only have one supported UTI, but
// if we start supporting more types, then we'll need a table.
-static String getUTIForMIMEType(const String& mimeType)
+static NSString *getUTIForSystemPreviewMIMEType(const String& mimeType)
{
- static const NeverDestroyed<String> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, CFSTR("usdz"), nil)).get();
+ static NSString *uti = (__bridge NSString *) UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, CFSTR("usdz"), nil);
if (!WebCore::MIMETypeRegistry::isSystemPreviewMIMEType(mimeType))
- return emptyString();
+ return nil;
return uti;
}
@@ -103,8 +103,7 @@
_suggestedFilename = adoptNS([filename copy]);
_data = adoptNS([data copy]);
- NSString *contentType;
- contentType = getUTIForMIMEType(_mimeType.get());
+ NSString *contentType = getUTIForSystemPreviewMIMEType(_mimeType.get());
_item = adoptNS([allocQLItemInstance() initWithDataProvider:self contentType:contentType previewTitle:_suggestedFilename.get()]);
[_item setUseLoadingTimeout:NO];