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

Side by Side Diff: Source/core/dom/CustomElementRegistry.h

Issue 14776002: Create wrappers for unresolved Custom Elements at the correct type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ~CustomElementRegistry(); 78 ~CustomElementRegistry();
79 79
80 PassRefPtr<CustomElementConstructor> registerElement(WebCore::ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionCode&); 80 PassRefPtr<CustomElementConstructor> registerElement(WebCore::ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionCode&);
81 81
82 // FIXME: findFor is dangerous since it consults the "is" 82 // FIXME: findFor is dangerous since it consults the "is"
83 // attribute; that should only be consulted at element creation 83 // attribute; that should only be consulted at element creation
84 // time. 84 // time.
85 PassRefPtr<CustomElementDefinition> findFor(Element*) const; 85 PassRefPtr<CustomElementDefinition> findFor(Element*) const;
86 PassRefPtr<CustomElementDefinition> findAndCheckNamespace(const AtomicString & type, const AtomicString& namespaceURI) const; 86 PassRefPtr<CustomElementDefinition> findAndCheckNamespace(const AtomicString & type, const AtomicString& namespaceURI) const;
87 87
88 PassRefPtr<Element> tryToCreateCustomTagElement(const QualifiedName& localNa me); 88 PassRefPtr<Element> createCustomTagElement(const QualifiedName& localName);
89 89
90 Document* document() const; 90 Document* document() const;
91 91
92 void didGiveTypeExtension(Element*); 92 void didGiveTypeExtension(Element*);
93 93
94 static bool isValidName(const AtomicString&); 94 static bool isCustomTagName(const AtomicString& name) { return isValidName(n ame); }
95
95 static void deliverAllLifecycleCallbacks(); 96 static void deliverAllLifecycleCallbacks();
96 static void deliverAllLifecycleCallbacksIfNeeded(); 97 static void deliverAllLifecycleCallbacksIfNeeded();
97 98
98 private: 99 private:
99 typedef HashMap<AtomicString, RefPtr<CustomElementDefinition> > DefinitionMa p; 100 typedef HashMap<AtomicString, RefPtr<CustomElementDefinition> > DefinitionMa p;
100 typedef HashSet<AtomicString> NameSet; 101 typedef HashSet<AtomicString> NameSet;
101 typedef ListHashSet<CustomElementRegistry*> InstanceSet; 102 typedef ListHashSet<CustomElementRegistry*> InstanceSet;
102 103
104 static bool isValidName(const AtomicString&);
105
103 static InstanceSet& activeCustomElementRegistries(); 106 static InstanceSet& activeCustomElementRegistries();
104 void activate(const CustomElementInvocation&); 107 void activate(const CustomElementInvocation&);
105 void deactivate(); 108 void deactivate();
106 void deliverLifecycleCallbacks(); 109 void deliverLifecycleCallbacks();
107 110
108 void didCreateElement(Element*); 111 void didCreateCustomTagElement(Element*);
109 112
110 DefinitionMap m_definitions; 113 DefinitionMap m_definitions;
111 Vector<CustomElementInvocation> m_invocations; 114 Vector<CustomElementInvocation> m_invocations;
112 }; 115 };
113 116
114 inline void CustomElementRegistry::deliverAllLifecycleCallbacksIfNeeded() 117 inline void CustomElementRegistry::deliverAllLifecycleCallbacksIfNeeded()
115 { 118 {
116 if (!activeCustomElementRegistries().isEmpty()) 119 if (!activeCustomElementRegistries().isEmpty())
117 deliverAllLifecycleCallbacks(); 120 deliverAllLifecycleCallbacks();
118 ASSERT(activeCustomElementRegistries().isEmpty()); 121 ASSERT(activeCustomElementRegistries().isEmpty());
119 } 122 }
120 123
121 inline CustomElementRegistry::InstanceSet& CustomElementRegistry::activeCustomEl ementRegistries() 124 inline CustomElementRegistry::InstanceSet& CustomElementRegistry::activeCustomEl ementRegistries()
122 { 125 {
123 DEFINE_STATIC_LOCAL(InstanceSet, activeInstances, ()); 126 DEFINE_STATIC_LOCAL(InstanceSet, activeInstances, ());
124 return activeInstances; 127 return activeInstances;
125 } 128 }
126 129
127 130
128 } // namespace WebCore 131 } // namespace WebCore
129 132
130 #endif 133 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698