| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/custom/CustomElementsRegistry.h" | 5 #include "core/dom/custom/CustomElementsRegistry.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" | 8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 "this name has already been used with this registry"); | 116 "this name has already been used with this registry"); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (!builder.checkConstructorNotRegistered()) | 120 if (!builder.checkConstructorNotRegistered()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 // TODO(dominicc): Implement steps: | 123 // TODO(dominicc): Implement steps: |
| 124 // 5: localName | 124 // 5: localName |
| 125 // 6-7: extends processing | 125 // 6-7: extends processing |
| 126 // 8-9: observed attributes caching | 126 |
| 127 // 8-9: observed attributes caching is done below, together with callbacks. |
| 128 // TODO(kojii): https://github.com/whatwg/html/issues/1373 for the ordering. |
| 129 // When it's resolved, revisit if this code needs changes. |
| 127 | 130 |
| 128 // TODO(dominicc): Add a test where the prototype getter destroys | 131 // TODO(dominicc): Add a test where the prototype getter destroys |
| 129 // the context. | 132 // the context. |
| 130 | 133 |
| 131 if (!builder.checkPrototype()) | 134 if (!builder.checkPrototype()) |
| 132 return; | 135 return; |
| 133 | 136 |
| 134 // TODO(dominicc): Implement steps: | 137 // 8-9: observed attributes caching |
| 135 // 12-13: connected callback | 138 // 12-13: connected callback |
| 136 // 14-15: disconnected callback | 139 // 14-15: disconnected callback |
| 137 // 16-17: attribute changed callback | 140 // 16-17: attribute changed callback |
| 138 | 141 |
| 142 if (!builder.retrieveProperties()) |
| 143 return; |
| 144 |
| 139 // TODO(dominicc): Add a test where retrieving the prototype | 145 // TODO(dominicc): Add a test where retrieving the prototype |
| 140 // recursively calls define with the same name. | 146 // recursively calls define with the same name. |
| 141 | 147 |
| 142 CustomElementDescriptor descriptor(name, name); | 148 CustomElementDescriptor descriptor(name, name); |
| 143 CustomElementDefinition* definition = builder.build(descriptor); | 149 CustomElementDefinition* definition = builder.build(descriptor); |
| 144 CHECK(!exceptionState.hadException()); | 150 CHECK(!exceptionState.hadException()); |
| 145 CHECK(definition->descriptor() == descriptor); | 151 CHECK(definition->descriptor() == descriptor); |
| 146 DefinitionMap::AddResult result = | 152 DefinitionMap::AddResult result = |
| 147 m_definitions.add(descriptor.name(), definition); | 153 m_definitions.add(descriptor.name(), definition); |
| 148 CHECK(result.isNewEntry); | 154 CHECK(result.isNewEntry); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 if (!element || !desc.matches(*element)) | 229 if (!element || !desc.matches(*element)) |
| 224 continue; | 230 continue; |
| 225 sorter.add(element); | 231 sorter.add(element); |
| 226 } | 232 } |
| 227 | 233 |
| 228 m_upgradeCandidates->remove(it); | 234 m_upgradeCandidates->remove(it); |
| 229 sorter.sorted(elements, m_document.get()); | 235 sorter.sorted(elements, m_document.get()); |
| 230 } | 236 } |
| 231 | 237 |
| 232 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |