Custom Elements: CustomElementConstructor::m_name doesn't have any good use.
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2013 07:53:47 +0000 (07:53 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2013 07:53:47 +0000 (07:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111523

Reviewed by Kentaro Hara.

This change removes CustomElementConstructor::m_name and renames
m_tagName to m_name. Now generated function name is same as interface name.

Originally, m_name was added to specify the generated constructor
name. An early version of custom element allows to give the name,
but it no longer says anything about that.

The rename is to align the semantics of type extension mechanism
of Custom Elements, where the name of a custom element isn't
necessarily a tag name.

No new tests. Just removing old code.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):
* dom/CustomElementConstructor.cpp:
(WebCore::CustomElementConstructor::create):
(WebCore::CustomElementConstructor::CustomElementConstructor):
(WebCore::CustomElementConstructor::createElement):
* dom/CustomElementConstructor.h:
(CustomElementConstructor):
(WebCore::CustomElementConstructor::name):
* dom/CustomElementRegistry.cpp:
(WebCore::CustomElementRegistry::registerElement):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144889 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/dom/CustomElementConstructor.cpp
Source/WebCore/dom/CustomElementConstructor.h
Source/WebCore/dom/CustomElementRegistry.cpp

index a6426ad..d83675d 100644 (file)
@@ -1,3 +1,35 @@
+2013-03-05  Hajime Morrita  <morrita@google.com>
+
+        Custom Elements: CustomElementConstructor::m_name doesn't have any good use.
+        https://bugs.webkit.org/show_bug.cgi?id=111523
+
+        Reviewed by Kentaro Hara.
+
+        This change removes CustomElementConstructor::m_name and renames
+        m_tagName to m_name. Now generated function name is same as interface name.
+
+        Originally, m_name was added to specify the generated constructor
+        name. An early version of custom element allows to give the name,
+        but it no longer says anything about that.
+
+        The rename is to align the semantics of type extension mechanism
+        of Custom Elements, where the name of a custom element isn't
+        necessarily a tag name.
+
+        No new tests. Just removing old code.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateHeader):
+        * dom/CustomElementConstructor.cpp:
+        (WebCore::CustomElementConstructor::create):
+        (WebCore::CustomElementConstructor::CustomElementConstructor):
+        (WebCore::CustomElementConstructor::createElement):
+        * dom/CustomElementConstructor.h:
+        (CustomElementConstructor):
+        (WebCore::CustomElementConstructor::name):
+        * dom/CustomElementRegistry.cpp:
+        (WebCore::CustomElementRegistry::registerElement):
+
 2013-03-05  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Web Inspector: Flame Chart. Provide node context info in a popover when mouse hovers over a flame chart item.
index c42f2b4..e9ac51f 100644 (file)
@@ -537,7 +537,7 @@ END
         my $createWrapperCall = $customWrap ? "${v8InterfaceName}::wrap" : "${v8InterfaceName}::createWrapper";
         my $returningWrapper = $interface->extendedAttributes->{"V8WrapAsFunction"} ? "V8DOMWrapper::toFunction(wrapper)" : "wrapper";
         my $returningCreatedWrapperOpening = $interface->extendedAttributes->{"V8WrapAsFunction"} ? "V8DOMWrapper::toFunction(" : "";
-        my $returningCreatedWrapperClosing = $interface->extendedAttributes->{"V8WrapAsFunction"} ? ", impl->name(), isolate)" : "";
+        my $returningCreatedWrapperClosing = $interface->extendedAttributes->{"V8WrapAsFunction"} ? ", \"${interfaceName}\", isolate)" : "";
 
         if ($customWrap) {
             push(@headerContent, <<END);
index 49ccf9e..198160f 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<CustomElementConstructor> CustomElementConstructor::create(ScriptState* state, Document* document, const QualifiedName& tagName, const String& name, const ScriptValue& prototype)
+PassRefPtr<CustomElementConstructor> CustomElementConstructor::create(ScriptState* state, Document* document, const QualifiedName& name, const ScriptValue& prototype)
 {
-    RefPtr<CustomElementConstructor> created = adoptRef(new CustomElementConstructor(document, tagName, name));
+    RefPtr<CustomElementConstructor> created = adoptRef(new CustomElementConstructor(document, name));
     if (!CustomElementHelpers::initializeConstructorWrapper(created.get(), prototype, state))
         return 0;
     return created.release();
 }
 
-CustomElementConstructor::CustomElementConstructor(Document* document, const QualifiedName& tagName, const String& name)
+CustomElementConstructor::CustomElementConstructor(Document* document, const QualifiedName& name)
     : ContextDestructionObserver(document)
-    , m_tagName(tagName)
     , m_name(name)
 {
 }
@@ -64,7 +63,7 @@ PassRefPtr<HTMLElement> CustomElementConstructor::createElement() const
 {
     if (!document())
         return 0;
-    return HTMLElement::create(m_tagName, document());
+    return HTMLElement::create(m_name, document());
 }
 
 }
index 578eb17..52b7cad 100644 (file)
@@ -50,21 +50,19 @@ class ScriptValue;
 
 class CustomElementConstructor : public RefCounted<CustomElementConstructor> , public ContextDestructionObserver {
 public:
-    static PassRefPtr<CustomElementConstructor> create(ScriptState*, Document*, const QualifiedName&, const String&, const ScriptValue&);
+    static PassRefPtr<CustomElementConstructor> create(ScriptState*, Document*, const QualifiedName&, const ScriptValue&);
 
     virtual ~CustomElementConstructor();
 
     Document* document() const { return static_cast<Document*>(m_scriptExecutionContext); }
-    const QualifiedName& tagName() const { return m_tagName; }
-    const AtomicString& name() const { return m_name; }
+    const QualifiedName& name() const { return m_name; }
 
     PassRefPtr<HTMLElement> createElement() const;
     
 private:
-    CustomElementConstructor(Document*, const QualifiedName&, const String&);
+    CustomElementConstructor(Document*, const QualifiedName&);
 
-    QualifiedName m_tagName;
-    AtomicString m_name;
+    QualifiedName m_name;
 };
 
 }
index 385e95b..5d9648b 100644 (file)
@@ -139,13 +139,13 @@ PassRefPtr<CustomElementConstructor> CustomElementRegistry::registerElement(Scri
         return 0;
     }
 
-    RefPtr<CustomElementConstructor> constructor = CustomElementConstructor::create(state, document(), newName, "HTMLCustomElement", prototypeValue);
+    RefPtr<CustomElementConstructor> constructor = CustomElementConstructor::create(state, document(), newName, prototypeValue);
     if (!constructor) {
         ec = INVALID_STATE_ERR;
         return 0;
     }
         
-    m_constructors.add(constructor->tagName().impl(), constructor);
+    m_constructors.add(constructor->name().impl(), constructor);
     return constructor;
 }