Diff
Modified: trunk/Source/WebKit2/ChangeLog (142899 => 142900)
--- trunk/Source/WebKit2/ChangeLog 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-14 20:53:22 UTC (rev 142900)
@@ -1,3 +1,26 @@
+2013-02-14 Sam Weinig <[email protected]>
+
+ Add conversions between ObjC and C DOM wrappers
+ <rdar://problem/13205468>
+ https://bugs.webkit.org/show_bug.cgi?id=109851
+
+ Reviewed by Anders Carlsson.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp:
+ (WKBundleRangeHandleCreate):
+ * WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h: Added.
+ * WebProcess/InjectedBundle/API/mac/WKDOMNode.mm:
+ (-[WKDOMNode _copyBundleNodeHandleRef]):
+ * WebProcess/InjectedBundle/API/mac/WKDOMNodePrivate.h: Added.
+ * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
+ (-[WKDOMRange _copyBundleRangeHandleRef]):
+ * WebProcess/InjectedBundle/API/mac/WKDOMRangePrivate.h: Added.
+ * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+ (WebKit::InjectedBundleRangeHandle::getOrCreate):
+ * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
+ (InjectedBundleRangeHandle):
+
2013-02-13 Anders Carlsson <[email protected]>
Remove StringPairVector
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (142899 => 142900)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-02-14 20:53:22 UTC (rev 142900)
@@ -793,6 +793,9 @@
BC5D24B516CC3F46007D5461 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
BC5D24B616CC3F4D007D5461 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
BC5D24B716CC3F5D007D5461 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
+ BC5D24C216CD706D007D5461 /* WKDOMNodePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5D24C116CD706D007D5461 /* WKDOMNodePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC5D24C516CD7088007D5461 /* WKDOMRangePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5D24C416CD7088007D5461 /* WKDOMRangePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC5D24C716CD73C5007D5461 /* WKBundleRangeHandlePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5D24C616CD73C5007D5461 /* WKBundleRangeHandlePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */; };
BC64696F11DBE603006455B0 /* ImmutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64696D11DBE603006455B0 /* ImmutableArray.cpp */; };
@@ -2186,6 +2189,9 @@
BC5C75C614954DA600BC4775 /* WKConnectionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKConnectionInternal.h; sourceTree = "<group>"; };
BC5D249F16CC3B9E007D5461 /* ChildProcessMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChildProcessMain.mm; sourceTree = "<group>"; };
BC5D24B816CC40BB007D5461 /* BaseLegacyProcess.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = BaseLegacyProcess.xcconfig; sourceTree = "<group>"; };
+ BC5D24C116CD706D007D5461 /* WKDOMNodePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDOMNodePrivate.h; sourceTree = "<group>"; };
+ BC5D24C416CD7088007D5461 /* WKDOMRangePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDOMRangePrivate.h; sourceTree = "<group>"; };
+ BC5D24C616CD73C5007D5461 /* WKBundleRangeHandlePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleRangeHandlePrivate.h; sourceTree = "<group>"; };
BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleRangeHandle.h; sourceTree = "<group>"; };
BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleRangeHandle.cpp; sourceTree = "<group>"; };
BC64696D11DBE603006455B0 /* ImmutableArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImmutableArray.cpp; sourceTree = "<group>"; };
@@ -3651,8 +3657,10 @@
BC017D0416260FF4007054F5 /* WKDOMInternals.mm */,
BC017D0516260FF4007054F5 /* WKDOMNode.h */,
BC017D0616260FF4007054F5 /* WKDOMNode.mm */,
+ BC5D24C116CD706D007D5461 /* WKDOMNodePrivate.h */,
BC39C4341626366F008BC689 /* WKDOMRange.h */,
BC39C4331626366F008BC689 /* WKDOMRange.mm */,
+ BC5D24C416CD7088007D5461 /* WKDOMRangePrivate.h */,
293EBEA91627D9C9005F89F1 /* WKDOMText.h */,
293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */,
BC017D1F16263308007054F5 /* WKDOMTextIterator.h */,
@@ -4249,6 +4257,7 @@
BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */,
BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */,
BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */,
+ BC5D24C616CD73C5007D5461 /* WKBundleRangeHandlePrivate.h */,
BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */,
BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */,
);
@@ -5549,6 +5558,9 @@
BCAF35E416CA24DA00D4E9FC /* OfflineStorageProcessMessages.h in Headers */,
BCAF35EA16CA253B00D4E9FC /* OfflineStorageProcessCreationParameters.h in Headers */,
514BDED316C98EDD00E4E25E /* StatisticsRequest.h in Headers */,
+ BC5D24C216CD706D007D5461 /* WKDOMNodePrivate.h in Headers */,
+ BC5D24C516CD7088007D5461 /* WKDOMRangePrivate.h in Headers */,
+ BC5D24C716CD73C5007D5461 /* WKBundleRangeHandlePrivate.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp (142899 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp 2013-02-14 20:53:22 UTC (rev 142900)
@@ -25,6 +25,7 @@
#include "config.h"
#include "WKBundleRangeHandle.h"
+#include "WKBundleRangeHandlePrivate.h"
#include "InjectedBundleRangeHandle.h"
#include "WKAPICast.h"
@@ -36,3 +37,9 @@
{
return toAPI(InjectedBundleRangeHandle::APIType);
}
+
+WKBundleRangeHandleRef WKBundleRangeHandleCreate(JSContextRef contextRef, JSObjectRef objectRef)
+{
+ RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(contextRef, objectRef);
+ return toAPI(rangeHandle.release().leakRef());
+}
Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h (0 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandlePrivate.h 2013-02-14 20:53:22 UTC (rev 142900)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2013 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 WKBundleRangeHandlePrivate_h
+#define WKBundleRangeHandlePrivate_h
+
+#include <_javascript_Core/_javascript_.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKBundleRangeHandleRef WKBundleRangeHandleCreate(JSContextRef context, JSObjectRef object);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKBundleRangeHandlePrivate_h
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm (142899 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNode.mm 2013-02-14 20:53:22 UTC (rev 142900)
@@ -29,6 +29,8 @@
#import "WKDOMNode.h"
+#import "InjectedBundleNodeHandle.h"
+#import "WKBundleAPICast.h"
#import "WKDOMInternals.h"
#import <WebCore/Document.h>
@@ -115,4 +117,14 @@
@end
+@implementation WKDOMNode (WKPrivate)
+
+- (WKBundleNodeHandleRef)_copyBundleNodeHandleRef
+{
+ RefPtr<WebKit::InjectedBundleNodeHandle> nodeHandle = WebKit::InjectedBundleNodeHandle::getOrCreate(_impl.get());
+ return toAPI(nodeHandle.release().leakRef());
+}
+
+@end
+
#endif // defined(__LP64__) && defined(__clang__)
Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNodePrivate.h (0 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNodePrivate.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMNodePrivate.h 2013-02-14 20:53:22 UTC (rev 142900)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <WebKit2/WKDOMNode.h>
+
+@interface WKDOMNode (WKPrivate)
+
+- (WKBundleNodeHandleRef)_copyWKBundleNodeHandleRef;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm (142899 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRange.mm 2013-02-14 20:53:22 UTC (rev 142900)
@@ -29,6 +29,8 @@
#import "WKDOMRange.h"
+#import "InjectedBundleRangeHandle.h"
+#import "WKBundleAPICast.h"
#import "WKDOMInternals.h"
#import <WebCore/Document.h>
@@ -147,4 +149,14 @@
@end
+@implementation WKDOMRange (WKPrivate)
+
+- (WKBundleRangeHandleRef)_copyBundleRangeHandleRef
+{
+ RefPtr<WebKit::InjectedBundleRangeHandle> rangeHandle = WebKit::InjectedBundleRangeHandle::getOrCreate(_impl.get());
+ return toAPI(rangeHandle.release().leakRef());
+}
+
+@end
+
#endif // defined(__LP64__) && defined(__clang__)
Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRangePrivate.h (0 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRangePrivate.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMRangePrivate.h 2013-02-14 20:53:22 UTC (rev 142900)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#if defined(__LP64__) && defined(__clang__)
+
+#import <WebKit2/WKRangeNode.h>
+
+@interface WKRangeNode (WKPrivate)
+
+- (WKBundleRangeHandleRef)_copyWKBundleRangeHandleRef;
+
+@end
+
+#endif // defined(__LP64__) && defined(__clang__)
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp (142899 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp 2013-02-14 20:53:22 UTC (rev 142900)
@@ -26,6 +26,8 @@
#include "config.h"
#include "InjectedBundleRangeHandle.h"
+#include <_javascript_Core/APICast.h>
+#include <WebCore/JSRange.h>
#include <WebCore/Range.h>
#include <wtf/HashMap.h>
@@ -41,6 +43,12 @@
return cache;
}
+PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(JSContextRef, JSObjectRef object)
+{
+ Range* range = toRange(toJS(object));
+ return getOrCreate(range);
+}
+
PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(Range* range)
{
if (!range)
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h (142899 => 142900)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h 2013-02-14 20:16:48 UTC (rev 142899)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h 2013-02-14 20:53:22 UTC (rev 142900)
@@ -27,6 +27,7 @@
#define InjectedBundleRangeHandle_h
#include "APIObject.h"
+#include <_javascript_Core/JSBase.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -42,6 +43,7 @@
public:
static const Type APIType = TypeBundleRangeHandle;
+ static PassRefPtr<InjectedBundleRangeHandle> getOrCreate(JSContextRef, JSObjectRef);
static PassRefPtr<InjectedBundleRangeHandle> getOrCreate(WebCore::Range*);
virtual ~InjectedBundleRangeHandle();