Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Unified Diff: Source/core/dom/CustomElementUpgradeCandidateMap.h

Issue 14626005: Upgrade elements that are created before a custom element definition is registered (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moar^2 better Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/CustomElementUpgradeCandidateMap.h
diff --git a/Source/core/platform/text/transcoder/FontTranscoder.h b/Source/core/dom/CustomElementUpgradeCandidateMap.h
similarity index 59%
copy from Source/core/platform/text/transcoder/FontTranscoder.h
copy to Source/core/dom/CustomElementUpgradeCandidateMap.h
index 6990a10f725ce42465693adba9172eced45091d2..3c374dc4b3e656b658875e3fe7e41b65e50934a6 100644
--- a/Source/core/platform/text/transcoder/FontTranscoder.h
+++ b/Source/core/dom/CustomElementUpgradeCandidateMap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2013 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
@@ -28,41 +28,43 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef FontTranscoder_h
-#define FontTranscoder_h
+#ifndef CustomElementUpgradeCandidateMap_h
+#define CustomElementUpgradeCandidateMap_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 {
-class FontDescription;
-class TextEncoding;
-
-class FontTranscoder {
- WTF_MAKE_NONCOPYABLE(FontTranscoder); WTF_MAKE_FAST_ALLOCATED;
+class CustomElementUpgradeCandidateMap {
+ WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap);
public:
- void convert(String& text, const FontDescription&, const TextEncoding* = 0) const;
- bool needsTranscoding(const FontDescription&, const TextEncoding* = 0) const;
+ CustomElementUpgradeCandidateMap() { }
-private:
- FontTranscoder();
- ~FontTranscoder(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons.
+ typedef HashSet<Element*> ElementSet;
- enum ConverterType {
- NoConversion, BackslashToYenSign,
- };
+ void add(CustomElementDefinition::CustomElementKind, const AtomicString& type, Element*);
+ bool contains(Element*) const;
+ void remove(Element*);
+ ElementSet takeUpgradeCandidatesFor(CustomElementDefinition* definition);
- ConverterType converterType(const FontDescription&, const TextEncoding*) const;
+private:
+ typedef std::pair<CustomElementDefinition::CustomElementKind, AtomicString> RequiredDefinition;
+ typedef HashMap<Element*, RequiredDefinition> UnresolvedElementMap;
+ typedef HashMap<AtomicString, ElementSet> UnresolvedDefinitionMap;
- HashMap<AtomicString, ConverterType> m_converterTypes;
+ bool matches(CustomElementDefinition*, Element*);
- friend FontTranscoder& fontTranscoder();
+ UnresolvedElementMap m_unresolvedElements;
+ UnresolvedDefinitionMap m_unresolvedDefinitions;
};
-FontTranscoder& fontTranscoder();
+}
-} // namespace WebCore
+#endif // CustomElementUpgradeCandidateMap_h
-#endif // FontTranscoder_h

Powered by Google App Engine
This is Rietveld 408576698