| 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/CustomElement.h" | 5 #include "core/dom/custom/CustomElement.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/QualifiedName.h" | 8 #include "core/dom/QualifiedName.h" |
| 9 #include "core/dom/custom/CEReactionsScope.h" | 9 #include "core/dom/custom/CEReactionsScope.h" |
| 10 #include "core/dom/custom/CustomElementDefinition.h" | 10 #include "core/dom/custom/CustomElementDefinition.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 U16_NEXT(name.characters16(), i, name.length(), ch); | 53 U16_NEXT(name.characters16(), i, name.length(), ch); |
| 54 if (ch == '-') | 54 if (ch == '-') |
| 55 hasHyphens = true; | 55 hasHyphens = true; |
| 56 else if (!Character::isPotentialCustomElementNameChar(ch)) | 56 else if (!Character::isPotentialCustomElementNameChar(ch)) |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 if (!hasHyphens) | 59 if (!hasHyphens) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 // https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-elemen
t-name | 62 // https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-elemen
t-name |
| 63 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, hyphenContainingElementNames, ())
; | 63 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, hyphenContainingElementNames, ({ |
| 64 if (hyphenContainingElementNames.isEmpty()) { | 64 "annotation-xml", |
| 65 hyphenContainingElementNames.add("annotation-xml"); | 65 "color-profile", |
| 66 hyphenContainingElementNames.add("color-profile"); | 66 "font-face", |
| 67 hyphenContainingElementNames.add("font-face"); | 67 "font-face-src", |
| 68 hyphenContainingElementNames.add("font-face-src"); | 68 "font-face-uri", |
| 69 hyphenContainingElementNames.add("font-face-uri"); | 69 "font-face-format", |
| 70 hyphenContainingElementNames.add("font-face-format"); | 70 "font-face-name", |
| 71 hyphenContainingElementNames.add("font-face-name"); | 71 "missing-glyph", |
| 72 hyphenContainingElementNames.add("missing-glyph"); | 72 })); |
| 73 } | |
| 74 | |
| 75 return !hyphenContainingElementNames.contains(name); | 73 return !hyphenContainingElementNames.contains(name); |
| 76 } | 74 } |
| 77 | 75 |
| 78 bool CustomElement::shouldCreateCustomElement(Document& document, const AtomicSt
ring& localName) | 76 bool CustomElement::shouldCreateCustomElement(Document& document, const AtomicSt
ring& localName) |
| 79 { | 77 { |
| 80 return RuntimeEnabledFeatures::customElementsV1Enabled() | 78 return RuntimeEnabledFeatures::customElementsV1Enabled() |
| 81 && document.frame() && isValidName(localName); | 79 && document.frame() && isValidName(localName); |
| 82 } | 80 } |
| 83 | 81 |
| 84 bool CustomElement::shouldCreateCustomElement(Document& document, const Qualifie
dName& tagName) | 82 bool CustomElement::shouldCreateCustomElement(Document& document, const Qualifie
dName& tagName) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 CustomElementsRegistry* registry = CustomElement::registry(*element); | 215 CustomElementsRegistry* registry = CustomElement::registry(*element); |
| 218 if (!registry) | 216 if (!registry) |
| 219 return; | 217 return; |
| 220 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) | 218 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) |
| 221 definition->enqueueUpgradeReaction(element); | 219 definition->enqueueUpgradeReaction(element); |
| 222 else | 220 else |
| 223 registry->addCandidate(element); | 221 registry->addCandidate(element); |
| 224 } | 222 } |
| 225 | 223 |
| 226 } // namespace blink | 224 } // namespace blink |
| OLD | NEW |