| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 CustomElementMicrotaskImportStep* CustomElement::didCreateImport(HTMLImportChild
* import) | 42 CustomElementMicrotaskImportStep* CustomElement::didCreateImport(HTMLImportChild
* import) |
| 43 { | 43 { |
| 44 return CustomElementScheduler::scheduleImport(import); | 44 return CustomElementScheduler::scheduleImport(import); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CustomElement::didFinishLoadingImport(Document& master) | 47 void CustomElement::didFinishLoadingImport(Document& master) |
| 48 { | 48 { |
| 49 master.customElementMicrotaskRunQueue()->requestDispatchIfNeeded(); | 49 master.customElementMicrotaskRunQueue()->requestDispatchIfNeeded(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 Vector<AtomicString>& CustomElement::embedderCustomElementNames() | 52 bool CustomElement::isValidName(const AtomicString& name) |
| 53 { | 53 { |
| 54 DEFINE_STATIC_LOCAL(Vector<AtomicString>, names, ()); | 54 if (kNotFound != name.find('-')) |
| 55 return names; | |
| 56 } | |
| 57 | |
| 58 void CustomElement::addEmbedderCustomElementName(const AtomicString& name) | |
| 59 { | |
| 60 AtomicString lower = name.lower(); | |
| 61 if (isValidName(lower, EmbedderNames)) | |
| 62 return; | |
| 63 embedderCustomElementNames().append(lower); | |
| 64 } | |
| 65 | |
| 66 bool CustomElement::isValidName(const AtomicString& name, NameSet validNames) | |
| 67 { | |
| 68 if ((validNames & EmbedderNames) && kNotFound != embedderCustomElementNames(
).find(name)) | |
| 69 return Document::isValidName(name); | |
| 70 | |
| 71 if ((validNames & StandardNames) && kNotFound != name.find('-')) | |
| 72 return Document::isValidName(name.string()); | 55 return Document::isValidName(name.string()); |
| 73 | 56 |
| 74 return false; | 57 return false; |
| 75 } | 58 } |
| 76 | 59 |
| 77 void CustomElement::define(Element* element, PassRefPtr<CustomElementDefinition>
passDefinition) | 60 void CustomElement::define(Element* element, PassRefPtr<CustomElementDefinition>
passDefinition) |
| 78 { | 61 { |
| 79 RefPtr<CustomElementDefinition> definition(passDefinition); | 62 RefPtr<CustomElementDefinition> definition(passDefinition); |
| 80 | 63 |
| 81 switch (element->customElementState()) { | 64 switch (element->customElementState()) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 break; | 104 break; |
| 122 | 105 |
| 123 case Element::WaitingForUpgrade: | 106 case Element::WaitingForUpgrade: |
| 124 case Element::Upgraded: | 107 case Element::Upgraded: |
| 125 CustomElementObserver::notifyElementWasDestroyed(element); | 108 CustomElementObserver::notifyElementWasDestroyed(element); |
| 126 break; | 109 break; |
| 127 } | 110 } |
| 128 } | 111 } |
| 129 | 112 |
| 130 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |