Title: [245806] branches/safari-608.1.24.20-branch

Diff

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-28 04:06:07 UTC (rev 245806)
@@ -1,5 +1,9 @@
 2019-05-27  Babak Shafiei  <[email protected]>
 
+        Revert r245775. rdar://problem/35205373
+
+2019-05-27  Babak Shafiei  <[email protected]>
+
         Revert r245637. rdar://problem/35205373
 
 2019-05-26  Babak Shafiei  <[email protected]>

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h	2019-05-28 04:06:07 UTC (rev 245806)
@@ -71,7 +71,6 @@
 private:
 #if PLATFORM(COCOA)
     bool readWebArchive(SharedBuffer&) override;
-    bool readFilePath(const String&, Optional<FloatSize> preferredPresentationSize = { }) override;
     bool readFilePaths(const Vector<String>&) override;
     bool readHTML(const String&) override;
     bool readRTFD(SharedBuffer&) override;
@@ -78,7 +77,7 @@
     bool readRTF(SharedBuffer&) override;
     bool readImage(Ref<SharedBuffer>&&, const String& type) override;
     bool readURL(const URL&, const String& title) override;
-    bool readDataBuffer(SharedBuffer&, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize = { }) override;
+    bool readDataBuffer(SharedBuffer&, const String& type, const String& name) override;
 #endif
     bool readPlainText(const String&) override;
 };
@@ -95,7 +94,6 @@
 private:
 #if PLATFORM(COCOA)
     bool readWebArchive(SharedBuffer&) override;
-    bool readFilePath(const String&, Optional<FloatSize> = { }) override { return false; }
     bool readFilePaths(const Vector<String>&) override { return false; }
     bool readHTML(const String&) override;
     bool readRTFD(SharedBuffer&) override;
@@ -102,7 +100,7 @@
     bool readRTF(SharedBuffer&) override;
     bool readImage(Ref<SharedBuffer>&&, const String&) override { return false; }
     bool readURL(const URL&, const String&) override { return false; }
-    bool readDataBuffer(SharedBuffer&, const String&, const String&, Optional<FloatSize> = { }) override { return false; }
+    bool readDataBuffer(SharedBuffer&, const String&, const String&) override { return false; }
 #endif
     bool readPlainText(const String&) override { return false; }
 };

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2019-05-28 04:06:07 UTC (rev 245806)
@@ -690,7 +690,7 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 
-static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path, Optional<FloatSize> preferredSize)
+static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path)
 {
     auto document = makeRef(*frame.document());
     auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document);
@@ -718,10 +718,6 @@
         auto image = HTMLImageElement::create(document);
         image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, File::create(path)));
         image->setAttachmentElement(WTFMove(attachment));
-        if (preferredSize) {
-            image->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomicString::number(preferredSize->width()));
-            image->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomicString::number(preferredSize->height()));
-        }
         return image;
     }
 
@@ -729,7 +725,7 @@
     return attachment;
 }
 
-static Ref<HTMLElement> attachmentForData(Frame& frame, SharedBuffer& buffer, const String& contentType, const String& name, Optional<FloatSize> preferredSize)
+static Ref<HTMLElement> attachmentForData(Frame& frame, SharedBuffer& buffer, const String& contentType, const String& name)
 {
     auto document = makeRef(*frame.document());
     auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document);
@@ -756,10 +752,6 @@
         auto image = HTMLImageElement::create(document);
         image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, File::create(Blob::create(buffer, WTFMove(typeForAttachmentElement)), WTFMove(fileName))));
         image->setAttachmentElement(WTFMove(attachment));
-        if (preferredSize) {
-            image->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomicString::number(preferredSize->width()));
-            image->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomicString::number(preferredSize->height()));
-        }
         return image;
     }
 
@@ -769,9 +761,9 @@
 
 #endif // ENABLE(ATTACHMENT_ELEMENT)
 
-bool WebContentReader::readFilePath(const String& path, Optional<FloatSize> preferredPresentationSize)
+bool WebContentReader::readFilePaths(const Vector<String>& paths)
 {
-    if (path.isEmpty() || !frame.document())
+    if (paths.isEmpty() || !frame.document())
         return false;
 
     auto& document = *frame.document();
@@ -779,24 +771,15 @@
         fragment = document.createDocumentFragment();
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    if (RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled())
-        fragment->appendChild(attachmentForFilePath(frame, path, preferredPresentationSize));
+    if (RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled()) {
+        for (auto& path : paths)
+            fragment->appendChild(attachmentForFilePath(frame, path));
+    }
 #endif
 
     return true;
 }
 
-bool WebContentReader::readFilePaths(const Vector<String>& paths)
-{
-    if (paths.isEmpty() || !frame.document())
-        return false;
-
-    for (auto& path : paths)
-        readFilePath(path);
-
-    return true;
-}
-
 bool WebContentReader::readURL(const URL& url, const String& title)
 {
     if (url.isEmpty())
@@ -828,7 +811,7 @@
     return true;
 }
 
-bool WebContentReader::readDataBuffer(SharedBuffer& buffer, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize)
+bool WebContentReader::readDataBuffer(SharedBuffer& buffer, const String& type, const String& name)
 {
     if (buffer.isEmpty())
         return false;
@@ -844,7 +827,7 @@
         fragment = document->createDocumentFragment();
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    fragment->appendChild(attachmentForData(frame, buffer, type, name, preferredPresentationSize));
+    fragment->appendChild(attachmentForData(frame, buffer, type, name));
 #else
     UNUSED_PARAM(type);
     UNUSED_PARAM(name);

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h	2019-05-28 04:06:07 UTC (rev 245806)
@@ -136,7 +136,6 @@
 
 #if PLATFORM(COCOA)
     virtual bool readWebArchive(SharedBuffer&) = 0;
-    virtual bool readFilePath(const String&, Optional<FloatSize> preferredPresentationSize = { }) = 0;
     virtual bool readFilePaths(const Vector<String>&) = 0;
     virtual bool readHTML(const String&) = 0;
     virtual bool readRTFD(SharedBuffer&) = 0;
@@ -143,7 +142,7 @@
     virtual bool readRTF(SharedBuffer&) = 0;
     virtual bool readImage(Ref<SharedBuffer>&&, const String& type) = 0;
     virtual bool readURL(const URL&, const String& title) = 0;
-    virtual bool readDataBuffer(SharedBuffer&, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize = { }) = 0;
+    virtual bool readDataBuffer(SharedBuffer&, const String& type, const String& name) = 0;
 #endif
     virtual bool readPlainText(const String&) = 0;
 };

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm	2019-05-28 04:06:07 UTC (rev 245806)
@@ -307,7 +307,7 @@
             auto typeForFileUpload = info.contentTypeForHighestFidelityItem();
             if (auto buffer = strategy.readBufferFromPasteboard(i, typeForFileUpload, m_pasteboardName)) {
                 readURLAlongsideAttachmentIfNecessary(reader, strategy, typeForFileUpload, m_pasteboardName, i);
-                reader.readDataBuffer(*buffer, typeForFileUpload, info.suggestedFileName, info.preferredPresentationSize);
+                reader.readDataBuffer(*buffer, typeForFileUpload, info.suggestedFileName);
                 continue;
             }
         }
@@ -347,7 +347,7 @@
         bool canReadAttachment = policy == WebContentReadingPolicy::AnyType && RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() && !attachmentFilePath.isEmpty();
         if (canReadAttachment && prefersAttachmentRepresentation(info)) {
             readURLAlongsideAttachmentIfNecessary(reader, strategy, info.contentTypeForHighestFidelityItem(), m_pasteboardName, index);
-            reader.readFilePath(WTFMove(attachmentFilePath), info.preferredPresentationSize);
+            reader.readFilePaths({ WTFMove(attachmentFilePath) });
             continue;
         }
 #endif
@@ -366,7 +366,7 @@
         }
 #if ENABLE(ATTACHMENT_ELEMENT)
         if (canReadAttachment && result == ReaderResult::DidNotReadType)
-            reader.readFilePath(WTFMove(attachmentFilePath), info.preferredPresentationSize);
+            reader.readFilePaths({ WTFMove(attachmentFilePath) });
 #endif
     }
 }

Modified: branches/safari-608.1.24.20-branch/Tools/ChangeLog (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Tools/ChangeLog	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Tools/ChangeLog	2019-05-28 04:06:07 UTC (rev 245806)
@@ -1,5 +1,9 @@
 2019-05-27  Babak Shafiei  <[email protected]>
 
+        Revert r245775. rdar://problem/35205373
+
+2019-05-27  Babak Shafiei  <[email protected]>
+
         Revert r245637. rdar://problem/35205373
 
 2019-05-27  Babak Shafiei  <[email protected]>

Modified: branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (245805 => 245806)


--- branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2019-05-28 04:06:02 UTC (rev 245805)
+++ branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2019-05-28 04:06:07 UTC (rev 245806)
@@ -1631,21 +1631,6 @@
     }
 }
 
-TEST(WKAttachmentTestsIOS, InsertDroppedImageWithPreferredPresentationSize)
-{
-    auto webView = webViewForTestingAttachments();
-    auto dragAndDropSimulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    auto item = adoptNS([[NSItemProvider alloc] init]);
-    [item registerData:testImageData() type:(__bridge NSString *)kUTTypePNG];
-    [item setPreferredPresentationSize:CGSizeMake(200, 100)];
-    [dragAndDropSimulator setExternalItemProviders:@[ item.get() ]];
-    [dragAndDropSimulator runFrom:CGPointZero to:CGPointMake(50, 50)];
-
-    CGSize imageElementSize = [webView imageElementSize];
-    EXPECT_EQ(200, imageElementSize.width);
-    EXPECT_EQ(100, imageElementSize.height);
-}
-
 TEST(WKAttachmentTestsIOS, InsertDroppedAttributedStringContainingAttachment)
 {
     auto webView = webViewForTestingAttachments();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to