[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
weinig at apple.com
weinig at apple.com
Wed Dec 22 13:25:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b8480bcfd6e8a5f820f28eafed33132abfced2bb
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Sep 14 22:53:31 2010 +0000
Remove WKBundleNodeRef, replacing uses with WKBundleNodeHandleRef.
https://bugs.webkit.org/show_bug.cgi?id=45785
Reviewed by Anders Carlsson.
WebKit2:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:
Remove files.
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
* WebProcess/InjectedBundle/API/c/WKBundleBase.h:
* WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: Removed.
* WebProcess/InjectedBundle/API/c/WKBundleNode.h: Removed.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/API/c/WKBundleRange.cpp:
(WKBundleRangeCopyStartContainer):
(WKBundleRangeCopyEndContainer):
* WebProcess/InjectedBundle/API/c/WKBundleRange.h:
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
(WebKit::InjectedBundlePageEditorClient::shouldInsertNode):
Change to be in terms of WKBundleNodeHandleRef.
WebKitTools:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::propertyValue):
(WTR::numericWindowPropertyValue):
(WTR::dumpPath):
(WTR::toStr):
(WTR::operator<<):
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::shouldInsertNode):
(WTR::InjectedBundlePage::shouldBeginEditing):
(WTR::InjectedBundlePage::shouldEndEditing):
(WTR::InjectedBundlePage::shouldInsertText):
(WTR::InjectedBundlePage::shouldDeleteRange):
(WTR::InjectedBundlePage::shouldChangeSelectedRange):
(WTR::InjectedBundlePage::shouldApplyStyle):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67507 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index cf13b5a..0666f36 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
+2010-09-14 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Remove WKBundleNodeRef, replacing uses with WKBundleNodeHandleRef.
+ https://bugs.webkit.org/show_bug.cgi?id=45785
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * win/WebKit2.vcproj:
+ Remove files.
+
+ * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+ * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
+ * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: Removed.
+ * WebProcess/InjectedBundle/API/c/WKBundleNode.h: Removed.
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+ * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp:
+ (WKBundleRangeCopyStartContainer):
+ (WKBundleRangeCopyEndContainer):
+ * WebProcess/InjectedBundle/API/c/WKBundleRange.h:
+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
+ (WebKit::InjectedBundlePageEditorClient::shouldInsertNode):
+ Change to be in terms of WKBundleNodeHandleRef.
+
2010-09-14 Jessie Berlin <jberlin at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 080092b..57a9d45 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -354,8 +354,6 @@
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 */
@@ -740,8 +738,6 @@
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 */
@@ -1343,8 +1339,6 @@
BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */,
BCF049E411FE20F600F86A58 /* WKBundleFramePrivate.h */,
BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */,
- E1EE565511F8F71700CCBEE4 /* WKBundleNode.cpp */,
- E1EE562F11F8F6AA00CCBEE4 /* WKBundleNode.h */,
BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */,
BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */,
BC20528011C94284008F3375 /* WKBundlePage.cpp */,
@@ -1588,7 +1582,6 @@
1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */,
E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */,
E1EE55F411F8F18900CCBEE4 /* WKBundleRange.h in Headers */,
- E1EE563011F8F6AA00CCBEE4 /* WKBundleNode.h in Headers */,
BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */,
BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */,
1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */,
@@ -1842,7 +1835,6 @@
1A24B5F211F531E800C38269 /* MachUtilities.cpp in Sources */,
E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */,
E1EE55F811F8F1BC00CCBEE4 /* WKBundleRange.cpp in Sources */,
- E1EE565611F8F71700CCBEE4 /* WKBundleNode.cpp in Sources */,
1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */,
1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */,
1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */,
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index 9c4a3fc..8dfc895 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -55,7 +55,6 @@ template<> struct BundleAPITypeInfo<WKBundlePageRef> { typede
template<> struct BundleAPITypeInfo<WKBundleRef> { typedef InjectedBundle* ImplType; };
template<> struct BundleAPITypeInfo<WKBundleNodeHandleRef> { typedef InjectedBundleNodeHandle* ImplType; };
template<> struct BundleAPITypeInfo<WKBundleScriptWorldRef> { typedef InjectedBundleScriptWorld* ImplType; };
-template<> struct BundleAPITypeInfo<WKBundleNodeRef> { typedef WebCore::Node* ImplType; };
template<> struct BundleAPITypeInfo<WKBundleRangeRef> { typedef WebCore::Range* ImplType; };
template<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef> { typedef WebCore::CSSStyleDeclaration* ImplType; };
@@ -66,7 +65,6 @@ template<> struct BundleImplTypeInfo<InjectedBundleScriptWorld*> { typede
template<> struct BundleImplTypeInfo<WebFrame*> { typedef WKBundleFrameRef APIType; };
template<> struct BundleImplTypeInfo<WebPage*> { typedef WKBundlePageRef 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; };
/* Opaque typing convenience methods */
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
index 51c1c70..16a2a48 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
@@ -33,7 +33,6 @@ typedef const struct OpaqueWKBundlePage* WKBundlePageRef;
typedef const struct OpaqueWKBundleScriptWorld* WKBundleScriptWorldRef;
typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
-typedef const struct OpaqueWKBundleNode* WKBundleNodeRef;
typedef const struct OpaqueWKBundleRange* WKBundleRangeRef;
#undef WK_EXPORT
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
deleted file mode 100644
index 9e271e2..0000000
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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/ContainerNode.h>
-
-using namespace WebCore;
-using namespace WebKit;
-
-WKStringRef WKBundleNodeCopyNodeName(WKBundleNodeRef node)
-{
- return toCopiedRef(toWK(node)->nodeName());
-}
-
-WKBundleNodeRef WKBundleNodeGetParent(WKBundleNodeRef node)
-{
- Node* parent = toWK(node)->parent();
- return toRef(parent);
-}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
deleted file mode 100644
index 39824bd..0000000
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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>
-
-#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.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index b723474..1fb8220 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -109,7 +109,7 @@ typedef struct WKBundlePageUIClient WKBundlePageUIClient;
// Editor client
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 (*WKBundlePageShouldInsertNodeCallback)(WKBundlePageRef page, WKBundleNodeHandleRef 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);
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
index efcb7f3..2ee91bd 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
@@ -25,8 +25,8 @@
#include "WKBundleRange.h"
+#include "InjectedBundleNodeHandle.h"
#include "WKBundleAPICast.h"
-#include "WKBundleNode.h"
#include <WebCore/Range.h>
using namespace WebCore;
@@ -37,9 +37,10 @@ unsigned WKBundleRangeGetStartOffset(WKBundleRangeRef range)
return toWK(range)->startOffset();
}
-WKBundleNodeRef WKBundleRangeGetStartContainer(WKBundleRangeRef range)
+WKBundleNodeHandleRef WKBundleRangeCopyStartContainer(WKBundleRangeRef range)
{
- return toRef(toWK(range)->startContainer());
+ RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(toWK(range)->startContainer());
+ return toRef(nodeHandle.release().leakRef());
}
unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range)
@@ -47,7 +48,8 @@ unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range)
return toWK(range)->endOffset();
}
-WKBundleNodeRef WKBundleRangeGetEndContainer(WKBundleRangeRef range)
+WKBundleNodeHandleRef WKBundleRangeCopyEndContainer(WKBundleRangeRef range)
{
- return toRef(toWK(range)->endContainer());
+ RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(toWK(range)->endContainer());
+ return toRef(nodeHandle.release().leakRef());
}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h
index 0d3d9d9..3b01805 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h
@@ -39,11 +39,11 @@ extern "C" {
WK_EXPORT unsigned WKBundleRangeGetStartOffset(WKBundleRangeRef range);
-WK_EXPORT WKBundleNodeRef WKBundleRangeGetStartContainer(WKBundleRangeRef range);
+WK_EXPORT WKBundleNodeHandleRef WKBundleRangeCopyStartContainer(WKBundleRangeRef range);
WK_EXPORT unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range);
-WK_EXPORT WKBundleNodeRef WKBundleRangeGetEndContainer(WKBundleRangeRef range);
+WK_EXPORT WKBundleNodeHandleRef WKBundleRangeCopyEndContainer(WKBundleRangeRef range);
#ifdef __cplusplus
}
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
index 4df8ee9..613441d 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
@@ -27,6 +27,7 @@
#include "WKAPICast.h"
#include "WKBundleAPICast.h"
+#include "InjectedBundleNodeHandle.h"
#include <wtf/text/WTFString.h>
using namespace WebCore;
@@ -62,8 +63,10 @@ bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage* page, Range* rang
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);
+ if (m_client.shouldInsertNode) {
+ RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(node);
+ return m_client.shouldInsertNode(toRef(page), toRef(nodeHandle.get()), toRef(rangeToReplace), toWK(action), m_client.clientInfo);
+ }
return true;
}
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index b84b0fc..cb2bd03 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -906,14 +906,6 @@
>
</File>
<File
- RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNode.cpp"
- >
- </File>
- <File
- RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNode.h"
- >
- </File>
- <File
RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.cpp"
>
</File>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 47b5e03..5aadec9 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,26 @@
+2010-09-14 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Remove WKBundleNodeRef, replacing uses with WKBundleNodeHandleRef.
+ https://bugs.webkit.org/show_bug.cgi?id=45785
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::propertyValue):
+ (WTR::numericWindowPropertyValue):
+ (WTR::dumpPath):
+ (WTR::toStr):
+ (WTR::operator<<):
+ (WTR::InjectedBundlePage::InjectedBundlePage):
+ (WTR::InjectedBundlePage::shouldInsertNode):
+ (WTR::InjectedBundlePage::shouldBeginEditing):
+ (WTR::InjectedBundlePage::shouldEndEditing):
+ (WTR::InjectedBundlePage::shouldInsertText):
+ (WTR::InjectedBundlePage::shouldDeleteRange):
+ (WTR::InjectedBundlePage::shouldChangeSelectedRange):
+ (WTR::InjectedBundlePage::shouldApplyStyle):
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
2010-09-14 Adam Barth <abarth at webkit.org>
Fix two typos in commit-queue. The first is harmless. The second
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 80dcbc0..5f0052c 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -31,54 +31,75 @@
#include <WebKit2/WKArray.h>
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKBundleFramePrivate.h>
-#include <WebKit2/WKBundleNode.h>
#include <WebKit2/WKBundlePagePrivate.h>
-#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKBundleRange.h>
-#include <WebKit2/WKBundleScriptWorld.h>
using namespace std;
namespace WTR {
-static ostream& operator<<(ostream& out, WKBundleFrameRef frame)
+static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const char* propertyName)
{
- WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
- if (WKBundleFrameIsMainFrame(frame)) {
- if (!WKStringIsEmpty(name.get()))
- out << "main frame \"" << name << "\"";
- else
- out << "main frame";
- } else {
- if (!WKStringIsEmpty(name.get()))
- out << "frame \"" << name << "\"";
- else
- out << "frame (anonymous)";
- }
+ if (!object)
+ return 0;
+ JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
+ JSValueRef exception;
+ return JSObjectGetProperty(context, object, propertyNameString.get(), &exception);
+}
- return out;
+static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
+{
+ JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
+ JSValueRef value = propertyValue(context, JSContextGetGlobalObject(context), propertyName);
+ if (!value)
+ return 0;
+ JSValueRef exception;
+ return JSValueToNumber(context, value, &exception);
}
-static string dumpPath(WKBundleNodeRef node)
+static string dumpPath(JSGlobalContextRef context, JSObjectRef nodeValue)
{
- if (!node)
- return "(null)";
- WKRetainPtr<WKStringRef> nodeName(AdoptWK, WKBundleNodeCopyNodeName(node));
+ JSValueRef nodeNameValue = propertyValue(context, nodeValue, "nodeName");
+ JSRetainPtr<JSStringRef> jsStringNodeName(Adopt, JSValueToStringCopy(context, nodeNameValue, 0));
+ WKRetainPtr<WKStringRef> nodeName = toWK(jsStringNodeName);
+
+ JSValueRef parentNode = propertyValue(context, nodeValue, "parentNode");
+
ostringstream out;
out << nodeName;
- if (WKBundleNodeRef parent = WKBundleNodeGetParent(node))
- out << " > " << dumpPath(parent);
+
+ if (parentNode && JSValueIsObject(context, parentNode))
+ out << " > " << dumpPath(context, (JSObjectRef)parentNode);
+
return out.str();
}
-static ostream& operator<<(ostream& out, WKBundleRangeRef rangeRef)
+static string dumpPath(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleNodeHandleRef node)
{
- if (rangeRef)
- out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef));
- else
- out << "(null)";
+ if (!node)
+ return "(null)";
- return out;
+ WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
+
+ JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world);
+ JSValueRef nodeValue = WKBundleFrameGetJavaScriptWrapperForNodeForWorld(frame, node, world);
+ ASSERT(JSValueIsObject(context, nodeValue));
+ JSObjectRef nodeObject = (JSObjectRef)nodeValue;
+
+ return dumpPath(context, nodeObject);
+}
+
+static string toStr(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleRangeRef rangeRef)
+{
+ if (!rangeRef)
+ return "(null)";
+
+ WKRetainPtr<WKBundleNodeHandleRef> startNode(AdoptWK, WKBundleRangeCopyStartContainer(rangeRef));
+ WKRetainPtr<WKBundleNodeHandleRef> endNode(AdoptWK, WKBundleRangeCopyEndContainer(rangeRef));
+
+ ostringstream out;
+ out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(page, world, startNode.get()) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(page, world, endNode.get());
+ return out.str();
}
static ostream& operator<<(ostream& out, WKBundleCSSStyleDeclarationRef style)
@@ -90,8 +111,27 @@ static ostream& operator<<(ostream& out, WKBundleCSSStyleDeclarationRef style)
return out;
}
+static ostream& operator<<(ostream& out, WKBundleFrameRef frame)
+{
+ WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
+ if (WKBundleFrameIsMainFrame(frame)) {
+ if (!WKStringIsEmpty(name.get()))
+ out << "main frame \"" << name << "\"";
+ else
+ out << "main frame";
+ } else {
+ if (!WKStringIsEmpty(name.get()))
+ out << "frame \"" << name << "\"";
+ else
+ out << "frame (anonymous)";
+ }
+
+ return out;
+}
+
InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
: m_page(page)
+ , m_world(AdoptWK, WKBundleScriptWorldCreateWorld())
, m_isLoading(false)
{
WKBundlePageLoaderClient loaderClient = {
@@ -261,25 +301,6 @@ void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
{
}
-static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const char* propertyName)
-{
- if (!object)
- return 0;
- JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
- JSValueRef exception;
- return JSObjectGetProperty(context, object, propertyNameString.get(), &exception);
-}
-
-static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
-{
- JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
- JSValueRef value = propertyValue(context, JSContextGetGlobalObject(context), propertyName);
- if (!value)
- return 0;
- JSValueRef exception;
- return JSValueToNumber(context, value, &exception);
-}
-
enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName };
static void dumpFrameScrollPosition(WKBundleFrameRef frame, FrameNamePolicy shouldIncludeFrameName = ShouldNotIncludeFrameName)
@@ -544,7 +565,7 @@ bool InjectedBundlePage::shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldEndEditing(range);
}
-bool InjectedBundlePage::shouldInsertNode(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
+bool InjectedBundlePage::shouldInsertNode(WKBundlePageRef page, WKBundleNodeHandleRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertNode(node, rangeToReplace, action);
}
@@ -595,7 +616,7 @@ bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
return true;
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldBeginEditingInDOMRange:" << range << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldBeginEditingInDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
@@ -605,11 +626,11 @@ bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
return true;
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldEndEditingInDOMRange:" << range << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldEndEditingInDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
-bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
+bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
{
if (!InjectedBundle::shared().isTestRunning())
return true;
@@ -621,7 +642,7 @@ bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef
};
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertNode:" << dumpPath(node) << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertNode:" << dumpPath(m_page, m_world.get(), node) << " replacingDOMRange:" << toStr(m_page, m_world.get(), rangeToReplace) << " givenAction:" << insertactionstring[action] << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
@@ -637,7 +658,7 @@ bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeRef ran
};
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertText:" << text << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertText:" << text << " replacingDOMRange:" << toStr(m_page, m_world.get(), rangeToReplace) << " givenAction:" << insertactionstring[action] << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
@@ -647,7 +668,7 @@ bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeRef range)
return true;
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldDeleteDOMRange:" << range << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldDeleteDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
@@ -666,7 +687,7 @@ bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeRef fromRange, W
};
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldChangeSelectedDOMRange:" << fromRange << " toDOMRange:" << toRange << " affinity:" << affinitystring[affinity] << " stillSelecting:" << boolstring[stillSelecting] << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldChangeSelectedDOMRange:" << toStr(m_page, m_world.get(), fromRange) << " toDOMRange:" << toStr(m_page, m_world.get(), toRange) << " affinity:" << affinitystring[affinity] << " stillSelecting:" << boolstring[stillSelecting] << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
@@ -676,7 +697,7 @@ bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style,
return true;
if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
- InjectedBundle::shared().os() << "EDITING DELEGATE: shouldApplyStyle:" << style << " toElementsInDOMRange:" << range << "\n";
+ InjectedBundle::shared().os() << "EDITING DELEGATE: shouldApplyStyle:" << style << " toElementsInDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index cde1655..06601bb 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -27,6 +27,8 @@
#define InjectedBundlePage_h
#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKRetainPtr.h>
namespace WTR {
@@ -91,7 +93,7 @@ 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 shouldInsertNode(WKBundlePageRef, WKBundleNodeHandleRef, 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);
@@ -102,7 +104,7 @@ private:
static void didChangeSelection(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
bool shouldBeginEditing(WKBundleRangeRef);
bool shouldEndEditing(WKBundleRangeRef);
- bool shouldInsertNode(WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
+ bool shouldInsertNode(WKBundleNodeHandleRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
bool shouldInsertText(WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
bool shouldDeleteRange(WKBundleRangeRef);
bool shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting);
@@ -116,6 +118,7 @@ private:
void dumpAllFrameScrollPositions();
WKBundlePageRef m_page;
+ WKRetainPtr<WKBundleScriptWorldRef> m_world;
bool m_isLoading;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list