Title: [226467] trunk/Source/WebKit
Revision
226467
Author
m...@apple.com
Date
2018-01-05 15:27:53 -0800 (Fri, 05 Jan 2018)

Log Message

Add injected bundle equivalents of DOMHTMLDocument (DOMHTMLDocumentExtensions)
https://bugs.webkit.org/show_bug.cgi?id=181345

Reviewed by Tim Horton.

* WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: Declared new methods.
* WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm:
(-[WKDOMDocument createDocumentFragmentWithMarkupString:baseURL:]): Added. Calls WebCore’s
  createFragmentFromMarkup.
(-[WKDOMDocument createDocumentFragmentWithText:]): Added. Calls WebCore’s
  createFragmentFromText.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (226466 => 226467)


--- trunk/Source/WebKit/ChangeLog	2018-01-05 23:13:35 UTC (rev 226466)
+++ trunk/Source/WebKit/ChangeLog	2018-01-05 23:27:53 UTC (rev 226467)
@@ -1,3 +1,17 @@
+2018-01-05  Dan Bernstein  <m...@apple.com>
+
+        Add injected bundle equivalents of DOMHTMLDocument (DOMHTMLDocumentExtensions)
+        https://bugs.webkit.org/show_bug.cgi?id=181345
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: Declared new methods.
+        * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm:
+        (-[WKDOMDocument createDocumentFragmentWithMarkupString:baseURL:]): Added. Calls WebCore’s
+          createFragmentFromMarkup.
+        (-[WKDOMDocument createDocumentFragmentWithText:]): Added. Calls WebCore’s
+          createFragmentFromText.
+
 2018-01-05  Don Olmstead  <don.olmst...@sony.com>
 
         [Curl] Add implementation stubs for Network Cache

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h (226466 => 226467)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h	2018-01-05 23:13:35 UTC (rev 226466)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h	2018-01-05 23:27:53 UTC (rev 226467)
@@ -37,6 +37,8 @@
 
 - (WKDOMElement *)createElement:(NSString *)tagName;
 - (WKDOMText *)createTextNode:(NSString *)data;
+- (WKDOMNode *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (WKDOMNode *)createDocumentFragmentWithText:(NSString *)text WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property(readonly) WKDOMElement *body;
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm (226466 => 226467)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm	2018-01-05 23:13:35 UTC (rev 226466)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm	2018-01-05 23:27:53 UTC (rev 226467)
@@ -30,8 +30,10 @@
 
 #import "WKDOMInternals.h"
 #import <WebCore/Document.h>
+#import <WebCore/DocumentFragment.h>
 #import <WebCore/HTMLElement.h>
 #import <WebCore/Text.h>
+#import <WebCore/markup.h>
 
 @implementation WKDOMDocument
 
@@ -54,6 +56,16 @@
     return WebKit::toWKDOMElement(downcast<WebCore::Document>(*_impl).bodyOrFrameset());
 }
 
+- (WKDOMNode *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL
+{
+    return WebKit::toWKDOMNode(createFragmentFromMarkup(downcast<WebCore::Document>(*_impl), markupString, baseURL.absoluteString).ptr());
+}
+
+- (WKDOMNode *)createDocumentFragmentWithText:(NSString *)text
+{
+    return WebKit::toWKDOMNode(createFragmentFromText(downcast<WebCore::Document>(*_impl).createRange().get(), text).ptr());
+}
+
 @end
 
 #endif // WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to