[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

japhet at chromium.org japhet at chromium.org
Thu Feb 4 21:37:19 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 6f6f4732be8c8359393e811d336795703092cd74
Author: japhet at chromium.org <japhet at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 2 23:23:33 2010 +0000

    2010-02-02  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            [V8] Use toV8() to wrap in the custom bindings, and remove
            the old wrapping code from V8DOMWrapper.
    
            https://bugs.webkit.org/show_bug.cgi?id=32563
    
            * bindings/v8/ScriptController.cpp:
            * bindings/v8/ScriptObject.cpp:
            * bindings/v8/V8AbstractEventListener.cpp:
            * bindings/v8/V8Collection.h:
            * bindings/v8/V8DOMWindowShell.cpp:
            * bindings/v8/V8DOMWrapper.cpp:
            * bindings/v8/V8DOMWrapper.h:
            * bindings/v8/V8NodeFilterCondition.cpp:
            * bindings/v8/V8Proxy.cpp:
            * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
            * bindings/v8/custom/V8CustomPositionCallback.cpp:
            * bindings/v8/custom/V8CustomPositionErrorCallback.cpp:
            * bindings/v8/custom/V8CustomSQLStatementCallback.cpp:
            * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
            * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp:
            * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp:
            * bindings/v8/custom/V8DOMWindowCustom.cpp:
            * bindings/v8/custom/V8DataGridColumnListCustom.cpp:
            * bindings/v8/custom/V8DocumentCustom.cpp:
            * bindings/v8/custom/V8DocumentLocationCustom.cpp:
            * bindings/v8/custom/V8ElementCustom.cpp:
            * bindings/v8/custom/V8EventCustom.cpp:
            * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
            * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
            * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
            * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
            * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
            * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
            * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
            * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
            * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
            * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
            * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
            * bindings/v8/custom/V8MessageChannelConstructor.cpp:
            * bindings/v8/custom/V8MessageEventCustom.cpp:
            * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
            * bindings/v8/custom/V8NodeIteratorCustom.cpp:
            * bindings/v8/custom/V8NodeListCustom.cpp:
            * bindings/v8/custom/V8NotificationCenterCustom.cpp:
            * bindings/v8/custom/V8SVGMatrixCustom.cpp:
            * bindings/v8/custom/V8StyleSheetListCustom.cpp:
            * bindings/v8/custom/V8TreeWalkerCustom.cpp:
            * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
            * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54259 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 318dd28..13a43e6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,57 @@
+2010-02-02  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        [V8] Use toV8() to wrap in the custom bindings, and remove
+        the old wrapping code from V8DOMWrapper.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=32563
+
+        * bindings/v8/ScriptController.cpp:
+        * bindings/v8/ScriptObject.cpp:
+        * bindings/v8/V8AbstractEventListener.cpp:
+        * bindings/v8/V8Collection.h:
+        * bindings/v8/V8DOMWindowShell.cpp:
+        * bindings/v8/V8DOMWrapper.cpp:
+        * bindings/v8/V8DOMWrapper.h:
+        * bindings/v8/V8NodeFilterCondition.cpp:
+        * bindings/v8/V8Proxy.cpp:
+        * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+        * bindings/v8/custom/V8CustomPositionCallback.cpp:
+        * bindings/v8/custom/V8CustomPositionErrorCallback.cpp:
+        * bindings/v8/custom/V8CustomSQLStatementCallback.cpp:
+        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
+        * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp:
+        * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp:
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        * bindings/v8/custom/V8DataGridColumnListCustom.cpp:
+        * bindings/v8/custom/V8DocumentCustom.cpp:
+        * bindings/v8/custom/V8DocumentLocationCustom.cpp:
+        * bindings/v8/custom/V8ElementCustom.cpp:
+        * bindings/v8/custom/V8EventCustom.cpp:
+        * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
+        * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
+        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+        * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
+        * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
+        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+        * bindings/v8/custom/V8MessageChannelConstructor.cpp:
+        * bindings/v8/custom/V8MessageEventCustom.cpp:
+        * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
+        * bindings/v8/custom/V8NodeIteratorCustom.cpp:
+        * bindings/v8/custom/V8NodeListCustom.cpp:
+        * bindings/v8/custom/V8NotificationCenterCustom.cpp:
+        * bindings/v8/custom/V8SVGMatrixCustom.cpp:
+        * bindings/v8/custom/V8StyleSheetListCustom.cpp:
+        * bindings/v8/custom/V8TreeWalkerCustom.cpp:
+        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+        * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
+
 2010-02-02  Garret Kelly  <gdk at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 608221b..3c64410 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -50,7 +50,9 @@
 #include "Settings.h"
 #include "V8Binding.h"
 #include "V8BindingState.h"
+#include "V8DOMWindow.h"
 #include "V8Event.h"
+#include "V8HTMLEmbedElement.h"
 #include "V8IsolatedContext.h"
 #include "V8NPObject.h"
 #include "V8Proxy.h"
@@ -169,7 +171,9 @@ bool ScriptController::processingUserGesture(DOMWrapperWorld*) const
 
     v8::Handle<v8::Object> global = v8Context->Global();
     v8::Handle<v8::Value> jsEvent = global->Get(v8::String::NewSymbol("event"));
-    Event* event = V8DOMWrapper::isDOMEventWrapper(jsEvent) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)) : 0;
+    if (jsEvent.IsEmpty() || !jsEvent->IsObject())
+        return false;
+    Event* event = V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent));
 
     // Based on code from kjs_bindings.cpp.
     // Note: This is more liberal than Firefox's implementation.
@@ -377,7 +381,7 @@ static NPObject* createScriptObject(Frame* frame)
 
     v8::Context::Scope scope(v8Context);
     DOMWindow* window = frame->domWindow();
-    v8::Handle<v8::Value> global = V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, window);
+    v8::Handle<v8::Value> global = toV8(window);
     ASSERT(global->IsObject());
     return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window);
 }
@@ -414,7 +418,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
     v8::Context::Scope scope(v8Context);
 
     DOMWindow* window = m_frame->domWindow();
-    v8::Handle<v8::Value> v8plugin = V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLEMBEDELEMENT, plugin);
+    v8::Handle<v8::Value> v8plugin = toV8(static_cast<HTMLEmbedElement*>(plugin));
     if (!v8plugin->IsObject())
         return createNoScriptObject();
 
diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp
index 8d80d34..0fcd16f 100644
--- a/WebCore/bindings/v8/ScriptObject.cpp
+++ b/WebCore/bindings/v8/ScriptObject.cpp
@@ -36,9 +36,10 @@
 
 #include "Document.h"
 #include "Frame.h"
-#include "InspectorBackend.h"
-#include "InspectorFrontendHost.h"
 #include "V8Binding.h"
+#include "V8InjectedScriptHost.h"
+#include "V8InspectorBackend.h"
+#include "V8InspectorFrontendHost.h"
 #include "V8Proxy.h"
 
 #include <v8.h>
@@ -144,21 +145,21 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorBackend* value)
 {
     ScriptScope scope(scriptState);
-    scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INSPECTORBACKEND, value));
+    scope.global()->Set(v8::String::New(name), toV8(value));
     return scope.success();
 }
 
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value)
 {
     ScriptScope scope(scriptState);
-    scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INSPECTORFRONTENDHOST, value));
+    scope.global()->Set(v8::String::New(name), toV8(value));
     return scope.success();
 }
 
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InjectedScriptHost* value)
 {
     ScriptScope scope(scriptState);
-    scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INJECTEDSCRIPTHOST, value));
+    scope.global()->Set(v8::String::New(name), toV8(value));
     return scope.success();
 }
 #endif
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp
index 0f5b5c8..944fd57 100644
--- a/WebCore/bindings/v8/V8AbstractEventListener.cpp
+++ b/WebCore/bindings/v8/V8AbstractEventListener.cpp
@@ -36,6 +36,7 @@
 #include "Event.h"
 #include "Frame.h"
 #include "V8Binding.h"
+#include "V8Event.h"
 #include "V8EventListenerList.h"
 #include "V8Proxy.h"
 #include "V8Utilities.h"
@@ -84,7 +85,7 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event
     v8::Context::Scope scope(v8Context);
 
     // Get the V8 wrapper for the event object.
-    v8::Handle<v8::Value> jsEvent = V8DOMWrapper::convertEventToV8Object(event);
+    v8::Handle<v8::Value> jsEvent = toV8(event);
 
     invokeEventHandler(context, event, jsEvent);
 
diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h
index 78bc69a..9611571 100644
--- a/WebCore/bindings/v8/V8Collection.h
+++ b/WebCore/bindings/v8/V8Collection.h
@@ -38,154 +38,149 @@
 #include <v8.h>
 
 namespace WebCore {
-    // FIXME: These functions should be named using to* since they return the item (get* is used for method that take a ref param).
-    // See https://bugs.webkit.org/show_bug.cgi?id=24664.
-
-    inline v8::Handle<v8::Value> getV8Object(void* implementation, v8::Local<v8::Value> implementationType)
-    {
-        if (!implementation)
-            return v8::Handle<v8::Value>();
-        V8ClassIndex::V8WrapperType type = V8ClassIndex::FromInt(implementationType->Int32Value());
-        if (type == V8ClassIndex::NODE)
-            return V8DOMWrapper::convertNodeToV8Object(static_cast<Node*>(implementation));
-        return V8DOMWrapper::convertToV8Object(type, implementation);
+// FIXME: These functions should be named using to* since they return the item (get* is used for method that take a ref param).
+// See https://bugs.webkit.org/show_bug.cgi?id=24664.
+
+template<class T> static v8::Handle<v8::Value> getV8Object(T* implementation)
+{
+    if (!implementation)
+        return v8::Handle<v8::Value>();
+    return toV8(implementation);
+}
+
+template<class Collection> static Collection* toNativeCollection(v8::Local<v8::Object> object)
+{
+    return reinterpret_cast<Collection*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
+}
+
+template<class T> static v8::Handle<v8::Value> getV8Object(PassRefPtr<T> implementation)
+{
+    return getV8Object(implementation.get());
+}
+
+// Returns named property of a collection.
+template<class Collection, class ItemType> static v8::Handle<v8::Value> getNamedPropertyOfCollection(v8::Local<v8::String> name, v8::Local<v8::Object> object)
+{
+    // FIXME: assert object is a collection type
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
+    ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE);
+    Collection* collection = toNativeCollection<Collection>(object);
+    AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name);
+    return getV8Object<ItemType>(collection->namedItem(propertyName));
+}
+
+// A template of named property accessor of collections.
+template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
+
+    if (!value.IsEmpty())
+        return value;
+
+    // Search local callback properties next to find IDL defined
+    // properties.
+    if (info.Holder()->HasRealNamedCallbackProperty(name))
+        return notHandledByInterceptor();
+    return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder());
+}
+
+// Returns the property at the index of a collection.
+template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndexedPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object)
+{
+    // FIXME: Assert that object must be a collection type.
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
+    ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE);
+    Collection* collection = toNativeCollection<Collection>(object);
+    return getV8Object<ItemType>(collection->item(index));
+}
+
+// A template of index interceptor of collections.
+template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+    return getIndexedPropertyOfCollection<Collection, ItemType>(index, info.Holder());
+}
+
+// Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement.
+template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
+{
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
+    Collection* collection = toNativeCollection<Collection>(info.Holder());
+    int length = collection->length();
+    v8::Handle<v8::Array> properties = v8::Array::New(length);
+    for (int i = 0; i < length; ++i) {
+        // FIXME: Do we need to check that the item function returns a non-null value for this index?
+        v8::Handle<v8::Integer> integer = v8::Integer::New(i);
+        properties->Set(integer, integer);
     }
-
-    template<class Collection> static Collection* toNativeCollection(v8::Local<v8::Object> object)
-    {
-        return reinterpret_cast<Collection*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
-    }
-
-    template<class T> static v8::Handle<v8::Value> getV8Object(PassRefPtr<T> implementation, v8::Local<v8::Value> implementationType)
-    {
-        return getV8Object(implementation.get(), implementationType);
-    }
-
-    // Returns named property of a collection.
-    template<class Collection, class ItemType> static v8::Handle<v8::Value> getNamedPropertyOfCollection(v8::Local<v8::String> name, v8::Local<v8::Object> object,
-                                                                                                         v8::Local<v8::Value> implementationType)
-    {
-        // FIXME: assert object is a collection type
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
-        ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE);
-        Collection* collection = toNativeCollection<Collection>(object);
-        AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name);
-        return getV8Object<ItemType>(collection->namedItem(propertyName), implementationType);
-    }
-
-    // A template of named property accessor of collections.
-    template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-    {
-        v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
-
-        if (!value.IsEmpty())
-            return value;
-
-        // Search local callback properties next to find IDL defined
-        // properties.
-        if (info.Holder()->HasRealNamedCallbackProperty(name))
-            return notHandledByInterceptor();
-        return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder(), info.Data());
+    return properties;
+}
+
+// Get an array containing the names of indexed properties in a collection.
+template<class Collection> static v8::Handle<v8::Array> collectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
+{
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
+    Collection* collection = toNativeCollection<Collection>(info.Holder());
+    int length = collection->length();
+    v8::Handle<v8::Array> properties = v8::Array::New(length);
+    for (int i = 0; i < length; ++i) {
+        // FIXME: Do we need to check that the item function returns a non-null value for this index?
+        v8::Handle<v8::Integer> integer = v8::Integer::New(i);
+        properties->Set(integer, integer);
     }
-
-    // Returns the property at the index of a collection.
-    template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndexedPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object,
-                                                                                                           v8::Local<v8::Value> implementationType)
-    {
-        // FIXME: Assert that object must be a collection type.
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
-        ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE);
-        Collection* collection = toNativeCollection<Collection>(object);
-        return getV8Object<ItemType>(collection->item(index), implementationType);
-    }
-
-    // A template of index interceptor of collections.
-    template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-    {
-        return getIndexedPropertyOfCollection<Collection, ItemType>(index, info.Holder(), info.Data());
-    }
-
-    // Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement.
-    template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
-    {
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
-        Collection* collection = toNativeCollection<Collection>(info.Holder());
-        int length = collection->length();
-        v8::Handle<v8::Array> properties = v8::Array::New(length);
-        for (int i = 0; i < length; ++i) {
-            // FIXME: Do we need to check that the item function returns a non-null value for this index?
-            v8::Handle<v8::Integer> integer = v8::Integer::New(i);
-            properties->Set(integer, integer);
-        }
-        return properties;
-    }
-
-    // Get an array containing the names of indexed properties in a collection.
-    template<class Collection> static v8::Handle<v8::Array> collectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
-    {
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
-        Collection* collection = toNativeCollection<Collection>(info.Holder());
-        int length = collection->length();
-        v8::Handle<v8::Array> properties = v8::Array::New(length);
-        for (int i = 0; i < length; ++i) {
-            // FIXME: Do we need to check that the item function returns a non-null value for this index?
-            v8::Handle<v8::Integer> integer = v8::Integer::New(i);
-            properties->Set(integer, integer);
-        }
-        return properties;
-    }
-
-
-    // A template for indexed getters on collections of strings that should return null if the resulting string is a null string.
-    template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-    {
-        // FIXME: assert that object must be a collection type
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
-        Collection* collection = toNativeCollection<Collection>(info.Holder());
-        String result = collection->item(index);
-        return v8StringOrNull(result);
-    }
-
-
-    // A template for indexed getters on collections of strings.
-    template<class Collection> static v8::Handle<v8::Value> collectionStringIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-    {
-        // FIXME: assert that object must be a collection type
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
-        Collection* collection = toNativeCollection<Collection>(info.Holder());
-        String result = collection->item(index);
-        return v8String(result);
-    }
-
-
-    // Add indexed getter to the function template for a collection.
-    template<class Collection, class ItemType> static void setCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type)
-    {
-        desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionIndexedPropertyGetter<Collection, ItemType>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>,
-                                                            v8::Integer::New(V8ClassIndex::ToInt(type)));
-    }
-
-
-    // Add named getter to the function template for a collection.
-    template<class Collection, class ItemType> static void setCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type)
-    {
-        desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0, v8::Integer::New(V8ClassIndex::ToInt(type)));
-    }
-
-    // Add indexed getter returning a string or null to a function template for a collection.
-    template<class Collection> static void setCollectionStringOrNullIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
-    {
-        desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringOrNullIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
-    }
-
-
-    // Add indexed getter returning a string to a function template for a collection.
-    template<class Collection> static void setCollectionStringIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
-    {
-        desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
-    }
-
-    v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*);
+    return properties;
+}
+
+
+// A template for indexed getters on collections of strings that should return null if the resulting string is a null string.
+template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+    // FIXME: assert that object must be a collection type
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
+    Collection* collection = toNativeCollection<Collection>(info.Holder());
+    String result = collection->item(index);
+    return v8StringOrNull(result);
+}
+
+
+// A template for indexed getters on collections of strings.
+template<class Collection> static v8::Handle<v8::Value> collectionStringIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
+{
+    // FIXME: assert that object must be a collection type
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
+    Collection* collection = toNativeCollection<Collection>(info.Holder());
+    String result = collection->item(index);
+    return v8String(result);
+}
+
+
+// Add indexed getter to the function template for a collection.
+template<class Collection, class ItemType> static void setCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type)
+{
+    desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionIndexedPropertyGetter<Collection, ItemType>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>,
+                                                        v8::Integer::New(V8ClassIndex::ToInt(type)));
+}
+
+
+// Add named getter to the function template for a collection.
+template<class Collection, class ItemType> static void setCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type)
+{
+    desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0, v8::Integer::New(V8ClassIndex::ToInt(type)));
+}
+
+// Add indexed getter returning a string or null to a function template for a collection.
+template<class Collection> static void setCollectionStringOrNullIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
+{
+    desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringOrNullIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
+}
+
+
+// Add indexed getter returning a string to a function template for a collection.
+template<class Collection> static void setCollectionStringIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
+{
+    desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
+}
+
+v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*);
 
 } // namespace WebCore
 
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index 793547d..b3fedf5 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -48,9 +48,9 @@
 #include "V8BindingState.h"
 #include "V8Collection.h"
 #include "V8ConsoleMessage.h"
-#include "V8CustomBinding.h"
 #include "V8DOMMap.h"
 #include "V8DOMWindow.h"
+#include "V8Document.h"
 #include "V8HiddenPropertyName.h"
 #include "V8History.h"
 #include "V8Index.h"
@@ -422,7 +422,7 @@ void V8DOMWindowShell::updateDocumentWrapperCache()
         return;
     }
 
-    v8::Handle<v8::Value> documentWrapper = V8DOMWrapper::convertNodeToV8Object(m_frame->document());
+    v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document());
 
     // If instantiation of the document wrapper fails, clear the cache
     // and let the DOMWindow accessor handle access to the document.
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index b9d0911..a715160 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -43,7 +43,6 @@
 #include "V8AbstractEventListener.h"
 #include "V8Binding.h"
 #include "V8Collection.h"
-#include "V8CustomBinding.h"
 #include "V8CustomEventListener.h"
 #include "V8DOMApplicationCache.h"
 #include "V8DOMMap.h"
@@ -84,93 +83,6 @@ namespace WebCore {
 typedef HashMap<Node*, v8::Object*> DOMNodeMap;
 typedef HashMap<void*, v8::Object*> DOMObjectMap;
 
-#if ENABLE(SVG)
-
-static V8ClassIndex::V8WrapperType downcastSVGPathSeg(void* pathSeg)
-{
-    SVGPathSeg* realPathSeg = reinterpret_cast<SVGPathSeg*>(pathSeg);
-
-    switch (realPathSeg->pathSegType()) {
-    case SVGPathSeg::PATHSEG_CLOSEPATH:                    return V8ClassIndex::SVGPATHSEGCLOSEPATH;
-    case SVGPathSeg::PATHSEG_MOVETO_ABS:                   return V8ClassIndex::SVGPATHSEGMOVETOABS;
-    case SVGPathSeg::PATHSEG_MOVETO_REL:                   return V8ClassIndex::SVGPATHSEGMOVETOREL;
-    case SVGPathSeg::PATHSEG_LINETO_ABS:                   return V8ClassIndex::SVGPATHSEGLINETOABS;
-    case SVGPathSeg::PATHSEG_LINETO_REL:                   return V8ClassIndex::SVGPATHSEGLINETOREL;
-    case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:            return V8ClassIndex::SVGPATHSEGCURVETOCUBICABS;
-    case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:            return V8ClassIndex::SVGPATHSEGCURVETOCUBICREL;
-    case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:        return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICABS;
-    case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:        return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICREL;
-    case SVGPathSeg::PATHSEG_ARC_ABS:                      return V8ClassIndex::SVGPATHSEGARCABS;
-    case SVGPathSeg::PATHSEG_ARC_REL:                      return V8ClassIndex::SVGPATHSEGARCREL;
-    case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:        return V8ClassIndex::SVGPATHSEGLINETOHORIZONTALABS;
-    case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:        return V8ClassIndex::SVGPATHSEGLINETOHORIZONTALREL;
-    case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:          return V8ClassIndex::SVGPATHSEGLINETOVERTICALABS;
-    case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:          return V8ClassIndex::SVGPATHSEGLINETOVERTICALREL;
-    case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:     return V8ClassIndex::SVGPATHSEGCURVETOCUBICSMOOTHABS;
-    case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:     return V8ClassIndex::SVGPATHSEGCURVETOCUBICSMOOTHREL;
-    case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICSMOOTHABS;
-    case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICSMOOTHREL;
-    default:                                               return V8ClassIndex::INVALID_CLASS_INDEX;
-    }
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertSVGElementInstanceToV8Object(SVGElementInstance* instance)
-{
-    if (!instance)
-        return v8::Null();
-
-    v8::Handle<v8::Object> existingInstance = getDOMSVGElementInstanceMap().get(instance);
-    if (!existingInstance.IsEmpty())
-        return existingInstance;
-
-    instance->ref();
-
-    // Instantiate the V8 object and remember it
-    v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::SVGELEMENTINSTANCE, V8ClassIndex::SVGELEMENTINSTANCE, instance);
-    if (!result.IsEmpty()) {
-        // Only update the DOM SVG element map if the result is non-empty.
-        getDOMSVGElementInstanceMap().set(instance, v8::Persistent<v8::Object>::New(result));
-    }
-    return result;
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertSVGObjectWithContextToV8Object(V8ClassIndex::V8WrapperType type, void* object)
-{
-    if (!object)
-        return v8::Null();
-
-    v8::Persistent<v8::Object> result = getDOMSVGObjectWithContextMap().get(object);
-    if (!result.IsEmpty())
-        return result;
-
-    // Special case: SVGPathSegs need to be downcast to their real type
-    if (type == V8ClassIndex::SVGPATHSEG)
-        type = downcastSVGPathSeg(object);
-
-    v8::Local<v8::Object> v8Object = instantiateV8Object(type, type, object);
-    if (!v8Object.IsEmpty()) {
-        result = v8::Persistent<v8::Object>::New(v8Object);
-        switch (type) {
-#define MAKE_CASE(TYPE, NAME)     \
-        case V8ClassIndex::TYPE: static_cast<NAME*>(object)->ref(); break;
-        SVG_OBJECT_TYPES(MAKE_CASE)
-#undef MAKE_CASE
-#define MAKE_CASE(TYPE, NAME)     \
-        case V8ClassIndex::TYPE:    \
-            static_cast<V8SVGPODTypeWrapper<NAME>*>(object)->ref(); break;
-        SVG_POD_NATIVE_TYPES(MAKE_CASE)
-#undef MAKE_CASE
-        default:
-            ASSERT_NOT_REACHED();
-        }
-        getDOMSVGObjectWithContextMap().set(object, result);
-    }
-
-    return result;
-}
-
-#endif // ENABLE(SVG)
-
 #if ENABLE(3D_CANVAS)
 void V8DOMWrapper::setIndexedPropertiesToExternalArray(v8::Handle<v8::Object> wrapper,
                                                        int index,
@@ -324,188 +236,6 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     return getConstructorForContext(type, context);
 }
 
-v8::Handle<v8::Value> V8DOMWrapper::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
-{
-    ASSERT(type != V8ClassIndex::EVENTLISTENER);
-    ASSERT(type != V8ClassIndex::EVENTTARGET);
-    ASSERT(type != V8ClassIndex::EVENT);
-
-    // These objects can be constructed under WorkerContextExecutionProxy.  They need special
-    // handling, since if we proceed below V8Proxy::retrieve() will get called and will crash.
-    // TODO(ukai): websocket?
-    if ((type == V8ClassIndex::DOMCOREEXCEPTION
-         || type == V8ClassIndex::RANGEEXCEPTION
-         || type == V8ClassIndex::EVENTEXCEPTION
-         || type == V8ClassIndex::XMLHTTPREQUESTEXCEPTION
-         || type == V8ClassIndex::MESSAGEPORT)
-        && WorkerContextExecutionProxy::retrieve()) {
-        return WorkerContextExecutionProxy::convertToV8Object(type, impl);
-    }
-
-    bool isActiveDomObject = false;
-    switch (type) {
-#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
-        DOM_NODE_TYPES(MAKE_CASE)
-#if ENABLE(SVG)
-        SVG_NODE_TYPES(MAKE_CASE)
-#endif
-        return convertNodeToV8Object(static_cast<Node*>(impl));
-    case V8ClassIndex::CSSVALUE:
-        return convertCSSValueToV8Object(static_cast<CSSValue*>(impl));
-    case V8ClassIndex::CSSRULE:
-        return convertCSSRuleToV8Object(static_cast<CSSRule*>(impl));
-    case V8ClassIndex::STYLESHEET:
-        return convertStyleSheetToV8Object(static_cast<StyleSheet*>(impl));
-    case V8ClassIndex::DOMWINDOW:
-        return convertWindowToV8Object(static_cast<DOMWindow*>(impl));
-    case V8ClassIndex::NAMEDNODEMAP:
-        return convertNamedNodeMapToV8Object(static_cast<NamedNodeMap*>(impl));
-#if ENABLE(SVG)
-        SVG_NONNODE_TYPES(MAKE_CASE)
-        if (type == V8ClassIndex::SVGELEMENTINSTANCE)
-            return convertSVGElementInstanceToV8Object(static_cast<SVGElementInstance*>(impl));
-        return convertSVGObjectWithContextToV8Object(type, impl);
-#endif
-
-        ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-        isActiveDomObject = true;
-        break;
-    default:
-        break;
-  }
-
-#undef MAKE_CASE
-
-    if (!impl)
-        return v8::Null();
-
-    // Non DOM node
-    v8::Persistent<v8::Object> result = isActiveDomObject ? getActiveDOMObjectMap().get(impl) : getDOMObjectMap().get(impl);
-    if (result.IsEmpty()) {
-#if ENABLE(3D_CANVAS)
-        if (type == V8ClassIndex::WEBGLARRAY && impl) {
-            // Determine which subclass we are wrapping.
-            WebGLArray* array = reinterpret_cast<WebGLArray*>(impl);
-            if (array->isByteArray())
-                type = V8ClassIndex::WEBGLBYTEARRAY;
-            else if (array->isFloatArray())
-                type = V8ClassIndex::WEBGLFLOATARRAY;
-            else if (array->isIntArray())
-                type = V8ClassIndex::WEBGLINTARRAY;
-            else if (array->isShortArray())
-                type = V8ClassIndex::WEBGLSHORTARRAY;
-            else if (array->isUnsignedByteArray())
-                type = V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY;
-            else if (array->isUnsignedIntArray())
-                type = V8ClassIndex::WEBGLUNSIGNEDINTARRAY;
-            else if (array->isUnsignedShortArray())
-                type = V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY;
-        }
-#endif
-
-        v8::Local<v8::Object> v8Object = instantiateV8Object(type, type, impl);
-        if (!v8Object.IsEmpty()) {
-            // Go through big switch statement, it has some duplications
-            // that were handled by code above (such as CSSVALUE, CSSRULE, etc).
-            switch (type) {
-#define MAKE_CASE(TYPE, NAME) \
-            case V8ClassIndex::TYPE: static_cast<NAME*>(impl)->ref(); break;
-                DOM_OBJECT_TYPES(MAKE_CASE)
-#undef MAKE_CASE
-            default:
-                ASSERT_NOT_REACHED();
-            }
-            result = v8::Persistent<v8::Object>::New(v8Object);
-            if (isActiveDomObject)
-                setJSWrapperForActiveDOMObject(impl, result);
-            else
-                setJSWrapperForDOMObject(impl, result);
-
-            if (type == V8ClassIndex::CANVASPIXELARRAY) {
-                CanvasPixelArray* pixels = reinterpret_cast<CanvasPixelArray*>(impl);
-                result->SetIndexedPropertiesToPixelData(pixels->data()->data(), pixels->length());
-            }
-
-#if ENABLE(3D_CANVAS)
-            // Set up WebGLArray subclasses' accesses similarly.
-            switch (type) {
-            case V8ClassIndex::WEBGLBYTEARRAY:
-            case V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY:
-            case V8ClassIndex::WEBGLSHORTARRAY:
-            case V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY:
-            case V8ClassIndex::WEBGLINTARRAY:
-            case V8ClassIndex::WEBGLUNSIGNEDINTARRAY:
-            case V8ClassIndex::WEBGLFLOATARRAY: {
-                WebGLArray* array = reinterpret_cast<WebGLArray*>(impl);
-                setIndexedPropertiesToExternalArray(result,
-                                                    V8ClassIndex::ToInt(type),
-                                                    array->baseAddress(),
-                                                    array->length());
-                break;
-            }
-            default:
-                break;
-            }
-#endif
-
-            // Special case for non-node objects associated with a
-            // DOMWindow. Both Safari and FF let the JS wrappers for these
-            // objects survive GC. To mimic their behavior, V8 creates
-            // hidden references from the DOMWindow to these wrapper
-            // objects. These references get cleared when the DOMWindow is
-            // reused by a new page.
-            switch (type) {
-            case V8ClassIndex::CONSOLE:
-                setHiddenWindowReference(static_cast<Console*>(impl)->frame(), V8DOMWindow::consoleIndex, result);
-                break;
-            case V8ClassIndex::HISTORY:
-                setHiddenWindowReference(static_cast<History*>(impl)->frame(), V8DOMWindow::historyIndex, result);
-                break;
-            case V8ClassIndex::NAVIGATOR:
-                setHiddenWindowReference(static_cast<Navigator*>(impl)->frame(), V8DOMWindow::navigatorIndex, result);
-                break;
-            case V8ClassIndex::SCREEN:
-                setHiddenWindowReference(static_cast<Screen*>(impl)->frame(), V8DOMWindow::screenIndex, result);
-                break;
-            case V8ClassIndex::LOCATION:
-                setHiddenWindowReference(static_cast<Location*>(impl)->frame(), V8DOMWindow::locationIndex, result);
-                break;
-            case V8ClassIndex::DOMSELECTION:
-                setHiddenWindowReference(static_cast<DOMSelection*>(impl)->frame(), V8DOMWindow::domSelectionIndex, result);
-                break;
-            case V8ClassIndex::BARINFO: {
-                BarInfo* barInfo = static_cast<BarInfo*>(impl);
-                Frame* frame = barInfo->frame();
-                switch (barInfo->type()) {
-                case BarInfo::Locationbar:
-                    setHiddenWindowReference(frame, V8DOMWindow::locationbarIndex, result);
-                    break;
-                case BarInfo::Menubar:
-                    setHiddenWindowReference(frame, V8DOMWindow::menubarIndex, result);
-                    break;
-                case BarInfo::Personalbar:
-                    setHiddenWindowReference(frame, V8DOMWindow::personalbarIndex, result);
-                    break;
-                case BarInfo::Scrollbars:
-                    setHiddenWindowReference(frame, V8DOMWindow::scrollbarsIndex, result);
-                    break;
-                case BarInfo::Statusbar:
-                    setHiddenWindowReference(frame, V8DOMWindow::statusbarIndex, result);
-                    break;
-                case BarInfo::Toolbar:
-                    setHiddenWindowReference(frame, V8DOMWindow::toolbarIndex, result);
-                    break;
-                }
-                break;
-            }
-            default:
-                break;
-            }
-        }
-    }
-    return result;
-}
-
 void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalIndex, v8::Handle<v8::Object> jsObject)
 {
     // Get DOMWindow
@@ -549,12 +279,8 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value>
     return NodeFilter::create(condition);
 }
 
-v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl)
+v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl)
 {
-    // Make a special case for document.all
-    if (descriptorType == V8ClassIndex::HTMLCOLLECTION && static_cast<HTMLCollection*>(impl)->type() == DocAll)
-        descriptorType = V8ClassIndex::HTMLALLCOLLECTION;
-
     if (V8IsolatedContext::getEntered()) {
         // This effectively disables the wrapper cache for isolated worlds.
         proxy = 0;
@@ -567,14 +293,14 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI
     v8::Local<v8::Object> instance;
     if (proxy)
         // FIXME: Fix this to work properly with isolated worlds (see above).
-        instance = proxy->windowShell()->createWrapperFromCache(descriptorType);
+        instance = proxy->windowShell()->createWrapperFromCache(type);
     else {
-        v8::Local<v8::Function> function = getTemplate(descriptorType)->GetFunction();
+        v8::Local<v8::Function> function = getTemplate(type)->GetFunction();
         instance = SafeAllocation::newInstance(function);
     }
     if (!instance.IsEmpty()) {
         // Avoid setting the DOM wrapper for failed allocations.
-        setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
+        setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl);
     }
     return instance;
 }
@@ -602,13 +328,6 @@ bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
 }
 #endif
 
-bool V8DOMWrapper::isDOMEventWrapper(v8::Handle<v8::Value> value)
-{
-    // All kinds of events use EVENT as dom type in JS wrappers.
-    // See EventToV8Object
-    return isWrapperOfType(value, V8ClassIndex::EVENT);
-}
-
 bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, V8ClassIndex::V8WrapperType classType)
 {
     if (value.IsEmpty() || !value->IsObject())
@@ -630,359 +349,6 @@ bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, V8ClassIndex::V8
     return V8ClassIndex::FromInt(type->Int32Value()) == classType;
 }
 
-#if ENABLE(VIDEO)
-#define FOR_EACH_VIDEO_TAG(macro)                  \
-    macro(audio, AUDIO)                            \
-    macro(source, SOURCE)                          \
-    macro(video, VIDEO)
-#else
-#define FOR_EACH_VIDEO_TAG(macro)
-#endif
-
-#if ENABLE(DATAGRID)
-#define FOR_EACH_DATAGRID_TAG(macro)               \
-    macro(datagrid, DATAGRID)                        \
-    macro(dcell, DATAGRIDCELL)                       \
-    macro(dcol, DATAGRIDCOL)                         \
-    macro(drow, DATAGRIDROW)
-#else
-#define FOR_EACH_DATAGRID_TAG(macro)
-#endif
-
-#define FOR_EACH_TAG(macro)                        \
-    FOR_EACH_DATAGRID_TAG(macro)                   \
-    macro(a, ANCHOR)                               \
-    macro(applet, APPLET)                          \
-    macro(area, AREA)                              \
-    macro(base, BASE)                              \
-    macro(basefont, BASEFONT)                      \
-    macro(blockquote, BLOCKQUOTE)                  \
-    macro(body, BODY)                              \
-    macro(br, BR)                                  \
-    macro(button, BUTTON)                          \
-    macro(caption, TABLECAPTION)                   \
-    macro(col, TABLECOL)                           \
-    macro(colgroup, TABLECOL)                      \
-    macro(del, MOD)                                \
-    macro(canvas, CANVAS)                          \
-    macro(dir, DIRECTORY)                          \
-    macro(div, DIV)                                \
-    macro(dl, DLIST)                               \
-    macro(embed, EMBED)                            \
-    macro(fieldset, FIELDSET)                      \
-    macro(font, FONT)                              \
-    macro(form, FORM)                              \
-    macro(frame, FRAME)                            \
-    macro(frameset, FRAMESET)                      \
-    macro(h1, HEADING)                             \
-    macro(h2, HEADING)                             \
-    macro(h3, HEADING)                             \
-    macro(h4, HEADING)                             \
-    macro(h5, HEADING)                             \
-    macro(h6, HEADING)                             \
-    macro(head, HEAD)                              \
-    macro(hr, HR)                                  \
-    macro(html, HTML)                              \
-    macro(img, IMAGE)                              \
-    macro(iframe, IFRAME)                          \
-    macro(image, IMAGE)                            \
-    macro(input, INPUT)                            \
-    macro(ins, MOD)                                \
-    macro(isindex, ISINDEX)                        \
-    macro(keygen, SELECT)                          \
-    macro(label, LABEL)                            \
-    macro(legend, LEGEND)                          \
-    macro(li, LI)                                  \
-    macro(link, LINK)                              \
-    macro(listing, PRE)                            \
-    macro(map, MAP)                                \
-    macro(marquee, MARQUEE)                        \
-    macro(menu, MENU)                              \
-    macro(meta, META)                              \
-    macro(object, OBJECT)                          \
-    macro(ol, OLIST)                               \
-    macro(optgroup, OPTGROUP)                      \
-    macro(option, OPTION)                          \
-    macro(p, PARAGRAPH)                            \
-    macro(param, PARAM)                            \
-    macro(pre, PRE)                                \
-    macro(q, QUOTE)                                \
-    macro(script, SCRIPT)                          \
-    macro(select, SELECT)                          \
-    macro(style, STYLE)                            \
-    macro(table, TABLE)                            \
-    macro(thead, TABLESECTION)                     \
-    macro(tbody, TABLESECTION)                     \
-    macro(tfoot, TABLESECTION)                     \
-    macro(td, TABLECELL)                           \
-    macro(th, TABLECELL)                           \
-    macro(tr, TABLEROW)                            \
-    macro(textarea, TEXTAREA)                      \
-    macro(title, TITLE)                            \
-    macro(ul, ULIST)                               \
-    macro(xmp, PRE)
-
-V8ClassIndex::V8WrapperType V8DOMWrapper::htmlElementType(HTMLElement* element)
-{
-    typedef HashMap<String, V8ClassIndex::V8WrapperType> WrapperTypeMap;
-    DEFINE_STATIC_LOCAL(WrapperTypeMap, wrapperTypeMap, ());
-    if (wrapperTypeMap.isEmpty()) {
-#define ADD_TO_HASH_MAP(tag, name) \
-        wrapperTypeMap.set(#tag, V8ClassIndex::HTML##name##ELEMENT);
-        FOR_EACH_TAG(ADD_TO_HASH_MAP)
-#if ENABLE(VIDEO)
-        if (MediaPlayer::isAvailable()) {
-            FOR_EACH_VIDEO_TAG(ADD_TO_HASH_MAP)
-        }
-#endif
-#undef ADD_TO_HASH_MAP
-    }
-
-    V8ClassIndex::V8WrapperType type = wrapperTypeMap.get(element->localName().impl());
-    if (!type)
-        return V8ClassIndex::HTMLELEMENT;
-    return type;
-}
-#undef FOR_EACH_TAG
-
-#if ENABLE(SVG)
-
-#if ENABLE(SVG_ANIMATION)
-#define FOR_EACH_ANIMATION_TAG(macro) \
-    macro(animateColor, ANIMATECOLOR) \
-    macro(animate, ANIMATE) \
-    macro(animateTransform, ANIMATETRANSFORM) \
-    macro(set, SET)
-#else
-#define FOR_EACH_ANIMATION_TAG(macro)
-#endif
-
-#if ENABLE(SVG) && ENABLE(FILTERS)
-#define FOR_EACH_FILTERS_TAG(macro) \
-    macro(feBlend, FEBLEND) \
-    macro(feColorMatrix, FECOLORMATRIX) \
-    macro(feComponentTransfer, FECOMPONENTTRANSFER) \
-    macro(feComposite, FECOMPOSITE) \
-    macro(feDiffuseLighting, FEDIFFUSELIGHTING) \
-    macro(feDisplacementMap, FEDISPLACEMENTMAP) \
-    macro(feDistantLight, FEDISTANTLIGHT) \
-    macro(feFlood, FEFLOOD) \
-    macro(feFuncA, FEFUNCA) \
-    macro(feFuncB, FEFUNCB) \
-    macro(feFuncG, FEFUNCG) \
-    macro(feFuncR, FEFUNCR) \
-    macro(feGaussianBlur, FEGAUSSIANBLUR) \
-    macro(feImage, FEIMAGE) \
-    macro(feMerge, FEMERGE) \
-    macro(feMergeNode, FEMERGENODE) \
-    macro(feMorphology, FEMORPHOLOGY) \
-    macro(feOffset, FEOFFSET) \
-    macro(fePointLight, FEPOINTLIGHT) \
-    macro(feSpecularLighting, FESPECULARLIGHTING) \
-    macro(feSpotLight, FESPOTLIGHT) \
-    macro(feTile, FETILE) \
-    macro(feTurbulence, FETURBULENCE) \
-    macro(filter, FILTER)
-#else
-#define FOR_EACH_FILTERS_TAG(macro)
-#endif
-
-#if ENABLE(SVG_FONTS)
-#define FOR_EACH_FONTS_TAG(macro) \
-    macro(font-face, FONTFACE) \
-    macro(font-face-format, FONTFACEFORMAT) \
-    macro(font-face-name, FONTFACENAME) \
-    macro(font-face-src, FONTFACESRC) \
-    macro(font-face-uri, FONTFACEURI)
-#else
-#define FOR_EACH_FONTS_TAG(marco)
-#endif
-
-#if ENABLE(SVG_FOREIGN_OBJECT)
-#define FOR_EACH_FOREIGN_OBJECT_TAG(macro) \
-    macro(foreignObject, FOREIGNOBJECT)
-#else
-#define FOR_EACH_FOREIGN_OBJECT_TAG(macro)
-#endif
-
-#if ENABLE(SVG_USE)
-#define FOR_EACH_USE_TAG(macro) \
-    macro(use, USE)
-#else
-#define FOR_EACH_USE_TAG(macro)
-#endif
-
-#define FOR_EACH_TAG(macro) \
-    FOR_EACH_ANIMATION_TAG(macro) \
-    FOR_EACH_FILTERS_TAG(macro) \
-    FOR_EACH_FONTS_TAG(macro) \
-    FOR_EACH_FOREIGN_OBJECT_TAG(macro) \
-    FOR_EACH_USE_TAG(macro) \
-    macro(a, A) \
-    macro(altGlyph, ALTGLYPH) \
-    macro(circle, CIRCLE) \
-    macro(clipPath, CLIPPATH) \
-    macro(cursor, CURSOR) \
-    macro(defs, DEFS) \
-    macro(desc, DESC) \
-    macro(ellipse, ELLIPSE) \
-    macro(g, G) \
-    macro(glyph, GLYPH) \
-    macro(image, IMAGE) \
-    macro(linearGradient, LINEARGRADIENT) \
-    macro(line, LINE) \
-    macro(marker, MARKER) \
-    macro(mask, MASK) \
-    macro(metadata, METADATA) \
-    macro(path, PATH) \
-    macro(pattern, PATTERN) \
-    macro(polyline, POLYLINE) \
-    macro(polygon, POLYGON) \
-    macro(radialGradient, RADIALGRADIENT) \
-    macro(rect, RECT) \
-    macro(script, SCRIPT) \
-    macro(stop, STOP) \
-    macro(style, STYLE) \
-    macro(svg, SVG) \
-    macro(switch, SWITCH) \
-    macro(symbol, SYMBOL) \
-    macro(text, TEXT) \
-    macro(textPath, TEXTPATH) \
-    macro(title, TITLE) \
-    macro(tref, TREF) \
-    macro(tspan, TSPAN) \
-    macro(view, VIEW) \
-    // end of macro
-
-V8ClassIndex::V8WrapperType V8DOMWrapper::svgElementType(SVGElement* element)
-{
-    typedef HashMap<String, V8ClassIndex::V8WrapperType> WrapperTypeMap;
-    DEFINE_STATIC_LOCAL(WrapperTypeMap, wrapperTypeMap, ());
-    if (wrapperTypeMap.isEmpty()) {
-#define ADD_TO_HASH_MAP(tag, name) \
-        wrapperTypeMap.set(#tag, V8ClassIndex::SVG##name##ELEMENT);
-        FOR_EACH_TAG(ADD_TO_HASH_MAP)
-#undef ADD_TO_HASH_MAP
-    }
-
-    V8ClassIndex::V8WrapperType type = wrapperTypeMap.get(element->localName().impl());
-    if (!type)
-        return V8ClassIndex::SVGELEMENT;
-    return type;
-}
-#undef FOR_EACH_TAG
-
-#endif // ENABLE(SVG)
-
-v8::Handle<v8::Value> V8DOMWrapper::convertEventToV8Object(Event* event)
-{
-    if (!event)
-        return v8::Null();
-
-    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(event);
-    if (!wrapper.IsEmpty())
-        return wrapper;
-
-    V8ClassIndex::V8WrapperType type = V8ClassIndex::EVENT;
-
-    if (event->isUIEvent()) {
-        if (event->isKeyboardEvent())
-            type = V8ClassIndex::KEYBOARDEVENT;
-        else if (event->isTextEvent())
-            type = V8ClassIndex::TEXTEVENT;
-        else if (event->isMouseEvent())
-            type = V8ClassIndex::MOUSEEVENT;
-        else if (event->isWheelEvent())
-            type = V8ClassIndex::WHEELEVENT;
-#if ENABLE(SVG)
-        else if (event->isSVGZoomEvent())
-            type = V8ClassIndex::SVGZOOMEVENT;
-#endif
-        else if (event->isCompositionEvent())
-            type = V8ClassIndex::COMPOSITIONEVENT;
-        else
-            type = V8ClassIndex::UIEVENT;
-    } else if (event->isMutationEvent())
-        type = V8ClassIndex::MUTATIONEVENT;
-    else if (event->isOverflowEvent())
-        type = V8ClassIndex::OVERFLOWEVENT;
-    else if (event->isMessageEvent())
-        type = V8ClassIndex::MESSAGEEVENT;
-    else if (event->isPageTransitionEvent())
-        type = V8ClassIndex::PAGETRANSITIONEVENT;
-    else if (event->isPopStateEvent())
-        type = V8ClassIndex::POPSTATEEVENT;
-    else if (event->isProgressEvent()) {
-        if (event->isXMLHttpRequestProgressEvent())
-            type = V8ClassIndex::XMLHTTPREQUESTPROGRESSEVENT;
-        else
-            type = V8ClassIndex::PROGRESSEVENT;
-    } else if (event->isWebKitAnimationEvent())
-        type = V8ClassIndex::WEBKITANIMATIONEVENT;
-    else if (event->isWebKitTransitionEvent())
-        type = V8ClassIndex::WEBKITTRANSITIONEVENT;
-#if ENABLE(WORKERS)
-    else if (event->isErrorEvent())
-        type = V8ClassIndex::ERROREVENT;
-#endif
-#if ENABLE(DOM_STORAGE)
-    else if (event->isStorageEvent())
-        type = V8ClassIndex::STORAGEEVENT;
-#endif
-    else if (event->isBeforeLoadEvent())
-        type = V8ClassIndex::BEFORELOADEVENT;
-
-
-    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::EVENT, event);
-    if (result.IsEmpty()) {
-        // Instantiation failed. Avoid updating the DOM object map and
-        // return null which is already handled by callers of this function
-        // in case the event is NULL.
-        return v8::Null();
-    }
-
-    event->ref(); // fast ref
-    setJSWrapperForDOMObject(event, v8::Persistent<v8::Object>::New(result));
-
-    return result;
-}
-
-static const V8ClassIndex::V8WrapperType mapping[] = {
-    V8ClassIndex::INVALID_CLASS_INDEX,    // NONE
-    V8ClassIndex::INVALID_CLASS_INDEX,    // ELEMENT_NODE needs special treatment
-    V8ClassIndex::ATTR,                   // ATTRIBUTE_NODE
-    V8ClassIndex::TEXT,                   // TEXT_NODE
-    V8ClassIndex::CDATASECTION,           // CDATA_SECTION_NODE
-    V8ClassIndex::ENTITYREFERENCE,        // ENTITY_REFERENCE_NODE
-    V8ClassIndex::ENTITY,                 // ENTITY_NODE
-    V8ClassIndex::PROCESSINGINSTRUCTION,  // PROCESSING_INSTRUCTION_NODE
-    V8ClassIndex::COMMENT,                // COMMENT_NODE
-    V8ClassIndex::INVALID_CLASS_INDEX,    // DOCUMENT_NODE needs special treatment
-    V8ClassIndex::DOCUMENTTYPE,           // DOCUMENT_TYPE_NODE
-    V8ClassIndex::DOCUMENTFRAGMENT,       // DOCUMENT_FRAGMENT_NODE
-    V8ClassIndex::NOTATION,               // NOTATION_NODE
-    V8ClassIndex::NODE,                   // XPATH_NAMESPACE_NODE
-};
-
-v8::Handle<v8::Value> V8DOMWrapper::convertDocumentToV8Object(Document* document)
-{
-    // Find a proxy for this node.
-    //
-    // Note that if proxy is found, we might initialize the context which can
-    // instantiate a document wrapper.  Therefore, we get the proxy before
-    // checking if the node already has a wrapper.
-    V8Proxy* proxy = V8Proxy::retrieve(document->frame());
-    if (proxy)
-        proxy->windowShell()->initContextIfNeeded();
-
-    DOMNodeMapping& domNodeMap = getDOMNodeMap();
-    v8::Handle<v8::Object> wrapper = domNodeMap.get(document);
-    if (wrapper.IsEmpty())
-        return convertNewNodeToV8Object(document, proxy, domNodeMap);
-
-    return wrapper;
-}
-
 v8::Handle<v8::Object> V8DOMWrapper::getWrapper(Node* node)
 {
     ASSERT(WTF::isMainThread());
@@ -998,101 +364,6 @@ v8::Handle<v8::Object> V8DOMWrapper::getWrapper(Node* node)
     return domNodeMap.get(node);
 }
 
-v8::Handle<v8::Value> V8DOMWrapper::convertNodeToV8Object(Node* node)
-{
-    if (!node)
-        return v8::Null();
-    
-    v8::Handle<v8::Value> wrapper = getWrapper(node);
-    if (!wrapper.IsEmpty())
-        return wrapper;
-
-    Document* document = node->document();
-    if (node == document)
-        return convertDocumentToV8Object(document);
-
-    return convertNewNodeToV8Object(node, 0, getDOMNodeMap());
-}
-    
-// Caller checks node is not null.
-v8::Handle<v8::Value> V8DOMWrapper::convertNewNodeToV8Object(Node* node, V8Proxy* proxy, DOMNodeMapping& domNodeMap)
-{
-    if (!proxy && node->document())
-        proxy = V8Proxy::retrieve(node->document()->frame());
-
-    bool isDocument = false; // document type node has special handling
-    V8ClassIndex::V8WrapperType type;
-
-    Node::NodeType nodeType = node->nodeType();
-    if (nodeType == Node::ELEMENT_NODE) {
-        if (node->isHTMLElement())
-            type = htmlElementType(static_cast<HTMLElement*>(node));
-#if ENABLE(SVG)
-        else if (node->isSVGElement())
-            type = svgElementType(static_cast<SVGElement*>(node));
-#endif
-        else
-            type = V8ClassIndex::ELEMENT;
-    } else if (nodeType == Node::DOCUMENT_NODE) {
-        isDocument = true;
-        Document* document = static_cast<Document*>(node);
-        if (document->isHTMLDocument())
-            type = V8ClassIndex::HTMLDOCUMENT;
-#if ENABLE(SVG)
-        else if (document->isSVGDocument())
-            type = V8ClassIndex::SVGDOCUMENT;
-#endif
-        else
-            type = V8ClassIndex::DOCUMENT;
-    } else {
-        ASSERT(nodeType < static_cast<int>(sizeof(mapping)/sizeof(mapping[0])));
-        type = mapping[nodeType];
-        ASSERT(type != V8ClassIndex::INVALID_CLASS_INDEX);
-    }
-
-    v8::Handle<v8::Context> context;
-    if (proxy)
-        context = proxy->context();
-
-    // Enter the node's context and create the wrapper in that context.
-    if (!context.IsEmpty())
-        context->Enter();
-
-    v8::Local<v8::Object> result = instantiateV8Object(proxy, type, V8ClassIndex::NODE, node);
-
-    // Exit the node's context if it was entered.
-    if (!context.IsEmpty())
-        context->Exit();
-
-    if (result.IsEmpty()) {
-        // If instantiation failed it's important not to add the result
-        // to the DOM node map. Instead we return an empty handle, which
-        // should already be handled by callers of this function in case
-        // the node is NULL.
-        return result;
-    }
-
-    node->ref();
-    domNodeMap.set(node, v8::Persistent<v8::Object>::New(result));
-
-    if (isDocument) {
-        if (proxy)
-            proxy->windowShell()->updateDocumentWrapper(result);
-
-        if (type == V8ClassIndex::HTMLDOCUMENT) {
-            // Create marker object and insert it in two internal fields.
-            // This is used to implement temporary shadowing of
-            // document.all.
-            ASSERT(result->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
-            v8::Local<v8::Object> marker = v8::Object::New();
-            result->SetInternalField(V8HTMLDocument::markerIndex, marker);
-            result->SetInternalField(V8HTMLDocument::shadowIndex, marker);
-        }
-    }
-
-    return result;
-}
-
 // A JS object of type EventTarget is limited to a small number of possible classes.
 // Check EventTarget.h for new type conversion methods
 v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* target)
@@ -1165,16 +436,6 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
     return notHandledByInterceptor();
 }
 
-v8::Handle<v8::Value> V8DOMWrapper::convertEventListenerToV8Object(ScriptExecutionContext* context, EventListener* listener)
-{
-    if (!listener)
-        return v8::Null();
-
-    // FIXME: can a user take a lazy event listener and set to other places?
-    V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener);
-    return v8listener->getListenerObject(context);
-}
-
 PassRefPtr<EventListener> V8DOMWrapper::getEventListener(Node* node, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup)
 {
     return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute);
@@ -1260,193 +521,4 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(V8Proxy* proxy, v8::Loc
     return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute);
 }
 
-v8::Handle<v8::Value> V8DOMWrapper::convertDOMImplementationToV8Object(DOMImplementation* impl)
-{
-    v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::DOMIMPLEMENTATION, V8ClassIndex::DOMIMPLEMENTATION, impl);
-    if (result.IsEmpty()) {
-        // If the instantiation failed, we ignore it and return null instead
-        // of returning an empty handle.
-        return v8::Null();
-    }
-    return result;
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertStyleSheetToV8Object(StyleSheet* sheet)
-{
-    if (!sheet)
-        return v8::Null();
-
-    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(sheet);
-    if (!wrapper.IsEmpty())
-        return wrapper;
-
-    V8ClassIndex::V8WrapperType type = V8ClassIndex::STYLESHEET;
-    if (sheet->isCSSStyleSheet())
-        type = V8ClassIndex::CSSSTYLESHEET;
-
-    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::STYLESHEET, sheet);
-    if (!result.IsEmpty()) {
-        // Only update the DOM object map if the result is non-empty.
-        sheet->ref();
-        setJSWrapperForDOMObject(sheet, v8::Persistent<v8::Object>::New(result));
-    }
-
-    // Add a hidden reference from stylesheet object to its owner node.
-    Node* ownerNode = sheet->ownerNode();
-    if (ownerNode) {
-        v8::Handle<v8::Object> owner = v8::Handle<v8::Object>::Cast(convertNodeToV8Object(ownerNode));
-        result->SetInternalField(V8StyleSheet::ownerNodeIndex, owner);
-    }
-
-    return result;
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertCSSValueToV8Object(CSSValue* value)
-{
-    if (!value)
-        return v8::Null();
-
-    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(value);
-    if (!wrapper.IsEmpty())
-        return wrapper;
-
-    V8ClassIndex::V8WrapperType type;
-
-    if (value->isWebKitCSSTransformValue())
-        type = V8ClassIndex::WEBKITCSSTRANSFORMVALUE;
-    else if (value->isValueList())
-        type = V8ClassIndex::CSSVALUELIST;
-    else if (value->isPrimitiveValue())
-        type = V8ClassIndex::CSSPRIMITIVEVALUE;
-#if ENABLE(SVG)
-    else if (value->isSVGPaint())
-        type = V8ClassIndex::SVGPAINT;
-    else if (value->isSVGColor())
-        type = V8ClassIndex::SVGCOLOR;
-#endif
-    else
-        type = V8ClassIndex::CSSVALUE;
-
-    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSVALUE, value);
-    if (!result.IsEmpty()) {
-        // Only update the DOM object map if the result is non-empty.
-        value->ref();
-        setJSWrapperForDOMObject(value, v8::Persistent<v8::Object>::New(result));
-    }
-
-    return result;
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertCSSRuleToV8Object(CSSRule* rule)
-{
-    if (!rule) 
-        return v8::Null();
-
-    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(rule);
-    if (!wrapper.IsEmpty())
-        return wrapper;
-
-    V8ClassIndex::V8WrapperType type;
-
-    switch (rule->type()) {
-    case CSSRule::STYLE_RULE:
-        type = V8ClassIndex::CSSSTYLERULE;
-        break;
-    case CSSRule::CHARSET_RULE:
-        type = V8ClassIndex::CSSCHARSETRULE;
-        break;
-    case CSSRule::IMPORT_RULE:
-        type = V8ClassIndex::CSSIMPORTRULE;
-        break;
-    case CSSRule::MEDIA_RULE:
-        type = V8ClassIndex::CSSMEDIARULE;
-        break;
-    case CSSRule::FONT_FACE_RULE:
-        type = V8ClassIndex::CSSFONTFACERULE;
-        break;
-    case CSSRule::PAGE_RULE:
-        type = V8ClassIndex::CSSPAGERULE;
-        break;
-    case CSSRule::VARIABLES_RULE:
-        type = V8ClassIndex::CSSVARIABLESRULE;
-        break;
-    case CSSRule::WEBKIT_KEYFRAME_RULE:
-        type = V8ClassIndex::WEBKITCSSKEYFRAMERULE;
-        break;
-    case CSSRule::WEBKIT_KEYFRAMES_RULE:
-        type = V8ClassIndex::WEBKITCSSKEYFRAMESRULE;
-        break;
-    default:  // CSSRule::UNKNOWN_RULE
-        type = V8ClassIndex::CSSRULE;
-        break;
-    }
-
-    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSRULE, rule);
-    if (!result.IsEmpty()) {
-        // Only update the DOM object map if the result is non-empty.
-        rule->ref();
-        setJSWrapperForDOMObject(rule, v8::Persistent<v8::Object>::New(result));
-    }
-    return result;
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertWindowToV8Object(DOMWindow* window)
-{
-    if (!window)
-        return v8::Null();
-    // Initializes environment of a frame, and return the global object
-    // of the frame.
-    Frame* frame = window->frame();
-    if (!frame)
-        return v8::Handle<v8::Object>();
-
-    // Special case: Because of evaluateInIsolatedWorld() one DOMWindow can have
-    // multiple contexts and multiple global objects associated with it. When
-    // code running in one of those contexts accesses the window object, we
-    // want to return the global object associated with that context, not
-    // necessarily the first global object associated with that DOMWindow.
-    v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent();
-    v8::Handle<v8::Object> currentGlobal = currentContext->Global();
-    v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, currentGlobal);
-    if (!windowWrapper.IsEmpty()) {
-        if (V8DOMWindow::toNative(windowWrapper) == window)
-            return currentGlobal;
-    }
-
-    // Otherwise, return the global object associated with this frame.
-    v8::Handle<v8::Context> context = V8Proxy::context(frame);
-    if (context.IsEmpty())
-        return v8::Handle<v8::Object>();
-
-    v8::Handle<v8::Object> global = context->Global();
-    ASSERT(!global.IsEmpty());
-    return global;
-}
-
-v8::Handle<v8::Value> V8DOMWrapper::convertNamedNodeMapToV8Object(NamedNodeMap* map)
-{
-    if (!map)
-        return v8::Null();
-
-    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(map);
-    if (!wrapper.IsEmpty())
-        return wrapper;
-
-    v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::NAMEDNODEMAP, V8ClassIndex::NAMEDNODEMAP, map);
-    if (result.IsEmpty())
-        return result;
-
-    // Only update the DOM object map if the result is non-empty.
-    map->ref();
-    setJSWrapperForDOMObject(map, v8::Persistent<v8::Object>::New(result));
-
-    // Add a hidden reference from named node map to its owner node.
-    if (Element* element = map->element()) {
-        v8::Handle<v8::Object> owner = v8::Handle<v8::Object>::Cast(convertNodeToV8Object(element));
-        result->SetInternalField(V8NamedNodeMap::ownerNodeIndex, owner);
-    }
-
-    return result;
-}
-
 }  // namespace WebCore
diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h
index 0ccd8ac..51abff7 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.h
+++ b/WebCore/bindings/v8/V8DOMWrapper.h
@@ -36,7 +36,6 @@
 #include "Node.h"
 #include "NodeFilter.h"
 #include "PlatformString.h" // for WebCore::String
-#include "V8CustomBinding.h"
 #include "V8CustomXPathNSResolver.h"
 #include "V8DOMMap.h"
 #include "V8Event.h"
@@ -123,45 +122,8 @@ namespace WebCore {
             return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(getTemplate(type));
         }
 
-        template<typename T>
-        static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType type, PassRefPtr<T> imp)
-        {
-            return convertToV8Object(type, imp.get());
-        }
-
-        static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType, void*);
-
-        // Fast-path for Node objects.
-        static v8::Handle<v8::Value> convertNodeToV8Object(PassRefPtr<Node> node)
-        {
-            return convertNodeToV8Object(node.get());
-        }
-
-        static v8::Handle<v8::Value> convertNodeToV8Object(Node*);
-
-        static v8::Handle<v8::Value> convertDocumentToV8Object(Document*);
-
-        static v8::Handle<v8::Value> convertNewNodeToV8Object(PassRefPtr<Node> node)
-        {
-            return convertNewNodeToV8Object(node.get());
-        }
-
-        static v8::Handle<v8::Value> convertNewNodeToV8Object(Node* node)
-        {
-            return convertNewNodeToV8Object(node, 0, getDOMNodeMap());
-        }
-
-        static v8::Handle<v8::Value> convertNewNodeToV8Object(Node*, V8Proxy*, DOMNodeMapping&);
-
         static V8ClassIndex::V8WrapperType domWrapperType(v8::Handle<v8::Object>);
 
-        static v8::Handle<v8::Value> convertEventToV8Object(PassRefPtr<Event> event)
-        {
-            return convertEventToV8Object(event.get());
-        }
-
-        static v8::Handle<v8::Value> convertEventToV8Object(Event*);
-
         static v8::Handle<v8::Value> convertEventTargetToV8Object(PassRefPtr<EventTarget> eventTarget)
         {
             return convertEventTargetToV8Object(eventTarget.get());
@@ -169,14 +131,6 @@ namespace WebCore {
 
         static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*);
 
-        // Wrap and unwrap JS event listeners.
-        static v8::Handle<v8::Value> convertEventListenerToV8Object(ScriptExecutionContext* context, PassRefPtr<EventListener> eventListener)
-        {
-            return convertEventListenerToV8Object(context, eventListener.get());
-        }
-
-        static v8::Handle<v8::Value> convertEventListenerToV8Object(ScriptExecutionContext*, EventListener*);
-
         static PassRefPtr<EventListener> getEventListener(Node* node, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup);
 
         static PassRefPtr<EventListener> getEventListener(SVGElementInstance* element, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup);
@@ -211,10 +165,6 @@ namespace WebCore {
             return resolver;
         }
 #endif
-        // DOMImplementation is a singleton and it is handled in a special
-        // way. A wrapper is generated per document and stored in an
-        // internal field of the document.
-        static v8::Handle<v8::Value> convertDOMImplementationToV8Object(DOMImplementation*);
 
         // Wrap JS node filter in C++.
         static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
@@ -233,57 +183,18 @@ namespace WebCore {
         // Check whether a V8 value is a wrapper of type |classType|.
         static bool isWrapperOfType(v8::Handle<v8::Value>, V8ClassIndex::V8WrapperType);
 
-        // Check whether a V8 value is a DOM Event wrapper.
-        static bool isDOMEventWrapper(v8::Handle<v8::Value>);
-
-        static v8::Handle<v8::Value> convertStyleSheetToV8Object(StyleSheet*);
-        static v8::Handle<v8::Value> convertCSSValueToV8Object(CSSValue*);
-        static v8::Handle<v8::Value> convertCSSRuleToV8Object(CSSRule*);
-        // Returns the JS wrapper of a window object, initializes the environment
-        // of the window frame if needed.
-        static v8::Handle<v8::Value> convertWindowToV8Object(DOMWindow*);
-        static v8::Handle<v8::Value> convertNamedNodeMapToV8Object(NamedNodeMap*);
-
-#if ENABLE(SVG)
-        static v8::Handle<v8::Value> convertSVGElementInstanceToV8Object(SVGElementInstance*);
-        static v8::Handle<v8::Value> convertSVGObjectWithContextToV8Object(V8ClassIndex::V8WrapperType, void*);
-#endif
-
 #if ENABLE(3D_CANVAS)
         static void setIndexedPropertiesToExternalArray(v8::Handle<v8::Object>,
                                                         int,
                                                         void*,
                                                         int);
 #endif
-
-        static V8ClassIndex::V8WrapperType htmlElementType(HTMLElement*);
-#if ENABLE(SVG)
-        static V8ClassIndex::V8WrapperType svgElementType(SVGElement*);
-#endif
         // Set hidden references in a DOMWindow object of a frame.
         static void setHiddenWindowReference(Frame*, const int internalIndex, v8::Handle<v8::Object>);
 
-        static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl)
-        {
-            return instantiateV8Object(proxy, type, type, impl);
-        }
+        static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl);
 
         static v8::Handle<v8::Object> getWrapper(Node*);
-
-    private:
-
-        // The first V8WrapperType specifies the function descriptor
-        // used to create JS object. The second V8WrapperType specifies
-        // the actual type of the void* for type casting.
-        // For example, a HTML element has HTMLELEMENT for the first V8WrapperType, but always
-        // use NODE as the second V8WrapperType. JS wrapper stores the second
-        // V8WrapperType and the void* as internal fields.
-        static v8::Local<v8::Object> instantiateV8Object(V8ClassIndex::V8WrapperType descType, V8ClassIndex::V8WrapperType cptrType, void* impl)
-        {
-            return instantiateV8Object(NULL, descType, cptrType, impl);
-        }
-
-        static v8::Local<v8::Object> instantiateV8Object(V8Proxy*, V8ClassIndex::V8WrapperType, V8ClassIndex::V8WrapperType, void*);
     };
 
 }
diff --git a/WebCore/bindings/v8/V8NodeFilterCondition.cpp b/WebCore/bindings/v8/V8NodeFilterCondition.cpp
index 9f57a44..a8868b5 100644
--- a/WebCore/bindings/v8/V8NodeFilterCondition.cpp
+++ b/WebCore/bindings/v8/V8NodeFilterCondition.cpp
@@ -34,6 +34,7 @@
 #include "Node.h"
 #include "NodeFilter.h"
 #include "ScriptState.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 
 #include <wtf/OwnArrayPtr.h>
@@ -69,7 +70,7 @@ short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const
     v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
     v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(m_filter);
     OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[1]);
-    args[0] = V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node);
+    args[0] = toV8(node);
 
     V8Proxy* proxy = V8Proxy::retrieve();
     ASSERT(proxy);
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 5ab36da..9509677 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -46,12 +46,17 @@
 #include "V8BindingState.h"
 #include "V8Collection.h"
 #include "V8ConsoleMessage.h"
-#include "V8CustomBinding.h"
+#include "V8DOMCoreException.h"
 #include "V8DOMMap.h"
 #include "V8DOMWindow.h"
+#include "V8EventException.h"
 #include "V8HiddenPropertyName.h"
 #include "V8Index.h"
 #include "V8IsolatedContext.h"
+#include "V8RangeException.h"
+#include "V8SVGException.h"
+#include "V8XMLHttpRequestException.h"
+#include "V8XPathException.h"
 #include "WorkerContextExecutionProxy.h"
 
 #include <algorithm>
@@ -607,25 +612,25 @@ void V8Proxy::setDOMException(int exceptionCode)
     v8::Handle<v8::Value> exception;
     switch (description.type) {
     case DOMExceptionType:
-        exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMCOREEXCEPTION, DOMCoreException::create(description));
+        exception = toV8(DOMCoreException::create(description));
         break;
     case RangeExceptionType:
-        exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::RANGEEXCEPTION, RangeException::create(description));
+        exception = toV8(RangeException::create(description));
         break;
     case EventExceptionType:
-        exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::EVENTEXCEPTION, EventException::create(description));
+        exception = toV8(EventException::create(description));
         break;
     case XMLHttpRequestExceptionType:
-        exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException::create(description));
+        exception = toV8(XMLHttpRequestException::create(description));
         break;
 #if ENABLE(SVG)
     case SVGExceptionType:
-        exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGEXCEPTION, SVGException::create(description));
+        exception = toV8(SVGException::create(description));
         break;
 #endif
 #if ENABLE(XPATH)
     case XPathExceptionType:
-        exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::XPATHEXCEPTION, XPathException::create(description));
+        exception = toV8(XPathException::create(description));
         break;
 #endif
     }
diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 5e6f40a..70be193 100644
--- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -53,10 +53,10 @@ namespace WebCore {
 static v8::Handle<v8::Value> toV8Object(CanvasStyle* style)
 {
     if (style->canvasGradient())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASGRADIENT, style->canvasGradient());
+        return toV8(style->canvasGradient());
 
     if (style->canvasPattern())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASPATTERN, style->canvasPattern());
+        return toV8(style->canvasPattern());
 
     return v8String(style->color());
 }
@@ -348,7 +348,7 @@ v8::Handle<v8::Value> V8CanvasRenderingContext2D::createPatternCallback(const v8
             V8Proxy::setDOMException(ec);
             return notHandledByInterceptor();
         }
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASPATTERN, pattern.release());
+        return toV8(pattern.release());
     }
 
     if (V8HTMLCanvasElement::HasInstance(arg)) {
@@ -359,7 +359,7 @@ v8::Handle<v8::Value> V8CanvasRenderingContext2D::createPatternCallback(const v8
             V8Proxy::setDOMException(ec);
             return notHandledByInterceptor();
         }
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASPATTERN, pattern.release());
+        return toV8(pattern.release());
     }
 
     V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
index 5e9a8f2..19300b0 100644
--- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
@@ -28,6 +28,7 @@
 
 #include "Frame.h"
 #include "V8CustomVoidCallback.h"  // For invokeCallback
+#include "V8Geoposition.h"
 
 namespace WebCore {
 
@@ -53,7 +54,7 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position)
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::GEOPOSITION, position)
+        toV8(position)
     };
 
     // Protect the frame until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
index 117f374..c6c632b 100644
--- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
@@ -28,6 +28,7 @@
 
 #include "Frame.h"
 #include "V8CustomVoidCallback.h"  // For invokeCallback
+#include "V8PositionError.h"
 
 namespace WebCore {
 
@@ -53,7 +54,7 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error)
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::POSITIONERROR, error)
+        toV8(error)
     };
 
     // Protect the frame until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp
index 64abdc4..d30b95a 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp
@@ -36,6 +36,8 @@
 
 #include "Frame.h"
 #include "V8CustomVoidCallback.h"
+#include "V8SQLResultSet.h"
+#include "V8SQLTransaction.h"
 
 namespace WebCore {
 
@@ -61,8 +63,8 @@ void V8CustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLR
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction),
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLRESULTSET, resultSet)
+        toV8(transaction),
+        toV8(resultSet)
     };
 
     // Protect the frame until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
index 1af3562..84a3b96 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
@@ -36,6 +36,8 @@
 
 #include "Frame.h"
 #include "V8CustomVoidCallback.h"
+#include "V8SQLError.h"
+#include "V8SQLTransaction.h"
 
 namespace WebCore {
 
@@ -61,8 +63,8 @@ bool V8CustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction,
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction),
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLERROR, error)
+        toV8(transaction),
+        toV8(error)
     };
 
     // Protect the frame until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp
index 2cef6b3..68002d7 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp
@@ -36,6 +36,7 @@
 
 #include "Frame.h"
 #include "V8CustomVoidCallback.h"
+#include "V8SQLTransaction.h"
 
 namespace WebCore {
 
@@ -62,7 +63,7 @@ void V8CustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bo
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction)
+        toV8(transaction)
     };
 
     // Protect the frame until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp
index 1a0939d..cf5a0ef 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp
@@ -36,6 +36,7 @@
 
 #include "Frame.h"
 #include "V8CustomVoidCallback.h"
+#include "V8SQLError.h"
 
 namespace WebCore {
 
@@ -61,7 +62,7 @@ void V8CustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLERROR, error)
+        toV8(error)
     };
 
     // Protect the frame until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index 1e2f949..ba6c738 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -57,7 +57,9 @@
 #include "V8BindingState.h"
 #include "V8CustomBinding.h"
 #include "V8CustomEventListener.h"
+#include "V8HTMLCollection.h"
 #include "V8MessagePortCustom.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 #include "V8Utilities.h"
 #if ENABLE(WEB_SOCKETS)
@@ -708,7 +710,7 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args)
 
             frame->redirectScheduler()->scheduleLocationChange(completedUrl, referrer, false, userGesture);
         }
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+        return toV8(frame->domWindow());
     }
 
     // In the case of a named frame or a new window, we'll use the
@@ -768,7 +770,7 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args)
     if (!frame)
         return v8::Undefined();
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+    return toV8(frame->domWindow());
 }
 
 
@@ -786,7 +788,7 @@ v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v
 
     Frame* child = frame->tree()->child(index);
     if (child)
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
+        return toV8(child->domWindow());
 
     return notHandledByInterceptor();
 }
@@ -809,7 +811,7 @@ v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> nam
     AtomicString propName = v8StringToAtomicWebCoreString(name);
     Frame* child = frame->tree()->child(propName);
     if (child)
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
+        return toV8(child->domWindow());
 
     // Search IDL functions defined in the prototype
     v8::Handle<v8::Value> result = info.Holder()->GetRealNamedProperty(name);
@@ -824,8 +826,8 @@ v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> nam
             RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
             if (items->length() >= 1) {
                 if (items->length() == 1)
-                    return V8DOMWrapper::convertNodeToV8Object(items->firstItem());
-                return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release());
+                    return toV8(items->firstItem());
+                return toV8(items.release());
             }
         }
     }
diff --git a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
index 8980cfe..58e5d01 100644
--- a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
@@ -57,7 +57,7 @@ NAMED_PROPERTY_GETTER(DataGridColumnList)
     DataGridColumn* result = imp->itemWithName(toWebCoreString(name));
     if (!result)
         return notHandledByInterceptor();
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::DATAGRIDCOLUMN, result);
+    return toV8(result);
 }
     
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
index 08b2294..1ac16b2 100644
--- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
@@ -37,16 +37,17 @@
 #include "Node.h"
 #include "XPathNSResolver.h"
 #include "XPathResult.h"
-#include "CanvasRenderingContext.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8CanvasRenderingContext2D.h"
 #include "V8CustomXPathNSResolver.h"
+#include "V8DOMImplementation.h"
 #include "V8HTMLDocument.h"
 #include "V8IsolatedContext.h"
 #include "V8Node.h"
 #include "V8Proxy.h"
 #include "V8SVGDocument.h"
+#include "V8WebGLRenderingContext.h"
 #include "V8XPathNSResolver.h"
 #include "V8XPathResult.h"
 
@@ -82,7 +83,7 @@ v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args)
     if (ec)
         return throwError(ec);
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::XPATHRESULT, result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Arguments& args)
@@ -98,10 +99,10 @@ v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Argument
     if (!result)
         return v8::Undefined();
     if (result->is2d())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
+        return toV8(static_cast<CanvasRenderingContext2D*>(result));
 #if ENABLE(3D_CANVAS)
     else if (result->is3d())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERINGCONTEXT, result);
+        return toV8(static_cast<WebGLRenderingContext*>(result));
 #endif // ENABLE(3D_CANVAS)
     ASSERT_NOT_REACHED();
     return v8::Undefined();
@@ -127,7 +128,7 @@ v8::Handle<v8::Value> V8Document::implementationAccessorGetter(v8::Local<v8::Str
 
     // Generate a wrapper.
     Document* document = V8Document::toNative(info.Holder());
-    v8::Handle<v8::Value> wrapper = V8DOMWrapper::convertDOMImplementationToV8Object(document->implementation());
+    v8::Handle<v8::Value> wrapper = toV8(document->implementation());
 
     // Store the wrapper in the internal field.
     info.Holder()->SetInternalField(implementationIndex, wrapper);
diff --git a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
index 8dc4672..f86054b 100644
--- a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
@@ -27,8 +27,7 @@
 #include "DOMWindow.h"
 #include "Frame.h"
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
-#include "V8Document.h"
+#include "V8Location.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -40,7 +39,7 @@ v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> n
         return v8::Null();
 
     DOMWindow* window = document->frame()->domWindow();
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::LOCATION, window->location());
+    return toV8(window->location());
 }
 
 void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index 9901f1b..b420f6a 100644
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -87,7 +87,7 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& a
     if (ec)
         throwError(ec);
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args)
@@ -126,7 +126,7 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments&
     if (ec)
         throwError(ec);
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> toV8(Element* impl, bool forceNewObject)
diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp
index 41984b6..a13603e 100644
--- a/WebCore/bindings/v8/custom/V8EventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp
@@ -36,8 +36,8 @@
 #include "Event.h"
 #include "V8BeforeLoadEvent.h"
 #include "V8Binding.h"
+#include "V8Clipboard.h"
 #include "V8CompositionEvent.h"
-#include "V8CustomBinding.h"
 #include "V8ErrorEvent.h"
 #include "V8KeyboardEvent.h"
 #include "V8MessageEvent.h"
@@ -70,7 +70,7 @@ v8::Handle<v8::Value> V8Event::dataTransferAccessorGetter(v8::Local<v8::String>
     Event* event = V8Event::toNative(info.Holder());
 
     if (event->isDragEvent())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<MouseEvent*>(event)->clipboard());
+        return toV8(static_cast<MouseEvent*>(event)->clipboard());
 
     return v8::Undefined();
 }
@@ -80,7 +80,7 @@ v8::Handle<v8::Value> V8Event::clipboardDataAccessorGetter(v8::Local<v8::String>
     Event* event = V8Event::toNative(info.Holder());
 
     if (event->isClipboardEvent())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<ClipboardEvent*>(event)->clipboard());
+        return toV8(static_cast<ClipboardEvent*>(event)->clipboard());
 
     return v8::Undefined();
 }
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index c34d9e7..88b3a9d 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -36,6 +36,8 @@
 #include "V8Binding.h"
 #include "V8CustomBinding.h"
 #include "V8NamedNodesCollection.h"
+#include "V8Node.h"
+#include "V8NodeList.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -49,10 +51,10 @@ static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, Atomic
         return v8::Handle<v8::Value>();
 
     if (namedItems.size() == 1)
-        return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release());
+        return toV8(namedItems.at(0).release());
 
     NodeList* list = new V8NamedNodesCollection(namedItems);
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+    return toV8(list);
 }
 
 static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument)
@@ -68,7 +70,7 @@ static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v
     }
 
     RefPtr<Node> result = collection->item(index->Uint32Value());
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8HTMLAllCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -130,7 +132,7 @@ v8::Handle<v8::Value> V8HTMLAllCollection::callAsFunctionCallback(const v8::Argu
     Node* node = imp->namedItem(name);
     while (node) {
         if (!current)
-            return V8DOMWrapper::convertNodeToV8Object(node);
+            return toV8(node);
 
         node = imp->nextNamedItem(name);
         current--;
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
index e634003..28b0a99 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
@@ -36,6 +36,7 @@
 #include "Frame.h"
 #include "HTMLNames.h"
 #include "V8Binding.h"
+#include "V8Document.h"
 #include "V8HTMLAudioElement.h"
 #include "V8Proxy.h"
 
@@ -78,7 +79,7 @@ v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::
 
     // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance
     // may end up being the only node in the map and get garbage-ccollected prematurely.
-    V8DOMWrapper::convertNodeToV8Object(document);
+    toV8(document);
 
     RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, document);
     audio->setAutobuffer(true);
diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
index 0d1ff44..54a003c 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
@@ -36,9 +36,10 @@
 #include "HTMLCanvasElement.h"
 #include "WebGLContextAttributes.h"
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8CanvasRenderingContext2D.h"
 #include "V8Node.h"
 #include "V8Proxy.h"
+#include "V8WebGLRenderingContext.h"
 
 namespace WebCore {
 
@@ -77,10 +78,10 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
     if (!result)
         return v8::Undefined();
     if (result->is2d())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
+        return toV8(static_cast<CanvasRenderingContext2D*>(result));
 #if ENABLE(3D_CANVAS)
     else if (result->is3d())
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERINGCONTEXT, result);
+        return toV8(static_cast<WebGLRenderingContext*>(result));
 #endif
     ASSERT_NOT_REACHED();
     return v8::Undefined();
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index 0741432..29ff6eb 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -36,6 +36,8 @@
 #include "V8CustomBinding.h"
 #include "V8HTMLAllCollection.h"
 #include "V8NamedNodesCollection.h"
+#include "V8Node.h"
+#include "V8NodeList.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -49,10 +51,10 @@ static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicStr
         return v8::Handle<v8::Value>();
 
     if (namedItems.size() == 1)
-        return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release());
+        return toV8(namedItems.at(0).release());
 
     NodeList* list = new V8NamedNodesCollection(namedItems);
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+    return toV8(list);
 }
 
 static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument)
@@ -68,7 +70,7 @@ static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::
     }
 
     RefPtr<Node> result = collection->item(index->Uint32Value());
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -130,7 +132,7 @@ v8::Handle<v8::Value> V8HTMLCollection::callAsFunctionCallback(const v8::Argumen
     Node* node = imp->namedItem(name);
     while (node) {
         if (!current)
-            return V8DOMWrapper::convertNodeToV8Object(node);
+            return toV8(node);
 
         node = imp->nextNamedItem(name);
         current--;
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index 3cb3ee6..6478e07 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -38,7 +38,11 @@
 #include "HTMLIFrameElement.h"
 #include "HTMLNames.h"
 #include "V8Binding.h"
+#include "V8DOMWindow.h"
+#include "V8HTMLAllCollection.h"
+#include "V8HTMLCollection.h"
 #include "V8IsolatedContext.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 #include <wtf/RefPtr.h>
 #include <wtf/StdLibExtras.h>
@@ -92,12 +96,12 @@ v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String>
         Node* node = items->firstItem();
         Frame* frame = 0;
         if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
-            return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+            return toV8(frame->domWindow());
 
-        return V8DOMWrapper::convertNodeToV8Object(node);
+        return toV8(node);
     }
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release());
+    return toV8(items.release());
 }
 
 v8::Handle<v8::Value> V8HTMLDocument::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo &info) 
@@ -182,10 +186,9 @@ v8::Handle<v8::Value> V8HTMLDocument::openCallback(const v8::Arguments& args)
 v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.HTMLDocument.all._get");
-    v8::HandleScope scope;
     v8::Handle<v8::Object> holder = info.Holder();
     HTMLDocument* htmlDocument = V8HTMLDocument::toNative(holder);
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, htmlDocument->all());
+    return toV8(htmlDocument->all());
 }
 
 void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
index d819e9b..0a9e8dd 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
@@ -34,8 +34,9 @@
 #include "HTMLCollection.h"
 #include "HTMLFormElement.h"
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8NamedNodesCollection.h"
+#include "V8Node.h"
+#include "V8NodeList.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -48,7 +49,7 @@ v8::Handle<v8::Value> V8HTMLFormElement::indexedPropertyGetter(uint32_t index, c
     RefPtr<Node> formElement = form->elements()->item(index);
     if (!formElement)
         return notHandledByInterceptor();
-    return V8DOMWrapper::convertNodeToV8Object(formElement.release());
+    return toV8(formElement.release());
 }
 
 v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -74,10 +75,10 @@ v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::Strin
     ASSERT(!elements.isEmpty());
 
     if (elements.size() == 1)
-        return V8DOMWrapper::convertNodeToV8Object(elements.at(0).release());
+        return toV8(elements.at(0).release());
 
     NodeList* collection = new V8NamedNodesCollection(elements);
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, collection);
+    return toV8(collection);
 }
 
 v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
index 214b11e..6a45be7 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
@@ -40,7 +40,7 @@
 #include "Node.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8DOMWindow.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -55,7 +55,7 @@ v8::Handle<v8::Value> V8HTMLFrameSetElement::namedPropertyGetter(v8::Local<v8::S
         if (!doc)
             return v8::Undefined();
         if (Frame* frame = doc->frame())
-            return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+            return toV8(frame->domWindow());
     }
     return notHandledByInterceptor();
 }
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index 57efa34..2c28fa5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -36,6 +36,7 @@
 #include "Frame.h"
 #include "HTMLNames.h"
 #include "V8Binding.h"
+#include "V8Document.h"
 #include "V8HTMLImageElement.h"
 #include "V8Proxy.h"
 
@@ -78,7 +79,7 @@ v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8::
 
     // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
     // may end up being the only node in the map and get garbage-ccollected prematurely.
-    V8DOMWrapper::convertNodeToV8Object(document);
+    toV8(document);
 
     RefPtr<HTMLImageElement> image = new HTMLImageElement(HTMLNames::imgTag, document);
     if (args.Length() > 0) {
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index c060df7..81bc287 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -37,9 +37,9 @@
 
 #include "V8Binding.h"
 #include "V8Collection.h"
-#include "V8CustomBinding.h"
 #include "V8HTMLOptionElement.h"
 #include "V8HTMLSelectElementCustom.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -123,7 +123,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t in
     if (!result)
         return notHandledByInterceptor();
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
index 4801dc0..d0d8dac 100644
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
@@ -37,10 +37,11 @@
 
 #include "V8Binding.h"
 #include "V8Collection.h"
-#include "V8CustomBinding.h"
 #include "V8HTMLOptionElement.h"
 #include "V8HTMLSelectElement.h"
 #include "V8NamedNodesCollection.h"
+#include "V8Node.h"
+#include "V8NodeList.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
@@ -67,10 +68,10 @@ v8::Handle<v8::Value> V8HTMLSelectElement::namedPropertyGetter(v8::Local<v8::Str
         return notHandledByInterceptor();
 
     if (items.size() == 1)
-        return V8DOMWrapper::convertNodeToV8Object(items.at(0).release());
+        return toV8(items.at(0).release());
 
     NodeList* list = new V8NamedNodesCollection(items);
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+    return toV8(list);
 }
 
 v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
@@ -80,7 +81,7 @@ v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertyGetter(uint32_t index,
     if (!result)
         return notHandledByInterceptor();
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 0ddcf97..f3dac9c 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -40,7 +40,6 @@
 #include "Page.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8Database.h"
 #include "V8Node.h"
 #include "V8Proxy.h"
@@ -85,7 +84,7 @@ static ScriptObject createInjectedScript(const String& scriptSource, InjectedScr
     v8::Context::Scope contextScope(inspectedContext);
 
     // Call custom code to create InjectedScripHost wrapper specific for the context
-    // instead of calling V8DOMWrapper::convertToV8Object that would create the
+    // instead of calling toV8() that would create the
     // wrapper in the current context.
     // FIXME: make it possible to use generic bindings factory for InjectedScriptHost.
     v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(injectedScriptHost);
@@ -130,7 +129,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument
     if (!ic)
         return v8::Undefined();
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node);
+    return toV8(node);
 }
 
 v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const v8::Arguments& args)
@@ -160,7 +159,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::databaseForIdCallback(const v8::Argu
     Database* database = host->databaseForId(args[0]->ToInt32()->Value());
     if (!database)
         return v8::Undefined();
-    return V8DOMWrapper::convertToV8Object<Database>(V8ClassIndex::DATABASE, database);
+    return toV8(database);
 }
 
 v8::Handle<v8::Value> V8InjectedScriptHost::selectDatabaseCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
index 3ea8e26..4fb82ba 100644
--- a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
@@ -35,6 +35,7 @@
 #include "Frame.h"
 #include "MessageChannel.h"
 #include "V8Binding.h"
+#include "V8MessagePort.h"
 #include "V8Proxy.h"
 #include "V8Utilities.h"
 #include "WorkerContext.h"
@@ -66,8 +67,8 @@ v8::Handle<v8::Value> V8MessageChannel::constructorCallback(const v8::Arguments&
     // Create references from the MessageChannel wrapper to the two
     // MessagePort wrappers to make sure that the MessagePort wrappers
     // stay alive as long as the MessageChannel wrapper is around.
-    messageChannel->SetInternalField(V8MessageChannel::port1Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1()));
-    messageChannel->SetInternalField(V8MessageChannel::port2Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2()));
+    messageChannel->SetInternalField(V8MessageChannel::port1Index, toV8(obj->port1()));
+    messageChannel->SetInternalField(V8MessageChannel::port2Index, toV8(obj->port2()));
 
     // Setup the standard wrapper object internal fields.
     V8DOMWrapper::setDOMWrapper(messageChannel, V8ClassIndex::MESSAGECHANNEL, obj.get());
diff --git a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
index 9e40855..9f2c080 100644
--- a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -35,8 +35,8 @@
 #include "SerializedScriptValue.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8DOMWindow.h"
+#include "V8MessagePort.h"
 #include "V8MessagePortCustom.h"
 #include "V8Proxy.h"
 
@@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8MessageEvent::portsAccessorGetter(v8::Local<v8::String>
 
     v8::Local<v8::Array> portArray = v8::Array::New(ports->size());
     for (size_t i = 0; i < ports->size(); ++i)
-        portArray->Set(v8::Integer::New(i), V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, (*ports)[i].get()));
+        portArray->Set(v8::Integer::New(i), toV8((*ports)[i].get()));
 
     return portArray;
 }
diff --git a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
index 4a05b08..611ab94 100644
--- a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
@@ -33,8 +33,8 @@
 
 #include "NamedNodeMap.h"
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8Element.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 
 #include <wtf/RefPtr.h>
@@ -49,7 +49,7 @@ v8::Handle<v8::Value> V8NamedNodeMap::indexedPropertyGetter(uint32_t index, cons
     if (!result)
         return notHandledByInterceptor();
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -70,7 +70,7 @@ v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String>
     if (!result)
         return notHandledByInterceptor();
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 v8::Handle<v8::Value> toV8(NamedNodeMap* impl)
diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
index 074eac3..728b3dc 100644
--- a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
@@ -35,7 +35,7 @@
 #include "ScriptState.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 
 #include <wtf/PassRefPtr.h>
@@ -54,7 +54,7 @@ static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ExceptionCode
     if (!object)
         return v8::Null();
 
-    return V8DOMWrapper::convertNodeToV8Object(object);
+    return toV8(object);
 }
 
 v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
index 5721a7e..20a5471 100644
--- a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
@@ -32,9 +32,8 @@
 #include "V8NodeList.h" 
 
 #include "NodeList.h"
-
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 
 #include <wtf/RefPtr.h>
@@ -57,7 +56,7 @@ v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name
     if (!result)
         return notHandledByInterceptor();
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 // Need to support call so that list(0) works.
@@ -75,7 +74,7 @@ v8::Handle<v8::Value> V8NodeList::callAsFunctionCallback(const v8::Arguments& ar
         return v8::Undefined();
 
     RefPtr<Node> result = list->item(index->Uint32Value());
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
index 1cb4554..5531b48 100644
--- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
@@ -37,7 +37,6 @@
 #include "Notification.h"
 #include "NotificationCenter.h"
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8CustomEventListener.h"
 #include "V8CustomVoidCallback.h"
 #include "V8Notification.h"
@@ -95,7 +94,7 @@ v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const
     if (notificationCenter->context()->isWorkerContext())
         return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
+    return toV8(notification.get());
 }
 
 v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8::Arguments& args)
@@ -112,7 +111,7 @@ v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8:
     if (notificationCenter->context()->isWorkerContext())
         return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
+    return toV8(notification.get());
 }
 
 v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
index 78284cd..0a75c9f 100644
--- a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
@@ -31,16 +31,13 @@
 #include <config.h>
 
 #if ENABLE(SVG)
-
 #include "TransformationMatrix.h"
 
 #include "SVGException.h"
-
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8Proxy.h"
 #include "V8SVGMatrix.h"
 #include "V8SVGPODTypeWrapper.h"
-#include "V8Proxy.h"
 
 namespace WebCore {
 
@@ -56,7 +53,8 @@ v8::Handle<v8::Value> V8SVGMatrix::multiplyCallback(const v8::Arguments& args)
     TransformationMatrix m1 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
     TransformationMatrix m2 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(v8::Handle<v8::Object>::Cast(args[0]));
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)));
+    RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2));
+    return toV8(wrapper.get());
 }
 
 v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
@@ -74,7 +72,8 @@ v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
         return v8::Handle<v8::Value>();
     }
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result));
+    RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result);
+    return toV8(wrapper.get());
 }
 
 v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments& args)
@@ -94,7 +93,8 @@ v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments&
         return v8::Handle<v8::Value>();
     }
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result));
+    RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result);
+    return toV8(wrapper.get());
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
index a718451..cee1838 100644
--- a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
@@ -34,8 +34,8 @@
 #include "HTMLStyleElement.h"
 #include "StyleSheetList.h"
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8Proxy.h"
+#include "V8StyleSheet.h"
 
 namespace WebCore {
 
@@ -52,7 +52,7 @@ v8::Handle<v8::Value> V8StyleSheetList::namedPropertyGetter(v8::Local<v8::String
     if (!item)
         return notHandledByInterceptor();
 
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::STYLESHEET, item->sheet());
+    return toV8(item->sheet());
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
index 866fae2..37087df 100644
--- a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
@@ -36,7 +36,7 @@
 #include "TreeWalker.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
+#include "V8Node.h"
 #include "V8Proxy.h"
 
 #include <wtf/PassRefPtr.h>
@@ -52,7 +52,7 @@ static inline v8::Handle<v8::Value> toV8Object(PassRefPtr<Node> object, ScriptSt
     if (!object)
         return v8::Null();
 
-    return V8DOMWrapper::convertNodeToV8Object(object);
+    return toV8(object);
 }
 
 v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 1961d39..78de5e6 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -42,12 +42,16 @@
 
 #include "V8Binding.h"
 #include "V8WebGLArray.h"
+#include "V8WebGLBuffer.h"
 #include "V8WebGLByteArray.h"
 #include "V8WebGLFloatArray.h"
+#include "V8WebGLFramebuffer.h"
 #include "V8WebGLIntArray.h"
 #include "V8WebGLProgram.h"
+#include "V8WebGLRenderbuffer.h"
 #include "V8WebGLShader.h"
 #include "V8WebGLShortArray.h"
+#include "V8WebGLTexture.h"
 #include "V8WebGLUniformLocation.h"
 #include "V8WebGLUnsignedByteArray.h"
 #include "V8WebGLUnsignedIntArray.h"
@@ -191,23 +195,23 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)
     case WebGLGetInfo::kTypeUnsignedLong:
         return v8::Integer::NewFromUnsigned(info.getUnsignedLong());
     case WebGLGetInfo::kTypeWebGLBuffer:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLBUFFER, info.getWebGLBuffer());
+        return toV8(info.getWebGLBuffer());
     case WebGLGetInfo::kTypeWebGLFloatArray:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLFLOATARRAY, info.getWebGLFloatArray());
+        return toV8(info.getWebGLFloatArray());
     case WebGLGetInfo::kTypeWebGLFramebuffer:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLFRAMEBUFFER, info.getWebGLFramebuffer());
+        return toV8(info.getWebGLFramebuffer());
     case WebGLGetInfo::kTypeWebGLIntArray:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLINTARRAY, info.getWebGLIntArray());
+        return toV8(info.getWebGLIntArray());
     // FIXME: implement WebGLObjectArray
     // case WebGLGetInfo::kTypeWebGLObjectArray:
     case WebGLGetInfo::kTypeWebGLProgram:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLPROGRAM, info.getWebGLProgram());
+        return toV8(info.getWebGLProgram());
     case WebGLGetInfo::kTypeWebGLRenderbuffer:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERBUFFER, info.getWebGLRenderbuffer());
+        return toV8(info.getWebGLRenderbuffer());
     case WebGLGetInfo::kTypeWebGLTexture:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLTEXTURE, info.getWebGLTexture());
+        return toV8(info.getWebGLTexture());
     case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY, info.getWebGLUnsignedByteArray());
+        return toV8(info.getWebGLUnsignedByteArray());
     default:
         notImplemented();
         return v8::Undefined();
diff --git a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
index fd0305a..89f804c 100644
--- a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
@@ -36,8 +36,8 @@
 #include "Node.h"
 
 #include "V8Binding.h"
-#include "V8CustomBinding.h"
 #include "V8Document.h"
+#include "V8DocumentFragment.h"
 #include "V8Node.h"
 #include "V8Proxy.h"
 #include "XSLTProcessor.h"
@@ -78,7 +78,7 @@ v8::Handle<v8::Value> V8XSLTProcessor::transformToFragmentCallback(const v8::Arg
     Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
     Document* owner = V8Document::toNative(v8::Handle<v8::Object>::Cast(args[1]));
     RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner);
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 
@@ -99,7 +99,7 @@ v8::Handle<v8::Value> V8XSLTProcessor::transformToDocumentCallback(const v8::Arg
     if (!result)
         return v8::Undefined();
 
-    return V8DOMWrapper::convertNodeToV8Object(result.release());
+    return toV8(result.release());
 }
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list