[Custom Elements][V8] Custom Element doesn't need its own WrapperTypeInfo
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2013 02:52:34 +0000 (02:52 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2013 02:52:34 +0000 (02:52 +0000)
commit3903b82079fa6c9b615a88403591812d74c520eb
tree30c202089241977bf736098f4fae2a583a6d72da
parent673c2d08c0f44d9e842305f69dc25ec44de04642
[Custom Elements][V8] Custom Element doesn't need its own WrapperTypeInfo
https://bugs.webkit.org/show_bug.cgi?id=111411

Reviewed by Kentaro Hara.

No new tests. No observable change yet.

This is a preparation for Bug 110436, where WebKit is going to
allow any HTML element to be a superclass of custom elements.

This change eliminates WrapperTypeInfo for custom element. Instead
of that, the wrapper of a custom element picks WrapperTypeInfo
from most descendant built-in HTML element. For example, think about
following hierarchy:

- ... <- HTMLElement <- HTMLDivElememnt <- ExistingCustomElement <- NewCustomElement

In this case, both ExistingCustomElement and NewCustomElement has
HTMLDivElememnt's type info. This is because HTMLDivElememnt is
the most descendant (or "the nearest") built-in HTML
element. (HTMLElement isn't the most descendant.
ExistingCustomElement isn't a built-in.)

Using such WrapperTypeInfos, created custom element wrappers can
get appropriate set of method and properties regardless of its
super-elements.

This change tells the prototype object of each built-in object
which WrapperTypeInfo the native backing wants:
HTMLDivElememnt.prototype knows V8HTMLDivElement::info for
example. The pointer to the type info is stored into an internal
field. On wrapper construction, createWrapper() walks up the
prototype chain and pick the first one.

* bindings/v8/V8DOMConfiguration.cpp:
(WebCore::V8DOMConfiguration::configureTemplate):
* bindings/v8/V8HTMLCustomElement.cpp:
(WebCore::findWrapperTypeOf):
(WebCore::V8HTMLCustomElement::createWrapper):
* bindings/v8/V8HTMLCustomElement.h:
* bindings/v8/V8PerContextData.cpp:
(WebCore::V8PerContextData::constructorForTypeSlowCase):
* bindings/v8/WrapperTypeInfo.h:
(WebCore):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8DOMConfiguration.cpp
Source/WebCore/bindings/v8/V8HTMLCustomElement.cpp
Source/WebCore/bindings/v8/V8HTMLCustomElement.h
Source/WebCore/bindings/v8/V8PerContextData.cpp
Source/WebCore/bindings/v8/WrapperTypeInfo.h