<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209307] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209307">209307</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2016-12-03 15:49:32 -0800 (Sat, 03 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
https://bugs.webkit.org/show_bug.cgi?id=165276
<rdar://problem/29467040>
Reviewed by Darin Adler.
Source/WebCore:
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::write): Make sure to put the client data on the pasteboard,
like we do on macOS.
Source/WebKit2:
Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
* WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
* WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
based on InjectedBundlePageEditorClient.
(API::InjectedBundle::EditorClient::~EditorClient):
(API::InjectedBundle::EditorClient::shouldBeginEditing):
(API::InjectedBundle::EditorClient::shouldEndEditing):
(API::InjectedBundle::EditorClient::shouldInsertNode):
(API::InjectedBundle::EditorClient::shouldInsertText):
(API::InjectedBundle::EditorClient::shouldDeleteRange):
(API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
(API::InjectedBundle::EditorClient::shouldApplyStyle):
(API::InjectedBundle::EditorClient::didBeginEditing):
(API::InjectedBundle::EditorClient::didEndEditing):
(API::InjectedBundle::EditorClient::didChange):
(API::InjectedBundle::EditorClient::didChangeSelection):
(API::InjectedBundle::EditorClient::willWriteToPasteboard):
(API::InjectedBundle::EditorClient::getPasteboardDataForRange):
(API::InjectedBundle::EditorClient::didWriteToPasteboard):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
the new delegate protocol, currently comprising three methods corresponding to
willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
the specified range handle.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
(-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
(+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
InjectedBundleRangeHandle for the specified object.
(-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
(-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
(-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
(WebKit::wrapper):
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetEditorClient): Updated for WebPage change.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
delegate.
(-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
delegate methods. Instantiates a Client and sets it on the WebPage.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
Declared new _editingDelegate property.
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
for the range’s owner document.
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
(WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
initialize().
(WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
(WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
(WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
(WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
(WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
(WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
(WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
(WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
(WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
(WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
(WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
(WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
(WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
(WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
API::InjectedBundle::EditorClient.
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::shouldDeleteRange): Ditto.
(WebKit::WebEditorClient::shouldBeginEditing): Ditto.
(WebKit::WebEditorClient::shouldEndEditing): Ditto.
(WebKit::WebEditorClient::shouldInsertNode): Ditto.
(WebKit::WebEditorClient::shouldInsertText): Ditto.
(WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
(WebKit::WebEditorClient::shouldApplyStyle): Ditto.
(WebKit::WebEditorClient::didBeginEditing): Ditto.
(WebKit::WebEditorClient::respondToChangedContents): Ditto.
(WebKit::WebEditorClient::respondToChangedSelection): Ditto.
(WebKit::WebEditorClient::didEndEditing): Ditto.
(WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
(WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
(WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize m_editorClient.
(WebKit::WebPage::setInjectedBundleEditorClient): Replaces
initializeInjectedBundleEditorClient and just sets m_editorClient.
(WebKit::WebPage::close): Resets m_editorClient.
* WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm: Added.
(-[BundleEditingDelegateRemoteObject willWriteToPasteboard:]):
(-[BundleEditingDelegateRemoteObject didWriteToPasteboard]):
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm: Added.
(-[BundleEditingDelegatePlugIn webProcessPlugIn:didCreateBrowserContextController:]):
(-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:willWriteRangeToPasteboard:]):
(-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:pasteboardDataForRange:]):
(-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextControllerDidWriteToPasteboard:]):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformiosPlatformPasteboardIOSmm">trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaAPIObjectmm">trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInFrameh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInFramemm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePagecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllermm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllerPrivateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleRangeHandlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleRangeHandleh">trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageEditorClientcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageEditorClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIAPIInjectedBundleEditorClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInEditingDelegateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandleh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandlemm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandleInternalh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaBundleEditingDelegatemm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaBundleEditingDelegatePlugInmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaBundleEditingDelegateProtocolh">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebCore/ChangeLog        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-12-03 Dan Bernstein <mitz@apple.com>
+
+ [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
+ https://bugs.webkit.org/show_bug.cgi?id=165276
+ <rdar://problem/29467040>
+
+ Reviewed by Darin Adler.
+
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::write): Make sure to put the client data on the pasteboard,
+ like we do on macOS.
+
</ins><span class="cx"> 2016-12-03 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> [CSS Parser] Remove line numbers from StyleRule.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosPlatformPasteboardIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -130,6 +130,10 @@
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
</span><span class="cx">
</span><ins>+ ASSERT(content.clientTypes.size() == content.clientData.size());
+ for (size_t i = 0, size = content.clientTypes.size(); i < size; ++i)
+ [representations setValue:content.clientData[i]->createNSData().get() forKey:content.clientTypes[i]];
+
</ins><span class="cx"> if (content.dataInWebArchiveFormat) {
</span><span class="cx"> [representations setValue:(NSData *)content.dataInWebArchiveFormat->createNSData().get() forKey:WebArchivePboardType];
</span><span class="cx"> // Flag for UIKit to know that this copy contains rich content. This will trigger a two-step paste.
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/ChangeLog        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -1,3 +1,120 @@
</span><ins>+2016-12-03 Dan Bernstein <mitz@apple.com>
+
+ [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
+ https://bugs.webkit.org/show_bug.cgi?id=165276
+ <rdar://problem/29467040>
+
+ Reviewed by Darin Adler.
+
+ Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
+
+ * Shared/Cocoa/APIObject.mm:
+ (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
+
+ * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
+ WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
+
+ * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
+ based on InjectedBundlePageEditorClient.
+ (API::InjectedBundle::EditorClient::~EditorClient):
+ (API::InjectedBundle::EditorClient::shouldBeginEditing):
+ (API::InjectedBundle::EditorClient::shouldEndEditing):
+ (API::InjectedBundle::EditorClient::shouldInsertNode):
+ (API::InjectedBundle::EditorClient::shouldInsertText):
+ (API::InjectedBundle::EditorClient::shouldDeleteRange):
+ (API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
+ (API::InjectedBundle::EditorClient::shouldApplyStyle):
+ (API::InjectedBundle::EditorClient::didBeginEditing):
+ (API::InjectedBundle::EditorClient::didEndEditing):
+ (API::InjectedBundle::EditorClient::didChange):
+ (API::InjectedBundle::EditorClient::didChangeSelection):
+ (API::InjectedBundle::EditorClient::willWriteToPasteboard):
+ (API::InjectedBundle::EditorClient::getPasteboardDataForRange):
+ (API::InjectedBundle::EditorClient::didWriteToPasteboard):
+
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
+ the new delegate protocol, currently comprising three methods corresponding to
+ willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
+
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
+ (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
+ the specified range handle.
+
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
+ (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
+ (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
+ InjectedBundleRangeHandle for the specified object.
+ (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
+ (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
+ (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
+
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
+ (WebKit::wrapper):
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageSetEditorClient): Updated for WebPage change.
+
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+ (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
+ delegate.
+ (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
+ Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
+ delegate methods. Instantiates a Client and sets it on the WebPage.
+
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
+ Declared new _editingDelegate property.
+
+ * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+ (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
+ for the range’s owner document.
+ * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
+
+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
+ (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
+ initialize().
+ (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
+ (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
+ (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
+ API::InjectedBundle::EditorClient.
+
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ (WebKit::WebEditorClient::shouldDeleteRange): Ditto.
+ (WebKit::WebEditorClient::shouldBeginEditing): Ditto.
+ (WebKit::WebEditorClient::shouldEndEditing): Ditto.
+ (WebKit::WebEditorClient::shouldInsertNode): Ditto.
+ (WebKit::WebEditorClient::shouldInsertText): Ditto.
+ (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
+ (WebKit::WebEditorClient::shouldApplyStyle): Ditto.
+ (WebKit::WebEditorClient::didBeginEditing): Ditto.
+ (WebKit::WebEditorClient::respondToChangedContents): Ditto.
+ (WebKit::WebEditorClient::respondToChangedSelection): Ditto.
+ (WebKit::WebEditorClient::didEndEditing): Ditto.
+ (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
+ (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
+ (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage): Initialize m_editorClient.
+ (WebKit::WebPage::setInjectedBundleEditorClient): Replaces
+ initializeInjectedBundleEditorClient and just sets m_editorClient.
+ (WebKit::WebPage::close): Resets m_editorClient.
+
+ * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
+
</ins><span class="cx"> 2016-12-02 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Add a WebView private configuration for changing the WebContent update frequency
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> #import "WKWebProcessPlugInInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInNodeHandleInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInPageGroupInternal.h"
</span><ins>+#import "WKWebProcessPlugInRangeHandleInternal.h"
</ins><span class="cx"> #import "WKWebProcessPlugInScriptWorldInternal.h"
</span><span class="cx"> #import "WKWebsiteDataRecordInternal.h"
</span><span class="cx"> #import "WKWebsiteDataStoreInternal.h"
</span><span class="lines">@@ -284,6 +285,10 @@
</span><span class="cx"> wrapper = [WKWebProcessPlugInPageGroup alloc];
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case Type::BundleRangeHandle:
+ wrapper = [WKWebProcessPlugInRangeHandle alloc];
+ break;
+
</ins><span class="cx"> case Type::BundleScriptWorld:
</span><span class="cx"> wrapper = [WKWebProcessPlugInScriptWorld alloc];
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -787,6 +787,9 @@
</span><span class="cx">                 373D122D18A4B6EB0066D9CC /* WKWebProcessPlugInFramePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 373D122C18A4B6A80066D9CC /* WKWebProcessPlugInFramePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 3743925818BC4C60001C8675 /* WKUIDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 374436881820E7240049579F /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374436871820E7240049579F /* WKObject.mm */; };
</span><ins>+                3749421A1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */; };
+                3749421B1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                3749421D1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */; };
</ins><span class="cx">                 3754D5451B3A29FD003A4C7F /* NSInvocationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */; };
</span><span class="cx">                 375E0E131D66432700EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E111D66432700EFEC2C /* WKNSNumber.mm */; };
</span><span class="cx">                 375E0E141D66432700EFEC2C /* WKNSNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 375E0E121D66432700EFEC2C /* WKNSNumber.h */; };
</span><span class="lines">@@ -804,6 +807,8 @@
</span><span class="cx">                 37694525184FC6B600CDE21F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; };
</span><span class="cx">                 37716A5A195B910500EE8B1B /* ProcessAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37716A59195B910500EE8B1B /* ProcessAssertion.cpp */; };
</span><span class="cx">                 377216B81A4E6BE000DCA718 /* _WKRenderingProgressEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 377216B71A4E6BE000DCA718 /* _WKRenderingProgressEvents.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                3775122F1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                377512311DF0DEE2008A351C /* APIInjectedBundleEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */; };
</ins><span class="cx">                 377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 377EAD4817E2C77B002D193D /* WKUserContentInjectedFrames.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 377EAD4917E2C77B002D193D /* WKUserScriptInjectionTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4717E2C77B002D193D /* WKUserScriptInjectionTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2861,6 +2866,9 @@
</span><span class="cx">                 373D122C18A4B6A80066D9CC /* WKWebProcessPlugInFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInFramePrivate.h; sourceTree = "<group>"; };
</span><span class="cx">                 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUIDelegatePrivate.h; sourceTree = "<group>"; };
</span><span class="cx">                 374436871820E7240049579F /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
</span><ins>+                374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInRangeHandle.mm; sourceTree = "<group>"; };
+                374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInRangeHandle.h; sourceTree = "<group>"; };
+                3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInRangeHandleInternal.h; sourceTree = "<group>"; };
</ins><span class="cx">                 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSInvocationSPI.h; sourceTree = "<group>"; };
</span><span class="cx">                 375E0E111D66432700EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; };
</span><span class="cx">                 375E0E121D66432700EFEC2C /* WKNSNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSNumber.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -2875,6 +2883,8 @@
</span><span class="cx">                 3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleFormClient.h; sourceTree = "<group>"; };
</span><span class="cx">                 37716A59195B910500EE8B1B /* ProcessAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessAssertion.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 377216B71A4E6BE000DCA718 /* _WKRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKRenderingProgressEvents.h; sourceTree = "<group>"; };
</span><ins>+                3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInEditingDelegate.h; sourceTree = "<group>"; };
+                377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleEditorClient.h; sourceTree = "<group>"; };
</ins><span class="cx">                 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeclarationSpecifiers.h; sourceTree = "<group>"; };
</span><span class="cx">                 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentInjectedFrames.h; sourceTree = "<group>"; };
</span><span class="cx">                 377EAD4717E2C77B002D193D /* WKUserScriptInjectionTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptInjectionTime.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4955,6 +4965,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */,
</span><span class="cx">                                 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */,
</span><ins>+                                3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */,
</ins><span class="cx">                                 3795789B18AD4F1100B9ED2E /* WKWebProcessPlugInFormDelegatePrivate.h */,
</span><span class="cx">                                 1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */,
</span><span class="cx">                                 1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */,
</span><span class="lines">@@ -4970,6 +4981,9 @@
</span><span class="cx">                                 1FB00AC4185F76460019142E /* WKWebProcessPlugInPageGroup.h */,
</span><span class="cx">                                 1FB00AC5185F76460019142E /* WKWebProcessPlugInPageGroup.mm */,
</span><span class="cx">                                 1FB00AC6185F76460019142E /* WKWebProcessPlugInPageGroupInternal.h */,
</span><ins>+                                374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */,
+                                374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */,
+                                3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */,
</ins><span class="cx">                                 1F0181721858DC1600F92884 /* WKWebProcessPlugInScriptWorld.h */,
</span><span class="cx">                                 1F0181731858DC1600F92884 /* WKWebProcessPlugInScriptWorld.mm */,
</span><span class="cx">                                 1F0181741858DC1600F92884 /* WKWebProcessPlugInScriptWorldInternal.h */,
</span><span class="lines">@@ -6660,6 +6674,7 @@
</span><span class="cx">                                 BC204EE811C83EB7008F3375 /* c */,
</span><span class="cx">                                 1F0181681858DC1500F92884 /* Cocoa */,
</span><span class="cx">                                 BC989D4516181691000D46D3 /* mac */,
</span><ins>+                                377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */,
</ins><span class="cx">                                 076E884F1A13CBC6005E90FC /* APIInjectedBundlePageContextMenuClient.h */,
</span><span class="cx">                         );
</span><span class="cx">                         path = API;
</span><span class="lines">@@ -7789,6 +7804,7 @@
</span><span class="cx">                                 831EEBBD1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.h in Headers */,
</span><span class="cx">                                 832AE2521BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h in Headers */,
</span><span class="cx">                                 834B25121A842C8700CFB150 /* NetworkCacheStatistics.h in Headers */,
</span><ins>+                                377512311DF0DEE2008A351C /* APIInjectedBundleEditorClient.h in Headers */,
</ins><span class="cx">                                 E4436ECF1A0D040B00EAD204 /* NetworkCacheStorage.h in Headers */,
</span><span class="cx">                                 8310428B1BD6B66F00A715E4 /* NetworkCacheSubresourcesEntry.h in Headers */,
</span><span class="cx">                                 513A164D1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h in Headers */,
</span><span class="lines">@@ -8016,6 +8032,7 @@
</span><span class="cx">                                 515BE1791D53FE8F00DD7C68 /* WebGamepadProvider.h in Headers */,
</span><span class="cx">                                 BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */,
</span><span class="cx">                                 BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */,
</span><ins>+                                3749421B1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h in Headers */,
</ins><span class="cx">                                 BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */,
</span><span class="cx">                                 BC54CACB12D64291005C67B0 /* WebGeolocationManagerProxy.h in Headers */,
</span><span class="cx">                                 BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */,
</span><span class="lines">@@ -8065,6 +8082,7 @@
</span><span class="cx">                                 BC1DFEA412B31F87005DF730 /* WebOpenPanelResultListenerProxy.h in Headers */,
</span><span class="cx">                                 BC032D8F10F437A00058C15A /* WebPage.h in Headers */,
</span><span class="cx">                                 8372DB291A67562800C697C5 /* WebPageDiagnosticLoggingClient.h in Headers */,
</span><ins>+                                3775122F1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h in Headers */,
</ins><span class="cx">                                 BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */,
</span><span class="cx">                                 BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */,
</span><span class="cx">                                 BC7B621512A4219A00D174A4 /* WebPageGroupProxy.h in Headers */,
</span><span class="lines">@@ -8125,6 +8143,7 @@
</span><span class="cx">                                 BCC5715B115ADAEF001CCAF9 /* WebSystemInterface.h in Headers */,
</span><span class="cx">                                 51032F19180F73BB00961BB7 /* WebToDatabaseProcessConnection.h in Headers */,
</span><span class="cx">                                 BCA0EF7F12331E78007D3CFB /* WebUndoStep.h in Headers */,
</span><ins>+                                3749421D1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h in Headers */,
</ins><span class="cx">                                 1AAF08AE1926936700B6390C /* WebUserContentController.h in Headers */,
</span><span class="cx">                                 7C065F2C1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h in Headers */,
</span><span class="cx">                                 1AAF08B819269E6D00B6390C /* WebUserContentControllerMessages.h in Headers */,
</span><span class="lines">@@ -9770,6 +9789,7 @@
</span><span class="cx">                                 0FCB4E5018BBE044000FCFC9 /* WKGeolocationProviderIOS.mm in Sources */,
</span><span class="cx">                                 0FCB4E5118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm in Sources */,
</span><span class="cx">                                 0F174AA7142AAC610039250F /* WKGeometry.cpp in Sources */,
</span><ins>+                                3749421A1DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm in Sources */,
</ins><span class="cx">                                 B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */,
</span><span class="cx">                                 83EE575B1DB7D61100C74C50 /* WebValidationMessageClient.cpp in Sources */,
</span><span class="cx">                                 5110AE0C133C16CB0072717A /* WKIconDatabase.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIAPIInjectedBundleEditorClienth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#pragma once
+
+#include <WebCore/EditorInsertAction.h>
+#include <WebCore/SharedBuffer.h>
+#include <WebCore/TextAffinity.h>
+#include <wtf/Forward.h>
+
+namespace WebCore {
+class CSSStyleDeclaration;
+class Node;
+class Range;
+}
+
+namespace WebKit {
+class WebPage;
+}
+
+namespace API {
+
+namespace InjectedBundle {
+
+class EditorClient {
+public:
+ virtual ~EditorClient() { }
+
+ virtual bool shouldBeginEditing(WebKit::WebPage&, WebCore::Range*) { return true; }
+ virtual bool shouldEndEditing(WebKit::WebPage&, WebCore::Range*) { return true; }
+ virtual bool shouldInsertNode(WebKit::WebPage&, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) { return true; }
+ virtual bool shouldInsertText(WebKit::WebPage&, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) { return true; }
+ virtual bool shouldDeleteRange(WebKit::WebPage&, WebCore::Range*) { return true; }
+ virtual bool shouldChangeSelectedRange(WebKit::WebPage&, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity affinity, bool stillSelecting) { return true; }
+ virtual bool shouldApplyStyle(WebKit::WebPage&, WebCore::CSSStyleDeclaration*, WebCore::Range*) { return true; }
+ virtual void didBeginEditing(WebKit::WebPage&, StringImpl* notificationName) { }
+ virtual void didEndEditing(WebKit::WebPage&, StringImpl* notificationName) { }
+ virtual void didChange(WebKit::WebPage&, StringImpl* notificationName) { }
+ virtual void didChangeSelection(WebKit::WebPage&, StringImpl* notificationName) { }
+ virtual void willWriteToPasteboard(WebKit::WebPage&, WebCore::Range*) { }
+ virtual void getPasteboardDataForRange(WebKit::WebPage&, WebCore::Range*, Vector<WTF::String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) { }
+ virtual void didWriteToPasteboard(WebKit::WebPage&) { }
+};
+
+} // namespace InjectedBundle
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInEditingDelegateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <WebKit/WKWebProcessPlugInBrowserContextController.h>
+#import <WebKit/WKWebProcessPlugInRangeHandle.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@protocol WKWebProcessPlugInEditingDelegate <NSObject>
+
+@optional
+
+- (void)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller willWriteRangeToPasteboard:(WKWebProcessPlugInRangeHandle *)range;
+- (NSDictionary<NSString *, NSData *> *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller pasteboardDataForRange:(WKWebProcessPlugInRangeHandle *)range;
+- (void)_webProcessPlugInBrowserContextControllerDidWriteToPasteboard:(WKWebProcessPlugInBrowserContextController *)controller;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> @class _WKFrameHandle;
</span><span class="cx"> @class WKWebProcessPlugInHitTestResult;
</span><span class="cx"> @class WKWebProcessPlugInNodeHandle;
</span><ins>+@class WKWebProcessPlugInRangeHandle;
</ins><span class="cx"> @class WKWebProcessPlugInScriptWorld;
</span><span class="cx">
</span><span class="cx"> WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
</span><span class="lines">@@ -53,6 +54,7 @@
</span><span class="cx"> - (JSContext *)jsContextForWorld:(WKWebProcessPlugInScriptWorld *)world;
</span><span class="cx"> - (WKWebProcessPlugInHitTestResult *)hitTest:(CGPoint)point;
</span><span class="cx"> - (JSValue *)jsNodeForNodeHandle:(WKWebProcessPlugInNodeHandle *)nodeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world;
</span><ins>+- (JSValue *)jsRangeForRangeHandle:(WKWebProcessPlugInRangeHandle *)rangeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</ins><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import "WKWebProcessPlugInBrowserContextControllerInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInHitTestResultInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInNodeHandleInternal.h"
</span><ins>+#import "WKWebProcessPlugInRangeHandleInternal.h"
</ins><span class="cx"> #import "WKWebProcessPlugInScriptWorldInternal.h"
</span><span class="cx"> #import "WebProcess.h"
</span><span class="cx"> #import "_WKFrameHandleInternal.h"
</span><span class="lines">@@ -81,6 +82,12 @@
</span><span class="cx"> return [JSValue valueWithJSValueRef:valueRef inContext:[self jsContextForWorld:world]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (JSValue *)jsRangeForRangeHandle:(WKWebProcessPlugInRangeHandle *)rangeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world
+{
+ JSValueRef valueRef = _frame->jsWrapperForWorld(&[rangeHandle _rangeHandle], &[world _scriptWorld]);
+ return [JSValue valueWithJSValueRef:valueRef inContext:[self jsContextForWorld:world]];
+}
+
</ins><span class="cx"> - (WKWebProcessPlugInBrowserContextController *)_browserContextController
</span><span class="cx"> {
</span><span class="cx"> return wrapper(*_frame->page());
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandleh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+#import <JavaScriptCore/JavaScriptCore.h>
+
+@class WKWebProcessPlugInFrame;
+
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface WKWebProcessPlugInRangeHandle : NSObject
+
++ (WKWebProcessPlugInRangeHandle *)rangeHandleWithJSValue:(JSValue *)value inContext:(JSContext *)context;
+
+@property (nonatomic, readonly) WKWebProcessPlugInFrame *frame;
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandlemm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import "config.h"
+#import "WKWebProcessPlugInRangeHandleInternal.h"
+
+#if WK_API_ENABLED
+
+#import "InjectedBundleNodeHandle.h"
+#import "WKWebProcessPlugInFrameInternal.h"
+
+using namespace WebKit;
+
+@implementation WKWebProcessPlugInRangeHandle {
+ API::ObjectStorage<InjectedBundleRangeHandle> _rangeHandle;
+}
+
+- (void)dealloc
+{
+ _rangeHandle->~InjectedBundleRangeHandle();
+ [super dealloc];
+}
+
++ (WKWebProcessPlugInRangeHandle *)rangeHandleWithJSValue:(JSValue *)value inContext:(JSContext *)context
+{
+ JSContextRef contextRef = [context JSGlobalContextRef];
+ JSObjectRef objectRef = JSValueToObject(contextRef, [value JSValueRef], 0);
+ auto rangeHandle = InjectedBundleRangeHandle::getOrCreate(contextRef, objectRef);
+ if (!rangeHandle)
+ return nil;
+
+ return [wrapper(*rangeHandle.leakRef()) autorelease];
+}
+
+- (WKWebProcessPlugInFrame *)frame
+{
+ return [wrapper(*_rangeHandle->document()->documentFrame().leakRef()) autorelease];
+}
+
+- (InjectedBundleRangeHandle&)_rangeHandle
+{
+ return *_rangeHandle;
+}
+
+// MARK: WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+ return *_rangeHandle;
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandleInternalh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import "WKWebProcessPlugInRangeHandle.h"
+
+#if WK_API_ENABLED
+
+#import "InjectedBundleRangeHandle.h"
+#import "WKObject.h"
+
+namespace WebKit {
+
+inline WKWebProcessPlugInRangeHandle *wrapper(InjectedBundleRangeHandle& rangeHandle)
+{
+ ASSERT([rangeHandle.wrapper() isKindOfClass:[WKWebProcessPlugInRangeHandle class]]);
+ return (WKWebProcessPlugInRangeHandle *)rangeHandle.wrapper();
+}
+
+}
+
+@interface WKWebProcessPlugInRangeHandle () <WKObject>
+
+@property (readonly) WebKit::InjectedBundleRangeHandle& _rangeHandle;
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "APIURLRequest.h"
</span><span class="cx"> #include "InjectedBundleBackForwardList.h"
</span><span class="cx"> #include "InjectedBundleNodeHandle.h"
</span><ins>+#include "InjectedBundlePageEditorClient.h"
</ins><span class="cx"> #include "InjectedBundlePageFormClient.h"
</span><span class="cx"> #include "InjectedBundlePageUIClient.h"
</span><span class="cx"> #include "PageBanner.h"
</span><span class="lines">@@ -83,7 +84,7 @@
</span><span class="cx">
</span><span class="cx"> void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClientBase* wkClient)
</span><span class="cx"> {
</span><del>- toImpl(pageRef)->initializeInjectedBundleEditorClient(wkClient);
</del><ins>+ toImpl(pageRef)->setInjectedBundleEditorClient(wkClient ? std::make_unique<InjectedBundlePageEditorClient>(*wkClient) : std::make_unique<API::InjectedBundle::EditorClient>());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClientBase* wkClient)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #import "WKRetainPtr.h"
</span><span class="cx"> #import "WKStringCF.h"
</span><span class="cx"> #import "WKURLRequestNS.h"
</span><ins>+#import "WKWebProcessPlugInEditingDelegate.h"
</ins><span class="cx"> #import "WKWebProcessPlugInFrameInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInFormDelegatePrivate.h"
</span><span class="lines">@@ -50,6 +51,7 @@
</span><span class="cx"> #import "WKWebProcessPlugInLoadDelegate.h"
</span><span class="cx"> #import "WKWebProcessPlugInNodeHandleInternal.h"
</span><span class="cx"> #import "WKWebProcessPlugInPageGroupInternal.h"
</span><ins>+#import "WKWebProcessPlugInRangeHandleInternal.h"
</ins><span class="cx"> #import "WKWebProcessPlugInScriptWorldInternal.h"
</span><span class="cx"> #import "WeakObjCPtr.h"
</span><span class="cx"> #import "WebPage.h"
</span><span class="lines">@@ -74,6 +76,7 @@
</span><span class="cx"> API::ObjectStorage<WebPage> _page;
</span><span class="cx"> WeakObjCPtr<id <WKWebProcessPlugInLoadDelegate>> _loadDelegate;
</span><span class="cx"> WeakObjCPtr<id <WKWebProcessPlugInFormDelegatePrivate>> _formDelegate;
</span><ins>+ WeakObjCPtr<id <WKWebProcessPlugInEditingDelegate>> _editingDelegate;
</ins><span class="cx">
</span><span class="cx"> RetainPtr<_WKRemoteObjectRegistry> _remoteObjectRegistry;
</span><span class="cx"> }
</span><span class="lines">@@ -565,6 +568,73 @@
</span><span class="cx"> _page->setInjectedBundleFormClient(nullptr);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (id <WKWebProcessPlugInEditingDelegate>)_editingDelegate
+{
+ return _editingDelegate.getAutoreleased();
+}
+
+- (void)_setEditingDelegate:(id <WKWebProcessPlugInEditingDelegate>)editingDelegate
+{
+ _editingDelegate = editingDelegate;
+
+ class Client final : public API::InjectedBundle::EditorClient {
+ public:
+ explicit Client(WKWebProcessPlugInBrowserContextController *controller)
+ : m_controller { controller }
+ , m_delegateMethods { m_controller->_editingDelegate.get() }
+ {
+ }
+
+ private:
+ void willWriteToPasteboard(WebKit::WebPage&, WebCore::Range* range) final
+ {
+ if (!m_delegateMethods.willWriteToPasteboard)
+ return;
+
+ [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller willWriteRangeToPasteboard:wrapper(*InjectedBundleRangeHandle::getOrCreate(range).get())];
+ }
+
+ void getPasteboardDataForRange(WebKit::WebPage&, WebCore::Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final
+ {
+ if (!m_delegateMethods.getPasteboardDataForRange)
+ return;
+
+ auto dataByType = [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller pasteboardDataForRange:wrapper(*InjectedBundleRangeHandle::getOrCreate(range).get())];
+ for (NSString *type in dataByType) {
+ pasteboardTypes.append(type);
+ pasteboardData.append(SharedBuffer::wrapNSData(dataByType[type]));
+ };
+ }
+
+ void didWriteToPasteboard(WebKit::WebPage&) final
+ {
+ if (!m_delegateMethods.didWriteToPasteboard)
+ return;
+
+ [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextControllerDidWriteToPasteboard:m_controller];
+ }
+
+ WKWebProcessPlugInBrowserContextController *m_controller;
+ const struct DelegateMethods {
+ DelegateMethods(RetainPtr<id <WKWebProcessPlugInEditingDelegate>> delegate)
+ : willWriteToPasteboard([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willWriteRangeToPasteboard:)])
+ , getPasteboardDataForRange([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:pasteboardDataForRange:)])
+ , didWriteToPasteboard([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextControllerDidWriteToPasteboard:)])
+ {
+ }
+
+ bool willWriteToPasteboard;
+ bool getPasteboardDataForRange;
+ bool didWriteToPasteboard;
+ } m_delegateMethods;
+ };
+
+ if (editingDelegate)
+ _page->setInjectedBundleEditorClient(std::make_unique<Client>(self));
+ else
+ _page->setInjectedBundleEditorClient(nullptr);
+}
+
</ins><span class="cx"> - (BOOL)_defersLoading
</span><span class="cx"> {
</span><span class="cx"> return _page->defersLoading();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllerPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx">
</span><span class="cx"> @class WKBrowsingContextHandle;
</span><span class="cx"> @class _WKRemoteObjectRegistry;
</span><ins>+@protocol WKWebProcessPlugInEditingDelegate;
</ins><span class="cx"> @protocol WKWebProcessPlugInFormDelegatePrivate;
</span><span class="cx">
</span><span class="cx"> @interface WKWebProcessPlugInBrowserContextController (WKPrivate)
</span><span class="lines">@@ -42,6 +43,7 @@
</span><span class="cx"> @property (nonatomic, readonly) _WKRemoteObjectRegistry *_remoteObjectRegistry;
</span><span class="cx">
</span><span class="cx"> @property (weak, setter=_setFormDelegate:) id <WKWebProcessPlugInFormDelegatePrivate> _formDelegate;
</span><ins>+@property (weak, setter=_setEditingDelegate:) id <WKWebProcessPlugInEditingDelegate> _editingDelegate WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</ins><span class="cx">
</span><span class="cx"> @property (nonatomic, setter=_setDefersLoading:) BOOL _defersLoading;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleRangeHandlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "InjectedBundleRangeHandle.h"
</span><span class="cx">
</span><ins>+#include "InjectedBundleNodeHandle.h"
</ins><span class="cx"> #include "ShareableBitmap.h"
</span><span class="cx"> #include "WebImage.h"
</span><span class="cx"> #include <JavaScriptCore/APICast.h>
</span><span class="lines">@@ -96,6 +97,11 @@
</span><span class="cx"> return m_range.get();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<InjectedBundleNodeHandle> InjectedBundleRangeHandle::document()
+{
+ return InjectedBundleNodeHandle::getOrCreate(m_range->ownerDocument());
+}
+
</ins><span class="cx"> WebCore::IntRect InjectedBundleRangeHandle::boundingRectInWindowCoordinates() const
</span><span class="cx"> {
</span><span class="cx"> FloatRect boundingRect = m_range->absoluteBoundingRect();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleRangeHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class InjectedBundleNodeHandle;
</ins><span class="cx"> class InjectedBundleScriptWorld;
</span><span class="cx"> class WebImage;
</span><span class="cx">
</span><span class="lines">@@ -49,6 +50,8 @@
</span><span class="cx">
</span><span class="cx"> virtual ~InjectedBundleRangeHandle();
</span><span class="cx">
</span><ins>+ Ref<InjectedBundleNodeHandle> document();
+
</ins><span class="cx"> WebCore::IntRect boundingRectInWindowCoordinates() const;
</span><span class="cx"> PassRefPtr<WebImage> renderedImage(SnapshotOptions);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -41,111 +41,116 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range)
</del><ins>+InjectedBundlePageEditorClient::InjectedBundlePageEditorClient(const WKBundlePageEditorClientBase& client)
</ins><span class="cx"> {
</span><ins>+ initialize(&client);
+}
+
+bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage& page, Range* range)
+{
</ins><span class="cx"> if (m_client.shouldBeginEditing) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>- return m_client.shouldBeginEditing(toAPI(page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+ return m_client.shouldBeginEditing(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage* page, Range* range)
</del><ins>+bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage& page, Range* range)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.shouldEndEditing) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>- return m_client.shouldEndEditing(toAPI(page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+ return m_client.shouldEndEditing(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage* page, Node* node, Range* rangeToReplace, EditorInsertAction action)
</del><ins>+bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage& page, Node* node, Range* rangeToReplace, EditorInsertAction action)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.shouldInsertNode) {
</span><span class="cx"> RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(node);
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace);
</span><del>- return m_client.shouldInsertNode(toAPI(page), toAPI(nodeHandle.get()), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo);
</del><ins>+ return m_client.shouldInsertNode(toAPI(&page), toAPI(nodeHandle.get()), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldInsertText(WebPage* page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action)
</del><ins>+bool InjectedBundlePageEditorClient::shouldInsertText(WebPage& page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.shouldInsertText) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace);
</span><del>- return m_client.shouldInsertText(toAPI(page), toAPI(text), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo);
</del><ins>+ return m_client.shouldInsertText(toAPI(&page), toAPI(text), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage* page, Range* range)
</del><ins>+bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage& page, Range* range)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.shouldDeleteRange) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>- return m_client.shouldDeleteRange(toAPI(page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+ return m_client.shouldDeleteRange(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage* page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
</del><ins>+bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage& page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.shouldChangeSelectedRange) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> fromRangeHandle = InjectedBundleRangeHandle::getOrCreate(fromRange);
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> toRangeHandle = InjectedBundleRangeHandle::getOrCreate(toRange);
</span><del>- return m_client.shouldChangeSelectedRange(toAPI(page), toAPI(fromRangeHandle.get()), toAPI(toRangeHandle.get()), toAPI(affinity), stillSelecting, m_client.base.clientInfo);
</del><ins>+ return m_client.shouldChangeSelectedRange(toAPI(&page), toAPI(fromRangeHandle.get()), toAPI(toRangeHandle.get()), toAPI(affinity), stillSelecting, m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage* page, CSSStyleDeclaration* style, Range* range)
</del><ins>+bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage& page, CSSStyleDeclaration* style, Range* range)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.shouldApplyStyle) {
</span><span class="cx"> RefPtr<InjectedBundleCSSStyleDeclarationHandle> styleHandle = InjectedBundleCSSStyleDeclarationHandle::getOrCreate(style);
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>- return m_client.shouldApplyStyle(toAPI(page), toAPI(styleHandle.get()), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+ return m_client.shouldApplyStyle(toAPI(&page), toAPI(styleHandle.get()), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::didBeginEditing(WebPage* page, StringImpl* notificationName)
</del><ins>+void InjectedBundlePageEditorClient::didBeginEditing(WebPage& page, StringImpl* notificationName)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.didBeginEditing)
</span><del>- m_client.didBeginEditing(toAPI(page), toAPI(notificationName), m_client.base.clientInfo);
</del><ins>+ m_client.didBeginEditing(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::didEndEditing(WebPage* page, StringImpl* notificationName)
</del><ins>+void InjectedBundlePageEditorClient::didEndEditing(WebPage& page, StringImpl* notificationName)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.didEndEditing)
</span><del>- m_client.didEndEditing(toAPI(page), toAPI(notificationName), m_client.base.clientInfo);
</del><ins>+ m_client.didEndEditing(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::didChange(WebPage* page, StringImpl* notificationName)
</del><ins>+void InjectedBundlePageEditorClient::didChange(WebPage& page, StringImpl* notificationName)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.didChange)
</span><del>- m_client.didChange(toAPI(page), toAPI(notificationName), m_client.base.clientInfo);
</del><ins>+ m_client.didChange(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::didChangeSelection(WebPage* page, StringImpl* notificationName)
</del><ins>+void InjectedBundlePageEditorClient::didChangeSelection(WebPage& page, StringImpl* notificationName)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.didChangeSelection)
</span><del>- m_client.didChangeSelection(toAPI(page), toAPI(notificationName), m_client.base.clientInfo);
</del><ins>+ m_client.didChangeSelection(toAPI(&page), toAPI(notificationName), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::willWriteToPasteboard(WebPage* page, Range* range)
</del><ins>+void InjectedBundlePageEditorClient::willWriteToPasteboard(WebPage& page, Range* range)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.willWriteToPasteboard) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>- m_client.willWriteToPasteboard(toAPI(page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+ m_client.willWriteToPasteboard(toAPI(&page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::getPasteboardDataForRange(WebPage* page, Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData)
</del><ins>+void InjectedBundlePageEditorClient::getPasteboardDataForRange(WebPage& page, Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.getPasteboardDataForRange) {
</span><span class="cx"> RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><span class="cx"> WKArrayRef types = 0;
</span><span class="cx"> WKArrayRef data = 0;
</span><del>- m_client.getPasteboardDataForRange(toAPI(page), toAPI(rangeHandle.get()), &types, &data, m_client.base.clientInfo);
</del><ins>+ m_client.getPasteboardDataForRange(toAPI(&page), toAPI(rangeHandle.get()), &types, &data, m_client.base.clientInfo);
</ins><span class="cx"> RefPtr<API::Array> typesArray = adoptRef(toImpl(types));
</span><span class="cx"> RefPtr<API::Array> dataArray = adoptRef(toImpl(data));
</span><span class="cx">
</span><span class="lines">@@ -167,10 +172,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedBundlePageEditorClient::didWriteToPasteboard(WebPage* page)
</del><ins>+void InjectedBundlePageEditorClient::didWriteToPasteboard(WebPage& page)
</ins><span class="cx"> {
</span><span class="cx"> if (m_client.didWriteToPasteboard)
</span><del>- m_client.didWriteToPasteboard(toAPI(page), m_client.base.clientInfo);
</del><ins>+ m_client.didWriteToPasteboard(toAPI(&page), m_client.base.clientInfo);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,15 +23,11 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef InjectedBundlePageEditorClient_h
-#define InjectedBundlePageEditorClient_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "APIClient.h"
</span><del>-#include "WKBundlePage.h"
-#include <WebCore/EditorInsertAction.h>
-#include <WebCore/SharedBuffer.h>
-#include <WebCore/TextAffinity.h>
-#include <wtf/Forward.h>
</del><ins>+#include "APIInjectedBundleEditorClient.h"
+#include "WKBundlePageEditorClient.h"
</ins><span class="cx">
</span><span class="cx"> namespace API {
</span><span class="cx"> template<> struct ClientTraits<WKBundlePageEditorClientBase> {
</span><span class="lines">@@ -50,24 +46,25 @@
</span><span class="cx"> class WebFrame;
</span><span class="cx"> class WebPage;
</span><span class="cx">
</span><del>-class InjectedBundlePageEditorClient : public API::Client<WKBundlePageEditorClientBase> {
</del><ins>+class InjectedBundlePageEditorClient final : public API::Client<WKBundlePageEditorClientBase>, public API::InjectedBundle::EditorClient {
</ins><span class="cx"> public:
</span><del>- bool shouldBeginEditing(WebPage*, WebCore::Range*);
- bool shouldEndEditing(WebPage*, WebCore::Range*);
- bool shouldInsertNode(WebPage*, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction);
- bool shouldInsertText(WebPage*, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction);
- bool shouldDeleteRange(WebPage*, WebCore::Range*);
- bool shouldChangeSelectedRange(WebPage*, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity affinity, bool stillSelecting);
- bool shouldApplyStyle(WebPage*, WebCore::CSSStyleDeclaration*, WebCore::Range*);
- void didBeginEditing(WebPage*, StringImpl* notificationName);
- void didEndEditing(WebPage*, StringImpl* notificationName);
- void didChange(WebPage*, StringImpl* notificationName);
- void didChangeSelection(WebPage*, StringImpl* notificationName);
- void willWriteToPasteboard(WebPage*, WebCore::Range*);
- void getPasteboardDataForRange(WebPage*, WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData);
- void didWriteToPasteboard(WebPage*);
</del><ins>+ explicit InjectedBundlePageEditorClient(const WKBundlePageEditorClientBase&);
+
+private:
+ bool shouldBeginEditing(WebPage&, WebCore::Range*) final;
+ bool shouldEndEditing(WebPage&, WebCore::Range*) final;
+ bool shouldInsertNode(WebPage&, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) final;
+ bool shouldInsertText(WebPage&, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) final;
+ bool shouldDeleteRange(WebPage&, WebCore::Range*) final;
+ bool shouldChangeSelectedRange(WebPage&, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) final;
+ bool shouldApplyStyle(WebPage&, WebCore::CSSStyleDeclaration*, WebCore::Range*) final;
+ void didBeginEditing(WebPage&, StringImpl* notificationName) final;
+ void didEndEditing(WebPage&, StringImpl* notificationName) final;
+ void didChange(WebPage&, StringImpl* notificationName) final;
+ void didChangeSelection(WebPage&, StringImpl* notificationName) final;
+ void willWriteToPasteboard(WebPage&, WebCore::Range*) final;
+ void getPasteboardDataForRange(WebPage&, WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final;
+ void didWriteToPasteboard(WebPage&) final;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // InjectedBundlePageEditorClient_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldDeleteRange(Range* range)
</span><span class="cx"> {
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(m_page, range);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(*m_page, range);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldBeginEditing(Range* range)
</span><span class="cx"> {
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(m_page, range);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(*m_page, range);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldEndEditing(Range* range)
</span><span class="cx"> {
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldEndEditing(m_page, range);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldEndEditing(*m_page, range);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldInsertNode(Node* node, Range* rangeToReplace, EditorInsertAction action)
</span><span class="cx"> {
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldInsertNode(m_page, node, rangeToReplace, action);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldInsertNode(*m_page, node, rangeToReplace, action);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldInsertText(const String& text, Range* rangeToReplace, EditorInsertAction action)
</span><span class="cx"> {
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldInsertText(m_page, text.impl(), rangeToReplace, action);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldInsertText(*m_page, text.impl(), rangeToReplace, action);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">
</span><span class="cx"> bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
</span><span class="cx"> {
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(m_page, fromRange, toRange, affinity, stillSelecting);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(*m_page, fromRange, toRange, affinity, stillSelecting);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -151,7 +151,7 @@
</span><span class="cx"> bool WebEditorClient::shouldApplyStyle(StyleProperties* style, Range* range)
</span><span class="cx"> {
</span><span class="cx"> Ref<MutableStyleProperties> mutableStyle(style->isMutable() ? Ref<MutableStyleProperties>(static_cast<MutableStyleProperties&>(*style)) : style->mutableCopy());
</span><del>- bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, mutableStyle->ensureCSSStyleDeclaration(), range);
</del><ins>+ bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(*m_page, mutableStyle->ensureCSSStyleDeclaration(), range);
</ins><span class="cx"> notImplemented();
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx"> {
</span><span class="cx"> // FIXME: What good is a notification name, if it's always the same?
</span><span class="cx"> static NeverDestroyed<String> WebViewDidBeginEditingNotification(ASCIILiteral("WebViewDidBeginEditingNotification"));
</span><del>- m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.get().impl());
</del><ins>+ m_page->injectedBundleEditorClient().didBeginEditing(*m_page, WebViewDidBeginEditingNotification.get().impl());
</ins><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> void WebEditorClient::respondToChangedContents()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> WebViewDidChangeNotification(ASCIILiteral("WebViewDidChangeNotification"));
</span><del>- m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.get().impl());
</del><ins>+ m_page->injectedBundleEditorClient().didChange(*m_page, WebViewDidChangeNotification.get().impl());
</ins><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -185,7 +185,7 @@
</span><span class="cx"> void WebEditorClient::respondToChangedSelection(Frame* frame)
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> WebViewDidChangeSelectionNotification(ASCIILiteral("WebViewDidChangeSelectionNotification"));
</span><del>- m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.get().impl());
</del><ins>+ m_page->injectedBundleEditorClient().didChangeSelection(*m_page, WebViewDidChangeSelectionNotification.get().impl());
</ins><span class="cx"> if (!frame)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -219,23 +219,23 @@
</span><span class="cx"> void WebEditorClient::didEndEditing()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification"));
</span><del>- m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.get().impl());
</del><ins>+ m_page->injectedBundleEditorClient().didEndEditing(*m_page, WebViewDidEndEditingNotification.get().impl());
</ins><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didWriteSelectionToPasteboard()
</span><span class="cx"> {
</span><del>- m_page->injectedBundleEditorClient().didWriteToPasteboard(m_page);
</del><ins>+ m_page->injectedBundleEditorClient().didWriteToPasteboard(*m_page);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::willWriteSelectionToPasteboard(Range* range)
</span><span class="cx"> {
</span><del>- m_page->injectedBundleEditorClient().willWriteToPasteboard(m_page, range);
</del><ins>+ m_page->injectedBundleEditorClient().willWriteToPasteboard(*m_page, range);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::getClientPasteboardDataForRange(Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData)
</span><span class="cx"> {
</span><del>- m_page->injectedBundleEditorClient().getPasteboardDataForRange(m_page, range, pasteboardTypes, pasteboardData);
</del><ins>+ m_page->injectedBundleEditorClient().getPasteboardDataForRange(*m_page, range, pasteboardTypes, pasteboardData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::registerUndoStep(PassRefPtr<UndoStep> step)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -304,6 +304,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> , m_contextMenuClient(std::make_unique<API::InjectedBundle::PageContextMenuClient>())
</span><span class="cx"> #endif
</span><ins>+ , m_editorClient { std::make_unique<API::InjectedBundle::EditorClient>() }
</ins><span class="cx"> , m_formClient(std::make_unique<API::InjectedBundle::FormClient>())
</span><span class="cx"> , m_uiClient(std::make_unique<API::InjectedBundle::PageUIClient>())
</span><span class="cx"> , m_findController(this)
</span><span class="lines">@@ -619,9 +620,14 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void WebPage::initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase* client)
</del><ins>+void WebPage::setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient> editorClient)
</ins><span class="cx"> {
</span><del>- m_editorClient.initialize(client);
</del><ins>+ if (!editorClient) {
+ m_editorClient = std::make_unique<API::InjectedBundle::EditorClient>();
+ return;
+ }
+
+ m_editorClient = WTFMove(editorClient);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPage::setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient> formClient)
</span><span class="lines">@@ -1059,7 +1065,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> m_contextMenuClient = std::make_unique<API::InjectedBundle::PageContextMenuClient>();
</span><span class="cx"> #endif
</span><del>- m_editorClient.initialize(0);
</del><ins>+ m_editorClient = std::make_unique<API::InjectedBundle::EditorClient>();
</ins><span class="cx"> m_formClient = std::make_unique<API::InjectedBundle::FormClient>();
</span><span class="cx"> m_loaderClient.initialize(0);
</span><span class="cx"> m_policyClient.initialize(0);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><ins>+#include "APIInjectedBundleEditorClient.h"
</ins><span class="cx"> #include "APIInjectedBundleFormClient.h"
</span><span class="cx"> #include "APIInjectedBundlePageContextMenuClient.h"
</span><span class="cx"> #include "APIInjectedBundlePageUIClient.h"
</span><span class="lines">@@ -35,7 +36,6 @@
</span><span class="cx"> #include "GeolocationPermissionRequestManager.h"
</span><span class="cx"> #include "ImageOptions.h"
</span><span class="cx"> #include "InjectedBundlePageDiagnosticLoggingClient.h"
</span><del>-#include "InjectedBundlePageEditorClient.h"
</del><span class="cx"> #include "InjectedBundlePageFullScreenClient.h"
</span><span class="cx"> #include "InjectedBundlePageLoaderClient.h"
</span><span class="cx"> #include "InjectedBundlePagePolicyClient.h"
</span><span class="lines">@@ -322,7 +322,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>);
</span><span class="cx"> #endif
</span><del>- void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);
</del><ins>+ void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>);
</ins><span class="cx"> void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>);
</span><span class="cx"> void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClientBase*);
</span><span class="cx"> void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
</span><span class="lines">@@ -336,7 +336,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient.get(); }
</span><span class="cx"> #endif
</span><del>- InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
</del><ins>+ API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient.get(); }
</ins><span class="cx"> API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); }
</span><span class="cx"> InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
</span><span class="cx"> InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
</span><span class="lines">@@ -1337,7 +1337,7 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
</span><span class="cx"> #endif
</span><del>- InjectedBundlePageEditorClient m_editorClient;
</del><ins>+ std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
</ins><span class="cx"> std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
</span><span class="cx"> InjectedBundlePageLoaderClient m_loaderClient;
</span><span class="cx"> InjectedBundlePagePolicyClient m_policyClient;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Tools/ChangeLog        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-12-03 Dan Bernstein <mitz@apple.com>
+
+ [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
+ https://bugs.webkit.org/show_bug.cgi?id=165276
+ <rdar://problem/29467040>
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm: Added.
+ (-[BundleEditingDelegateRemoteObject willWriteToPasteboard:]):
+ (-[BundleEditingDelegateRemoteObject didWriteToPasteboard]):
+ (TEST):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm: Added.
+ (-[BundleEditingDelegatePlugIn webProcessPlugIn:didCreateBrowserContextController:]):
+ (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:willWriteRangeToPasteboard:]):
+ (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:pasteboardDataForRange:]):
+ (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextControllerDidWriteToPasteboard:]):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h: Added.
+
</ins><span class="cx"> 2016-12-02 Andy Estes <aestes@apple.com>
</span><span class="cx">
</span><span class="cx"> [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (209306 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-12-03 22:58:26 UTC (rev 209306)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -91,6 +91,8 @@
</span><span class="cx">                 33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; };
</span><span class="cx">                 33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
</span><span class="cx">                 33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
</span><ins>+                374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */; };
+                374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */; };
</ins><span class="cx">                 375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E151D66674400EFEC2C /* WKNSNumber.mm */; };
</span><span class="cx">                 376C8C061D6E197C007D2BB9 /* FrameHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */; };
</span><span class="cx">                 378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
</span><span class="lines">@@ -858,6 +860,9 @@
</span><span class="cx">                 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCanceledNoServerRedirectCallback_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
</span><span class="cx">                 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
</span><ins>+                374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegate.mm; sourceTree = "<group>"; };
+                374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegatePlugIn.mm; sourceTree = "<group>"; };
+                374B7A621DF3734C00ACCB6C /* BundleEditingDelegateProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BundleEditingDelegateProtocol.h; sourceTree = "<group>"; };
</ins><span class="cx">                 3751AF7A169518F800764319 /* DOMNodeFromJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNodeFromJSObject.mm; sourceTree = "<group>"; };
</span><span class="cx">                 375E0E151D66674400EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; };
</span><span class="cx">                 376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameHandle.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -1413,6 +1418,9 @@
</span><span class="cx">                                 A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */,
</span><span class="cx">                                 2DE71AFD1D49C0BD00904094 /* AnimatedResize.mm */,
</span><span class="cx">                                 2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */,
</span><ins>+                                374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */,
+                                374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */,
+                                374B7A621DF3734C00ACCB6C /* BundleEditingDelegateProtocol.h */,
</ins><span class="cx">                                 A13EBBAC1B87436F00097110 /* BundleParameters.mm */,
</span><span class="cx">                                 A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */,
</span><span class="cx">                                 1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
</span><span class="lines">@@ -2386,6 +2394,7 @@
</span><span class="cx">                                 7CEFA9661AC0B9E200B910FD /* _WKUserContentExtensionStore.mm in Sources */,
</span><span class="cx">                                 7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */,
</span><span class="cx">                                 7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */,
</span><ins>+                                374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */,
</ins><span class="cx">                                 5C0BF8951DD599CD00B00328 /* NavigatorLanguage.mm in Sources */,
</span><span class="cx">                                 A1DF74321C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm in Sources */,
</span><span class="cx">                                 2DE71AFE1D49C0BD00904094 /* AnimatedResize.mm in Sources */,
</span><span class="lines">@@ -2653,6 +2662,7 @@
</span><span class="cx">                                 A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */,
</span><span class="cx">                                 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */,
</span><span class="cx">                                 7C882E091C80C630006BF731 /* UserContentWorldPlugIn.mm in Sources */,
</span><ins>+                                374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */,
</ins><span class="cx">                                 7C83E03D1D0A60D600FEBCF3 /* UtilitiesCocoa.mm in Sources */,
</span><span class="cx">                                 A13EBBAA1B87428D00097110 /* WebProcessPlugIn.mm in Sources */,
</span><span class="cx">                         );
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaBundleEditingDelegatemm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import "config.h"
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import "BundleEditingDelegateProtocol.h"
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import "WKWebViewConfigurationExtras.h"
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKRemoteObjectInterface.h>
+#import <WebKit/_WKRemoteObjectRegistry.h>
+#import <wtf/RetainPtr.h>
+
+static bool willWriteToPasteboard;
+static bool didWriteToPasteboard;
+
+@interface BundleEditingDelegateRemoteObject : NSObject <BundleEditingDelegateProtocol>
+@end
+
+@implementation BundleEditingDelegateRemoteObject
+
+- (void)willWriteToPasteboard:(NSString *)rangeAsString
+{
+ willWriteToPasteboard = true;
+ EXPECT_STREQ("something", rangeAsString.UTF8String);
+}
+
+- (void)didWriteToPasteboard
+{
+ didWriteToPasteboard = true;
+}
+
+@end
+
+TEST(WebKit2, WKWebProcessPlugInEditingDelegate)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = retainPtr([WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:@"BundleEditingDelegatePlugIn"]);
+
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ [webView loadHTMLString:@"Just something to copy <script> var textNode = document.body.firstChild; document.getSelection().setBaseAndExtent(textNode, 5, textNode, 14) </script>" baseURL:nil];
+ [webView _test_waitForDidFinishNavigation];
+
+ RetainPtr<BundleEditingDelegateRemoteObject> object = adoptNS([[BundleEditingDelegateRemoteObject alloc] init]);
+ _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(BundleEditingDelegateProtocol)];
+ [[webView _remoteObjectRegistry] registerExportedObject:object.get() interface:interface];
+
+ [webView performSelector:@selector(copy:) withObject:nil];
+
+ TestWebKitAPI::Util::run(&didWriteToPasteboard);
+#if PLATFORM(MAC)
+ EXPECT_STREQ("hello", [[NSPasteboard generalPasteboard] stringForType:@"org.webkit.data"].UTF8String);
+#elsif PLATFORM(IOS)
+ EXPECT_TRUE([[[UIPasteboard generalPasteboard] dataForPasteboardType:@"org.webkit.data"] isEqual:[@"hello" dataUsingEncoding:NSUTF8StringEncoding]]);
+#endif
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaBundleEditingDelegatePlugInmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegatePlugIn.mm        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import "config.h"
+
+#if WK_API_ENABLED
+
+#import "BundleEditingDelegateProtocol.h"
+#import "PlatformUtilities.h"
+#import <WebKit/WKWebProcessPlugIn.h>
+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h>
+#import <WebKit/WKWebProcessPlugInEditingDelegate.h>
+#import <WebKit/WKWebProcessPlugInFrame.h>
+#import <WebKit/WKWebProcessPlugInScriptWorld.h>
+#import <WebKit/_WKRemoteObjectInterface.h>
+#import <WebKit/_WKRemoteObjectRegistry.h>
+#import <wtf/RetainPtr.h>
+
+@interface BundleEditingDelegatePlugIn : NSObject <WKWebProcessPlugIn, WKWebProcessPlugInEditingDelegate>
+@end
+
+@implementation BundleEditingDelegatePlugIn {
+ RetainPtr<WKWebProcessPlugInBrowserContextController> _browserContextController;
+ RetainPtr<WKWebProcessPlugInController> _plugInController;
+ RetainPtr<id <BundleEditingDelegateProtocol>> _remoteObject;
+}
+
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController
+{
+ ASSERT(!_browserContextController);
+ ASSERT(!_plugInController);
+ _browserContextController = browserContextController;
+ _plugInController = plugInController;
+
+ _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(BundleEditingDelegateProtocol)];
+ _remoteObject = [browserContextController._remoteObjectRegistry remoteObjectProxyWithInterface:interface];
+
+ [_browserContextController _setEditingDelegate:self];
+}
+
+- (void)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller willWriteRangeToPasteboard:(WKWebProcessPlugInRangeHandle *)range
+{
+ JSValue *jsRange = [range.frame jsRangeForRangeHandle:range inWorld:[WKWebProcessPlugInScriptWorld normalWorld]];
+ [_remoteObject willWriteToPasteboard:[jsRange toString]];
+}
+
+- (NSDictionary<NSString *, NSData *> *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller pasteboardDataForRange:(WKWebProcessPlugInRangeHandle *)range
+{
+ return @{ @"org.webkit.data" : [NSData dataWithBytesNoCopy:(void*)"hello" length:5 freeWhenDone:NO] };
+}
+
+- (void)_webProcessPlugInBrowserContextControllerDidWriteToPasteboard:(WKWebProcessPlugInBrowserContextController *)controller
+{
+ [_remoteObject didWriteToPasteboard];
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaBundleEditingDelegateProtocolh"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h (0 => 209307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h        2016-12-03 23:49:32 UTC (rev 209307)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+@protocol BundleEditingDelegateProtocol <NSObject>
+
+- (void)willWriteToPasteboard:(NSString *)rangeAsString;
+- (void)didWriteToPasteboard;
+
+@end
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>