[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:27:20 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 9e86be13a91dc873ba8e9e5f7f177cc6bc56aeb2
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Jul 25 07:56:34 2010 +0000
2010-07-25 Alexey Proskuryakov <ap at apple.com>
Reviewed by Sam Weinig.
https://bugs.webkit.org/show_bug.cgi?id=42193
Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
Step 2 - add the rest of editing delegates.
* platform/mac-wk2/Skipped: Changed the bug tracking why the tests are skipped - the delegates
are now implemented, but one of them isn't called for some reason.
2010-07-25 Alexey Proskuryakov <ap at apple.com>
Reviewed by Sam Weinig.
https://bugs.webkit.org/show_bug.cgi?id=42193
Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
Step 2 - add the rest of editing delegates.
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
* WebProcess/InjectedBundle/API/c/WKBundleBase.h:
Added enums for EditorInsertAction and EAffinity. Also added a dummy type for
CSSStyleDeclaration - neither DumpRenderTree not WebKitTestRunner actually use that.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
(WebKit::InjectedBundlePageEditorClient::shouldBeginEditing):
(WebKit::InjectedBundlePageEditorClient::shouldEndEditing):
(WebKit::InjectedBundlePageEditorClient::shouldInsertNode):
(WebKit::InjectedBundlePageEditorClient::shouldInsertText):
(WebKit::InjectedBundlePageEditorClient::shouldDeleteRange):
(WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange):
(WebKit::InjectedBundlePageEditorClient::shouldApplyStyle):
(WebKit::InjectedBundlePageEditorClient::didBeginEditing):
(WebKit::InjectedBundlePageEditorClient::didEndEditing):
(WebKit::InjectedBundlePageEditorClient::didChange):
(WebKit::InjectedBundlePageEditorClient::didChangeSelection):
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::shouldDeleteRange):
(WebKit::WebEditorClient::shouldEndEditing):
(WebKit::WebEditorClient::shouldInsertNode):
(WebKit::WebEditorClient::shouldInsertText):
(WebKit::WebEditorClient::shouldChangeSelectedRange):
(WebKit::WebEditorClient::shouldApplyStyle):
(WebKit::WebEditorClient::didBeginEditing):
(WebKit::WebEditorClient::respondToChangedContents):
(WebKit::WebEditorClient::respondToChangedSelection):
(WebKit::WebEditorClient::didEndEditing):
Added remaining delagates that are needed for WebKitTestRunner.
2010-07-25 Alexey Proskuryakov <ap at apple.com>
Reviewed by Sam Weinig.
https://bugs.webkit.org/show_bug.cgi?id=42193
Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
Step 2 - add the rest of editing delegates.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::operator<<): Fixed to not crash when range is null.
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::_shouldEndEditing):
(WTR::InjectedBundlePage::_shouldInsertNode):
(WTR::InjectedBundlePage::_shouldInsertText):
(WTR::InjectedBundlePage::_shouldDeleteRange):
(WTR::InjectedBundlePage::_shouldChangeSelectedRange):
(WTR::InjectedBundlePage::_shouldApplyStyle):
(WTR::InjectedBundlePage::_didBeginEditing):
(WTR::InjectedBundlePage::_didEndEditing):
(WTR::InjectedBundlePage::_didChange):
(WTR::InjectedBundlePage::_didChangeSelection):
(WTR::InjectedBundlePage::shouldEndEditing):
(WTR::InjectedBundlePage::shouldInsertNode):
(WTR::InjectedBundlePage::shouldInsertText):
(WTR::InjectedBundlePage::shouldDeleteRange):
(WTR::InjectedBundlePage::shouldChangeSelectedRange):
(WTR::InjectedBundlePage::shouldApplyStyle):
(WTR::InjectedBundlePage::didBeginEditing):
(WTR::InjectedBundlePage::didEndEditing):
(WTR::InjectedBundlePage::didChange):
(WTR::InjectedBundlePage::didChangeSelection):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64020 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b16a7a2..5f36031 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-25 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42193
+ Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
+
+ Step 2 - add the rest of editing delegates.
+
+ * platform/mac-wk2/Skipped: Changed the bug tracking why the tests are skipped - the delegates
+ are now implemented, but one of them isn't called for some reason.
+
2010-07-24 Chris Fleizach <cfleizach at apple.com>
Reviewed by David Kilzer.
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index 0c235e6..8f2b14a 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -97,8 +97,8 @@ compositing/geometry/limit-layer-bounds-transformed.html
compositing/geometry/limit-layer-bounds-transformed-overflow.html
compositing/animation/animation-compositing.html
-# Support layoutTestController.dumpEditingCallbacks in WebKitTestRunner
-# <https://bugs.webkit.org/show_bug.cgi?id=42193>
+# WebEditorClient::didBeginEditing is never called in WebKit2
+# <https://bugs.webkit.org/show_bug.cgi?id=42939>
editing/deleting/4845371.html
editing/deleting/5546763.html
editing/deleting/collapse-whitespace-3587601-fix.html
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 827be1c..8aad2c9 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,44 @@
+2010-07-25 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42193
+ Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
+
+ Step 2 - add the rest of editing delegates.
+
+ * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+ * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
+ Added enums for EditorInsertAction and EAffinity. Also added a dummy type for
+ CSSStyleDeclaration - neither DumpRenderTree not WebKitTestRunner actually use that.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
+ (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing):
+ (WebKit::InjectedBundlePageEditorClient::shouldEndEditing):
+ (WebKit::InjectedBundlePageEditorClient::shouldInsertNode):
+ (WebKit::InjectedBundlePageEditorClient::shouldInsertText):
+ (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange):
+ (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange):
+ (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle):
+ (WebKit::InjectedBundlePageEditorClient::didBeginEditing):
+ (WebKit::InjectedBundlePageEditorClient::didEndEditing):
+ (WebKit::InjectedBundlePageEditorClient::didChange):
+ (WebKit::InjectedBundlePageEditorClient::didChangeSelection):
+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ (WebKit::WebEditorClient::shouldDeleteRange):
+ (WebKit::WebEditorClient::shouldEndEditing):
+ (WebKit::WebEditorClient::shouldInsertNode):
+ (WebKit::WebEditorClient::shouldInsertText):
+ (WebKit::WebEditorClient::shouldChangeSelectedRange):
+ (WebKit::WebEditorClient::shouldApplyStyle):
+ (WebKit::WebEditorClient::didBeginEditing):
+ (WebKit::WebEditorClient::respondToChangedContents):
+ (WebKit::WebEditorClient::respondToChangedSelection):
+ (WebKit::WebEditorClient::didEndEditing):
+ Added remaining delagates that are needed for WebKitTestRunner.
+
2010-07-19 Balazs Kelemen <kb at inf.u-szeged.hu>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index b301823..52a33e2 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -27,8 +27,12 @@
#define WKBundleAPICast_h
#include "WKBundleBase.h"
+#include "WKBundlePage.h"
+#include <WebCore/EditorInsertAction.h>
+#include <WebCore/TextAffinity.h>
namespace WebCore {
+ class CSSStyleDeclaration;
class Node;
class Range;
}
@@ -40,18 +44,20 @@ class WebFrame;
class WebPage;
template<typename APIType> struct BundleAPITypeInfo { };
-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<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef> { typedef WebCore::CSSStyleDeclaration* 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<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; };
+template<> struct BundleImplTypeInfo<InjectedBundle*> { typedef WKBundleRef APIType; };
+template<> struct BundleImplTypeInfo<WebCore::CSSStyleDeclaration*> { typedef WKBundleCSSStyleDeclarationRef 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
@@ -69,4 +75,35 @@ inline typename WebKit::BundleImplTypeInfo<T>::APIType toRef(T t)
return reinterpret_cast<typename WebKit::BundleImplTypeInfo<T>::APIType>(t);
}
+inline WKInsertActionType toWK(WebCore::EditorInsertAction action)
+{
+ switch (action) {
+ case WebCore::EditorInsertActionTyped:
+ return kWKInsertActionTyped;
+ break;
+ case WebCore::EditorInsertActionPasted:
+ return kWKInsertActionPasted;
+ break;
+ case WebCore::EditorInsertActionDropped:
+ return kWKInsertActionDropped;
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return kWKInsertActionTyped;
+}
+
+inline WKAffinityType toWK(WebCore::EAffinity affinity)
+{
+ switch (affinity) {
+ case WebCore::UPSTREAM:
+ return kWKAffinityUpstream;
+ break;
+ case WebCore::DOWNSTREAM:
+ return kWKAffinityDownstream;
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return kWKAffinityUpstream;
+}
+
#endif // WKBundleAPICast_h
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
index 61b4d32..784f862 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
@@ -27,6 +27,7 @@
#define WKBundleBase_h
typedef struct OpaqueWKBundle* WKBundleRef;
+typedef struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
typedef struct OpaqueWKBundleFrame* WKBundleFrameRef;
typedef struct OpaqueWKBundleNode* WKBundleNodeRef;
typedef struct OpaqueWKBundlePage* WKBundlePageRef;
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index 32c30f8..04b8e5c 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -35,6 +35,19 @@
extern "C" {
#endif
+enum {
+ kWKInsertActionTyped = 0,
+ kWKInsertActionPasted = 1,
+ kWKInsertActionDropped = 2
+};
+typedef uint32_t WKInsertActionType;
+
+enum {
+ kWKAffinityUpstream,
+ kWKAffinityDownstream
+};
+typedef uint32_t WKAffinityType;
+
// Loader Client
typedef void (*WKBundlePageDidStartProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
@@ -78,11 +91,30 @@ struct WKBundlePageUIClient {
typedef struct WKBundlePageUIClient WKBundlePageUIClient;
// Editor client
+// FIXME: Objective-C API provides a WebView pointer in callbacks, what should the injected bundle API do?
typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldEndEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldInsertNodeCallback)(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
+typedef bool (*WKBundlePageShouldInsertTextCallback)(WKBundlePageRef page, WKStringRef string, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
+typedef bool (*WKBundlePageShouldDeleteRangeCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldChangeSelectedRange)(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo);
+typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
+typedef void (*WKBundlePageEditingNotification)(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo);
+
struct WKBundlePageEditorClient {
int version;
const void * clientInfo;
WKBundlePageShouldBeginEditingCallback shouldBeginEditing;
+ WKBundlePageShouldEndEditingCallback shouldEndEditing;
+ WKBundlePageShouldInsertNodeCallback shouldInsertNode;
+ WKBundlePageShouldInsertTextCallback shouldInsertText;
+ WKBundlePageShouldDeleteRangeCallback shouldDeleteRange;
+ WKBundlePageShouldChangeSelectedRange shouldChangeSelectedRange;
+ WKBundlePageShouldApplyStyle shouldApplyStyle;
+ WKBundlePageEditingNotification didBeginEditing;
+ WKBundlePageEditingNotification didEndEditing;
+ WKBundlePageEditingNotification didChange;
+ WKBundlePageEditingNotification didChangeSelection;
};
typedef struct WKBundlePageEditorClient WKBundlePageEditorClient;
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
index c7d2137..052dfa5 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
@@ -46,11 +46,77 @@ void InjectedBundlePageEditorClient::initialize(WKBundlePageEditorClient* client
memset(&m_client, 0, sizeof(m_client));
}
-bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, WebCore::Range* range)
+bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range)
{
if (m_client.shouldBeginEditing)
return m_client.shouldBeginEditing(toRef(page), toRef(range), m_client.clientInfo);
return true;
}
+bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage* page, Range* range)
+{
+ if (m_client.shouldEndEditing)
+ return m_client.shouldEndEditing(toRef(page), toRef(range), m_client.clientInfo);
+ return true;
+}
+
+bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage* page, Node* node, Range* rangeToReplace, EditorInsertAction action)
+{
+ if (m_client.shouldInsertNode)
+ return m_client.shouldInsertNode(toRef(page), toRef(node), toRef(rangeToReplace), toWK(action), m_client.clientInfo);
+ return true;
+}
+
+bool InjectedBundlePageEditorClient::shouldInsertText(WebPage* page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action)
+{
+ if (m_client.shouldInsertText)
+ return m_client.shouldInsertText(toRef(page), toRef(text), toRef(rangeToReplace), toWK(action), m_client.clientInfo);
+ return true;
+}
+
+bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage* page, Range* range)
+{
+ if (m_client.shouldDeleteRange)
+ return m_client.shouldDeleteRange(toRef(page), toRef(range), m_client.clientInfo);
+ return true;
+}
+
+bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage* page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
+{
+ if (m_client.shouldChangeSelectedRange)
+ return m_client.shouldChangeSelectedRange(toRef(page), toRef(fromRange), toRef(toRange), toWK(affinity), stillSelecting, m_client.clientInfo);
+ return true;
+}
+
+bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage* page, CSSStyleDeclaration* style, Range* range)
+{
+ if (m_client.shouldApplyStyle)
+ return m_client.shouldApplyStyle(toRef(page), toRef(style), toRef(range), m_client.clientInfo);
+ return true;
+}
+
+void InjectedBundlePageEditorClient::didBeginEditing(WebPage* page, StringImpl* notificationName)
+{
+ if (m_client.didBeginEditing)
+ m_client.didBeginEditing(toRef(page), toRef(notificationName), m_client.clientInfo);
+}
+
+void InjectedBundlePageEditorClient::didEndEditing(WebPage* page, StringImpl* notificationName)
+{
+ if (m_client.didEndEditing)
+ m_client.didEndEditing(toRef(page), toRef(notificationName), m_client.clientInfo);
+}
+
+void InjectedBundlePageEditorClient::didChange(WebPage* page, StringImpl* notificationName)
+{
+ if (m_client.didChange)
+ m_client.didChange(toRef(page), toRef(notificationName), m_client.clientInfo);
+}
+
+void InjectedBundlePageEditorClient::didChangeSelection(WebPage* page, StringImpl* notificationName)
+{
+ if (m_client.didChangeSelection)
+ m_client.didChangeSelection(toRef(page), toRef(notificationName), m_client.clientInfo);
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
index 60874b5..62bb687 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h
@@ -27,9 +27,14 @@
#define InjectedBundlePageEditorClient_h
#include "WKBundlePage.h"
+#include <WebCore/EditorInsertAction.h>
+#include <WebCore/TextAffinity.h>
namespace WebCore {
+ class CSSStyleDeclaration;
+ class Node;
class Range;
+ class StringImpl;
}
namespace WebKit {
@@ -43,6 +48,16 @@ public:
void initialize(WKBundlePageEditorClient*);
bool shouldBeginEditing(WebPage*, WebCore::Range*);
+ bool shouldEndEditing(WebPage*, WebCore::Range*);
+ bool shouldInsertNode(WebPage*, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction);
+ bool shouldInsertText(WebPage*, WebCore::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*, WebCore::StringImpl* notificationName);
+ void didEndEditing(WebPage*, WebCore::StringImpl* notificationName);
+ void didChange(WebPage*, WebCore::StringImpl* notificationName);
+ void didChangeSelection(WebPage*, WebCore::StringImpl* notificationName);
private:
WKBundlePageEditorClient m_client;
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 6530af0..b8d9a05 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -42,10 +42,11 @@ void WebEditorClient::pageDestroyed()
delete this;
}
-bool WebEditorClient::shouldDeleteRange(Range*)
+bool WebEditorClient::shouldDeleteRange(Range* range)
{
+ bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(m_page, range);
notImplemented();
- return true;
+ return result;
}
bool WebEditorClient::shouldShowDeleteInterface(HTMLElement*)
@@ -109,32 +110,39 @@ bool WebEditorClient::shouldBeginEditing(Range* range)
return result;
}
-bool WebEditorClient::shouldEndEditing(Range*)
+bool WebEditorClient::shouldEndEditing(Range* range)
{
+ bool result = m_page->injectedBundleEditorClient().shouldEndEditing(m_page, range);
notImplemented();
- return true;
+ return result;
}
-bool WebEditorClient::shouldInsertNode(Node*, Range*, EditorInsertAction)
+bool WebEditorClient::shouldInsertNode(Node* node, Range* rangeToReplace, EditorInsertAction action)
{
+ bool result = m_page->injectedBundleEditorClient().shouldInsertNode(m_page, node, rangeToReplace, action);
notImplemented();
- return true;
+ return result;
}
-bool WebEditorClient::shouldInsertText(const String&, Range*, EditorInsertAction)
+bool WebEditorClient::shouldInsertText(const String& text, Range* rangeToReplace, EditorInsertAction action)
{
- return true;
+ bool result = m_page->injectedBundleEditorClient().shouldInsertText(m_page, text.impl(), rangeToReplace, action);
+ notImplemented();
+ return result;
}
-bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting)
+bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
{
- return true;
+ bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(m_page, fromRange, toRange, affinity, stillSelecting);
+ notImplemented();
+ return result;
}
-bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration*, Range*)
+bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
{
+ bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, style, range);
notImplemented();
- return true;
+ return result;
}
bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
@@ -145,21 +153,30 @@ bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
void WebEditorClient::didBeginEditing()
{
+ // FIXME: What good is a notification name, if it's always the same?
+ static const String WebViewDidBeginEditingNotification = "WebViewDidBeginEditingNotification";
+ m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.impl());
notImplemented();
}
void WebEditorClient::respondToChangedContents()
{
+ static const String WebViewDidChangeNotification = "WebViewDidChangeNotification";
+ m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.impl());
notImplemented();
}
void WebEditorClient::respondToChangedSelection()
{
+ static const String WebViewDidChangeSelectionNotification = "WebViewDidChangeSelectionNotification";
+ m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl());
notImplemented();
}
void WebEditorClient::didEndEditing()
{
+ static const String WebViewDidEndEditingNotification = "WebViewDidEndEditingNotification";
+ m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.impl());
notImplemented();
}
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 01edca4..7fb7aa7 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,37 @@
+2010-07-25 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42193
+ Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
+
+ Step 2 - add the rest of editing delegates.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::operator<<): Fixed to not crash when range is null.
+ (WTR::InjectedBundlePage::InjectedBundlePage):
+ (WTR::InjectedBundlePage::_shouldEndEditing):
+ (WTR::InjectedBundlePage::_shouldInsertNode):
+ (WTR::InjectedBundlePage::_shouldInsertText):
+ (WTR::InjectedBundlePage::_shouldDeleteRange):
+ (WTR::InjectedBundlePage::_shouldChangeSelectedRange):
+ (WTR::InjectedBundlePage::_shouldApplyStyle):
+ (WTR::InjectedBundlePage::_didBeginEditing):
+ (WTR::InjectedBundlePage::_didEndEditing):
+ (WTR::InjectedBundlePage::_didChange):
+ (WTR::InjectedBundlePage::_didChangeSelection):
+ (WTR::InjectedBundlePage::shouldEndEditing):
+ (WTR::InjectedBundlePage::shouldInsertNode):
+ (WTR::InjectedBundlePage::shouldInsertText):
+ (WTR::InjectedBundlePage::shouldDeleteRange):
+ (WTR::InjectedBundlePage::shouldChangeSelectedRange):
+ (WTR::InjectedBundlePage::shouldApplyStyle):
+ (WTR::InjectedBundlePage::didBeginEditing):
+ (WTR::InjectedBundlePage::didEndEditing):
+ (WTR::InjectedBundlePage::didChange):
+ (WTR::InjectedBundlePage::didChangeSelection):
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
2010-07-24 Chris Fleizach <cfleizach at apple.com>
Reviewed by David Kilzer.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 5535f0a..c7417c0 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -101,7 +101,20 @@ static string dumpPath(WKBundleNodeRef node)
static ostream& operator<<(ostream& out, WKBundleRangeRef rangeRef)
{
- out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef));
+ if (rangeRef)
+ out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef));
+ else
+ out << "(null)";
+
+ return out;
+}
+
+static ostream& operator<<(ostream& out, WKBundleCSSStyleDeclarationRef style)
+{
+ // DumpRenderTree calls -[DOMCSSStyleDeclaration description], which just dumps class name and object address.
+ // No existing tests actually hit this code path at the time of this writing, because WebCore doesn't call
+ // the editing client if the styling operation source is CommandFromDOM or CommandFromDOMWithUserInterface.
+ out << "<DOMCSSStyleDeclaration ADDRESS>";
return out;
}
@@ -138,6 +151,16 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
0,
this,
_shouldBeginEditing,
+ _shouldEndEditing,
+ _shouldInsertNode,
+ _shouldInsertText,
+ _shouldDeleteRange,
+ _shouldChangeSelectedRange,
+ _shouldApplyStyle,
+ _didBeginEditing,
+ _didEndEditing,
+ _didChange,
+ _didChangeSelection
};
WKBundlePageSetEditorClient(m_page, &editorClient);
}
@@ -427,6 +450,56 @@ bool InjectedBundlePage::_shouldBeginEditing(WKBundlePageRef page, WKBundleRange
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldBeginEditing(range);
}
+bool InjectedBundlePage::_shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+{
+ return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldEndEditing(range);
+}
+
+bool InjectedBundlePage::_shouldInsertNode(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
+{
+ return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertNode(node, rangeToReplace, action);
+}
+
+bool InjectedBundlePage::_shouldInsertText(WKBundlePageRef page, WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
+{
+ return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertText(text, rangeToReplace, action);
+}
+
+bool InjectedBundlePage::_shouldDeleteRange(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+{
+ return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldDeleteRange(range);
+}
+
+bool InjectedBundlePage::_shouldChangeSelectedRange(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo)
+{
+ return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldChangeSelectedRange(fromRange, toRange, affinity, stillSelecting);
+}
+
+bool InjectedBundlePage::_shouldApplyStyle(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo)
+{
+ return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldApplyStyle(style, range);
+}
+
+void InjectedBundlePage::_didBeginEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didBeginEditing(notificationName);
+}
+
+void InjectedBundlePage::_didEndEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didEndEditing(notificationName);
+}
+
+void InjectedBundlePage::_didChange(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChange(notificationName);
+}
+
+void InjectedBundlePage::_didChangeSelection(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
+{
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeSelection(notificationName);
+}
+
bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
{
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
@@ -434,4 +507,92 @@ bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
return InjectedBundle::shared().layoutTestController()->acceptsEditing();
}
+bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldEndEditingInDOMRange:" << range << "\n";
+ return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
+{
+ static const char *insertactionstring[] = {
+ "WebViewInsertActionTyped",
+ "WebViewInsertActionPasted",
+ "WebViewInsertActionDropped",
+ };
+
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertNode:" << dumpPath(node) << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n";
+ return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
+{
+ static const char *insertactionstring[] = {
+ "WebViewInsertActionTyped",
+ "WebViewInsertActionPasted",
+ "WebViewInsertActionDropped",
+ };
+
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertText:" << text << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n";
+ return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeRef range)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldDeleteDOMRange:" << range << "\n";
+ return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting)
+{
+ static const char *affinitystring[] = {
+ "NSSelectionAffinityUpstream",
+ "NSSelectionAffinityDownstream"
+ };
+ static const char *boolstring[] = {
+ "FALSE",
+ "TRUE"
+ };
+
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldChangeSelectedDOMRange:" << fromRange << " toDOMRange:" << toRange << " affinity:" << affinitystring[affinity] << " stillSelecting:" << boolstring[stillSelecting] << "\n";
+ return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldApplyStyle:" << style << " toElementsInDOMRange:" << range << "\n";
+ return InjectedBundle::shared().layoutTestController()->acceptsEditing();
+}
+
+void InjectedBundlePage::didBeginEditing(WKStringRef notificationName)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidBeginEditing:" << notificationName << "\n";
+}
+
+void InjectedBundlePage::didEndEditing(WKStringRef notificationName)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidEndEditing:" << notificationName << "\n";
+}
+
+void InjectedBundlePage::didChange(WKStringRef notificationName)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChange:" << notificationName << "\n";
+}
+
+void InjectedBundlePage::didChangeSelection(WKStringRef notificationName)
+{
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
+ InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChangeSelection:" << notificationName << "\n";
+}
+
+
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index 0849b3a..1b67af0 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -73,7 +73,27 @@ private:
// Editor client
static bool _shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+ static bool _shouldEndEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+ static bool _shouldInsertNode(WKBundlePageRef, WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
+ static bool _shouldInsertText(WKBundlePageRef, WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
+ static bool _shouldDeleteRange(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
+ static bool _shouldChangeSelectedRange(WKBundlePageRef, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting, const void* clientInfo);
+ static bool _shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
+ static void _didBeginEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static void _didEndEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static void _didChange(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
+ static void _didChangeSelection(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
bool shouldBeginEditing(WKBundleRangeRef);
+ bool shouldEndEditing(WKBundleRangeRef);
+ bool shouldInsertNode(WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
+ bool shouldInsertText(WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
+ bool shouldDeleteRange(WKBundleRangeRef);
+ bool shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting);
+ bool shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range);
+ void didBeginEditing(WKStringRef notificationName);
+ void didEndEditing(WKStringRef notificationName);
+ void didChange(WKStringRef notificationName);
+ void didChangeSelection(WKStringRef notificationName);
void dumpAllFramesText();
void dumpAllFrameScrollPositions();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list