Title: [219781] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (219780 => 219781)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-23 06:51:12 UTC (rev 219780)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-23 06:51:18 UTC (rev 219781)
@@ -1,5 +1,24 @@
 2017-07-22  Jason Marcell  <[email protected]>
 
+        Cherry-pick r219666. rdar://problem/33464328
+
+    2017-07-19  Megan Gardner  <[email protected]>
+
+            Don't write file URLs to iOS Pasteboard
+            https://bugs.webkit.org/show_bug.cgi?id=174647
+            <rdar://problem/33199730>
+
+            Reviewed by Wenson Hsieh.
+
+            Tests updated to reflect the changes. We are no longer vending file URLs in Drag & Drop and Copy/Paste.
+
+            * editing/ios/EditorIOS.mm:
+            (WebCore::Editor::writeImageToPasteboard):
+            * platform/ios/PlatformPasteboardIOS.mm:
+            (WebCore::PlatformPasteboard::write):
+
+2017-07-22  Jason Marcell  <[email protected]>
+
         Cherry-pick r219661. rdar://problem/33465132
 
     2017-07-19  Nan Wang  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/editing/ios/EditorIOS.mm (219780 => 219781)


--- branches/safari-604-branch/Source/WebCore/editing/ios/EditorIOS.mm	2017-07-23 06:51:12 UTC (rev 219780)
+++ branches/safari-604-branch/Source/WebCore/editing/ios/EditorIOS.mm	2017-07-23 06:51:18 UTC (rev 219781)
@@ -207,8 +207,12 @@
     ASSERT(cachedImage);
 
     auto imageSourceURL = imageElement.document().completeURL(stripLeadingAndTrailingHTMLSpaces(imageElement.imageSourceURL()));
-    pasteboardImage.url.url = "" ? imageSourceURL : url;
-    pasteboardImage.url.title = title;
+
+    auto pasteboardImageURL = url.isEmpty() ? imageSourceURL : url;
+    if (!pasteboardImageURL.isLocalFile()) {
+        pasteboardImage.url.url = ""
+        pasteboardImage.url.title = title;
+    }
     pasteboardImage.suggestedName = imageSourceURL.lastPathComponent();
     pasteboardImage.imageSize = image->size();
     pasteboardImage.resourceMIMEType = pasteboard.resourceMIMEType(cachedImage->response().mimeType());

Modified: branches/safari-604-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (219780 => 219781)


--- branches/safari-604-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2017-07-23 06:51:12 UTC (rev 219780)
+++ branches/safari-604-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2017-07-23 06:51:18 UTC (rev 219781)
@@ -323,7 +323,8 @@
     RetainPtr<NSMutableDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
     if (!pasteboardImage.resourceMIMEType.isNull()) {
         [representations setObject:pasteboardImage.resourceData->createNSData().get() forKey:pasteboardImage.resourceMIMEType];
-        [representations setObject:(NSURL *)pasteboardImage.url.url forKey:(NSString *)kUTTypeURL];
+        if (!pasteboardImage.url.url.isNull())
+            [representations setObject:(NSURL *)pasteboardImage.url.url forKey:(NSString *)kUTTypeURL];
     }
     [m_pasteboard setItems:@[representations.get()]];
 }

Modified: branches/safari-604-branch/Tools/ChangeLog (219780 => 219781)


--- branches/safari-604-branch/Tools/ChangeLog	2017-07-23 06:51:12 UTC (rev 219780)
+++ branches/safari-604-branch/Tools/ChangeLog	2017-07-23 06:51:18 UTC (rev 219781)
@@ -1,5 +1,24 @@
 2017-07-22  Jason Marcell  <[email protected]>
 
+        Cherry-pick r219666. rdar://problem/33464328
+
+    2017-07-19  Megan Gardner  <[email protected]>
+
+            Don't write file URLs to iOS Pasteboard
+            https://bugs.webkit.org/show_bug.cgi?id=174647
+            <rdar://problem/33199730>
+
+            Reviewed by Wenson Hsieh.
+
+            Updating tests to reflect the lack of file URLs for images.
+
+            * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+            (checkTypeIdentifierAndIsNotOtherTypeIdentifier):
+            (checkEstimatedSize):
+            (TestWebKitAPI::TEST):
+
+2017-07-22  Jason Marcell  <[email protected]>
+
         Cherry-pick r219664. rdar://problem/33464115
 
     2017-07-19  Brady Eidson  <[email protected]>

Modified: branches/safari-604-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (219780 => 219781)


--- branches/safari-604-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-07-23 06:51:12 UTC (rev 219780)
+++ branches/safari-604-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-07-23 06:51:18 UTC (rev 219781)
@@ -114,6 +114,13 @@
     EXPECT_TRUE([registeredTypes indexOfObject:firstType] < [registeredTypes indexOfObject:secondType]);
 }
 
+static void checkTypeIdentifierAndIsNotOtherTypeIdentifier(DataInteractionSimulator *simulator, NSString *firstType, NSString *secondType)
+{
+    NSArray *registeredTypes = [simulator.sourceItemProviders.firstObject registeredTypeIdentifiers];
+    EXPECT_TRUE([registeredTypes containsObject:firstType]);
+    EXPECT_FALSE([registeredTypes containsObject:secondType]);
+}
+
 static void checkTypeIdentifierIsRegisteredAtIndex(DataInteractionSimulator *simulator, NSString *type, NSUInteger index)
 {
     NSArray *registeredTypes = [simulator.sourceItemProviders.firstObject registeredTypeIdentifiers];
@@ -121,6 +128,13 @@
     EXPECT_WK_STREQ(type.UTF8String, [registeredTypes[index] UTF8String]);
 }
 
+static void checkEstimatedSize(DataInteractionSimulator *simulator, CGSize estimatedSize)
+{
+    UIItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
+    EXPECT_EQ(estimatedSize.width, sourceItemProvider.estimatedDisplayedSize.width);
+    EXPECT_EQ(estimatedSize.height, sourceItemProvider.estimatedDisplayedSize.height);
+}
+
 static void checkSuggestedNameAndEstimatedSize(DataInteractionSimulator *simulator, NSString *suggestedName, CGSize estimatedSize)
 {
     UIItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
@@ -166,8 +180,8 @@
     EXPECT_TRUE([observedEventNames containsObject:DataInteractionOverEventName]);
     EXPECT_TRUE([observedEventNames containsObject:DataInteractionPerformOperationEventName]);
     checkSelectionRectsWithLogging(@[ makeCGRectValue(1, 201, 215, 174) ], [dataInteractionSimulator finalSelectionRects]);
-    checkTypeIdentifierPrecedesOtherTypeIdentifier(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, (NSString *)kUTTypeFileURL);
-    checkSuggestedNameAndEstimatedSize(dataInteractionSimulator.get(), @"icon.png", { 215, 174 });
+    checkTypeIdentifierAndIsNotOtherTypeIdentifier(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, (NSString *)kUTTypeFileURL);
+    checkEstimatedSize(dataInteractionSimulator.get(), { 215, 174 });
 }
 
 TEST(DataInteractionTests, CanStartDragOnEnormousImage)
@@ -190,16 +204,14 @@
     RetainPtr<DataInteractionSimulator> dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    NSURL *imageURL = [NSURL fileURLWithPath:[webView editorValue]];
-    EXPECT_WK_STREQ("icon.png", imageURL.lastPathComponent);
+    EXPECT_WK_STREQ("", [webView editorValue]);
 
     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
     EXPECT_TRUE([observedEventNames containsObject:DataInteractionOverEventName]);
     EXPECT_TRUE([observedEventNames containsObject:DataInteractionPerformOperationEventName]);
-
-    checkTypeIdentifierPrecedesOtherTypeIdentifier(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, (NSString *)kUTTypeFileURL);
-    checkSuggestedNameAndEstimatedSize(dataInteractionSimulator.get(), @"icon.png", { 215, 174 });
+    checkTypeIdentifierAndIsNotOtherTypeIdentifier(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, (NSString *)kUTTypeFileURL);
+    checkEstimatedSize(dataInteractionSimulator.get(), { 215, 174 });
 }
 
 TEST(DataInteractionTests, ImageInLinkToInput)
@@ -225,9 +237,8 @@
     RetainPtr<DataInteractionSimulator> dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
 
-    NSURL *imageURL = [NSURL fileURLWithPath:[webView editorValue]];
-    EXPECT_WK_STREQ("icon.png", imageURL.lastPathComponent);
-    checkSuggestedNameAndEstimatedSize(dataInteractionSimulator.get(), @"icon.png", { 215, 174 });
+    EXPECT_WK_STREQ("", [webView editorValue]);
+    checkEstimatedSize(dataInteractionSimulator.get(), { 215, 174 });
     checkTypeIdentifierIsRegisteredAtIndex(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, 0);
 }
 
@@ -1003,8 +1014,8 @@
     RetainPtr<DataInteractionSimulator> dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
     [dataInteractionSimulator runFrom:CGPointMake(200, 400) to:CGPointMake(200, 150)];
     EXPECT_WK_STREQ("PASS", [webView stringByEvaluatingJavaScript:@"target.textContent"].UTF8String);
-    checkTypeIdentifierPrecedesOtherTypeIdentifier(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, (NSString *)kUTTypeFileURL);
-    checkSuggestedNameAndEstimatedSize(dataInteractionSimulator.get(), @"large-red-square.png", { 2000, 2000 });
+    checkTypeIdentifierAndIsNotOtherTypeIdentifier(dataInteractionSimulator.get(), (NSString *)kUTTypePNG, (NSString *)kUTTypeFileURL);
+    checkEstimatedSize(dataInteractionSimulator.get(), { 2000, 2000 });
 }
 
 TEST(DataInteractionTests, LinkWithEmptyHREF)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to