| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // API for registration contexts | 57 // API for registration contexts |
| 58 static void define(Element*, PassRefPtr<CustomElementDefinition>); | 58 static void define(Element*, PassRefPtr<CustomElementDefinition>); |
| 59 | 59 |
| 60 // API for wrapper creation, which uses a definition as a key | 60 // API for wrapper creation, which uses a definition as a key |
| 61 static CustomElementDefinition* definitionFor(Element*); | 61 static CustomElementDefinition* definitionFor(Element*); |
| 62 | 62 |
| 63 // API for Element to kick off changes | 63 // API for Element to kick off changes |
| 64 | 64 |
| 65 static void didFinishParsingChildren(Element*); | 65 static void didFinishParsingChildren(Element*); |
| 66 static void attributeDidChange(Element*, const AtomicString& name, const Ato
micString& oldValue, const AtomicString& newValue); | 66 static void attributeDidChange(Element*, const AtomicString& name, const Ato
micString& oldValue, const AtomicString& newValue); |
| 67 static void didEnterDocument(Element*, Document*); | 67 static void didEnterDocument(Element*, const Document&); |
| 68 static void didLeaveDocument(Element*, Document*); | 68 static void didLeaveDocument(Element*, const Document&); |
| 69 static void wasDestroyed(Element*); | 69 static void wasDestroyed(Element*); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 CustomElement(); | 72 CustomElement(); |
| 73 | 73 |
| 74 static Vector<AtomicString>& embedderCustomElementNames(); | 74 static Vector<AtomicString>& embedderCustomElementNames(); |
| 75 | 75 |
| 76 // Maps resolved elements to their definitions | 76 // Maps resolved elements to their definitions |
| 77 | 77 |
| 78 class DefinitionMap { | 78 class DefinitionMap { |
| 79 WTF_MAKE_NONCOPYABLE(DefinitionMap); | 79 WTF_MAKE_NONCOPYABLE(DefinitionMap); |
| 80 public: | 80 public: |
| 81 DefinitionMap() { } | 81 DefinitionMap() { } |
| 82 ~DefinitionMap() { } | 82 ~DefinitionMap() { } |
| 83 | 83 |
| 84 void add(Element*, PassRefPtr<CustomElementDefinition>); | 84 void add(Element*, PassRefPtr<CustomElementDefinition>); |
| 85 void remove(Element* element) { m_definitions.remove(element); } | 85 void remove(Element* element) { m_definitions.remove(element); } |
| 86 CustomElementDefinition* get(Element* element) const { return m_definiti
ons.get(element); } | 86 CustomElementDefinition* get(Element* element) const { return m_definiti
ons.get(element); } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 typedef HashMap<Element*, RefPtr<CustomElementDefinition> > ElementDefin
itionHashMap; | 89 typedef HashMap<Element*, RefPtr<CustomElementDefinition> > ElementDefin
itionHashMap; |
| 90 ElementDefinitionHashMap m_definitions; | 90 ElementDefinitionHashMap m_definitions; |
| 91 }; | 91 }; |
| 92 static DefinitionMap& definitions(); | 92 static DefinitionMap& definitions(); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } | 95 } |
| 96 | 96 |
| 97 #endif // CustomElement_h | 97 #endif // CustomElement_h |
| OLD | NEW |