[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ap at apple.com ap at apple.com
Wed Dec 22 11:25:33 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0f9228c1a99a1811b8c4fee6a69cc51271bf9052
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 23 00:49:55 2010 +0000

            Reviewed by Sam Weinig and Darin Adler.
    
            https://bugs.webkit.org/show_bug.cgi?id=42193
            Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
    
            Step 1: Add the method, and implement one actual delegate call as proof of concept. No tests
            fixed, but this makes difference one line smaller on many editing tests.
    
            * WebKit2.xcodeproj/project.pbxproj:
            * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
            * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
            * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: Added.
            (WKBundleNodeCopyNodeName):
            (WKBundleNodeGetParent):
            * WebProcess/InjectedBundle/API/c/WKBundleNode.h: Added.
            * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
            (WKBundlePageSetEditorClient):
            * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
            * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: Added.
            (WKBundleRangeGetStartOffset):
            (WKBundleRangeGetStartContainer):
            (WKBundleRangeGetEndOffset):
            (WKBundleRangeGetEndContainer):
            * WebProcess/InjectedBundle/API/c/WKBundleRange.h: Added.
            Added WKBundleRangeRef and WKBundleNodeRef types for injected bundles. These are just pointers
            to respective WebCore objects, without any WebKit2 wrappers.
    
            * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: Added.
            (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient):
            (WebKit::InjectedBundlePageEditorClient::initialize):
            (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing):
            * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Added.
            * WebProcess/WebCoreSupport/WebEditorClient.cpp:
            (WebKit::WebEditorClient::shouldBeginEditing):
            * WebProcess/WebPage/WebPage.cpp:
            (WebKit::WebPage::initializeInjectedBundleEditorClient):
            * WebProcess/WebPage/WebPage.h:
            (WebKit::WebPage::injectedBundleEditorClient):
            Added the plumbing for invoking injected bundle code for editor client. There is no real API
            for editor client yet.
    
    WebKitTools:
            * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
            Added dumpEditingCallbacks() and setAcceptsEditing().
    
            * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
            (WTR::dumpPath): Dump path to a node in a format that's compatible with DumpRenderTree.
            (WTR::operator<<): Print a range.
            (WTR::InjectedBundlePage::InjectedBundlePage): Set editor client in addition to existing
            clients.
            (WTR::InjectedBundlePage::_shouldBeginEditing): The only client method implemented so far.
            (WTR::InjectedBundlePage::shouldBeginEditing): Ditto.
            * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added a section for editor client
            calls.
    
            * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
            (WTR::LayoutTestController::LayoutTestController):
            * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
            (WTR::LayoutTestController::dumpEditingCallbacks):
            (WTR::LayoutTestController::setAcceptsEditing):
            (WTR::LayoutTestController::acceptsEditing):
            (WTR::LayoutTestController::shouldDumpEditingCallbacks):
            Store m_acceptsEditing and m_dumpEditingCallbacks.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63930 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 053463b..dcfd58b 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,46 @@
+2010-07-22  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig and Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42193
+        Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
+
+        Step 1: Add the method, and implement one actual delegate call as proof of concept. No tests
+        fixed, but this makes difference one line smaller on many editing tests.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: Added.
+        (WKBundleNodeCopyNodeName):
+        (WKBundleNodeGetParent):
+        * WebProcess/InjectedBundle/API/c/WKBundleNode.h: Added.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageSetEditorClient):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: Added.
+        (WKBundleRangeGetStartOffset):
+        (WKBundleRangeGetStartContainer):
+        (WKBundleRangeGetEndOffset):
+        (WKBundleRangeGetEndContainer):
+        * WebProcess/InjectedBundle/API/c/WKBundleRange.h: Added.
+        Added WKBundleRangeRef and WKBundleNodeRef types for injected bundles. These are just pointers
+        to respective WebCore objects, without any WebKit2 wrappers.
+
+        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: Added.
+        (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient):
+        (WebKit::InjectedBundlePageEditorClient::initialize):
+        (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing):
+        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Added.
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::shouldBeginEditing):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::initializeInjectedBundleEditorClient):
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::injectedBundleEditorClient):
+        Added the plumbing for invoking injected bundle code for editor client. There is no real API
+        for editor client yet.
+
 2010-07-22  Ivan Krstić  <ike at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index d1babc7..b0160b9 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -255,6 +255,12 @@
 		BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA11176D01400471A52 /* WebNavigationData.cpp */; };
 		BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA71176D1CB00471A52 /* WKNavigationData.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */; };
+		E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */; };
+		E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */; };
+		E1EE55F411F8F18900CCBEE4 /* WKBundleRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		E1EE55F811F8F1BC00CCBEE4 /* WKBundleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE55F711F8F1BC00CCBEE4 /* WKBundleRange.cpp */; };
+		E1EE563011F8F6AA00CCBEE4 /* WKBundleNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE562F11F8F6AA00CCBEE4 /* WKBundleNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		E1EE565611F8F71700CCBEE4 /* WKBundleNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE565511F8F71700CCBEE4 /* WKBundleNode.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -537,6 +543,12 @@
 		BCF69FA11176D01400471A52 /* WebNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNavigationData.cpp; sourceTree = "<group>"; };
 		BCF69FA71176D1CB00471A52 /* WKNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationData.h; sourceTree = "<group>"; };
 		BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationData.cpp; sourceTree = "<group>"; };
+		E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageEditorClient.h; sourceTree = "<group>"; };
+		E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageEditorClient.cpp; sourceTree = "<group>"; };
+		E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleRange.h; sourceTree = "<group>"; };
+		E1EE55F711F8F1BC00CCBEE4 /* WKBundleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleRange.cpp; sourceTree = "<group>"; };
+		E1EE562F11F8F6AA00CCBEE4 /* WKBundleNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNode.h; sourceTree = "<group>"; };
+		E1EE565511F8F71700CCBEE4 /* WKBundleNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleNode.cpp; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1016,6 +1028,8 @@
 				BC204EE411C83E9C008F3375 /* mac */,
 				BC204EE011C83E98008F3375 /* InjectedBundle.cpp */,
 				BC204EE111C83E98008F3375 /* InjectedBundle.h */,
+				E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */,
+				E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */,
 				BCA8C6A611E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp */,
 				BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */,
 				BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */,
@@ -1050,9 +1064,13 @@
 				BCD25F1611D6BDE100169B0E /* WKBundleFrame.cpp */,
 				BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */,
 				BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */,
+				E1EE565511F8F71700CCBEE4 /* WKBundleNode.cpp */,
+				E1EE562F11F8F6AA00CCBEE4 /* WKBundleNode.h */,
 				BC20528011C94284008F3375 /* WKBundlePage.cpp */,
 				BC20527F11C94284008F3375 /* WKBundlePage.h */,
 				BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */,
+				E1EE55F711F8F1BC00CCBEE4 /* WKBundleRange.cpp */,
+				E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */,
 			);
 			path = c;
 			sourceTree = "<group>";
@@ -1261,6 +1279,9 @@
 				1A2161B011F37664008AD0F5 /* NPJSObjectMap.h in Headers */,
 				1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */,
 				1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */,
+				E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */,
+				E1EE55F411F8F18900CCBEE4 /* WKBundleRange.h in Headers */,
+				E1EE563011F8F6AA00CCBEE4 /* WKBundleNode.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1456,6 +1477,9 @@
 				1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */,
 				1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */,
 				1A24B5F211F531E800C38269 /* MachUtilities.cpp in Sources */,
+				E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */,
+				E1EE55F811F8F1BC00CCBEE4 /* WKBundleRange.cpp in Sources */,
+				E1EE565611F8F71700CCBEE4 /* WKBundleNode.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index f832c8d..b301823 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -28,6 +28,11 @@
 
 #include "WKBundleBase.h"
 
+namespace WebCore {
+    class Node;
+    class Range;
+}
+
 namespace WebKit {
 
 class InjectedBundle;
@@ -35,14 +40,18 @@ class WebFrame;
 class WebPage;
 
 template<typename APIType> struct BundleAPITypeInfo { };
-template<> struct BundleAPITypeInfo<WKBundlePageRef>            { typedef WebPage* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleFrameRef>           { typedef WebFrame* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleNodeRef>            { typedef WebCore::Node* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundlePageRef>            { typedef WebPage* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleRangeRef>           { typedef WebCore::Range* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleRef>                { typedef InjectedBundle* ImplType; };
 
 template<typename ImplType> struct BundleImplTypeInfo { };
-template<> struct BundleImplTypeInfo<WebPage*>                  { typedef WKBundlePageRef APIType; };
-template<> struct BundleImplTypeInfo<WebFrame*>                 { typedef WKBundleFrameRef APIType; };
 template<> struct BundleImplTypeInfo<InjectedBundle*>           { typedef WKBundleRef APIType; };
+template<> struct BundleImplTypeInfo<WebCore::Node*>            { typedef WKBundleNodeRef APIType; };
+template<> struct BundleImplTypeInfo<WebCore::Range*>           { typedef WKBundleRangeRef APIType; };
+template<> struct BundleImplTypeInfo<WebFrame*>                 { typedef WKBundleFrameRef APIType; };
+template<> struct BundleImplTypeInfo<WebPage*>                  { typedef WKBundlePageRef APIType; };
 
 } // namespace WebKit
 
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
index 145c57b..61b4d32 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
@@ -26,9 +26,11 @@
 #ifndef WKBundleBase_h
 #define WKBundleBase_h
 
-typedef struct OpaqueWKBundlePage* WKBundlePageRef;
-typedef struct OpaqueWKBundleFrame* WKBundleFrameRef;
 typedef struct OpaqueWKBundle* WKBundleRef;
+typedef struct OpaqueWKBundleFrame* WKBundleFrameRef;
+typedef struct OpaqueWKBundleNode* WKBundleNodeRef;
+typedef struct OpaqueWKBundlePage* WKBundlePageRef;
+typedef struct OpaqueWKBundleRange* WKBundleRangeRef;
 
 #undef WK_EXPORT
 #if defined(WK_NO_EXPORT)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
new file mode 100644
index 0000000..f90c186
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "WKBundleNode.h"
+
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+#include "WKBundleNode.h"
+#include <WebCore/Node.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+WKStringRef WKBundleNodeCopyNodeName(WKBundleNodeRef node)
+{
+    RefPtr<StringImpl> name = toWK(node)->nodeName().impl();
+    return toRef(name.release().releaseRef());
+}
+
+WKBundleNodeRef WKBundleNodeGetParent(WKBundleNodeRef node)
+{
+    return toRef(toWK(node)->parent());
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
new file mode 100644
index 0000000..ac2ed0f
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef WKBundleNode_h
+#define WKBundleNode_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKBundleBase.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKStringRef WKBundleNodeCopyNodeName(WKBundleNodeRef node);
+
+WK_EXPORT WKBundleNodeRef WKBundleNodeGetParent(WKBundleNodeRef node);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBundleNode_h */
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index c697345..bec1f8d 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -33,6 +33,12 @@
 
 using namespace WebKit;
 
+void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClient * wkClient)
+{
+    if (wkClient && !wkClient->version)
+        toWK(pageRef)->initializeInjectedBundleEditorClient(wkClient);
+}
+
 void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient * wkClient)
 {
     if (wkClient && !wkClient->version)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index b000177..32c30f8 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -77,8 +77,18 @@ struct WKBundlePageUIClient {
 };
 typedef struct WKBundlePageUIClient WKBundlePageUIClient;
 
-WK_EXPORT void WKBundlePageSetLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient * client);
-WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient * client);
+// Editor client
+typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
+struct WKBundlePageEditorClient {
+    int                                                                 version;
+    const void *                                                        clientInfo;
+    WKBundlePageShouldBeginEditingCallback                              shouldBeginEditing;
+};
+typedef struct WKBundlePageEditorClient WKBundlePageEditorClient;
+
+WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClient* client);
+WK_EXPORT void WKBundlePageSetLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client);
+WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client);
 
 WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page);
 
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
new file mode 100644
index 0000000..efcb7f3
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "WKBundleRange.h"
+
+#include "WKBundleAPICast.h"
+#include "WKBundleNode.h"
+#include <WebCore/Range.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+unsigned WKBundleRangeGetStartOffset(WKBundleRangeRef range)
+{
+    return toWK(range)->startOffset();
+}
+
+WKBundleNodeRef WKBundleRangeGetStartContainer(WKBundleRangeRef range)
+{
+    return toRef(toWK(range)->startContainer());
+}
+
+unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range)
+{
+    return toWK(range)->endOffset();
+}
+
+WKBundleNodeRef WKBundleRangeGetEndContainer(WKBundleRangeRef range)
+{
+    return toRef(toWK(range)->endContainer());
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h
new file mode 100644
index 0000000..0d3d9d9
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef WKBundleRange_h
+#define WKBundleRange_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKBundleBase.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT unsigned WKBundleRangeGetStartOffset(WKBundleRangeRef range);
+
+WK_EXPORT WKBundleNodeRef WKBundleRangeGetStartContainer(WKBundleRangeRef range);
+
+WK_EXPORT unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range);
+
+WK_EXPORT WKBundleNodeRef WKBundleRangeGetEndContainer(WKBundleRangeRef range);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBundleRange_h */
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
new file mode 100644
index 0000000..c7d2137
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "InjectedBundlePageEditorClient.h"
+
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+#include <WebCore/PlatformString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+InjectedBundlePageEditorClient::InjectedBundlePageEditorClient()
+{
+    initialize(0);
+}
+
+void InjectedBundlePageEditorClient::initialize(WKBundlePageEditorClient* client)
+{
+    if (client && !client->version)
+        m_client = *client;
+    else 
+        memset(&m_client, 0, sizeof(m_client));
+}
+
+bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, WebCore::Range* range)
+{
+    if (m_client.shouldBeginEditing)
+        return m_client.shouldBeginEditing(toRef(page), toRef(range), m_client.clientInfo);
+    return true;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
new file mode 100644
index 0000000..60874b5
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef InjectedBundlePageEditorClient_h
+#define InjectedBundlePageEditorClient_h
+
+#include "WKBundlePage.h"
+
+namespace WebCore {
+    class Range;
+}
+
+namespace WebKit {
+
+class WebFrame;
+class WebPage;
+
+class InjectedBundlePageEditorClient {
+public:
+    InjectedBundlePageEditorClient();
+    void initialize(WKBundlePageEditorClient*);
+
+    bool shouldBeginEditing(WebPage*, WebCore::Range*);
+
+private:
+    WKBundlePageEditorClient m_client;
+};
+
+} // namespace WebKit
+
+#endif // InjectedBundlePageEditorClient_h
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 6fcb277..6530af0 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -102,10 +102,11 @@ bool WebEditorClient::isEditable()
 }
 
 
-bool WebEditorClient::shouldBeginEditing(Range*)
+bool WebEditorClient::shouldBeginEditing(Range* range)
 {
+    bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(m_page, range);
     notImplemented();
-    return true;
+    return result;
 }
 
 bool WebEditorClient::shouldEndEditing(Range*)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index c1c402e..9df3717 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -123,6 +123,11 @@ WebPage::~WebPage()
 #endif
 }
 
+void WebPage::initializeInjectedBundleEditorClient(WKBundlePageEditorClient* client)
+{
+    m_editorClient.initialize(client);
+}
+
 void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* client)
 {
     m_loaderClient.initialize(client);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index a8df1e5..865556f 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -27,6 +27,7 @@
 #define WebPage_h
 
 #include "DrawingArea.h"
+#include "InjectedBundlePageEditorClient.h"
 #include "InjectedBundlePageLoaderClient.h"
 #include "InjectedBundlePageUIClient.h"
 #include <WebCore/FrameLoaderTypes.h>
@@ -91,9 +92,11 @@ public:
     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder&);
 
     // -- InjectedBundle methods
+    void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*);
     void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*);
     void initializeInjectedBundleUIClient(WKBundlePageUIClient*);
 
+    InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
     InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
     InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
 
@@ -138,6 +141,7 @@ private:
     WebCore::IntSize m_viewSize;
     OwnPtr<DrawingArea> m_drawingArea;
 
+    InjectedBundlePageEditorClient m_editorClient;
     InjectedBundlePageLoaderClient m_loaderClient;
     InjectedBundlePageUIClient m_uiClient;
 
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index a4d598f..ecbe665 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,35 @@
+2010-07-22  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig and Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42193
+        Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
+
+        Step 1: Add the method, and implement one actual delegate call as proof of concept. No tests
+        fixed, but this makes difference one line smaller on many editing tests.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        Added dumpEditingCallbacks() and setAcceptsEditing().
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::dumpPath): Dump path to a node in a format that's compatible with DumpRenderTree.
+        (WTR::operator<<): Print a range.
+        (WTR::InjectedBundlePage::InjectedBundlePage): Set editor client in addition to existing
+        clients.
+        (WTR::InjectedBundlePage::_shouldBeginEditing): The only client method implemented so far.
+        (WTR::InjectedBundlePage::shouldBeginEditing): Ditto.
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added a section for editor client
+        calls.
+
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::LayoutTestController):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+        (WTR::LayoutTestController::dumpEditingCallbacks):
+        (WTR::LayoutTestController::setAcceptsEditing):
+        (WTR::LayoutTestController::acceptsEditing):
+        (WTR::LayoutTestController::shouldDumpEditingCallbacks):
+        Store m_acceptsEditing and m_dumpEditingCallbacks.
+
 2010-07-22  Yael Aharon  <yael.aharon at nokia.com>
 
         Reviewed by Laszlo Gombos.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index dc4b406..1c72882 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -34,6 +34,7 @@ module WTR {
 
         // Other dumping.
         void dumpChildFrameScrollPositions();
+        void dumpEditingCallbacks();
         void dumpStatusCallbacks();
 
         // Repaint testing.
@@ -44,6 +45,8 @@ module WTR {
         // Animation testing.
         int numberOfActiveAnimations();
         boolean pauseAnimationAtTimeOnElementWithId(in DOMString animationName, in double time, in DOMString elementId);
+
+        void setAcceptsEditing(in boolean value);
     };
 
 }
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 088b680..ceb3b68 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -29,14 +29,18 @@
 #include <JavaScriptCore/JSRetainPtr.h>
 #include <WebKit2/WKArray.h>
 #include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundleNode.h>
 #include <WebKit2/WKBundlePagePrivate.h>
 #include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKBundleRange.h>
 #include <WebKit2/WKString.h>
 #include <WebKit2/WKStringCF.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
+using namespace std;
+
 namespace WTR {
 
 static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
@@ -52,6 +56,30 @@ static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
     return buffer.release();
 }
 
+
+static string dumpPath(WKBundleNodeRef node)
+{
+    if (!node)
+        return "(null)";
+
+    WKRetainPtr<WKStringRef> nodeName(AdoptWK, WKBundleNodeCopyNodeName(node));
+    OwnPtr<Vector<char> > str = WKStringToUTF8(nodeName.get());
+    str->shrink(str->size() - 1);
+    WKBundleNodeRef parent = WKBundleNodeGetParent(node);
+    if (parent) {
+        str->append(" > ", 3);
+        string parentPath = dumpPath(parent);
+        str->append(parentPath.data(), parentPath.length());
+    }
+    return string(str->data(), str->size());
+}
+
+static ostream& operator<<(ostream& out, WKBundleRangeRef rangeRef)
+{
+    out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef));
+    return out;
+}
+
 InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
     : m_page(page)
     , m_isLoading(false)
@@ -80,6 +108,13 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
         _willRunJavaScriptPrompt
     };
     WKBundlePageSetUIClient(m_page, &uiClient);
+
+    WKBundlePageEditorClient editorClient = {
+        0,
+        this,
+        _shouldBeginEditing,
+    };
+    WKBundlePageSetEditorClient(m_page, &editorClient);
 }
 
 InjectedBundlePage::~InjectedBundlePage()
@@ -334,4 +369,19 @@ void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRe
     InjectedBundle::shared().os() << "PROMPT: " << WKStringToUTF8(message)->data() << ", default text: " << WKStringToUTF8(defaultValue)->data() <<  "\n";
 }
 
+// Editor Client Callbacks
+
+bool InjectedBundlePage::_shouldBeginEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+{
+    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldBeginEditing(range);
+}
+
+bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
+{
+    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldBeginEditingInDOMRange:" << range << "\n";
+    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+
 } // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index be74133..0849b3a 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -71,6 +71,10 @@ private:
     void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef);
     void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
 
+    // Editor client
+    static bool _shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+    bool shouldBeginEditing(WKBundleRangeRef);
+
     void dumpAllFramesText();
     void dumpAllFrameScrollPositions();
 
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 35351a6..b08fae0 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -44,6 +44,8 @@ PassRefPtr<LayoutTestController> LayoutTestController::create(const std::string&
 LayoutTestController::LayoutTestController(const std::string& testPathOrURL)
     : m_whatToDump(RenderTree)
     , m_shouldDumpAllFrameScrollPositions(false)
+    , m_acceptsEditing(true)
+    , m_dumpEditingCallbacks(false)
     , m_dumpStatusCallbacks(false)
     , m_waitToDump(false)
     , m_testRepaint(false)
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index a3b42f6..dda65c4 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -52,6 +52,7 @@ public:
 
     // Other dumping.
     void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
+    void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; }
     void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
 
     // Repaint testing.
@@ -63,10 +64,14 @@ public:
     unsigned numberOfActiveAnimations() const;
     bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
 
+    void setAcceptsEditing(bool value) { m_acceptsEditing = value; }
+    bool acceptsEditing() const { return m_acceptsEditing; }
+
     enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
     WhatToDump whatToDump() const { return m_whatToDump; }
 
     bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; }
+    bool shouldDumpEditingCallbacks() const { return m_dumpEditingCallbacks; }
     bool shouldDumpMainFrameScrollPosition() const { return m_whatToDump == RenderTree; }
 
     bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
@@ -80,6 +85,8 @@ private:
 
     WhatToDump m_whatToDump;
     bool m_shouldDumpAllFrameScrollPositions;
+    bool m_acceptsEditing;
+    bool m_dumpEditingCallbacks;
     bool m_dumpStatusCallbacks;
     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
     bool m_testRepaint;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list