WebContentReader::readWebArchive doesn't need to handle image MIME type
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 23:43:55 +0000 (23:43 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 23:43:55 +0000 (23:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176884

Reviewed by Sam Weinig.

Remove the code to handle image MIME types in the web archive on macOS since we have a separate code path
to handle images in the pasteboard directly. As far as I can tell, this code is never used in practice.

This allows merging iOS and macOS code to read web archive from the pasteboard. Also merged member functions
for handling RTFD and RTF in iOS and macOS in WebContentReaderCocoa.mm.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/WebContentReader.cpp: Added.
(WebCore::WebContentReader::addFragment): Moved from WebContentReaderIOS.mm and simplified since appendChild
knows how to add a DocumentFragment.
* editing/WebContentReader.h:
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::createFragmentAndAddResources):
(WebCore::WebContentReader::readWebArchive): Merged iOS / macOS code here.
(WebCore::WebContentReader::readRTFD): Ditto.
(WebCore::WebContentReader::readRTF): Ditto.
(WebCore::WebContentReader::readPlainText): Ditto.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::pasteWithPasteboard):
* editing/ios/WebContentReaderIOS.mm:
(WebCore::WebContentReader::readImage):
(WebCore::WebContentReader::readURL):
(WebCore::WebContentReader::readWebArchive): Moved to WebContentReaderCocoa.mm.
(WebCore::WebContentReader::readRTFD): Ditto.
(WebCore::WebContentReader::readRTF): Ditto.
(WebCore::WebContentReader::readPlainText): Ditto.
* editing/mac/WebContentReaderMac.mm:
(WebCore::WebContentReader::readWebArchive): Ditto.
(WebCore::WebContentReader::readRTFD): Ditto.
(WebCore::WebContentReader::readRTF): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222062 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/WebContentReader.cpp [new file with mode: 0644]
Source/WebCore/editing/WebContentReader.h
Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/editing/ios/WebContentReaderIOS.mm
Source/WebCore/editing/mac/WebContentReaderMac.mm

index 1cb7e7b..4e602fd 100644 (file)
@@ -1781,6 +1781,7 @@ set(WebCore_SOURCES
     editing/VisiblePosition.cpp
     editing/VisibleSelection.cpp
     editing/VisibleUnits.cpp
+    editing/WebContentReader.cpp
     editing/WrapContentsInDummySpanCommand.cpp
     editing/markup.cpp
 
index 495e0e9..7475d46 100644 (file)
@@ -1,3 +1,42 @@
+2017-09-14  Ryosuke Niwa  <rniwa@webkit.org>
+
+        WebContentReader::readWebArchive doesn't need to handle image MIME type
+        https://bugs.webkit.org/show_bug.cgi?id=176884
+
+        Reviewed by Sam Weinig.
+
+        Remove the code to handle image MIME types in the web archive on macOS since we have a separate code path
+        to handle images in the pasteboard directly. As far as I can tell, this code is never used in practice.
+
+        This allows merging iOS and macOS code to read web archive from the pasteboard. Also merged member functions
+        for handling RTFD and RTF in iOS and macOS in WebContentReaderCocoa.mm.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * editing/WebContentReader.cpp: Added.
+        (WebCore::WebContentReader::addFragment): Moved from WebContentReaderIOS.mm and simplified since appendChild
+        knows how to add a DocumentFragment.
+        * editing/WebContentReader.h:
+        * editing/cocoa/WebContentReaderCocoa.mm:
+        (WebCore::createFragmentAndAddResources):
+        (WebCore::WebContentReader::readWebArchive): Merged iOS / macOS code here.
+        (WebCore::WebContentReader::readRTFD): Ditto.
+        (WebCore::WebContentReader::readRTF): Ditto.
+        (WebCore::WebContentReader::readPlainText): Ditto.
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::pasteWithPasteboard):
+        * editing/ios/WebContentReaderIOS.mm:
+        (WebCore::WebContentReader::readImage):
+        (WebCore::WebContentReader::readURL):
+        (WebCore::WebContentReader::readWebArchive): Moved to WebContentReaderCocoa.mm.
+        (WebCore::WebContentReader::readRTFD): Ditto.
+        (WebCore::WebContentReader::readRTF): Ditto.
+        (WebCore::WebContentReader::readPlainText): Ditto.
+        * editing/mac/WebContentReaderMac.mm:
+        (WebCore::WebContentReader::readWebArchive): Ditto.
+        (WebCore::WebContentReader::readRTFD): Ditto.
+        (WebCore::WebContentReader::readRTF): Ditto.
+
 2017-09-14  Devin Rousso  <webkit@devinrousso.com>
 
         Web Inspector: make recording swizzle async
index d006ebf..f703817 100644 (file)
                9B532EA41BA928570038A827 /* SlotAssignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B532EA21BA928570038A827 /* SlotAssignment.h */; };
                9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */; };
                9B56C9AA1C89329A00C456DF /* CustomElementReactionQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */; };
+               9B61164A1F6A593300E923B8 /* WebContentReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B6116491F6A593300E923B8 /* WebContentReader.cpp */; };
                9B69D3B41B98FFE900E3512B /* HTMLSlotElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */; };
                9B69D3B51B98FFE900E3512B /* HTMLSlotElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */; };
                9B69D3B81B99100700E3512B /* JSHTMLSlotElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B69D3B61B99100700E3512B /* JSHTMLSlotElement.cpp */; };
                9B55EEE81B3E8898005342BC /* EditorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorCocoa.mm; sourceTree = "<group>"; };
                9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomElementReactionQueue.h; sourceTree = "<group>"; };
                9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomElementReactionQueue.cpp; sourceTree = "<group>"; };
+               9B6116491F6A593300E923B8 /* WebContentReader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebContentReader.cpp; sourceTree = "<group>"; };
                9B69D3B11B98FF0A00E3512B /* HTMLSlotElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLSlotElement.idl; sourceTree = "<group>"; };
                9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLSlotElement.cpp; sourceTree = "<group>"; };
                9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSlotElement.h; sourceTree = "<group>"; };
                                A883DF260F3D045D00F19BF6 /* VisibleSelection.h */,
                                93309DCE099E64910056E581 /* VisibleUnits.cpp */,
                                93309DCF099E64910056E581 /* VisibleUnits.h */,
+                               9B6116491F6A593300E923B8 /* WebContentReader.cpp */,
                                9BF433761F67619B00E1FD71 /* WebContentReader.h */,
                                93309DD4099E64910056E581 /* WrapContentsInDummySpanCommand.cpp */,
                                93309DD5099E64910056E581 /* WrapContentsInDummySpanCommand.h */,
                                CDA29A311CBF74DA00901CCF /* WebAVPlayerController.mm in Sources */,
                                1F36EA9D1E21BA1700621E25 /* WebBackgroundTaskController.mm in Sources */,
                                A56C5B9A189F34570082D13C /* WebConsoleAgent.cpp in Sources */,
+                               9B61164A1F6A593300E923B8 /* WebContentReader.cpp in Sources */,
                                9B9299B21F6796A4006723C2 /* WebContentReaderCocoa.mm in Sources */,
                                9B0811241F67CDC00074BDE2 /* WebContentReaderIOS.mm in Sources */,
                                9B9299AE1F67865B006723C2 /* WebContentReaderMac.mm in Sources */,
diff --git a/Source/WebCore/editing/WebContentReader.cpp b/Source/WebCore/editing/WebContentReader.cpp
new file mode 100644 (file)
index 0000000..72c679a
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebContentReader.h"
+
+#include "DocumentFragment.h"
+
+namespace WebCore {
+
+void WebContentReader::addFragment(Ref<DocumentFragment>&& newFragment)
+{
+    if (!fragment)
+        fragment = WTFMove(newFragment);
+    else
+        fragment->appendChild(newFragment.get());
+}
+
+}
+
index 11ace20..d0a8a52 100644 (file)
@@ -50,12 +50,10 @@ public:
     {
     }
 
-#if PLATFORM(IOS)
-    void addFragment(RefPtr<DocumentFragment>&&);
-#endif
+    void addFragment(Ref<DocumentFragment>&&);
 
 private:
-#if !(PLATFORM(GTK) || PLATFORM(WIN))
+#if PLATFORM(COCOA)
     bool readWebArchive(SharedBuffer*) override;
     bool readFilenames(const Vector<String>&) override;
     bool readHTML(const String&) override;
@@ -67,7 +65,7 @@ private:
     bool readPlainText(const String&) override;
 };
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && defined(__OBJC__)
 struct FragmentAndResources {
     RefPtr<DocumentFragment> fragment;
     Vector<Ref<ArchiveResource>> resources;
@@ -75,5 +73,5 @@ struct FragmentAndResources {
 
 RefPtr<DocumentFragment> createFragmentAndAddResources(Frame&, NSAttributedString*);
 #endif
-    
+
 }
index fbaef71..e4a7119 100644 (file)
 #include "DocumentLoader.h"
 #include "Frame.h"
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "HTMLImageElement.h"
+#include "LegacyWebArchive.h"
 #include "Page.h"
+#include "Settings.h"
+#include "WebNSAttributedStringExtras.h"
+#include "markup.h"
+#include <pal/spi/cocoa/NSAttributedStringSPI.h>
 #include <wtf/SoftLinking.h>
 
 #if PLATFORM(IOS)
@@ -63,33 +69,101 @@ RefPtr<DocumentFragment> createFragmentAndAddResources(Frame& frame, NSAttribute
 {
     if (!frame.page() || !frame.document())
         return nullptr;
-    
+
     auto& document = *frame.document();
     if (!document.isHTMLDocument() || !string)
         return nullptr;
-    
+
     bool wasDeferringCallbacks = frame.page()->defersLoading();
     if (!wasDeferringCallbacks)
         frame.page()->setDefersLoading(true);
-    
+
     auto& cachedResourceLoader = document.cachedResourceLoader();
     bool wasImagesEnabled = cachedResourceLoader.imagesEnabled();
     if (wasImagesEnabled)
         cachedResourceLoader.setImagesEnabled(false);
-    
+
     auto fragmentAndResources = createFragment(frame, string);
-    
     if (auto* loader = frame.loader().documentLoader()) {
         for (auto& resource : fragmentAndResources.resources)
             loader->addArchiveResource(WTFMove(resource));
     }
-    
+
     if (wasImagesEnabled)
         cachedResourceLoader.setImagesEnabled(true);
     if (!wasDeferringCallbacks)
         frame.page()->setDefersLoading(false);
-    
+
     return WTFMove(fragmentAndResources.fragment);
 }
 
+bool WebContentReader::readWebArchive(SharedBuffer* buffer)
+{
+    if (frame.settings().preferMIMETypeForImages())
+        return false;
+
+    if (!frame.document())
+        return false;
+
+    if (!buffer)
+        return false;
+
+    auto archive = LegacyWebArchive::create(URL(), *buffer);
+    if (!archive)
+        return false;
+
+    RefPtr<ArchiveResource> mainResource = archive->mainResource();
+    if (!mainResource)
+        return false;
+
+    auto type = mainResource->mimeType();
+    if (!frame.loader().client().canShowMIMETypeAsHTML(type))
+        return false;
+
+    // FIXME: The code in createFragmentAndAddResources calls setDefersLoading(true). Don't we need that here?
+    if (DocumentLoader* loader = frame.loader().documentLoader())
+        loader->addAllArchiveResources(*archive);
+
+    auto markupString = String::fromUTF8(mainResource->data().data(), mainResource->data().size());
+    addFragment(createFragmentFromMarkup(*frame.document(), markupString, mainResource->url(), DisallowScriptingAndPluginContent));
+    return true;
+}
+
+bool WebContentReader::readRTFD(SharedBuffer& buffer)
+{
+    if (frame.settings().preferMIMETypeForImages())
+        return false;
+
+    auto fragment = createFragmentAndAddResources(frame, adoptNS([[NSAttributedString alloc] initWithRTFD:buffer.createNSData().get() documentAttributes:nullptr]).get());
+    if (!fragment)
+        return false;
+    addFragment(fragment.releaseNonNull());
+
+    return true;
+}
+
+bool WebContentReader::readRTF(SharedBuffer& buffer)
+{
+    if (frame.settings().preferMIMETypeForImages())
+        return false;
+
+    auto fragment = createFragmentAndAddResources(frame, adoptNS([[NSAttributedString alloc] initWithRTF:buffer.createNSData().get() documentAttributes:nullptr]).get());
+    if (!fragment)
+        return false;
+    addFragment(fragment.releaseNonNull());
+
+    return true;
+}
+
+bool WebContentReader::readPlainText(const String& text)
+{
+    if (!allowPlainText)
+        return false;
+
+    addFragment(createFragmentFromText(context, [text precomposedStringWithCanonicalMapping]));
+
+    madeFragmentFromPlainText = true;
+    return true;
+}
+
 }
index 3ddd3c3..325297e 100644 (file)
@@ -233,8 +233,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, Ma
         RefPtr<DocumentFragment> fragment = client()->documentFragmentFromDelegate(i);
         if (!fragment)
             continue;
-
-        reader.addFragment(WTFMove(fragment));
+        reader.addFragment(fragment.releaseNonNull());
     }
 
     RefPtr<DocumentFragment> fragment = reader.fragment;
index bc64613..53df6f8 100644 (file)
 #import "MIMETypeRegistry.h"
 #import "Text.h"
 #import "UTIUtilities.h"
-#import "WebNSAttributedStringExtras.h"
 #import "markup.h"
 #import <MobileCoreServices/MobileCoreServices.h>
-#import <pal/spi/cocoa/NSAttributedStringSPI.h>
 #import <wtf/unicode/CharacterNames.h>
 
 namespace WebCore {
 
-void WebContentReader::addFragment(RefPtr<DocumentFragment>&& newFragment)
-{
-    if (!newFragment)
-        return;
-
-    if (!fragment) {
-        fragment = WTFMove(newFragment);
-        return;
-    }
-
-    while (auto* firstChild = newFragment->firstChild()) {
-        if (fragment->appendChild(*firstChild).hasException())
-            break;
-    }
-}
-
-bool WebContentReader::readWebArchive(SharedBuffer* buffer)
-{
-    if (!frame.document())
-        return false;
-
-    if (!buffer)
-        return false;
-
-    auto archive = LegacyWebArchive::create(URL(), *buffer);
-    if (!archive)
-        return false;
-
-    auto* mainResource = archive->mainResource();
-    if (!mainResource)
-        return false;
-
-    auto& type = mainResource->mimeType();
-    if (!frame.loader().client().canShowMIMETypeAsHTML(type))
-        return false;
-
-    // FIXME: The code in createFragmentAndAddResources calls setDefersLoading(true). Don't we need that here?
-    if (auto* loader = frame.loader().documentLoader())
-        loader->addAllArchiveResources(*archive);
-
-    auto markupString = String::fromUTF8(mainResource->data().data(), mainResource->data().size());
-    addFragment(createFragmentFromMarkup(*frame.document(), markupString, mainResource->url(), DisallowScriptingAndPluginContent));
-    return true;
-}
-
 bool WebContentReader::readFilenames(const Vector<String>&)
 {
     return false;
@@ -109,18 +62,6 @@ bool WebContentReader::readHTML(const String& string)
     return true;
 }
 
-bool WebContentReader::readRTFD(SharedBuffer& buffer)
-{
-    addFragment(createFragmentAndAddResources(frame, adoptNS([[NSAttributedString alloc] initWithRTFD:buffer.createNSData().get() documentAttributes:nullptr]).get()));
-    return fragment;
-}
-
-bool WebContentReader::readRTF(SharedBuffer& buffer)
-{
-    addFragment(createFragmentAndAddResources(frame, adoptNS([[NSAttributedString alloc] initWithRTF:buffer.createNSData().get() documentAttributes:nullptr]).get()));
-    return fragment;
-}
-
 bool WebContentReader::readImage(Ref<SharedBuffer>&& buffer, const String& type)
 {
     RetainPtr<CFStringRef> stringType = type.createCFString();
@@ -131,8 +72,11 @@ bool WebContentReader::readImage(Ref<SharedBuffer>&& buffer, const String& type)
     // FIXME: Use a blob URL instead.
     auto archive = ArchiveResource::create(WTFMove(buffer), URL::fakeURLWithRelativePart(relativeURLPart), mimeType, emptyString(), emptyString());
     ASSERT(archive);
-    addFragment(createFragmentForImageResourceAndAddResource(frame, *archive));
-    return fragment;
+    auto fragment = createFragmentForImageResourceAndAddResource(frame, *archive);
+    if (!fragment)
+        return false;
+    addFragment(fragment.releaseNonNull());
+    return true;
 }
 
 bool WebContentReader::readURL(const URL& url, const String& title)
@@ -163,17 +107,4 @@ bool WebContentReader::readURL(const URL& url, const String& title)
     return true;
 }
 
-bool WebContentReader::readPlainText(const String& text)
-{
-    if (!allowPlainText)
-        return false;
-
-    addFragment(createFragmentFromText(context, [text precomposedStringWithCanonicalMapping]));
-    if (!fragment)
-        return false;
-
-    madeFragmentFromPlainText = true;
-    return true;
-}
-
 }
index aec17b3..e6ded37 100644 (file)
 #import "RuntimeEnabledFeatures.h"
 #import "Settings.h"
 #import "Text.h"
-#import "WebNSAttributedStringExtras.h"
 #import "markup.h"
 
 namespace WebCore {
 
-bool WebContentReader::readWebArchive(SharedBuffer* buffer)
-{
-    if (frame.settings().preferMIMETypeForImages())
-        return false;
-
-    if (!frame.document())
-        return false;
-
-    if (!buffer)
-        return false;
-
-    auto archive = LegacyWebArchive::create(URL(), *buffer);
-    if (!archive)
-        return false;
-
-    RefPtr<ArchiveResource> mainResource = archive->mainResource();
-    if (!mainResource)
-        return false;
-
-    const String& type = mainResource->mimeType();
-
-    if (frame.loader().client().canShowMIMETypeAsHTML(type)) {
-        // FIXME: The code in createFragmentAndAddResources calls setDefersLoading(true). Don't we need that here?
-        if (DocumentLoader* loader = frame.loader().documentLoader())
-            loader->addAllArchiveResources(*archive);
-
-        String markupString = String::fromUTF8(mainResource->data().data(), mainResource->data().size());
-        fragment = createFragmentFromMarkup(*frame.document(), markupString, mainResource->url(), DisallowScriptingAndPluginContent);
-        return true;
-    }
-
-    if (MIMETypeRegistry::isSupportedImageMIMEType(type)) {
-        fragment = createFragmentForImageResourceAndAddResource(frame, mainResource.releaseNonNull());
-        return true;
-    }
-
-    return false;
-}
-
 bool WebContentReader::readFilenames(const Vector<String>& paths)
 {
     if (paths.isEmpty())
@@ -140,24 +100,6 @@ bool WebContentReader::readHTML(const String& string)
     return fragment;
 }
 
-bool WebContentReader::readRTFD(SharedBuffer& buffer)
-{
-    if (frame.settings().preferMIMETypeForImages())
-        return false;
-
-    fragment = createFragmentAndAddResources(frame, adoptNS([[NSAttributedString alloc] initWithRTFD:buffer.createNSData().get() documentAttributes:nullptr]).get());
-    return fragment;
-}
-
-bool WebContentReader::readRTF(SharedBuffer& buffer)
-{
-    if (frame.settings().preferMIMETypeForImages())
-        return false;
-
-    fragment = createFragmentAndAddResources(frame, adoptNS([[NSAttributedString alloc] initWithRTF:buffer.createNSData().get() documentAttributes:nullptr]).get());
-    return fragment;
-}
-
 bool WebContentReader::readImage(Ref<SharedBuffer>&& buffer, const String& type)
 {
     ASSERT(type.contains('/'));
@@ -189,17 +131,4 @@ bool WebContentReader::readURL(const URL& url, const String& title)
     return true;
 }
 
-bool WebContentReader::readPlainText(const String& text)
-{
-    if (!allowPlainText)
-        return false;
-
-    fragment = createFragmentFromText(context, [text precomposedStringWithCanonicalMapping]);
-    if (!fragment)
-        return false;
-
-    madeFragmentFromPlainText = true;
-    return true;
-}
-    
 }