Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 }; | 55 }; |
| 56 static bool isValidName(const AtomicString& name, NameSet validNames = AllNa mes); | 56 static bool isValidName(const AtomicString& name, NameSet validNames = AllNa mes); |
| 57 static void addEmbedderCustomElementName(const AtomicString& name); | 57 static void addEmbedderCustomElementName(const AtomicString& name); |
| 58 | 58 |
| 59 // API to notify of document-level changes | 59 // API to notify of document-level changes |
| 60 static CustomElementMicrotaskImportStep* didCreateImport(HTMLImportChild*); | 60 static CustomElementMicrotaskImportStep* didCreateImport(HTMLImportChild*); |
| 61 | 61 |
| 62 // API for registration contexts | 62 // API for registration contexts |
| 63 static void define(Element*, PassRefPtr<CustomElementDefinition>); | 63 static void define(Element*, PassRefPtr<CustomElementDefinition>); |
| 64 | 64 |
| 65 // API for wrapper creation, which uses a definition as a key | |
|
dominicc (has gone to gerrit)
2014/03/03 04:32:23
Yay.
What do you think about moving the element -
| |
| 66 static CustomElementDefinition* definitionFor(Element*); | |
| 67 | |
| 68 // API for Element to kick off changes | 65 // API for Element to kick off changes |
| 69 | 66 |
| 70 static void attributeDidChange(Element*, const AtomicString& name, const Ato micString& oldValue, const AtomicString& newValue); | 67 static void attributeDidChange(Element*, const AtomicString& name, const Ato micString& oldValue, const AtomicString& newValue); |
| 71 static void didEnterDocument(Element*, const Document&); | 68 static void didEnterDocument(Element*, const Document&); |
| 72 static void didLeaveDocument(Element*, const Document&); | 69 static void didLeaveDocument(Element*, const Document&); |
| 73 static void wasDestroyed(Element*); | 70 static void wasDestroyed(Element*); |
| 74 | 71 |
| 75 private: | 72 private: |
| 76 CustomElement(); | 73 CustomElement(); |
| 77 | 74 |
| 78 static Vector<AtomicString>& embedderCustomElementNames(); | 75 static Vector<AtomicString>& embedderCustomElementNames(); |
| 79 | |
| 80 // Maps resolved elements to their definitions | |
| 81 | |
| 82 class DefinitionMap { | |
| 83 WTF_MAKE_NONCOPYABLE(DefinitionMap); | |
| 84 public: | |
| 85 DefinitionMap() { } | |
| 86 ~DefinitionMap() { } | |
| 87 | |
| 88 void add(Element*, PassRefPtr<CustomElementDefinition>); | |
| 89 void remove(Element* element) { m_definitions.remove(element); } | |
| 90 CustomElementDefinition* get(Element* element) const { return m_definiti ons.get(element); } | |
| 91 | |
| 92 private: | |
| 93 typedef HashMap<Element*, RefPtr<CustomElementDefinition> > ElementDefin itionHashMap; | |
| 94 ElementDefinitionHashMap m_definitions; | |
| 95 }; | |
| 96 static DefinitionMap& definitions(); | |
| 97 }; | 76 }; |
| 98 | 77 |
| 99 } | 78 } |
| 100 | 79 |
| 101 #endif // CustomElement_h | 80 #endif // CustomElement_h |
| OLD | NEW |