Index: Source/core/dom/CustomElementUpgradeCandidateMap.h |
diff --git a/Source/core/dom/CustomElementConstructor.cpp b/Source/core/dom/CustomElementUpgradeCandidateMap.h |
similarity index 58% |
copy from Source/core/dom/CustomElementConstructor.cpp |
copy to Source/core/dom/CustomElementUpgradeCandidateMap.h |
index f664ecf92864d5eadb5d9316e46ffe2df99ae40c..1cc8c35387e88bf9d35dec933db8eadf3fe9413a 100644 |
--- a/Source/core/dom/CustomElementConstructor.cpp |
+++ b/Source/core/dom/CustomElementUpgradeCandidateMap.h |
@@ -28,34 +28,43 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#include "config.h" |
+#ifndef CustomElementUpgradeCandidateMap_h |
+#define CustomElementUpgradeCandidateMap_h |
-#include "core/dom/CustomElementConstructor.h" |
- |
-#include "core/dom/Document.h" |
+#include "core/dom/CustomElementDefinition.h" |
#include "core/dom/Element.h" |
+#include "wtf/HashMap.h" |
+#include "wtf/HashSet.h" |
+#include "wtf/Noncopyable.h" |
+#include "wtf/text/AtomicString.h" |
+#include "wtf/text/AtomicStringHash.h" |
namespace WebCore { |
-PassRefPtr<CustomElementConstructor> CustomElementConstructor::create(Document* document, const QualifiedName& tag, const AtomicString& typeExtension) { |
- return adoptRef(new CustomElementConstructor(document, tag, typeExtension)); |
-} |
+class CustomElementUpgradeCandidateMap { |
+ WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); |
+public: |
+ CustomElementUpgradeCandidateMap() { } |
-CustomElementConstructor::CustomElementConstructor(Document* document, const QualifiedName& tag, const AtomicString& typeExtension) |
- : ContextDestructionObserver(document) |
- , m_tag(tag) |
- , m_typeExtension(typeExtension) |
-{ |
-} |
+ typedef HashSet<Element*> ElementSet; |
-Document* CustomElementConstructor::document() const { |
- return toDocument(m_scriptExecutionContext); |
-} |
+ void add(CustomElementDefinition::CustomElementKind, const AtomicString& type, Element*); |
+ bool contains(Element*) const; |
+ void remove(Element*); |
+ ElementSet takeUpgradeCandidatesFor(CustomElementDefinition* definition); |
-PassRefPtr<Element> CustomElementConstructor::createElement(ExceptionCode& ec) { |
- if (!document()) |
- return 0; |
- return document()->createElementNS(m_tag.namespaceURI(), m_tag.localName(), m_typeExtension, ec); |
-} |
+private: |
+ typedef std::pair<CustomElementDefinition::CustomElementKind, AtomicString> RequiredDefinition; |
+ typedef HashMap<Element*, RequiredDefinition> UnresolvedElementMap; |
+ typedef HashMap<AtomicString, ElementSet> UnresolvedDefinitionMap; |
+ |
+ bool matches(CustomElementDefinition*, Element*); |
+ |
+ UnresolvedElementMap m_unresolvedElements; |
+ UnresolvedDefinitionMap m_unresolvedDefinitions; |
+}; |
} |
+ |
+#endif // CustomElementUpgradeCandidateMap_h |
+ |