Title: [144889] trunk/Source/WebCore
Revision
144889
Author
morr...@google.com
Date
2013-03-05 23:53:47 -0800 (Tue, 05 Mar 2013)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144888 => 144889)


--- trunk/Source/WebCore/ChangeLog	2013-03-06 07:43:43 UTC (rev 144888)
+++ trunk/Source/WebCore/ChangeLog	2013-03-06 07:53:47 UTC (rev 144889)
@@ -1,3 +1,35 @@
+2013-03-05  Hajime Morrita  <morr...@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  <loi...@chromium.org>
 
         Web Inspector: Flame Chart. Provide node context info in a popover when mouse hovers over a flame chart item.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (144888 => 144889)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2013-03-06 07:43:43 UTC (rev 144888)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2013-03-06 07:53:47 UTC (rev 144889)
@@ -537,7 +537,7 @@
         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);

Modified: trunk/Source/WebCore/dom/CustomElementConstructor.cpp (144888 => 144889)


--- trunk/Source/WebCore/dom/CustomElementConstructor.cpp	2013-03-06 07:43:43 UTC (rev 144888)
+++ trunk/Source/WebCore/dom/CustomElementConstructor.cpp	2013-03-06 07:53:47 UTC (rev 144889)
@@ -41,17 +41,16 @@
 
 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 @@
 {
     if (!document())
         return 0;
-    return HTMLElement::create(m_tagName, document());
+    return HTMLElement::create(m_name, document());
 }
 
 }

Modified: trunk/Source/WebCore/dom/CustomElementConstructor.h (144888 => 144889)


--- trunk/Source/WebCore/dom/CustomElementConstructor.h	2013-03-06 07:43:43 UTC (rev 144888)
+++ trunk/Source/WebCore/dom/CustomElementConstructor.h	2013-03-06 07:53:47 UTC (rev 144889)
@@ -50,21 +50,19 @@
 
 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;
 };
 
 }

Modified: trunk/Source/WebCore/dom/CustomElementRegistry.cpp (144888 => 144889)


--- trunk/Source/WebCore/dom/CustomElementRegistry.cpp	2013-03-06 07:43:43 UTC (rev 144888)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.cpp	2013-03-06 07:53:47 UTC (rev 144889)
@@ -139,13 +139,13 @@
         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;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to