Title: [223020] trunk/Source/WebCore
Revision
223020
Author
[email protected]
Date
2017-10-07 00:04:07 -0700 (Sat, 07 Oct 2017)

Log Message

WebContentReader::readHTML should be shared between macOS and iOS
https://bugs.webkit.org/show_bug.cgi?id=178044

Reviewed by Wenson Hsieh.

Merged the implementations for WebContentReader::readHTML between macOS and iOS.

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::WebContentReader::readHTML):
* editing/ios/WebContentReaderIOS.mm:
(WebCore::WebContentReader::readHTML): Deleted.
* editing/mac/WebContentReaderMac.mm:
(WebCore::WebContentReader::readHTML): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223019 => 223020)


--- trunk/Source/WebCore/ChangeLog	2017-10-07 07:02:06 UTC (rev 223019)
+++ trunk/Source/WebCore/ChangeLog	2017-10-07 07:04:07 UTC (rev 223020)
@@ -1,3 +1,19 @@
+2017-10-07  Ryosuke Niwa  <[email protected]>
+
+        WebContentReader::readHTML should be shared between macOS and iOS
+        https://bugs.webkit.org/show_bug.cgi?id=178044
+
+        Reviewed by Wenson Hsieh.
+
+        Merged the implementations for WebContentReader::readHTML between macOS and iOS.
+
+        * editing/cocoa/WebContentReaderCocoa.mm:
+        (WebCore::WebContentReader::readHTML):
+        * editing/ios/WebContentReaderIOS.mm:
+        (WebCore::WebContentReader::readHTML): Deleted.
+        * editing/mac/WebContentReaderMac.mm:
+        (WebCore::WebContentReader::readHTML): Deleted.
+
 2017-10-06  Zalan Bujtas  <[email protected]>
 
         RenderTable should not hold a collection of raw pointers to RenderTableCaption

Modified: trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (223019 => 223020)


--- trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2017-10-07 07:02:06 UTC (rev 223019)
+++ trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2017-10-07 07:04:07 UTC (rev 223020)
@@ -211,6 +211,32 @@
     return true;
 }
 
+bool WebContentReader::readHTML(const String& string)
+{
+    String stringOmittingMicrosoftPrefix = string;
+    
+#if PLATFORM(MAC)
+    // This code was added to make HTML paste from Microsoft Word on Mac work, back in 2004.
+    // It's a simple-minded way to ignore the CF_HTML clipboard format, just skipping over the
+    // description part and parsing the entire context plus fragment.
+    if (string.startsWith("Version:")) {
+        size_t location = string.findIgnoringCase("<html");
+        if (location != notFound)
+            stringOmittingMicrosoftPrefix = string.substring(location);
+    }
+#endif
+
+    if (stringOmittingMicrosoftPrefix.isEmpty())
+        return false;
+
+    if (!frame.document())
+        return false;
+    Document& document = *frame.document();
+
+    addFragment(createFragmentFromMarkup(document, stringOmittingMicrosoftPrefix, emptyString(), DisallowScriptingAndPluginContent));
+    return true;
+}
+
 bool WebContentReader::readRTFD(SharedBuffer& buffer)
 {
     if (frame.settings().preferMIMETypeForImages())

Modified: trunk/Source/WebCore/editing/ios/WebContentReaderIOS.mm (223019 => 223020)


--- trunk/Source/WebCore/editing/ios/WebContentReaderIOS.mm	2017-10-07 07:02:06 UTC (rev 223019)
+++ trunk/Source/WebCore/editing/ios/WebContentReaderIOS.mm	2017-10-07 07:04:07 UTC (rev 223020)
@@ -52,15 +52,6 @@
     return false;
 }
 
-bool WebContentReader::readHTML(const String& string)
-{
-    if (!frame.document())
-        return false;
-
-    addFragment(createFragmentFromMarkup(*frame.document(), string, emptyString(), DisallowScriptingAndPluginContent));
-    return true;
-}
-
 bool WebContentReader::readURL(const URL& url, const String& title)
 {
     if (url.isEmpty())

Modified: trunk/Source/WebCore/editing/mac/WebContentReaderMac.mm (223019 => 223020)


--- trunk/Source/WebCore/editing/mac/WebContentReaderMac.mm	2017-10-07 07:02:06 UTC (rev 223019)
+++ trunk/Source/WebCore/editing/mac/WebContentReaderMac.mm	2017-10-07 07:04:07 UTC (rev 223020)
@@ -79,30 +79,6 @@
     return true;
 }
 
-bool WebContentReader::readHTML(const String& string)
-{
-    String stringOmittingMicrosoftPrefix = string;
-
-    // This code was added to make HTML paste from Microsoft Word on Mac work, back in 2004.
-    // It's a simple-minded way to ignore the CF_HTML clipboard format, just skipping over the
-    // description part and parsing the entire context plus fragment.
-    if (string.startsWith("Version:")) {
-        size_t location = string.findIgnoringCase("<html");
-        if (location != notFound)
-            stringOmittingMicrosoftPrefix = string.substring(location);
-    }
-
-    if (stringOmittingMicrosoftPrefix.isEmpty())
-        return false;
-
-    if (!frame.document())
-        return false;
-    Document& document = *frame.document();
-
-    fragment = createFragmentFromMarkup(document, stringOmittingMicrosoftPrefix, emptyString(), DisallowScriptingAndPluginContent);
-    return fragment;
-}
-
 bool WebContentReader::readURL(const URL& url, const String& title)
 {
     if (url.string().isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to