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

Changeset 245806 in webkit


Ignore:
Timestamp:
May 27, 2019, 9:06:07 PM (7 years ago)
Author:
bshafiei@apple.com
Message:

Revert r245775. rdar://problem/35205373

Location:
branches/safari-608.1.24.20-branch
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog

    r245805 r245806  
     12019-05-27  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Revert r245775. rdar://problem/35205373
     4
    152019-05-27  Babak Shafiei  <bshafiei@apple.com>
    26
  • branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h

    r245805 r245806  
    7272#if PLATFORM(COCOA)
    7373    bool readWebArchive(SharedBuffer&) override;
    74     bool readFilePath(const String&, Optional<FloatSize> preferredPresentationSize = { }) override;
    7574    bool readFilePaths(const Vector<String>&) override;
    7675    bool readHTML(const String&) override;
    … …  
    7978    bool readImage(Ref<SharedBuffer>&&, const String& type) override;
    8079    bool readURL(const URL&, const String& title) override;
    81     bool readDataBuffer(SharedBuffer&, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize = { }) override;
     80    bool readDataBuffer(SharedBuffer&, const String& type, const String& name) override;
    8281#endif
    8382    bool readPlainText(const String&) override;
    … …  
    9695#if PLATFORM(COCOA)
    9796    bool readWebArchive(SharedBuffer&) override;
    98     bool readFilePath(const String&, Optional<FloatSize> = { }) override { return false; }
    9997    bool readFilePaths(const Vector<String>&) override { return false; }
    10098    bool readHTML(const String&) override;
    … …  
    103101    bool readImage(Ref<SharedBuffer>&&, const String&) override { return false; }
    104102    bool readURL(const URL&, const String&) override { return false; }
    105     bool readDataBuffer(SharedBuffer&, const String&, const String&, Optional<FloatSize> = { }) override { return false; }
     103    bool readDataBuffer(SharedBuffer&, const String&, const String&) override { return false; }
    106104#endif
    107105    bool readPlainText(const String&) override { return false; }
  • branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm

    r245805 r245806  
    691691#if ENABLE(ATTACHMENT_ELEMENT)
    692692
    693 static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path, Optional<FloatSize> preferredSize)
     693static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path)
    694694{
    695695    auto document = makeRef(*frame.document());
    … …  
    719719        image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, File::create(path)));
    720720        image->setAttachmentElement(WTFMove(attachment));
    721         if (preferredSize) {
    722             image->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomicString::number(preferredSize->width()));
    723             image->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomicString::number(preferredSize->height()));
    724         }
    725721        return image;
    726722    }
    … …  
    730726}
    731727
    732 static Ref<HTMLElement> attachmentForData(Frame& frame, SharedBuffer& buffer, const String& contentType, const String& name, Optional<FloatSize> preferredSize)
     728static Ref<HTMLElement> attachmentForData(Frame& frame, SharedBuffer& buffer, const String& contentType, const String& name)
    733729{
    734730    auto document = makeRef(*frame.document());
    … …  
    757753        image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, File::create(Blob::create(buffer, WTFMove(typeForAttachmentElement)), WTFMove(fileName))));
    758754        image->setAttachmentElement(WTFMove(attachment));
    759         if (preferredSize) {
    760             image->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomicString::number(preferredSize->width()));
    761             image->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomicString::number(preferredSize->height()));
    762         }
    763755        return image;
    764756    }
    … …  
    770762#endif // ENABLE(ATTACHMENT_ELEMENT)
    771763
    772 bool WebContentReader::readFilePath(const String& path, Optional<FloatSize> preferredPresentationSize)
    773 {
    774     if (path.isEmpty() || !frame.document())
     764bool WebContentReader::readFilePaths(const Vector<String>& paths)
     765{
     766    if (paths.isEmpty() || !frame.document())
    775767        return false;
    776768
    … …  
    780772
    781773#if ENABLE(ATTACHMENT_ELEMENT)
    782     if (RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled())
    783         fragment->appendChild(attachmentForFilePath(frame, path, preferredPresentationSize));
    784 #endif
    785 
    786     return true;
    787 }
    788 
    789 bool WebContentReader::readFilePaths(const Vector<String>& paths)
    790 {
    791     if (paths.isEmpty() || !frame.document())
    792         return false;
    793 
    794     for (auto& path : paths)
    795         readFilePath(path);
     774    if (RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled()) {
     775        for (auto& path : paths)
     776            fragment->appendChild(attachmentForFilePath(frame, path));
     777    }
     778#endif
    796779
    797780    return true;
    … …  
    829812}
    830813
    831 bool WebContentReader::readDataBuffer(SharedBuffer& buffer, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize)
     814bool WebContentReader::readDataBuffer(SharedBuffer& buffer, const String& type, const String& name)
    832815{
    833816    if (buffer.isEmpty())
    … …  
    845828
    846829#if ENABLE(ATTACHMENT_ELEMENT)
    847     fragment->appendChild(attachmentForData(frame, buffer, type, name, preferredPresentationSize));
     830    fragment->appendChild(attachmentForData(frame, buffer, type, name));
    848831#else
    849832    UNUSED_PARAM(type);
  • branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h

    r245805 r245806  
    137137#if PLATFORM(COCOA)
    138138    virtual bool readWebArchive(SharedBuffer&) = 0;
    139     virtual bool readFilePath(const String&, Optional<FloatSize> preferredPresentationSize = { }) = 0;
    140139    virtual bool readFilePaths(const Vector<String>&) = 0;
    141140    virtual bool readHTML(const String&) = 0;
    … …  
    144143    virtual bool readImage(Ref<SharedBuffer>&&, const String& type) = 0;
    145144    virtual bool readURL(const URL&, const String& title) = 0;
    146     virtual bool readDataBuffer(SharedBuffer&, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize = { }) = 0;
     145    virtual bool readDataBuffer(SharedBuffer&, const String& type, const String& name) = 0;
    147146#endif
    148147    virtual bool readPlainText(const String&) = 0;
  • branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm

    r245805 r245806  
    308308            if (auto buffer = strategy.readBufferFromPasteboard(i, typeForFileUpload, m_pasteboardName)) {
    309309                readURLAlongsideAttachmentIfNecessary(reader, strategy, typeForFileUpload, m_pasteboardName, i);
    310                 reader.readDataBuffer(*buffer, typeForFileUpload, info.suggestedFileName, info.preferredPresentationSize);
     310                reader.readDataBuffer(*buffer, typeForFileUpload, info.suggestedFileName);
    311311                continue;
    312312            }
    … …  
    348348        if (canReadAttachment && prefersAttachmentRepresentation(info)) {
    349349            readURLAlongsideAttachmentIfNecessary(reader, strategy, info.contentTypeForHighestFidelityItem(), m_pasteboardName, index);
    350             reader.readFilePath(WTFMove(attachmentFilePath), info.preferredPresentationSize);
     350            reader.readFilePaths({ WTFMove(attachmentFilePath) });
    351351            continue;
    352352        }
    … …  
    367367#if ENABLE(ATTACHMENT_ELEMENT)
    368368        if (canReadAttachment && result == ReaderResult::DidNotReadType)
    369             reader.readFilePath(WTFMove(attachmentFilePath), info.preferredPresentationSize);
     369            reader.readFilePaths({ WTFMove(attachmentFilePath) });
    370370#endif
    371371    }
  • branches/safari-608.1.24.20-branch/Tools/ChangeLog

    r245805 r245806  
     12019-05-27  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Revert r245775. rdar://problem/35205373
     4
    152019-05-27  Babak Shafiei  <bshafiei@apple.com>
    26
  • branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm

    r245780 r245806  
    16321632}
    16331633
    1634 TEST(WKAttachmentTestsIOS, InsertDroppedImageWithPreferredPresentationSize)
    1635 {
    1636     auto webView = webViewForTestingAttachments();
    1637     auto dragAndDropSimulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
    1638     auto item = adoptNS([[NSItemProvider alloc] init]);
    1639     [item registerData:testImageData() type:(__bridge NSString *)kUTTypePNG];
    1640     [item setPreferredPresentationSize:CGSizeMake(200, 100)];
    1641     [dragAndDropSimulator setExternalItemProviders:@[ item.get() ]];
    1642     [dragAndDropSimulator runFrom:CGPointZero to:CGPointMake(50, 50)];
    1643 
    1644     CGSize imageElementSize = [webView imageElementSize];
    1645     EXPECT_EQ(200, imageElementSize.width);
    1646     EXPECT_EQ(100, imageElementSize.height);
    1647 }
    1648 
    16491634TEST(WKAttachmentTestsIOS, InsertDroppedAttributedStringContainingAttachment)
    16501635{
Note: See TracChangeset for help on using the changeset viewer.