OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef CustomElement_h | 31 #ifndef CustomElement_h |
32 #define CustomElement_h | 32 #define CustomElement_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/dom/custom/CustomElementDefinition.h" | 35 #include "core/dom/custom/CustomElementDefinition.h" |
| 36 #include "wtf/Allocator.h" |
36 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
37 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
41 #include "wtf/text/AtomicString.h" | 42 #include "wtf/text/AtomicString.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class CustomElementMicrotaskImportStep; | 46 class CustomElementMicrotaskImportStep; |
46 class Document; | 47 class Document; |
47 class HTMLImportChild; | 48 class HTMLImportChild; |
48 | 49 |
49 class CORE_EXPORT CustomElement { | 50 class CORE_EXPORT CustomElement { |
| 51 STATIC_ONLY(CustomElement); |
50 public: | 52 public: |
51 enum NameSet { | 53 enum NameSet { |
52 EmbedderNames = 1 << 0, | 54 EmbedderNames = 1 << 0, |
53 StandardNames = 1 << 1, | 55 StandardNames = 1 << 1, |
54 AllNames = EmbedderNames | StandardNames | 56 AllNames = EmbedderNames | StandardNames |
55 }; | 57 }; |
56 static bool isValidName(const AtomicString& name, NameSet validNames = AllNa
mes); | 58 static bool isValidName(const AtomicString& name, NameSet validNames = AllNa
mes); |
57 static void addEmbedderCustomElementName(const AtomicString& name); | 59 static void addEmbedderCustomElementName(const AtomicString& name); |
58 | 60 |
59 // API to notify of document-level changes | 61 // API to notify of document-level changes |
60 static CustomElementMicrotaskImportStep* didCreateImport(HTMLImportChild*); | 62 static CustomElementMicrotaskImportStep* didCreateImport(HTMLImportChild*); |
61 static void didFinishLoadingImport(Document& master); | 63 static void didFinishLoadingImport(Document& master); |
62 | 64 |
63 // API for registration contexts | 65 // API for registration contexts |
64 static void define(Element*, PassRefPtrWillBeRawPtr<CustomElementDefinition>
); | 66 static void define(Element*, PassRefPtrWillBeRawPtr<CustomElementDefinition>
); |
65 | 67 |
66 // API for Element to kick off changes | 68 // API for Element to kick off changes |
67 | 69 |
68 static void attributeDidChange(Element*, const AtomicString& name, const Ato
micString& oldValue, const AtomicString& newValue); | 70 static void attributeDidChange(Element*, const AtomicString& name, const Ato
micString& oldValue, const AtomicString& newValue); |
69 static void didAttach(Element*, const Document&); | 71 static void didAttach(Element*, const Document&); |
70 static void didDetach(Element*, const Document&); | 72 static void didDetach(Element*, const Document&); |
71 static void wasDestroyed(Element*); | 73 static void wasDestroyed(Element*); |
72 | 74 |
73 private: | 75 private: |
74 CustomElement(); | |
75 | |
76 static Vector<AtomicString>& embedderCustomElementNames(); | 76 static Vector<AtomicString>& embedderCustomElementNames(); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif // CustomElement_h | 81 #endif // CustomElement_h |
OLD | NEW |