[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:32:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 33503c154e64f2649b57d337fce8eac1ed220bd4
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Sep 19 17:40:36 2010 +0000

    Replace WKBundleRangeRef with WKBundleRangeHandleRef.
    https://bugs.webkit.org/show_bug.cgi?id=46054
    
    Reviewed by Anders Carlsson.
    
    The new one acts like WKBundleNodeHandleRef and allows for getting a
    wrapper in a specific world for the handle.
    
    WebKit2:
    
    * Shared/APIObject.h:
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
    * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
    * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
    (WKBundleFrameGetJavaScriptWrapperForRangeForWorld):
    * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: Removed.
    * WebProcess/InjectedBundle/API/c/WKBundleRange.h: Removed.
    * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp: Added.
    (WKBundleRangeHandleGetTypeID):
    * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h: Added.
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
    (WebKit::InjectedBundleNodeHandle::getOrCreate):
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
    * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: Added.
    (WebKit::domHandleCache):
    (WebKit::InjectedBundleRangeHandle::getOrCreate):
    (WebKit::InjectedBundleRangeHandle::create):
    (WebKit::InjectedBundleRangeHandle::InjectedBundleRangeHandle):
    (WebKit::InjectedBundleRangeHandle::~InjectedBundleRangeHandle):
    (WebKit::InjectedBundleRangeHandle::coreRange):
    * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h: Added.
    (WebKit::InjectedBundleRangeHandle::type):
    * 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):
    * WebProcess/WebPage/WebFrame.cpp:
    (WebKit::WebFrame::jsWrapperForWorld):
    * WebProcess/WebPage/WebFrame.h:
    * win/WebKit2.vcproj:
    * win/WebKit2Generated.make:
    
    WebKitTools:
    
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
    (WTR::propertyValue):
    (WTR::propertyValueDouble):
    (WTR::propertyValueInt):
    (WTR::numericWindowPropertyValue):
    (WTR::toStr):
    (WTR::InjectedBundlePage::shouldBeginEditing):
    (WTR::InjectedBundlePage::shouldEndEditing):
    (WTR::InjectedBundlePage::shouldInsertNode):
    (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@67813 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 58fbdc9..3762faa 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,53 @@
+2010-09-19  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Replace WKBundleRangeRef with WKBundleRangeHandleRef.
+        https://bugs.webkit.org/show_bug.cgi?id=46054
+
+        The new one acts like WKBundleNodeHandleRef and allows for getting a
+        wrapper in a specific world for the handle.
+
+        * Shared/APIObject.h:
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+        (WKBundleFrameGetJavaScriptWrapperForRangeForWorld):
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: Removed.
+        * WebProcess/InjectedBundle/API/c/WKBundleRange.h: Removed.
+        * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp: Added.
+        (WKBundleRangeHandleGetTypeID):
+        * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h: Added.
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+        (WebKit::InjectedBundleNodeHandle::getOrCreate):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: Added.
+        (WebKit::domHandleCache):
+        (WebKit::InjectedBundleRangeHandle::getOrCreate):
+        (WebKit::InjectedBundleRangeHandle::create):
+        (WebKit::InjectedBundleRangeHandle::InjectedBundleRangeHandle):
+        (WebKit::InjectedBundleRangeHandle::~InjectedBundleRangeHandle):
+        (WebKit::InjectedBundleRangeHandle::coreRange):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h: Added.
+        (WebKit::InjectedBundleRangeHandle::type):
+        * 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):
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::jsWrapperForWorld):
+        * WebProcess/WebPage/WebFrame.h:
+        * win/WebKit2.vcproj:
+        * win/WebKit2Generated.make:
+
 2010-09-18  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index 4eada83..ab481c9 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -66,9 +66,10 @@ public:
         // Bundle types
         TypeBundle,
         TypeBundleFrame,
+        TypeBundleNodeHandle,
         TypeBundlePage,
+        TypeBundleRangeHandle,
         TypeBundleScriptWorld,
-        TypeBundleNodeHandle,
 
         // Platform specific
         TypeView
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 378eb87..55cab07 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -233,6 +233,7 @@ HEADERS += \
     WebProcess/InjectedBundle/API/c/WKBundleBase.h \
     WebProcess/InjectedBundle/API/c/WKBundlePage.h \
     WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h \
+    WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h \
     WebProcess/InjectedBundle/InjectedBundle.h \
     WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \
     WebProcess/InjectedBundle/InjectedBundlePageUIClient.h \
@@ -347,6 +348,7 @@ SOURCES += \
     UIProcess/WebProcessProxy.cpp \
     UIProcess/WebUIClient.cpp \
     WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp \
+    WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp \
     WebProcess/InjectedBundle/InjectedBundle.cpp \
     WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp \
     WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 95125b3..8923b9f 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -199,6 +199,8 @@
 		BC33DE8E12385C3300360F3F /* WKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = BC33DE8C12385C3300360F3F /* WKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BC33DE8F12385C3300360F3F /* WKNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC33DE8D12385C3300360F3F /* WKNumber.cpp */; };
 		BC33DF061238677F00360F3F /* WKSerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A72D5F2E1236F9E800A88B15 /* WKSerializedScriptValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */; };
+		BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */; };
 		BC4BEEAB120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */; };
 		BC4BEEAC120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */; };
 		BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -208,6 +210,8 @@
 		BC5F7BB41182376C0052C02C /* ChunkedUpdateDrawingArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */; };
 		BC5F7BB51182376C0052C02C /* ChunkedUpdateDrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BB31182376C0052C02C /* ChunkedUpdateDrawingArea.h */; };
 		BC5F7BB9118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */; };
+		BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */; };
 		BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; };
 		BC64680311DBBA73006455B0 /* WKArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64680211DBBA73006455B0 /* WKArray.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BC64680B11DBBD69006455B0 /* WKArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64680A11DBBD69006455B0 /* WKArray.cpp */; };
@@ -360,8 +364,6 @@
 		D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */; };
 		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 */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -588,6 +590,8 @@
 		BC33DD671238464600360F3F /* WebNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNumber.h; sourceTree = "<group>"; };
 		BC33DE8C12385C3300360F3F /* WKNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNumber.h; sourceTree = "<group>"; };
 		BC33DE8D12385C3300360F3F /* WKNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNumber.cpp; sourceTree = "<group>"; };
+		BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleRangeHandle.h; sourceTree = "<group>"; };
+		BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleRangeHandle.cpp; sourceTree = "<group>"; };
 		BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleNodeHandle.h; sourceTree = "<group>"; };
 		BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleNodeHandle.cpp; sourceTree = "<group>"; };
 		BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNodeHandle.h; sourceTree = "<group>"; };
@@ -597,6 +601,8 @@
 		BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingArea.cpp; sourceTree = "<group>"; };
 		BC5F7BB31182376C0052C02C /* ChunkedUpdateDrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChunkedUpdateDrawingArea.h; sourceTree = "<group>"; };
 		BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingAreaMac.cpp; 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>"; };
 		BC64680211DBBA73006455B0 /* WKArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKArray.h; sourceTree = "<group>"; };
 		BC64680A11DBBD69006455B0 /* WKArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKArray.cpp; sourceTree = "<group>"; };
 		BC64696D11DBE603006455B0 /* ImmutableArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImmutableArray.cpp; sourceTree = "<group>"; };
@@ -752,8 +758,6 @@
 		D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSearchPopupMenu.h; 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>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1368,8 +1372,8 @@
 				BC20527F11C94284008F3375 /* WKBundlePage.h */,
 				BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */,
 				BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */,
-				E1EE55F711F8F1BC00CCBEE4 /* WKBundleRange.cpp */,
-				E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */,
+				BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */,
+				BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */,
 				BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */,
 				BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */,
 			);
@@ -1410,6 +1414,8 @@
 			children = (
 				BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */,
 				BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */,
+				BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */,
+				BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */,
 			);
 			path = DOM;
 			sourceTree = "<group>";
@@ -1606,7 +1612,6 @@
 				1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */,
 				1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */,
 				E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */,
-				E1EE55F411F8F18900CCBEE4 /* WKBundleRange.h in Headers */,
 				BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */,
 				BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */,
 				1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */,
@@ -1658,6 +1663,8 @@
 				BC33DE8E12385C3300360F3F /* WKNumber.h in Headers */,
 				BC33DF061238677F00360F3F /* WKSerializedScriptValue.h in Headers */,
 				BCF50121123ED3B3005955AE /* ThreadLauncher.h in Headers */,
+				BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */,
+				BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */,
 				BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */,
 				BCF50724124328A9005955AE /* WKCertificateInfo.h in Headers */,
 				BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */,
@@ -1863,7 +1870,6 @@
 				1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */,
 				1A24B5F211F531E800C38269 /* MachUtilities.cpp in Sources */,
 				E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */,
-				E1EE55F811F8F1BC00CCBEE4 /* WKBundleRange.cpp in Sources */,
 				1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */,
 				1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */,
 				1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */,
@@ -1909,6 +1915,8 @@
 				BC33DE8F12385C3300360F3F /* WKNumber.cpp in Sources */,
 				BCF50122123ED3B3005955AE /* ThreadLauncher.cpp in Sources */,
 				BCF501B4123EF602005955AE /* ThreadLauncherMac.mm in Sources */,
+				BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */,
+				BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */,
 				BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */,
 				BCF50725124328A9005955AE /* WKCertificateInfo.cpp in Sources */,
 				BCF5072F12432A97005955AE /* WKCertificateInfoMac.mm in Sources */,
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index 8dfc895..024a691 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -37,35 +37,34 @@
 
 namespace WebCore {
     class CSSStyleDeclaration;
-    class Node;
-    class Range;
 }
 
 namespace WebKit {
 
 class InjectedBundle;
 class InjectedBundleNodeHandle;
+class InjectedBundleRangeHandle;
 class InjectedBundleScriptWorld;
 class WebFrame;
 class WebPage;
 
 template<typename APIType> struct BundleAPITypeInfo { };
+template<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef>     { typedef WebCore::CSSStyleDeclaration* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleFrameRef>                   { typedef WebFrame* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleNodeHandleRef>              { typedef InjectedBundleNodeHandle* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundlePageRef>                    { typedef WebPage* ImplType; };
+template<> struct BundleAPITypeInfo<WKBundleRangeHandleRef>             { typedef InjectedBundleRangeHandle* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleRef>                        { typedef InjectedBundle* ImplType; };
-template<> struct BundleAPITypeInfo<WKBundleNodeHandleRef>              { typedef InjectedBundleNodeHandle* ImplType; };
 template<> struct BundleAPITypeInfo<WKBundleScriptWorldRef>             { typedef InjectedBundleScriptWorld* ImplType; };
-template<> struct BundleAPITypeInfo<WKBundleRangeRef>                   { typedef WebCore::Range* ImplType; };
-template<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef>     { typedef WebCore::CSSStyleDeclaration* ImplType; };
 
 template<typename ImplType> struct BundleImplTypeInfo { };
 template<> struct BundleImplTypeInfo<InjectedBundle*>                   { typedef WKBundleRef APIType; };
 template<> struct BundleImplTypeInfo<InjectedBundleNodeHandle*>         { typedef WKBundleNodeHandleRef APIType; };
+template<> struct BundleImplTypeInfo<InjectedBundleRangeHandle*>        { typedef WKBundleRangeHandleRef APIType; };
 template<> struct BundleImplTypeInfo<InjectedBundleScriptWorld*>        { typedef WKBundleScriptWorldRef APIType; };
 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::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 16a2a48..8d18ec4 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h
@@ -30,10 +30,10 @@ typedef const struct OpaqueWKBundle* WKBundleRef;
 typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef;
 typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef;
 typedef const struct OpaqueWKBundlePage* WKBundlePageRef;
+typedef const struct OpaqueWKBundleRangeHandle* WKBundleRangeHandleRef;
 typedef const struct OpaqueWKBundleScriptWorld* WKBundleScriptWorldRef;
 
 typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
-typedef const struct OpaqueWKBundleRange* WKBundleRangeRef;
 
 #undef WK_EXPORT
 #if defined(WK_NO_EXPORT)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index ea1ccb2..aaba297 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -79,6 +79,11 @@ JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef fra
     return toWK(frameRef)->jsWrapperForWorld(toWK(nodeHandleRef), toWK(worldRef));
 }
 
+JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frameRef, WKBundleRangeHandleRef rangeHandleRef, WKBundleScriptWorldRef worldRef)
+{
+    return toWK(frameRef)->jsWrapperForWorld(toWK(rangeHandleRef), toWK(worldRef));
+}
+
 WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frameRef)
 {
     return toCopiedRef(toWK(frameRef)->name());
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index 2e1b1ca..6a2cf00 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -46,6 +46,7 @@ WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef
 WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frame, WKBundleScriptWorldRef world);
 
 WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef frame, WKBundleNodeHandleRef nodeHandle, WKBundleScriptWorldRef world);
+WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frame, WKBundleRangeHandleRef rangeHandle, WKBundleScriptWorldRef world);
 
 #ifdef __cplusplus
 }
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index 602ffb9..f5313c4 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -26,7 +26,6 @@
 #ifndef WKBundlePage_h
 #define WKBundlePage_h
 
-#include <JavaScriptCore/JavaScript.h>
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKBundleBase.h>
 #include <stdint.h>
@@ -114,13 +113,13 @@ struct WKBundlePageUIClient {
 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, 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);
-typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldEndEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldInsertNodeCallback)(WKBundlePageRef page, WKBundleNodeHandleRef node, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
+typedef bool (*WKBundlePageShouldInsertTextCallback)(WKBundlePageRef page, WKStringRef string, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
+typedef bool (*WKBundlePageShouldDeleteRangeCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);
+typedef bool (*WKBundlePageShouldChangeSelectedRange)(WKBundlePageRef page, WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo);
+typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range, const void* clientInfo);
 typedef void (*WKBundlePageEditingNotification)(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo);
 
 struct WKBundlePageEditorClient {
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
deleted file mode 100644
index 2ee91bd..0000000
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.cpp
+++ /dev/null
@@ -1,55 +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 "WKBundleRange.h"
-
-#include "InjectedBundleNodeHandle.h"
-#include "WKBundleAPICast.h"
-#include <WebCore/Range.h>
-
-using namespace WebCore;
-using namespace WebKit;
-
-unsigned WKBundleRangeGetStartOffset(WKBundleRangeRef range)
-{
-    return toWK(range)->startOffset();
-}
-
-WKBundleNodeHandleRef WKBundleRangeCopyStartContainer(WKBundleRangeRef range)
-{
-    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(toWK(range)->startContainer());
-    return toRef(nodeHandle.release().leakRef());
-}
-
-unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range)
-{
-    return toWK(range)->endOffset();
-}
-
-WKBundleNodeHandleRef WKBundleRangeCopyEndContainer(WKBundleRangeRef range)
-{
-    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
deleted file mode 100644
index 3b01805..0000000
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRange.h
+++ /dev/null
@@ -1,52 +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 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 WKBundleNodeHandleRef WKBundleRangeCopyStartContainer(WKBundleRangeRef range);
-
-WK_EXPORT unsigned WKBundleRangeGetEndOffset(WKBundleRangeRef range);
-
-WK_EXPORT WKBundleNodeHandleRef WKBundleRangeCopyEndContainer(WKBundleRangeRef range);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* WKBundleRange_h */
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp
new file mode 100644
index 0000000..13c9064
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp
@@ -0,0 +1,37 @@
+/*
+ * 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 "WKBundleRangeHandle.h"
+
+#include "InjectedBundleRangeHandle.h"
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKBundleRangeHandleGetTypeID()
+{
+    return toRef(InjectedBundleRangeHandle::APIType);
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h
new file mode 100644
index 0000000..af068e8
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h
@@ -0,0 +1,43 @@
+/*
+ * 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 WKBundleRangeHandle_h
+#define WKBundleRangeHandle_h
+
+#include <JavaScriptCore/JavaScript.h>
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKBundleBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBundleRangeHandleGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBundleRangeHandle_h */
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
index 3b2a118..cb312f8 100644
--- a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
@@ -25,7 +25,6 @@
 
 #include "InjectedBundleNodeHandle.h"
 
-#include "InjectedBundleScriptWorld.h"
 #include <WebCore/Node.h>
 #include <wtf/HashMap.h>
 
@@ -43,6 +42,9 @@ static DOMHandleCache& domHandleCache()
 
 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node)
 {
+    if (!node)
+        return 0;
+
     std::pair<DOMHandleCache::iterator, bool> result = domHandleCache().add(node, 0);
     if (!result.second)
         return PassRefPtr<InjectedBundleNodeHandle>(result.first->second);
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
index f0e593b..e577d23 100644
--- a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
@@ -24,7 +24,6 @@
  */
 
 #include "APIObject.h"
-#include <JavaScriptCore/JSBase.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
new file mode 100644
index 0000000..9186637
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
@@ -0,0 +1,77 @@
+/*
+ * 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 "InjectedBundleRangeHandle.h"
+
+#include <WebCore/Range.h>
+#include <wtf/HashMap.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+typedef HashMap<Range*, InjectedBundleRangeHandle*> DOMHandleCache;
+
+static DOMHandleCache& domHandleCache()
+{
+    DEFINE_STATIC_LOCAL(DOMHandleCache, cache, ());
+    return cache;
+}
+
+PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(Range* range)
+{
+    if (!range)
+        return 0;
+
+    std::pair<DOMHandleCache::iterator, bool> result = domHandleCache().add(range, 0);
+    if (!result.second)
+        return PassRefPtr<InjectedBundleRangeHandle>(result.first->second);
+
+    RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::create(range);
+    result.first->second = rangeHandle.get();
+    return rangeHandle.release();
+}
+
+PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::create(Range* range)
+{
+    return adoptRef(new InjectedBundleRangeHandle(range));
+}
+
+InjectedBundleRangeHandle::InjectedBundleRangeHandle(Range* range)
+    : m_range(range)
+{
+}
+
+InjectedBundleRangeHandle::~InjectedBundleRangeHandle()
+{
+    domHandleCache().remove(m_range.get());
+}
+
+Range* InjectedBundleRangeHandle::coreRange() const
+{
+    return m_range.get();
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h
new file mode 100644
index 0000000..dbb28f9
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h
@@ -0,0 +1,61 @@
+/*
+ * 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 InjectedBundleRangeHandle_h
+#define InjectedBundleRangeHandle_h
+
+#include "APIObject.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+    class Range;
+}
+
+namespace WebKit {
+
+class InjectedBundleScriptWorld;
+
+class InjectedBundleRangeHandle : public APIObject {
+public:
+    static const Type APIType = TypeBundleRangeHandle;
+
+    static PassRefPtr<InjectedBundleRangeHandle> getOrCreate(WebCore::Range*);
+    ~InjectedBundleRangeHandle();
+
+    WebCore::Range* coreRange() const;
+
+private:
+    static PassRefPtr<InjectedBundleRangeHandle> create(WebCore::Range*);
+    InjectedBundleRangeHandle(WebCore::Range*);
+
+    virtual Type type() const { return APIType; }
+
+    RefPtr<WebCore::Range> m_range;
+};
+
+} // namespace WebKit
+
+#endif // InjectedBundleRangeHandle_h
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
index 613441d..7df6b59 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
@@ -25,9 +25,10 @@
 
 #include "InjectedBundlePageEditorClient.h"
 
+#include "InjectedBundleNodeHandle.h"
+#include "InjectedBundleRangeHandle.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
-#include "InjectedBundleNodeHandle.h"
 #include <wtf/text/WTFString.h>
 
 using namespace WebCore;
@@ -49,15 +50,19 @@ void InjectedBundlePageEditorClient::initialize(WKBundlePageEditorClient* client
 
 bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range)
 {
-    if (m_client.shouldBeginEditing)
-        return m_client.shouldBeginEditing(toRef(page), toRef(range), m_client.clientInfo);
+    if (m_client.shouldBeginEditing) {
+        RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
+        return m_client.shouldBeginEditing(toRef(page), toRef(rangeHandle.get()), 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);
+    if (m_client.shouldEndEditing) {
+        RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
+        return m_client.shouldEndEditing(toRef(page), toRef(rangeHandle.get()), m_client.clientInfo);
+    }
     return true;
 }
 
@@ -65,36 +70,46 @@ bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage* page, Node* node,
 {
     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);
+        RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace);
+        return m_client.shouldInsertNode(toRef(page), toRef(nodeHandle.get()), toRef(rangeToReplaceHandle.get()), 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);
+    if (m_client.shouldInsertText) {
+        RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace);
+        return m_client.shouldInsertText(toRef(page), toRef(text), toRef(rangeToReplaceHandle.get()), 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);
+    if (m_client.shouldDeleteRange) {
+        RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
+        return m_client.shouldDeleteRange(toRef(page), toRef(rangeHandle.get()), 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);
+    if (m_client.shouldChangeSelectedRange) {
+        RefPtr<InjectedBundleRangeHandle> fromRangeHandle = InjectedBundleRangeHandle::getOrCreate(fromRange);
+        RefPtr<InjectedBundleRangeHandle> toRangeHandle = InjectedBundleRangeHandle::getOrCreate(toRange);
+        return m_client.shouldChangeSelectedRange(toRef(page), toRef(fromRangeHandle.get()), toRef(toRangeHandle.get()), 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);
+    if (m_client.shouldApplyStyle) {
+        RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
+        return m_client.shouldApplyStyle(toRef(page), toRef(style), toRef(rangeHandle.get()), m_client.clientInfo);
+    }
     return true;
 }
 
diff --git a/WebKit2/WebProcess/WebPage/WebFrame.cpp b/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 90ee494..3a2ad31 100644
--- a/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -26,12 +26,14 @@
 #include "WebFrame.h"
 
 #include "InjectedBundleNodeHandle.h"
+#include "InjectedBundleRangeHandle.h"
 #include "InjectedBundleScriptWorld.h"
 #include "WebChromeClient.h"
 #include "WebPage.h"
 #include "WebProcess.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSLock.h>
+#include <JavaScriptCore/JSValueRef.h>
 #include <WebCore/AnimationController.h>
 #include <WebCore/CSSComputedStyleDeclaration.h>
 #include <WebCore/Chrome.h>
@@ -40,6 +42,7 @@
 #include <WebCore/HTMLFrameOwnerElement.h>
 #include <WebCore/JSCSSStyleDeclaration.h>
 #include <WebCore/JSElement.h>
+#include <WebCore/JSRange.h>
 #include <WebCore/Page.h>
 #include <WebCore/RenderTreeAsText.h>
 #include <WebCore/TextResourceDecoder.h>
@@ -314,6 +317,15 @@ JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleNodeHandle* nodeHandle, Inj
     return toRef(exec, toJS(exec, globalObject, nodeHandle->coreNode()));
 }
 
+JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleRangeHandle* rangeHandle, InjectedBundleScriptWorld* world)
+{
+    JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
+    ExecState* exec = globalObject->globalExec();
+
+    JSLock lock(SilenceAssertionsOnly);
+    return toRef(exec, toJS(exec, globalObject, rangeHandle->coreRange()));
+}
+
 JSValueRef WebFrame::computedStyleIncludingVisitedInfo(JSObjectRef element)
 {
     if (!m_coreFrame)
diff --git a/WebKit2/WebProcess/WebPage/WebFrame.h b/WebKit2/WebProcess/WebPage/WebFrame.h
index 10a5a93..f3465a1 100644
--- a/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -45,6 +45,7 @@ namespace WebCore {
 namespace WebKit {
 
 class InjectedBundleNodeHandle;
+class InjectedBundleRangeHandle;
 class InjectedBundleScriptWorld;
 class WebPage;
 
@@ -81,6 +82,7 @@ public:
     JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*);
 
     JSValueRef jsWrapperForWorld(InjectedBundleNodeHandle*, InjectedBundleScriptWorld*);
+    JSValueRef jsWrapperForWorld(InjectedBundleRangeHandle*, InjectedBundleScriptWorld*);
 
     static String counterValue(JSObjectRef element);
     static String markerText(JSObjectRef element);
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index ede8c8a..b00e00b 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -938,11 +938,11 @@
 							>
 						</File>
 						<File
-							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleRange.cpp"
+							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.cpp"
 							>
 						</File>
 						<File
-							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleRange.h"
+							RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.h"
 							>
 						</File>
 						<File
@@ -966,6 +966,14 @@
 						RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleNodeHandle.h"
 						>
 					</File>
+					<File
+						RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleRangeHandle.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleRangeHandle.h"
+						>
+					</File>
 				</Filter>
 				<Filter
 					Name="win"
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index 19f4b65..5d07f99 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -45,7 +45,7 @@ all:
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePagePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
-    xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleRange.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleScriptWorld.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     -del "$(WEBKITOUTPUTDIR)\buildfailed"
 
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6c06ea3..cca5a4a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,28 @@
+2010-09-19  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Replace WKBundleRangeRef with WKBundleRangeHandleRef.
+        https://bugs.webkit.org/show_bug.cgi?id=46054
+
+        The new one acts like WKBundleNodeHandleRef and allows for getting a
+        wrapper in a specific world for the handle.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::propertyValue):
+        (WTR::propertyValueDouble):
+        (WTR::propertyValueInt):
+        (WTR::numericWindowPropertyValue):
+        (WTR::toStr):
+        (WTR::InjectedBundlePage::shouldBeginEditing):
+        (WTR::InjectedBundlePage::shouldEndEditing):
+        (WTR::InjectedBundlePage::shouldInsertNode):
+        (WTR::InjectedBundlePage::shouldInsertText):
+        (WTR::InjectedBundlePage::shouldDeleteRange):
+        (WTR::InjectedBundlePage::shouldChangeSelectedRange):
+        (WTR::InjectedBundlePage::shouldApplyStyle):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
 2010-09-19  Kent Tamura  <tkent at chromium.org>
 
         Unreviewed. Fix WebGL test regressions by r67809.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 92e0332..19c4f35 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -32,7 +32,6 @@
 #include <WebKit2/WKBundleFrame.h>
 #include <WebKit2/WKBundleFramePrivate.h>
 #include <WebKit2/WKBundlePagePrivate.h>
-#include <WebKit2/WKBundleRange.h>
 
 using namespace std;
 
@@ -43,18 +42,26 @@ static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const
     if (!object)
         return 0;
     JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
-    JSValueRef exception;
-    return JSObjectGetProperty(context, object, propertyNameString.get(), &exception);
+    return JSObjectGetProperty(context, object, propertyNameString.get(), 0);
 }
 
-static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
+static double propertyValueDouble(JSContextRef context, JSObjectRef object, const char* propertyName)
 {
-    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
-    JSValueRef value = propertyValue(context, JSContextGetGlobalObject(context), propertyName);
+    JSValueRef value = propertyValue(context, object, propertyName);
     if (!value)
         return 0;
-    JSValueRef exception;
-    return JSValueToNumber(context, value, &exception);
+    return JSValueToNumber(context, value, 0);    
+}
+
+static int propertyValueInt(JSContextRef context, JSObjectRef object, const char* propertyName)
+{
+    return static_cast<int>(propertyValueDouble(context, object, propertyName));    
+}
+
+static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
+{
+    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
+    return propertyValueDouble(context, JSContextGetGlobalObject(context), propertyName);
 }
 
 static string dumpPath(JSGlobalContextRef context, JSObjectRef nodeValue)
@@ -89,16 +96,31 @@ static string dumpPath(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBun
     return dumpPath(context, nodeObject);
 }
 
-static string toStr(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleRangeRef rangeRef)
+static string toStr(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleRangeHandleRef rangeRef)
 {
     if (!rangeRef)
         return "(null)";
 
-    WKRetainPtr<WKBundleNodeHandleRef> startNode(AdoptWK, WKBundleRangeCopyStartContainer(rangeRef));
-    WKRetainPtr<WKBundleNodeHandleRef> endNode(AdoptWK, WKBundleRangeCopyEndContainer(rangeRef));
+    WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
+
+    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world);
+    JSValueRef rangeValue = WKBundleFrameGetJavaScriptWrapperForRangeForWorld(frame, rangeRef, world);
+    ASSERT(JSValueIsObject(context, rangeValue));
+    JSObjectRef rangeObject = (JSObjectRef)rangeValue;
+
+    JSValueRef startNodeValue = propertyValue(context, rangeObject, "startContainer");
+    ASSERT(JSValueIsObject(context, startNodeValue));
+    JSObjectRef startNodeObject = (JSObjectRef)startNodeValue;
+
+    JSValueRef endNodeValue = propertyValue(context, rangeObject, "endContainer");
+    ASSERT(JSValueIsObject(context, endNodeValue));
+    JSObjectRef endNodeObject = (JSObjectRef)endNodeValue;
+
+    int startOffset = propertyValueInt(context, rangeObject, "startOffset");
+    int endOffset = propertyValueInt(context, rangeObject, "endOffset");
 
     ostringstream out;
-    out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(page, world, startNode.get()) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(page, world, endNode.get());
+    out << "range from " << startOffset << " of " << dumpPath(context, startNodeObject) << " to " << endOffset << " of " << dumpPath(context, endNodeObject);
     return out.str();
 }
 
@@ -557,37 +579,37 @@ void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRe
 
 // Editor Client Callbacks
 
-bool InjectedBundlePage::shouldBeginEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+bool InjectedBundlePage::shouldBeginEditing(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo)
 {
     return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldBeginEditing(range);
 }
 
-bool InjectedBundlePage::shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
+bool InjectedBundlePage::shouldEndEditing(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo)
 {
     return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldEndEditing(range);
 }
 
-bool InjectedBundlePage::shouldInsertNode(WKBundlePageRef page, WKBundleNodeHandleRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
+bool InjectedBundlePage::shouldInsertNode(WKBundlePageRef page, WKBundleNodeHandleRef node, WKBundleRangeHandleRef 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)
+bool InjectedBundlePage::shouldInsertText(WKBundlePageRef page, WKStringRef text, WKBundleRangeHandleRef 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)
+bool InjectedBundlePage::shouldDeleteRange(WKBundlePageRef page, WKBundleRangeHandleRef 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)
+bool InjectedBundlePage::shouldChangeSelectedRange(WKBundlePageRef page, WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef 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)
+bool InjectedBundlePage::shouldApplyStyle(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range, const void* clientInfo)
 {
     return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldApplyStyle(style, range);
 }
@@ -612,7 +634,7 @@ void InjectedBundlePage::didChangeSelection(WKBundlePageRef page, WKStringRef no
     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeSelection(notificationName);
 }
 
-bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
+bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeHandleRef range)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
@@ -622,7 +644,7 @@ bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
     return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
 }
 
-bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
+bool InjectedBundlePage::shouldEndEditing(WKBundleRangeHandleRef range)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
@@ -632,7 +654,7 @@ bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
     return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
 }
 
-bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
+bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
@@ -648,7 +670,7 @@ bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRa
     return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
 }
 
-bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
+bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
@@ -664,7 +686,7 @@ bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeRef ran
     return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
 }
 
-bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeRef range)
+bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeHandleRef range)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
@@ -674,7 +696,7 @@ bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeRef range)
     return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
 }
 
-bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting)
+bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType affinity, bool stillSelecting)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
@@ -693,7 +715,7 @@ bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeRef fromRange, W
     return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
 }
 
-bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range)
+bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return true;
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index 19b9f21..c814c85 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -91,24 +91,24 @@ private:
     void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
 
     // Editor client
-    static bool shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
-    static bool shouldEndEditing(WKBundlePageRef, WKBundleRangeRef, 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);
-    static bool shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
+    static bool shouldBeginEditing(WKBundlePageRef, WKBundleRangeHandleRef, const void* clientInfo);
+    static bool shouldEndEditing(WKBundlePageRef, WKBundleRangeHandleRef, const void* clientInfo);
+    static bool shouldInsertNode(WKBundlePageRef, WKBundleNodeHandleRef, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType, const void* clientInfo);
+    static bool shouldInsertText(WKBundlePageRef, WKStringRef, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType, const void* clientInfo);
+    static bool shouldDeleteRange(WKBundlePageRef, WKBundleRangeHandleRef, const void* clientInfo);
+    static bool shouldChangeSelectedRange(WKBundlePageRef, WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType, bool stillSelecting, const void* clientInfo);
+    static bool shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef 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(WKBundleNodeHandleRef, 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);
+    bool shouldBeginEditing(WKBundleRangeHandleRef);
+    bool shouldEndEditing(WKBundleRangeHandleRef);
+    bool shouldInsertNode(WKBundleNodeHandleRef, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType);
+    bool shouldInsertText(WKStringRef, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType);
+    bool shouldDeleteRange(WKBundleRangeHandleRef);
+    bool shouldChangeSelectedRange(WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType, bool stillSelecting);
+    bool shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range);
     void didBeginEditing(WKStringRef notificationName);
     void didEndEditing(WKStringRef notificationName);
     void didChange(WKStringRef notificationName);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list