Diff
Modified: trunk/Source/WebCore/ChangeLog (145039 => 145040)
--- trunk/Source/WebCore/ChangeLog 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/ChangeLog 2013-03-07 06:32:27 UTC (rev 145040)
@@ -1,3 +1,51 @@
+2013-03-06 Hajime Morrita <morr...@google.com>
+
+ Custom Elements Refactoring: CustomElementConstructor API shouldn't bound to HTMLElement
+ https://bugs.webkit.org/show_bug.cgi?id=111678
+
+ Reviewed by Kentaro Hara.
+
+ The latest Custom Elements standard supports non-HTML custom elements. Even though current implementation
+ support only HTML, it'd be better off to make API generic enough to support them.
+
+ This change
+
+ - eliminates HTMLElement from the API signature by replacing it with Element, and
+ - rename V8HTMLCustomElement to V8CustomElement.
+
+ No new tests, just changing signatures and a class name.
+
+ * WebCore.gypi:
+ * bindings/v8/V8CustomElement.cpp: Renamed from Source/WebCore/bindings/v8/V8HTMLCustomElement.cpp.
+ (WebCore):
+ (WebCore::findWrapperTypeOf):
+ (WebCore::V8CustomElement::createWrapper):
+ * bindings/v8/V8CustomElement.h: Renamed from Source/WebCore/bindings/v8/V8HTMLCustomElement.h.
+ (WebCore):
+ (V8CustomElement):
+ (WebCore::V8CustomElement::toV8):
+ (WebCore::V8CustomElement::wrap):
+ (WebCore::HTMLCustomElement::wrap):
+ * bindings/v8/custom/V8CustomElementConstructorCustom.cpp:
+ (WebCore::V8CustomElementConstructor::callAsFunctionCallback):
+ * dom/CustomElementConstructor.cpp:
+ (WebCore::CustomElementConstructor::createElement):
+ * dom/CustomElementConstructor.h:
+ (WebCore):
+ (CustomElementConstructor):
+ * dom/CustomElementRegistry.cpp:
+ (WebCore::CustomElementRegistry::constructorOf):
+ (WebCore::CustomElementRegistry::createElement):
+ * dom/CustomElementRegistry.h:
+ (WebCore):
+ (CustomElementRegistry):
+ * dom/Document.cpp: Ensured that the document is an HTML.
+ (WebCore::Document::registerElement):
+ * dom/Document.idl:
+ * dom/make_names.pl:
+ (printWrapperFactoryCppFile):
+ * html/HTMLDocument.idl: Moved an API to Document.idl
+
2013-03-06 Tim Horton <timothy_hor...@apple.com>
TileCache debug minimap should fit inside the intersection of the visible rect and exposed rect
Modified: trunk/Source/WebCore/WebCore.gypi (145039 => 145040)
--- trunk/Source/WebCore/WebCore.gypi 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/WebCore.gypi 2013-03-07 06:32:27 UTC (rev 145040)
@@ -1361,6 +1361,8 @@
'bindings/v8/V8Callback.h',
'bindings/v8/V8Collection.cpp',
'bindings/v8/V8Collection.h',
+ 'bindings/v8/V8CustomElement.cpp',
+ 'bindings/v8/V8CustomElement.h',
'bindings/v8/V8DOMConfiguration.cpp',
'bindings/v8/V8DOMConfiguration.h',
'bindings/v8/V8DOMActivityLogger.h',
@@ -1376,8 +1378,6 @@
'bindings/v8/V8GCController.h',
'bindings/v8/V8GCForContextDispose.cpp',
'bindings/v8/V8GCForContextDispose.h',
- 'bindings/v8/V8HTMLCustomElement.cpp',
- 'bindings/v8/V8HTMLCustomElement.h',
'bindings/v8/V8HiddenPropertyName.cpp',
'bindings/v8/V8HiddenPropertyName.h',
'bindings/v8/V8Initializer.cpp',
Copied: trunk/Source/WebCore/bindings/v8/V8CustomElement.cpp (from rev 145039, trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.cpp) (0 => 145040)
--- trunk/Source/WebCore/bindings/v8/V8CustomElement.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/v8/V8CustomElement.cpp 2013-03-07 06:32:27 UTC (rev 145040)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+#include "V8CustomElement.h"
+
+#include "CustomElementHelpers.h"
+#include "CustomElementRegistry.h"
+#include "Element.h"
+#include "V8CustomElementConstructor.h"
+#include "V8HTMLUnknownElement.h"
+
+namespace WebCore {
+
+static WrapperTypeInfo* findWrapperTypeOf(v8::Handle<v8::Value> chain)
+{
+ while (!chain.IsEmpty() && chain->IsObject()) {
+ v8::Handle<v8::Object> chainObject = v8::Handle<v8::Object>::Cast(chain);
+ if (v8PrototypeInternalFieldcount == chainObject->InternalFieldCount())
+ return reinterpret_cast<WrapperTypeInfo*>(chainObject->GetAlignedPointerFromInternalField(v8PrototypeTypeIndex));
+ chain = chainObject->GetPrototype();
+ }
+
+ return 0;
+}
+
+v8::Handle<v8::Object> V8CustomElement::createWrapper(PassRefPtr<Element> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(impl);
+
+ RefPtr<CustomElementConstructor> constructor = CustomElementRegistry::constructorOf(impl.get());
+ if (!constructor) {
+ v8::Handle<v8::Value> wrapperValue = WebCore::toV8(toHTMLUnknownElement(toHTMLElement(impl.get())), creationContext, isolate);
+ if (!wrapperValue.IsEmpty() && wrapperValue->IsObject())
+ return v8::Handle<v8::Object>::Cast(wrapperValue);
+ return v8::Handle<v8::Object>();
+ }
+
+ // The constructor and registered lifecycle callbacks should be visible only from main world.
+ // FIXME: This shouldn't be needed once each custom element has its own FunctionTemplate
+ // https://bugs.webkit.org/show_bug.cgi?id=108138
+ if (!CustomElementHelpers::isFeatureAllowed(creationContext->CreationContext())) {
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &V8HTMLElement::info, impl.get(), isolate);
+ if (!wrapper.IsEmpty())
+ V8DOMWrapper::associateObjectWithWrapper(impl, &V8HTMLElement::info, wrapper, isolate, WrapperConfiguration::Dependent);
+ return wrapper;
+ }
+
+ v8::Handle<v8::Value> constructorValue = WebCore::toV8(constructor.get(), creationContext, isolate);
+ if (constructorValue.IsEmpty() || !constructorValue->IsObject())
+ return v8::Handle<v8::Object>();
+ v8::Handle<v8::Object> constructorWapper = v8::Handle<v8::Object>::Cast(constructorValue);
+ v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(constructorWapper->Get(v8::String::NewSymbol("prototype")));
+ WrapperTypeInfo* typeInfo = findWrapperTypeOf(prototype);
+ if (!typeInfo)
+ return v8::Handle<v8::Object>();
+
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, typeInfo, impl.get(), isolate);
+ if (wrapper.IsEmpty())
+ return v8::Handle<v8::Object>();
+
+ wrapper->SetPrototype(prototype);
+ V8DOMWrapper::associateObjectWithWrapper(impl, typeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
+ return wrapper;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CUSTOM_ELEMENTS)
Copied: trunk/Source/WebCore/bindings/v8/V8CustomElement.h (from rev 145039, trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.h) (0 => 145040)
--- trunk/Source/WebCore/bindings/v8/V8CustomElement.h (rev 0)
+++ trunk/Source/WebCore/bindings/v8/V8CustomElement.h 2013-03-07 06:32:27 UTC (rev 145040)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef V8CustomElement_h
+#define V8CustomElement_h
+
+#include "V8Binding.h"
+#include "V8DOMWrapper.h"
+#include "V8HTMLElement.h"
+#include "V8HTMLUnknownElement.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class Element;
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+class V8CustomElement {
+public:
+ static v8::Handle<v8::Value> toV8(Element*, v8::Handle<v8::Object> creationContext = v8::Handle<v8::Object>(), v8::Isolate* = 0);
+ static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+
+private:
+ static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle<v8::Object>, v8::Isolate*);
+};
+
+inline v8::Handle<v8::Value> V8CustomElement::toV8(Element* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ if (UNLIKELY(!impl))
+ return v8NullWithCheck(isolate);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return V8CustomElement::wrap(impl, creationContext, isolate);
+}
+
+inline v8::Handle<v8::Object> V8CustomElement::wrap(Element* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(impl);
+ ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ return V8CustomElement::createWrapper(impl, creationContext, isolate);
+}
+
+#else // ENABLE(CUSTOM_ELEMENTS)
+
+class V8CustomElement {
+public:
+ static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creationContext = v8::Handle<v8::Object>(), v8::Isolate* = 0);
+};
+
+inline v8::Handle<v8::Object> HTMLCustomElement::wrap(Element* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return wrap(toHTMLUnknownElement(impl), creationContext, isolate);
+}
+
+#endif // ENABLE(CUSTOM_ELEMENTS)
+
+} // namespace WebCore
+
+#endif // V8CustomElement_h
Deleted: trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.cpp (145039 => 145040)
--- trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.cpp 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.cpp 2013-03-07 06:32:27 UTC (rev 145040)
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-#include "V8HTMLCustomElement.h"
-
-#include "CustomElementHelpers.h"
-#include "CustomElementRegistry.h"
-#include "HTMLElement.h"
-#include "V8CustomElementConstructor.h"
-#include "V8HTMLUnknownElement.h"
-
-namespace WebCore {
-
-static WrapperTypeInfo* findWrapperTypeOf(v8::Handle<v8::Value> chain)
-{
- while (!chain.IsEmpty() && chain->IsObject()) {
- v8::Handle<v8::Object> chainObject = v8::Handle<v8::Object>::Cast(chain);
- if (v8PrototypeInternalFieldcount == chainObject->InternalFieldCount())
- return reinterpret_cast<WrapperTypeInfo*>(chainObject->GetAlignedPointerFromInternalField(v8PrototypeTypeIndex));
- chain = chainObject->GetPrototype();
- }
-
- return 0;
-}
-
-v8::Handle<v8::Object> V8HTMLCustomElement::createWrapper(PassRefPtr<HTMLElement> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
- ASSERT(impl);
-
- RefPtr<CustomElementConstructor> constructor = CustomElementRegistry::constructorOf(impl.get());
- if (!constructor) {
- v8::Handle<v8::Value> wrapperValue = WebCore::toV8(toHTMLUnknownElement(impl.get()), creationContext, isolate);
- if (!wrapperValue.IsEmpty() && wrapperValue->IsObject())
- return v8::Handle<v8::Object>::Cast(wrapperValue);
- return v8::Handle<v8::Object>();
- }
-
- // The constructor and registered lifecycle callbacks should be visible only from main world.
- // FIXME: This shouldn't be needed once each custom element has its own FunctionTemplate
- // https://bugs.webkit.org/show_bug.cgi?id=108138
- if (!CustomElementHelpers::isFeatureAllowed(creationContext->CreationContext())) {
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &V8HTMLElement::info, impl.get(), isolate);
- if (!wrapper.IsEmpty())
- V8DOMWrapper::associateObjectWithWrapper(impl, &V8HTMLElement::info, wrapper, isolate, WrapperConfiguration::Dependent);
- return wrapper;
- }
-
- v8::Handle<v8::Value> constructorValue = WebCore::toV8(constructor.get(), creationContext, isolate);
- if (constructorValue.IsEmpty() || !constructorValue->IsObject())
- return v8::Handle<v8::Object>();
- v8::Handle<v8::Object> constructorWapper = v8::Handle<v8::Object>::Cast(constructorValue);
- v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(constructorWapper->Get(v8::String::NewSymbol("prototype")));
- WrapperTypeInfo* typeInfo = findWrapperTypeOf(prototype);
- if (!typeInfo)
- return v8::Handle<v8::Object>();
-
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, typeInfo, impl.get(), isolate);
- if (wrapper.IsEmpty())
- return v8::Handle<v8::Object>();
-
- wrapper->SetPrototype(prototype);
- V8DOMWrapper::associateObjectWithWrapper(impl, typeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(CUSTOM_ELEMENTS)
Deleted: trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.h (145039 => 145040)
--- trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.h 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/bindings/v8/V8HTMLCustomElement.h 2013-03-07 06:32:27 UTC (rev 145040)
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8HTMLCustomElement_h
-#define V8HTMLCustomElement_h
-
-#include "V8Binding.h"
-#include "V8DOMWrapper.h"
-#include "V8HTMLElement.h"
-#include "V8HTMLUnknownElement.h"
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-class HTMLElement;
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-class V8HTMLCustomElement {
-public:
- static v8::Handle<v8::Value> toV8(HTMLElement*, v8::Handle<v8::Object> creationContext = v8::Handle<v8::Object>(), v8::Isolate* = 0);
- static v8::Handle<v8::Object> wrap(HTMLElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
-
-private:
- static v8::Handle<v8::Object> createWrapper(PassRefPtr<HTMLElement>, v8::Handle<v8::Object>, v8::Isolate*);
-};
-
-inline v8::Handle<v8::Value> V8HTMLCustomElement::toV8(HTMLElement* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
- if (UNLIKELY(!impl))
- return v8NullWithCheck(isolate);
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper(impl, isolate);
- if (!wrapper.IsEmpty())
- return wrapper;
- return V8HTMLCustomElement::wrap(impl, creationContext, isolate);
-}
-
-inline v8::Handle<v8::Object> V8HTMLCustomElement::wrap(HTMLElement* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
- ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
- return V8HTMLCustomElement::createWrapper(impl, creationContext, isolate);
-}
-
-#else // ENABLE(CUSTOM_ELEMENTS)
-
-class V8HTMLCustomElement {
-public:
- static v8::Handle<v8::Object> wrap(HTMLElement*, v8::Handle<v8::Object> creationContext = v8::Handle<v8::Object>(), v8::Isolate* = 0);
-};
-
-inline v8::Handle<v8::Object> HTMLCustomElement::wrap(HTMLElement* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
- return wrap(toHTMLUnknownElement(impl), creationContext, isolate);
-}
-
-#endif // ENABLE(CUSTOM_ELEMENTS)
-
-} // namespace WebCore
-
-#endif // V8HTMLCustomElement_h
Modified: trunk/Source/WebCore/bindings/v8/custom/V8CustomElementConstructorCustom.cpp (145039 => 145040)
--- trunk/Source/WebCore/bindings/v8/custom/V8CustomElementConstructorCustom.cpp 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CustomElementConstructorCustom.cpp 2013-03-07 06:32:27 UTC (rev 145040)
@@ -33,7 +33,7 @@
#include "CustomElementConstructor.h"
#include "V8Binding.h"
-#include "V8HTMLCustomElement.h"
+#include "V8CustomElement.h"
namespace WebCore {
@@ -45,10 +45,10 @@
return args.Holder();
CustomElementConstructor* impl = toNative(args.Holder());
- RefPtr<HTMLElement> element = impl->createElement();
+ RefPtr<Element> element = impl->createElement();
if (!element)
return v8Undefined();
- return V8HTMLCustomElement::toV8(element.get(), args.Holder(), args.GetIsolate());
+ return V8CustomElement::toV8(element.get(), args.Holder(), args.GetIsolate());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/CustomElementConstructor.cpp (145039 => 145040)
--- trunk/Source/WebCore/dom/CustomElementConstructor.cpp 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/CustomElementConstructor.cpp 2013-03-07 06:32:27 UTC (rev 145040)
@@ -59,7 +59,7 @@
{
}
-PassRefPtr<HTMLElement> CustomElementConstructor::createElement() const
+PassRefPtr<Element> CustomElementConstructor::createElement() const
{
if (!document())
return 0;
Modified: trunk/Source/WebCore/dom/CustomElementConstructor.h (145039 => 145040)
--- trunk/Source/WebCore/dom/CustomElementConstructor.h 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/CustomElementConstructor.h 2013-03-07 06:32:27 UTC (rev 145040)
@@ -44,7 +44,7 @@
namespace WebCore {
class Document;
-class HTMLElement;
+class Element;
class ScriptState;
class ScriptValue;
@@ -57,7 +57,7 @@
Document* document() const { return static_cast<Document*>(m_scriptExecutionContext); }
const QualifiedName& name() const { return m_name; }
- PassRefPtr<HTMLElement> createElement() const;
+ PassRefPtr<Element> createElement() const;
private:
CustomElementConstructor(Document*, const QualifiedName&);
Modified: trunk/Source/WebCore/dom/CustomElementRegistry.cpp (145039 => 145040)
--- trunk/Source/WebCore/dom/CustomElementRegistry.cpp 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.cpp 2013-03-07 06:32:27 UTC (rev 145040)
@@ -38,7 +38,7 @@
#include "CustomElementHelpers.h"
#include "Dictionary.h"
#include "Document.h"
-#include "HTMLElement.h"
+#include "Element.h"
#include "HTMLNames.h"
#include "RuntimeEnabledFeatures.h"
#include <wtf/ASCIICType.h>
@@ -62,7 +62,7 @@
{
}
-PassRefPtr<CustomElementConstructor> CustomElementRegistry::constructorOf(HTMLElement* element)
+PassRefPtr<CustomElementConstructor> CustomElementRegistry::constructorOf(Element* element)
{
RefPtr<CustomElementRegistry> self = element->document()->registry();
if (!self)
@@ -155,7 +155,7 @@
return (found != m_constructors.end()) ? found->value : 0;
}
-PassRefPtr<HTMLElement> CustomElementRegistry::createElement(const QualifiedName& name) const
+PassRefPtr<Element> CustomElementRegistry::createElement(const QualifiedName& name) const
{
if (RefPtr<CustomElementConstructor> found = find(name))
return found->createElement();
Modified: trunk/Source/WebCore/dom/CustomElementRegistry.h (145039 => 145040)
--- trunk/Source/WebCore/dom/CustomElementRegistry.h 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.h 2013-03-07 06:32:27 UTC (rev 145040)
@@ -48,7 +48,7 @@
class CustomElementConstructor;
class Dictionary;
class Document;
-class HTMLElement;
+class Element;
class ScriptExecutionContext;
class QualifiedName;
@@ -60,10 +60,10 @@
PassRefPtr<CustomElementConstructor> registerElement(WebCore::ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionCode&);
PassRefPtr<CustomElementConstructor> find(const QualifiedName&) const;
- PassRefPtr<HTMLElement> createElement(const QualifiedName&) const;
+ PassRefPtr<Element> createElement(const QualifiedName&) const;
Document* document() const;
- static PassRefPtr<CustomElementConstructor> constructorOf(HTMLElement*);
+ static PassRefPtr<CustomElementConstructor> constructorOf(Element*);
private:
static bool isValidName(const AtomicString&);
Modified: trunk/Source/WebCore/dom/Document.cpp (145039 => 145040)
--- trunk/Source/WebCore/dom/Document.cpp 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-03-07 06:32:27 UTC (rev 145040)
@@ -840,6 +840,11 @@
PassRefPtr<CustomElementConstructor> Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionCode& ec)
{
+ if (!isHTMLDocument() && !isXHTMLDocument()) {
+ ec = NOT_SUPPORTED_ERR;
+ return 0;
+ }
+
if (!m_registry)
m_registry = adoptRef(new CustomElementRegistry(this));
return m_registry->registerElement(state, name, options, ec);
Modified: trunk/Source/WebCore/dom/Document.idl (145039 => 145040)
--- trunk/Source/WebCore/dom/Document.idl 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/Document.idl 2013-03-07 06:32:27 UTC (rev 145040)
@@ -356,6 +356,11 @@
raises (DOMException);
#endif
+#if defined(ENABLE_CUSTOM_ELEMENTS) && ENABLE_CUSTOM_ELEMENTS
+ [V8EnabledAtRuntime=customDOMElements, Conditional=CUSTOM_ELEMENTS, ImplementedAs=registerElement, CallWith=ScriptState]
+ CustomElementConstructor webkitRegister(in DOMString name, in [Optional] Dictionary options) raises(DOMException);
+#endif
+
#if defined(LANGUAGE_CPP) && LANGUAGE_CPP
// Extra WebCore methods exposed to allow compile-time casting in C++
boolean isHTMLDocument();
Modified: trunk/Source/WebCore/dom/make_names.pl (145039 => 145040)
--- trunk/Source/WebCore/dom/make_names.pl 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/dom/make_names.pl 2013-03-07 06:32:27 UTC (rev 145040)
@@ -1172,7 +1172,7 @@
;
} elsif ($wrapperFactoryType eq "V8") {
print F <<END
-#include "V8HTMLCustomElement.h"
+#include "V8CustomElement.h"
#include "V8$parameters{namespace}Element.h"
#include <v8.h>
@@ -1277,7 +1277,7 @@
;
} elsif ($parameters{namespace} eq "HTML") {
print F <<END
- return V8HTMLCustomElement::wrap(element, creationContext, isolate);
+ return V8CustomElement::wrap(element, creationContext, isolate);
END
;
} else {
Modified: trunk/Source/WebCore/html/HTMLDocument.idl (145039 => 145040)
--- trunk/Source/WebCore/html/HTMLDocument.idl 2013-03-07 05:58:57 UTC (rev 145039)
+++ trunk/Source/WebCore/html/HTMLDocument.idl 2013-03-07 06:32:27 UTC (rev 145040)
@@ -53,11 +53,6 @@
readonly attribute Element activeElement;
boolean hasFocus();
-#if defined(ENABLE_CUSTOM_ELEMENTS) && ENABLE_CUSTOM_ELEMENTS
- [V8EnabledAtRuntime=customDOMElements, Conditional=CUSTOM_ELEMENTS, ImplementedAs=registerElement, CallWith=ScriptState]
- CustomElementConstructor webkitRegister(in DOMString name, in [Optional] Dictionary options) raises(DOMException);
-#endif
-
// Deprecated attributes
[TreatNullAs=NullString] attribute DOMString bgColor;
[TreatNullAs=NullString] attribute DOMString fgColor;