<!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
&lt;rdar://problem/29467040&gt;

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  &lt;mitz@apple.com&gt;
+
+        [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
+        https://bugs.webkit.org/show_bug.cgi?id=165276
+        &lt;rdar://problem/29467040&gt;
+
+        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  &lt;hyatt@apple.com&gt;
</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&lt;NSDictionary&gt; 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 &lt; size; ++i)
+        [representations setValue:content.clientData[i]-&gt;createNSData().get() forKey:content.clientTypes[i]];
+
</ins><span class="cx">     if (content.dataInWebArchiveFormat) {
</span><span class="cx">         [representations setValue:(NSData *)content.dataInWebArchiveFormat-&gt;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  &lt;mitz@apple.com&gt;
+
+        [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
+        https://bugs.webkit.org/show_bug.cgi?id=165276
+        &lt;rdar://problem/29467040&gt;
+
+        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  &lt;sabouhallawa@apple.com&gt;
</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 &quot;WKWebProcessPlugInInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInNodeHandleInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInPageGroupInternal.h&quot;
</span><ins>+#import &quot;WKWebProcessPlugInRangeHandleInternal.h&quot;
</ins><span class="cx"> #import &quot;WKWebProcessPlugInScriptWorldInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebsiteDataRecordInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebsiteDataStoreInternal.h&quot;
</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 = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUIDelegatePrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 374436871820E7240049579F /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                374942181DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInRangeHandle.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                374942191DF1F9FF0033C19F /* WKWebProcessPlugInRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInRangeHandle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                3749421C1DF1FAB90033C19F /* WKWebProcessPlugInRangeHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInRangeHandleInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSInvocationSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 375E0E111D66432700EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 375E0E121D66432700EFEC2C /* WKNSNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSNumber.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</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 = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37716A59195B910500EE8B1B /* ProcessAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessAssertion.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 377216B71A4E6BE000DCA718 /* _WKRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKRenderingProgressEvents.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                3775122E1DF0DC8B008A351C /* WKWebProcessPlugInEditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInEditingDelegate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                377512301DF0DEE2008A351C /* APIInjectedBundleEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleEditorClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeclarationSpecifiers.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentInjectedFrames.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 377EAD4717E2C77B002D193D /* WKUserScriptInjectionTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptInjectionTime.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</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 &lt;WebCore/EditorInsertAction.h&gt;
+#include &lt;WebCore/SharedBuffer.h&gt;
+#include &lt;WebCore/TextAffinity.h&gt;
+#include &lt;wtf/Forward.h&gt;
+
+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&amp;, WebCore::Range*) { return true; }
+    virtual bool shouldEndEditing(WebKit::WebPage&amp;, WebCore::Range*) { return true; }
+    virtual bool shouldInsertNode(WebKit::WebPage&amp;, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) { return true; }
+    virtual bool shouldInsertText(WebKit::WebPage&amp;, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) { return true; }
+    virtual bool shouldDeleteRange(WebKit::WebPage&amp;, WebCore::Range*) { return true; }
+    virtual bool shouldChangeSelectedRange(WebKit::WebPage&amp;, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity affinity, bool stillSelecting) { return true; }
+    virtual bool shouldApplyStyle(WebKit::WebPage&amp;, WebCore::CSSStyleDeclaration*, WebCore::Range*) { return true; }
+    virtual void didBeginEditing(WebKit::WebPage&amp;, StringImpl* notificationName) { }
+    virtual void didEndEditing(WebKit::WebPage&amp;, StringImpl* notificationName) { }
+    virtual void didChange(WebKit::WebPage&amp;, StringImpl* notificationName) { }
+    virtual void didChangeSelection(WebKit::WebPage&amp;, StringImpl* notificationName) { }
+    virtual void willWriteToPasteboard(WebKit::WebPage&amp;, WebCore::Range*) { }
+    virtual void getPasteboardDataForRange(WebKit::WebPage&amp;, WebCore::Range*, Vector&lt;WTF::String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;WebCore::SharedBuffer&gt;&gt;&amp; pasteboardData) { }
+    virtual void didWriteToPasteboard(WebKit::WebPage&amp;) { }
+};
+
+} // 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 &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &lt;WebKit/WKWebProcessPlugInBrowserContextController.h&gt;
+#import &lt;WebKit/WKWebProcessPlugInRangeHandle.h&gt;
+
+NS_ASSUME_NONNULL_BEGIN
+
+WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@protocol WKWebProcessPlugInEditingDelegate &lt;NSObject&gt;
+
+@optional
+
+- (void)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller willWriteRangeToPasteboard:(WKWebProcessPlugInRangeHandle *)range;
+- (NSDictionary&lt;NSString *, NSData *&gt; *)_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 &quot;WKWebProcessPlugInBrowserContextControllerInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInHitTestResultInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInNodeHandleInternal.h&quot;
</span><ins>+#import &quot;WKWebProcessPlugInRangeHandleInternal.h&quot;
</ins><span class="cx"> #import &quot;WKWebProcessPlugInScriptWorldInternal.h&quot;
</span><span class="cx"> #import &quot;WebProcess.h&quot;
</span><span class="cx"> #import &quot;_WKFrameHandleInternal.h&quot;
</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-&gt;jsWrapperForWorld(&amp;[rangeHandle _rangeHandle], &amp;[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-&gt;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 &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &lt;Foundation/Foundation.h&gt;
+#import &lt;JavaScriptCore/JavaScriptCore.h&gt;
+
+@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 &quot;config.h&quot;
+#import &quot;WKWebProcessPlugInRangeHandleInternal.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;InjectedBundleNodeHandle.h&quot;
+#import &quot;WKWebProcessPlugInFrameInternal.h&quot;
+
+using namespace WebKit;
+
+@implementation WKWebProcessPlugInRangeHandle {
+    API::ObjectStorage&lt;InjectedBundleRangeHandle&gt; _rangeHandle;
+}
+
+- (void)dealloc
+{
+    _rangeHandle-&gt;~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-&gt;document()-&gt;documentFrame().leakRef()) autorelease];
+}
+
+- (InjectedBundleRangeHandle&amp;)_rangeHandle
+{
+    return *_rangeHandle;
+}
+
+// MARK: WKObject protocol implementation
+
+- (API::Object&amp;)_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 &quot;WKWebProcessPlugInRangeHandle.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;InjectedBundleRangeHandle.h&quot;
+#import &quot;WKObject.h&quot;
+
+namespace WebKit {
+
+inline WKWebProcessPlugInRangeHandle *wrapper(InjectedBundleRangeHandle&amp; rangeHandle)
+{
+    ASSERT([rangeHandle.wrapper() isKindOfClass:[WKWebProcessPlugInRangeHandle class]]);
+    return (WKWebProcessPlugInRangeHandle *)rangeHandle.wrapper();
+}
+
+}
+
+@interface WKWebProcessPlugInRangeHandle () &lt;WKObject&gt;
+
+@property (readonly) WebKit::InjectedBundleRangeHandle&amp; _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 &quot;APIURLRequest.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleBackForwardList.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleNodeHandle.h&quot;
</span><ins>+#include &quot;InjectedBundlePageEditorClient.h&quot;
</ins><span class="cx"> #include &quot;InjectedBundlePageFormClient.h&quot;
</span><span class="cx"> #include &quot;InjectedBundlePageUIClient.h&quot;
</span><span class="cx"> #include &quot;PageBanner.h&quot;
</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)-&gt;initializeInjectedBundleEditorClient(wkClient);
</del><ins>+    toImpl(pageRef)-&gt;setInjectedBundleEditorClient(wkClient ? std::make_unique&lt;InjectedBundlePageEditorClient&gt;(*wkClient) : std::make_unique&lt;API::InjectedBundle::EditorClient&gt;());
</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 &quot;WKRetainPtr.h&quot;
</span><span class="cx"> #import &quot;WKStringCF.h&quot;
</span><span class="cx"> #import &quot;WKURLRequestNS.h&quot;
</span><ins>+#import &quot;WKWebProcessPlugInEditingDelegate.h&quot;
</ins><span class="cx"> #import &quot;WKWebProcessPlugInFrameInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInFormDelegatePrivate.h&quot;
</span><span class="lines">@@ -50,6 +51,7 @@
</span><span class="cx"> #import &quot;WKWebProcessPlugInLoadDelegate.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInNodeHandleInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInPageGroupInternal.h&quot;
</span><ins>+#import &quot;WKWebProcessPlugInRangeHandleInternal.h&quot;
</ins><span class="cx"> #import &quot;WKWebProcessPlugInScriptWorldInternal.h&quot;
</span><span class="cx"> #import &quot;WeakObjCPtr.h&quot;
</span><span class="cx"> #import &quot;WebPage.h&quot;
</span><span class="lines">@@ -74,6 +76,7 @@
</span><span class="cx">     API::ObjectStorage&lt;WebPage&gt; _page;
</span><span class="cx">     WeakObjCPtr&lt;id &lt;WKWebProcessPlugInLoadDelegate&gt;&gt; _loadDelegate;
</span><span class="cx">     WeakObjCPtr&lt;id &lt;WKWebProcessPlugInFormDelegatePrivate&gt;&gt; _formDelegate;
</span><ins>+    WeakObjCPtr&lt;id &lt;WKWebProcessPlugInEditingDelegate&gt;&gt; _editingDelegate;
</ins><span class="cx">     
</span><span class="cx">     RetainPtr&lt;_WKRemoteObjectRegistry&gt; _remoteObjectRegistry;
</span><span class="cx"> }
</span><span class="lines">@@ -565,6 +568,73 @@
</span><span class="cx">         _page-&gt;setInjectedBundleFormClient(nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (id &lt;WKWebProcessPlugInEditingDelegate&gt;)_editingDelegate
+{
+    return _editingDelegate.getAutoreleased();
+}
+
+- (void)_setEditingDelegate:(id &lt;WKWebProcessPlugInEditingDelegate&gt;)editingDelegate
+{
+    _editingDelegate = editingDelegate;
+
+    class Client final : public API::InjectedBundle::EditorClient {
+    public:
+        explicit Client(WKWebProcessPlugInBrowserContextController *controller)
+            : m_controller { controller }
+            , m_delegateMethods { m_controller-&gt;_editingDelegate.get() }
+        {
+        }
+
+    private:
+        void willWriteToPasteboard(WebKit::WebPage&amp;, WebCore::Range* range) final
+        {
+            if (!m_delegateMethods.willWriteToPasteboard)
+                return;
+
+            [m_controller-&gt;_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller willWriteRangeToPasteboard:wrapper(*InjectedBundleRangeHandle::getOrCreate(range).get())];
+        }
+
+        void getPasteboardDataForRange(WebKit::WebPage&amp;, WebCore::Range* range, Vector&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;WebCore::SharedBuffer&gt;&gt;&amp; pasteboardData) final
+        {
+            if (!m_delegateMethods.getPasteboardDataForRange)
+                return;
+
+            auto dataByType = [m_controller-&gt;_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&amp;) final
+        {
+            if (!m_delegateMethods.didWriteToPasteboard)
+                return;
+
+            [m_controller-&gt;_editingDelegate.get() _webProcessPlugInBrowserContextControllerDidWriteToPasteboard:m_controller];
+        }
+
+        WKWebProcessPlugInBrowserContextController *m_controller;
+        const struct DelegateMethods {
+            DelegateMethods(RetainPtr&lt;id &lt;WKWebProcessPlugInEditingDelegate&gt;&gt; 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-&gt;setInjectedBundleEditorClient(std::make_unique&lt;Client&gt;(self));
+    else
+        _page-&gt;setInjectedBundleEditorClient(nullptr);
+}
+
</ins><span class="cx"> - (BOOL)_defersLoading
</span><span class="cx"> {
</span><span class="cx">     return _page-&gt;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 &lt;WKWebProcessPlugInFormDelegatePrivate&gt; _formDelegate;
</span><ins>+@property (weak, setter=_setEditingDelegate:) id &lt;WKWebProcessPlugInEditingDelegate&gt; _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 &quot;config.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleRangeHandle.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;InjectedBundleNodeHandle.h&quot;
</ins><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><span class="cx"> #include &quot;WebImage.h&quot;
</span><span class="cx"> #include &lt;JavaScriptCore/APICast.h&gt;
</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&lt;InjectedBundleNodeHandle&gt; InjectedBundleRangeHandle::document()
+{
+    return InjectedBundleNodeHandle::getOrCreate(m_range-&gt;ownerDocument());
+}
+
</ins><span class="cx"> WebCore::IntRect InjectedBundleRangeHandle::boundingRectInWindowCoordinates() const
</span><span class="cx"> {
</span><span class="cx">     FloatRect boundingRect = m_range-&gt;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&lt;InjectedBundleNodeHandle&gt; document();
+
</ins><span class="cx">     WebCore::IntRect boundingRectInWindowCoordinates() const;
</span><span class="cx">     PassRefPtr&lt;WebImage&gt; 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&amp; client)
</ins><span class="cx"> {
</span><ins>+    initialize(&amp;client);
+}
+
+bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage&amp; page, Range* range)
+{
</ins><span class="cx">     if (m_client.shouldBeginEditing) {
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; page, Range* range)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.shouldEndEditing) {
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; page, Node* node, Range* rangeToReplace, EditorInsertAction action)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.shouldInsertNode) {
</span><span class="cx">         RefPtr&lt;InjectedBundleNodeHandle&gt; nodeHandle = InjectedBundleNodeHandle::getOrCreate(node);
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.shouldInsertText) {
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; page, Range* range)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.shouldDeleteRange) {
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; 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&lt;InjectedBundleRangeHandle&gt; fromRangeHandle = InjectedBundleRangeHandle::getOrCreate(fromRange);
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; page, CSSStyleDeclaration* style, Range* range)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.shouldApplyStyle) {
</span><span class="cx">         RefPtr&lt;InjectedBundleCSSStyleDeclarationHandle&gt; styleHandle = InjectedBundleCSSStyleDeclarationHandle::getOrCreate(style);
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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(&amp;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&amp; 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(&amp;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&amp; 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(&amp;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&amp; 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(&amp;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&amp; 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(&amp;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&amp; page, Range* range)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.willWriteToPasteboard) {
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>-        m_client.willWriteToPasteboard(toAPI(page), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+        m_client.willWriteToPasteboard(toAPI(&amp;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&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;SharedBuffer&gt;&gt;&amp; pasteboardData)
</del><ins>+void InjectedBundlePageEditorClient::getPasteboardDataForRange(WebPage&amp; page, Range* range, Vector&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;SharedBuffer&gt;&gt;&amp; pasteboardData)
</ins><span class="cx"> {
</span><span class="cx">     if (m_client.getPasteboardDataForRange) {
</span><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; 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()), &amp;types, &amp;data, m_client.base.clientInfo);
</del><ins>+        m_client.getPasteboardDataForRange(toAPI(&amp;page), toAPI(rangeHandle.get()), &amp;types, &amp;data, m_client.base.clientInfo);
</ins><span class="cx">         RefPtr&lt;API::Array&gt; typesArray = adoptRef(toImpl(types));
</span><span class="cx">         RefPtr&lt;API::Array&gt; 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&amp; 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(&amp;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 &quot;APIClient.h&quot;
</span><del>-#include &quot;WKBundlePage.h&quot;
-#include &lt;WebCore/EditorInsertAction.h&gt;
-#include &lt;WebCore/SharedBuffer.h&gt;
-#include &lt;WebCore/TextAffinity.h&gt;
-#include &lt;wtf/Forward.h&gt;
</del><ins>+#include &quot;APIInjectedBundleEditorClient.h&quot;
+#include &quot;WKBundlePageEditorClient.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="cx"> template&lt;&gt; struct ClientTraits&lt;WKBundlePageEditorClientBase&gt; {
</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&lt;WKBundlePageEditorClientBase&gt; {
</del><ins>+class InjectedBundlePageEditorClient final : public API::Client&lt;WKBundlePageEditorClientBase&gt;, 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&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;WebCore::SharedBuffer&gt;&gt;&amp; pasteboardData);
-    void didWriteToPasteboard(WebPage*);
</del><ins>+    explicit InjectedBundlePageEditorClient(const WKBundlePageEditorClientBase&amp;);
+
+private:
+    bool shouldBeginEditing(WebPage&amp;, WebCore::Range*) final;
+    bool shouldEndEditing(WebPage&amp;, WebCore::Range*) final;
+    bool shouldInsertNode(WebPage&amp;, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) final;
+    bool shouldInsertText(WebPage&amp;, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction) final;
+    bool shouldDeleteRange(WebPage&amp;, WebCore::Range*) final;
+    bool shouldChangeSelectedRange(WebPage&amp;, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) final;
+    bool shouldApplyStyle(WebPage&amp;, WebCore::CSSStyleDeclaration*, WebCore::Range*) final;
+    void didBeginEditing(WebPage&amp;, StringImpl* notificationName) final;
+    void didEndEditing(WebPage&amp;, StringImpl* notificationName) final;
+    void didChange(WebPage&amp;, StringImpl* notificationName) final;
+    void didChangeSelection(WebPage&amp;, StringImpl* notificationName) final;
+    void willWriteToPasteboard(WebPage&amp;, WebCore::Range*) final;
+    void getPasteboardDataForRange(WebPage&amp;, WebCore::Range*, Vector&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;WebCore::SharedBuffer&gt;&gt;&amp; pasteboardData) final;
+    void didWriteToPasteboard(WebPage&amp;) 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-&gt;injectedBundleEditorClient().shouldDeleteRange(m_page, range);
</del><ins>+    bool result = m_page-&gt;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-&gt;injectedBundleEditorClient().shouldBeginEditing(m_page, range);
</del><ins>+    bool result = m_page-&gt;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-&gt;injectedBundleEditorClient().shouldEndEditing(m_page, range);
</del><ins>+    bool result = m_page-&gt;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-&gt;injectedBundleEditorClient().shouldInsertNode(m_page, node, rangeToReplace, action);
</del><ins>+    bool result = m_page-&gt;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&amp; text, Range* rangeToReplace, EditorInsertAction action)
</span><span class="cx"> {
</span><del>-    bool result = m_page-&gt;injectedBundleEditorClient().shouldInsertText(m_page, text.impl(), rangeToReplace, action);
</del><ins>+    bool result = m_page-&gt;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-&gt;injectedBundleEditorClient().shouldChangeSelectedRange(m_page, fromRange, toRange, affinity, stillSelecting);
</del><ins>+    bool result = m_page-&gt;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&lt;MutableStyleProperties&gt; mutableStyle(style-&gt;isMutable() ? Ref&lt;MutableStyleProperties&gt;(static_cast&lt;MutableStyleProperties&amp;&gt;(*style)) : style-&gt;mutableCopy());
</span><del>-    bool result = m_page-&gt;injectedBundleEditorClient().shouldApplyStyle(m_page, mutableStyle-&gt;ensureCSSStyleDeclaration(), range);
</del><ins>+    bool result = m_page-&gt;injectedBundleEditorClient().shouldApplyStyle(*m_page, mutableStyle-&gt;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&lt;String&gt; WebViewDidBeginEditingNotification(ASCIILiteral(&quot;WebViewDidBeginEditingNotification&quot;));
</span><del>-    m_page-&gt;injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.get().impl());
</del><ins>+    m_page-&gt;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&lt;String&gt; WebViewDidChangeNotification(ASCIILiteral(&quot;WebViewDidChangeNotification&quot;));
</span><del>-    m_page-&gt;injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.get().impl());
</del><ins>+    m_page-&gt;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&lt;String&gt; WebViewDidChangeSelectionNotification(ASCIILiteral(&quot;WebViewDidChangeSelectionNotification&quot;));
</span><del>-    m_page-&gt;injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.get().impl());
</del><ins>+    m_page-&gt;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&lt;String&gt; WebViewDidEndEditingNotification(ASCIILiteral(&quot;WebViewDidEndEditingNotification&quot;));
</span><del>-    m_page-&gt;injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.get().impl());
</del><ins>+    m_page-&gt;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-&gt;injectedBundleEditorClient().didWriteToPasteboard(m_page);
</del><ins>+    m_page-&gt;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-&gt;injectedBundleEditorClient().willWriteToPasteboard(m_page, range);
</del><ins>+    m_page-&gt;injectedBundleEditorClient().willWriteToPasteboard(*m_page, range);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebEditorClient::getClientPasteboardDataForRange(Range* range, Vector&lt;String&gt;&amp; pasteboardTypes, Vector&lt;RefPtr&lt;SharedBuffer&gt;&gt;&amp; pasteboardData)
</span><span class="cx"> {
</span><del>-    m_page-&gt;injectedBundleEditorClient().getPasteboardDataForRange(m_page, range, pasteboardTypes, pasteboardData);
</del><ins>+    m_page-&gt;injectedBundleEditorClient().getPasteboardDataForRange(*m_page, range, pasteboardTypes, pasteboardData);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebEditorClient::registerUndoStep(PassRefPtr&lt;UndoStep&gt; 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&lt;API::InjectedBundle::PageContextMenuClient&gt;())
</span><span class="cx"> #endif
</span><ins>+    , m_editorClient { std::make_unique&lt;API::InjectedBundle::EditorClient&gt;() }
</ins><span class="cx">     , m_formClient(std::make_unique&lt;API::InjectedBundle::FormClient&gt;())
</span><span class="cx">     , m_uiClient(std::make_unique&lt;API::InjectedBundle::PageUIClient&gt;())
</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&lt;API::InjectedBundle::EditorClient&gt; editorClient)
</ins><span class="cx"> {
</span><del>-    m_editorClient.initialize(client);
</del><ins>+    if (!editorClient) {
+        m_editorClient = std::make_unique&lt;API::InjectedBundle::EditorClient&gt;();
+        return;
+    }
+
+    m_editorClient = WTFMove(editorClient);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::setInjectedBundleFormClient(std::unique_ptr&lt;API::InjectedBundle::FormClient&gt; 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&lt;API::InjectedBundle::PageContextMenuClient&gt;();
</span><span class="cx"> #endif
</span><del>-    m_editorClient.initialize(0);
</del><ins>+    m_editorClient = std::make_unique&lt;API::InjectedBundle::EditorClient&gt;();
</ins><span class="cx">     m_formClient = std::make_unique&lt;API::InjectedBundle::FormClient&gt;();
</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 &quot;APIInjectedBundleEditorClient.h&quot;
</ins><span class="cx"> #include &quot;APIInjectedBundleFormClient.h&quot;
</span><span class="cx"> #include &quot;APIInjectedBundlePageContextMenuClient.h&quot;
</span><span class="cx"> #include &quot;APIInjectedBundlePageUIClient.h&quot;
</span><span class="lines">@@ -35,7 +36,6 @@
</span><span class="cx"> #include &quot;GeolocationPermissionRequestManager.h&quot;
</span><span class="cx"> #include &quot;ImageOptions.h&quot;
</span><span class="cx"> #include &quot;InjectedBundlePageDiagnosticLoggingClient.h&quot;
</span><del>-#include &quot;InjectedBundlePageEditorClient.h&quot;
</del><span class="cx"> #include &quot;InjectedBundlePageFullScreenClient.h&quot;
</span><span class="cx"> #include &quot;InjectedBundlePageLoaderClient.h&quot;
</span><span class="cx"> #include &quot;InjectedBundlePagePolicyClient.h&quot;
</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&lt;API::InjectedBundle::PageContextMenuClient&gt;);
</span><span class="cx"> #endif
</span><del>-    void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);
</del><ins>+    void setInjectedBundleEditorClient(std::unique_ptr&lt;API::InjectedBundle::EditorClient&gt;);
</ins><span class="cx">     void setInjectedBundleFormClient(std::unique_ptr&lt;API::InjectedBundle::FormClient&gt;);
</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&amp; injectedBundleContextMenuClient() { return *m_contextMenuClient.get(); }
</span><span class="cx"> #endif
</span><del>-    InjectedBundlePageEditorClient&amp; injectedBundleEditorClient() { return m_editorClient; }
</del><ins>+    API::InjectedBundle::EditorClient&amp; injectedBundleEditorClient() { return *m_editorClient.get(); }
</ins><span class="cx">     API::InjectedBundle::FormClient&amp; injectedBundleFormClient() { return *m_formClient.get(); }
</span><span class="cx">     InjectedBundlePageLoaderClient&amp; injectedBundleLoaderClient() { return m_loaderClient; }
</span><span class="cx">     InjectedBundlePagePolicyClient&amp; 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&lt;API::InjectedBundle::PageContextMenuClient&gt; m_contextMenuClient;
</span><span class="cx"> #endif
</span><del>-    InjectedBundlePageEditorClient m_editorClient;
</del><ins>+    std::unique_ptr&lt;API::InjectedBundle::EditorClient&gt; m_editorClient;
</ins><span class="cx">     std::unique_ptr&lt;API::InjectedBundle::FormClient&gt; 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  &lt;mitz@apple.com&gt;
+
+        [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
+        https://bugs.webkit.org/show_bug.cgi?id=165276
+        &lt;rdar://problem/29467040&gt;
+
+        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  &lt;aestes@apple.com&gt;
</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 = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;mouse-move-listener.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegate.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegatePlugIn.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                374B7A621DF3734C00ACCB6C /* BundleEditingDelegateProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BundleEditingDelegateProtocol.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 3751AF7A169518F800764319 /* DOMNodeFromJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNodeFromJSObject.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 375E0E151D66674400EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameHandle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</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 &quot;config.h&quot;
+#import &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &quot;BundleEditingDelegateProtocol.h&quot;
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;Test.h&quot;
+#import &quot;TestNavigationDelegate.h&quot;
+#import &quot;WKWebViewConfigurationExtras.h&quot;
+#import &lt;WebKit/WKWebViewPrivate.h&gt;
+#import &lt;WebKit/_WKRemoteObjectInterface.h&gt;
+#import &lt;WebKit/_WKRemoteObjectRegistry.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+static bool willWriteToPasteboard;
+static bool didWriteToPasteboard;
+
+@interface BundleEditingDelegateRemoteObject : NSObject &lt;BundleEditingDelegateProtocol&gt;
+@end
+
+@implementation BundleEditingDelegateRemoteObject
+
+- (void)willWriteToPasteboard:(NSString *)rangeAsString
+{
+    willWriteToPasteboard = true;
+    EXPECT_STREQ(&quot;something&quot;, rangeAsString.UTF8String);
+}
+
+- (void)didWriteToPasteboard
+{
+    didWriteToPasteboard = true;
+}
+
+@end
+
+TEST(WebKit2, WKWebProcessPlugInEditingDelegate)
+{
+    RetainPtr&lt;WKWebViewConfiguration&gt; configuration = retainPtr([WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:@&quot;BundleEditingDelegatePlugIn&quot;]);
+    
+    RetainPtr&lt;WKWebView&gt; webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+    [webView loadHTMLString:@&quot;Just something to copy &lt;script&gt; var textNode = document.body.firstChild; document.getSelection().setBaseAndExtent(textNode, 5, textNode, 14) &lt;/script&gt;&quot; baseURL:nil];
+    [webView _test_waitForDidFinishNavigation];
+
+    RetainPtr&lt;BundleEditingDelegateRemoteObject&gt; 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(&amp;didWriteToPasteboard);
+#if PLATFORM(MAC)
+    EXPECT_STREQ(&quot;hello&quot;, [[NSPasteboard generalPasteboard] stringForType:@&quot;org.webkit.data&quot;].UTF8String);
+#elsif PLATFORM(IOS)
+    EXPECT_TRUE([[[UIPasteboard generalPasteboard] dataForPasteboardType:@&quot;org.webkit.data&quot;] isEqual:[@&quot;hello&quot; 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 &quot;config.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;BundleEditingDelegateProtocol.h&quot;
+#import &quot;PlatformUtilities.h&quot;
+#import &lt;WebKit/WKWebProcessPlugIn.h&gt;
+#import &lt;WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h&gt;
+#import &lt;WebKit/WKWebProcessPlugInEditingDelegate.h&gt;
+#import &lt;WebKit/WKWebProcessPlugInFrame.h&gt;
+#import &lt;WebKit/WKWebProcessPlugInScriptWorld.h&gt;
+#import &lt;WebKit/_WKRemoteObjectInterface.h&gt;
+#import &lt;WebKit/_WKRemoteObjectRegistry.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+@interface BundleEditingDelegatePlugIn : NSObject &lt;WKWebProcessPlugIn, WKWebProcessPlugInEditingDelegate&gt;
+@end
+
+@implementation BundleEditingDelegatePlugIn {
+    RetainPtr&lt;WKWebProcessPlugInBrowserContextController&gt; _browserContextController;
+    RetainPtr&lt;WKWebProcessPlugInController&gt; _plugInController;
+    RetainPtr&lt;id &lt;BundleEditingDelegateProtocol&gt;&gt; _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&lt;NSString *, NSData *&gt; *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller pasteboardDataForRange:(WKWebProcessPlugInRangeHandle *)range
+{
+    return @{ @&quot;org.webkit.data&quot; : [NSData dataWithBytesNoCopy:(void*)&quot;hello&quot; 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 &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+@protocol BundleEditingDelegateProtocol &lt;NSObject&gt;
+
+- (void)willWriteToPasteboard:(NSString *)rangeAsString;
+- (void)didWriteToPasteboard;
+
+@end
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>