| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 QualifiedName tagName = QualifiedName::null(); | 61 QualifiedName tagName = QualifiedName::null(); |
| 62 if (!constructorBuilder->validateOptions(type, tagName, exceptionState)) | 62 if (!constructorBuilder->validateOptions(type, tagName, exceptionState)) |
| 63 return 0; | 63 return 0; |
| 64 | 64 |
| 65 ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.nam
espaceURI() == SVGNames::svgNamespaceURI); | 65 ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.nam
espaceURI() == SVGNames::svgNamespaceURI); |
| 66 | 66 |
| 67 ASSERT(!m_documentWasDetached); | 67 ASSERT(!m_documentWasDetached); |
| 68 | 68 |
| 69 RefPtrWillBeRawPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = con
structorBuilder->createCallbacks(); | 69 RawPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuil
der->createCallbacks(); |
| 70 | 70 |
| 71 // Consulting the constructor builder could execute script and | 71 // Consulting the constructor builder could execute script and |
| 72 // kill the document. | 72 // kill the document. |
| 73 if (m_documentWasDetached) { | 73 if (m_documentWasDetached) { |
| 74 CustomElementException::throwException(CustomElementException::ContextDe
stroyedCreatingCallbacks, type, exceptionState); | 74 CustomElementException::throwException(CustomElementException::ContextDe
stroyedCreatingCallbacks, type, exceptionState); |
| 75 return 0; | 75 return 0; |
| 76 } | 76 } |
| 77 | 77 |
| 78 const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagNa
me.localName()); | 78 const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagNa
me.localName()); |
| 79 RefPtrWillBeRawPtr<CustomElementDefinition> definition = CustomElementDefini
tion::create(descriptor, lifecycleCallbacks); | 79 RawPtr<CustomElementDefinition> definition = CustomElementDefinition::create
(descriptor, lifecycleCallbacks); |
| 80 | 80 |
| 81 if (!constructorBuilder->createConstructor(document, definition.get(), excep
tionState)) | 81 if (!constructorBuilder->createConstructor(document, definition.get(), excep
tionState)) |
| 82 return 0; | 82 return 0; |
| 83 | 83 |
| 84 m_definitions.add(descriptor, definition); | 84 m_definitions.add(descriptor, definition); |
| 85 m_registeredTypeNames.add(descriptor.type()); | 85 m_registeredTypeNames.add(descriptor.type()); |
| 86 | 86 |
| 87 if (!constructorBuilder->didRegisterDefinition(definition.get())) { | 87 if (!constructorBuilder->didRegisterDefinition(definition.get())) { |
| 88 CustomElementException::throwException(CustomElementException::ContextDe
stroyedRegisteringDefinition, type, exceptionState); | 88 CustomElementException::throwException(CustomElementException::ContextDe
stroyedRegisteringDefinition, type, exceptionState); |
| 89 return 0; | 89 return 0; |
| 90 } | 90 } |
| 91 | 91 |
| 92 return definition.get(); | 92 return definition.get(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript
or& descriptor) const | 95 CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript
or& descriptor) const |
| 96 { | 96 { |
| 97 return m_definitions.get(descriptor); | 97 return m_definitions.get(descriptor); |
| 98 } | 98 } |
| 99 | 99 |
| 100 DEFINE_TRACE(CustomElementRegistry) | 100 DEFINE_TRACE(CustomElementRegistry) |
| 101 { | 101 { |
| 102 #if ENABLE(OILPAN) | 102 #if ENABLE(OILPAN) |
| 103 visitor->trace(m_definitions); | 103 visitor->trace(m_definitions); |
| 104 #endif | 104 #endif |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |