[Attachment Support] Create attachment elements when dropping files on iOS
[WebKit-https.git] / Source / WebCore / editing / WebContentReader.cpp
index 72c679a52acc3e37553dd5d3525851358d5f5551..544912a7493c716807777e35eee023e4e23ea734 100644 (file)
 #include "config.h"
 #include "WebContentReader.h"
 
 #include "config.h"
 #include "WebContentReader.h"
 
+#include "Document.h"
 #include "DocumentFragment.h"
 
 namespace WebCore {
 
 #include "DocumentFragment.h"
 
 namespace WebCore {
 
+DocumentFragment& WebContentReader::ensureFragment()
+{
+    ASSERT(frame.document());
+    if (!fragment)
+        fragment = frame.document()->createDocumentFragment();
+    return *fragment;
+}
+
 void WebContentReader::addFragment(Ref<DocumentFragment>&& newFragment)
 {
     if (!fragment)
 void WebContentReader::addFragment(Ref<DocumentFragment>&& newFragment)
 {
     if (!fragment)
@@ -38,5 +47,11 @@ void WebContentReader::addFragment(Ref<DocumentFragment>&& newFragment)
         fragment->appendChild(newFragment.get());
 }
 
         fragment->appendChild(newFragment.get());
 }
 
+bool FrameWebContentReader::shouldSanitize() const
+{
+    ASSERT(frame.document());
+    return frame.document()->originIdentifierForPasteboard() != contentOrigin;
+}
+
 }
 
 }