| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 void CustomElementRegistrationContext::registerElement(Document* document, Custo
mElementConstructorBuilder* constructorBuilder, const AtomicString& type, Custom
Element::NameSet validNames, ExceptionState& exceptionState) | 53 void CustomElementRegistrationContext::registerElement(Document* document, Custo
mElementConstructorBuilder* constructorBuilder, const AtomicString& type, Custom
Element::NameSet validNames, ExceptionState& exceptionState) |
| 54 { | 54 { |
| 55 CustomElementDefinition* definition = m_registry.registerElement(document, c
onstructorBuilder, type, validNames, exceptionState); | 55 CustomElementDefinition* definition = m_registry.registerElement(document, c
onstructorBuilder, type, validNames, exceptionState); |
| 56 | 56 |
| 57 if (!definition) | 57 if (!definition) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 // Upgrade elements that were waiting for this definition. | 60 // Upgrade elements that were waiting for this definition. |
| 61 OwnPtrWillBeRawPtr<CustomElementUpgradeCandidateMap::ElementSet> upgradeCand
idates = m_candidates->takeUpgradeCandidatesFor(definition->descriptor()); | 61 RawPtr<CustomElementUpgradeCandidateMap::ElementSet> upgradeCandidates = m_c
andidates->takeUpgradeCandidatesFor(definition->descriptor()); |
| 62 | 62 |
| 63 if (!upgradeCandidates) | 63 if (!upgradeCandidates) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 for (const auto& candidate : *upgradeCandidates) | 66 for (const auto& candidate : *upgradeCandidates) |
| 67 CustomElement::define(candidate, definition); | 67 CustomElement::define(candidate, definition); |
| 68 } | 68 } |
| 69 | 69 |
| 70 PassRefPtrWillBeRawPtr<Element> CustomElementRegistrationContext::createCustomTa
gElement(Document& document, const QualifiedName& tagName) | 70 RawPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Documen
t& document, const QualifiedName& tagName) |
| 71 { | 71 { |
| 72 ASSERT(CustomElement::isValidName(tagName.localName())); | 72 ASSERT(CustomElement::isValidName(tagName.localName())); |
| 73 | 73 |
| 74 RefPtrWillBeRawPtr<Element> element; | 74 RawPtr<Element> element; |
| 75 | 75 |
| 76 if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) { | 76 if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) { |
| 77 element = HTMLElement::create(tagName, document); | 77 element = HTMLElement::create(tagName, document); |
| 78 } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) { | 78 } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) { |
| 79 element = SVGUnknownElement::create(tagName, document); | 79 element = SVGUnknownElement::create(tagName, document); |
| 80 } else { | 80 } else { |
| 81 // XML elements are not custom elements, so return early. | 81 // XML elements are not custom elements, so return early. |
| 82 return Element::create(tagName, &document); | 82 return Element::create(tagName, &document); |
| 83 } | 83 } |
| 84 | 84 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 context->didGiveTypeExtension(element, element->document().convertLocalName(
type)); | 154 context->didGiveTypeExtension(element, element->document().convertLocalName(
type)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 DEFINE_TRACE(CustomElementRegistrationContext) | 157 DEFINE_TRACE(CustomElementRegistrationContext) |
| 158 { | 158 { |
| 159 visitor->trace(m_candidates); | 159 visitor->trace(m_candidates); |
| 160 visitor->trace(m_registry); | 160 visitor->trace(m_registry); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |