Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / custom / CustomElementRegistry.cpp
index b4bd666..985566f 100644 (file)
 #include "config.h"
 #include "core/dom/custom/CustomElementRegistry.h"
 
-#include "HTMLNames.h"
-#include "SVGNames.h"
-#include "bindings/v8/CustomElementConstructorBuilder.h"
+#include "bindings/core/v8/CustomElementConstructorBuilder.h"
+#include "core/HTMLNames.h"
+#include "core/SVGNames.h"
 #include "core/dom/DocumentLifecycleObserver.h"
 #include "core/dom/custom/CustomElementException.h"
 #include "core/dom/custom/CustomElementRegistrationContext.h"
 
-namespace WebCore {
+namespace blink {
 
 class RegistrationContextObserver : public DocumentLifecycleObserver {
 public:
@@ -51,7 +51,12 @@ public:
     bool registrationContextWentAway() { return m_wentAway; }
 
 private:
-    virtual void documentWasDisposed() OVERRIDE { m_wentAway = true; }
+#if ENABLE(OILPAN)
+    // In oilpan we don't have the disposed phase for context lifecycle observer.
+    virtual void documentWasDetached() override { m_wentAway = true; }
+#else
+    virtual void documentWasDisposed() override { m_wentAway = true; }
+#endif
 
     bool m_wentAway;
 };
@@ -76,18 +81,17 @@ CustomElementDefinition* CustomElementRegistry::registerElement(Document* docume
         return 0;
     }
 
-    QualifiedName tagName = nullQName();
-    if (!constructorBuilder->validateOptions(type, tagName, exceptionState))
-        return 0;
-
-    ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
-
-    // FIXME: This should be done earlier in validateOptions.
     if (m_registeredTypeNames.contains(type)) {
         CustomElementException::throwException(CustomElementException::TypeAlreadyRegistered, type, exceptionState);
         return 0;
     }
 
+    QualifiedName tagName = QualifiedName::null();
+    if (!constructorBuilder->validateOptions(type, tagName, exceptionState))
+        return 0;
+
+    ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
+
     ASSERT(!observer.registrationContextWentAway());
 
     RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuilder->createCallbacks();
@@ -121,4 +125,4 @@ CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript
     return m_definitions.get(descriptor);
 }
 
-} // namespace WebCore
+} // namespace blink