Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: sky/engine/core/dom/custom/CustomElementRegistry.cpp

Issue 831993005: Remove custom element type extensions. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/custom/CustomElementRegistry.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (!constructorBuilder->isFeatureAllowed()) { 72 if (!constructorBuilder->isFeatureAllowed()) {
73 CustomElementException::throwException(CustomElementException::CannotReg isterFromExtension, type, exceptionState); 73 CustomElementException::throwException(CustomElementException::CannotReg isterFromExtension, type, exceptionState);
74 return 0; 74 return 0;
75 } 75 }
76 76
77 if (!CustomElement::isValidName(type, validNames)) { 77 if (!CustomElement::isValidName(type, validNames)) {
78 CustomElementException::throwException(CustomElementException::InvalidNa me, type, exceptionState); 78 CustomElementException::throwException(CustomElementException::InvalidNa me, type, exceptionState);
79 return 0; 79 return 0;
80 } 80 }
81 81
82 if (m_registeredTypeNames.contains(type)) { 82 if (m_definitions.contains(type)) {
83 CustomElementException::throwException(CustomElementException::TypeAlrea dyRegistered, type, exceptionState); 83 CustomElementException::throwException(CustomElementException::TypeAlrea dyRegistered, type, exceptionState);
84 return 0; 84 return 0;
85 } 85 }
86 86
87 QualifiedName tagName = nullName; 87 QualifiedName tagName = nullName;
88 if (!constructorBuilder->validateOptions(type, tagName, exceptionState)) 88 if (!constructorBuilder->validateOptions(type, tagName, exceptionState))
89 return 0; 89 return 0;
90 90
91 ASSERT(!observer.registrationContextWentAway()); 91 ASSERT(!observer.registrationContextWentAway());
92 92
93 RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuil der->createCallbacks(); 93 RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuil der->createCallbacks();
94 94
95 // Consulting the constructor builder could execute script and 95 // Consulting the constructor builder could execute script and
96 // kill the document. 96 // kill the document.
97 if (observer.registrationContextWentAway()) { 97 if (observer.registrationContextWentAway()) {
98 CustomElementException::throwException(CustomElementException::ContextDe stroyedCreatingCallbacks, type, exceptionState); 98 CustomElementException::throwException(CustomElementException::ContextDe stroyedCreatingCallbacks, type, exceptionState);
99 return 0; 99 return 0;
100 } 100 }
101 101
102 const CustomElementDescriptor descriptor(type, tagName.localName()); 102 const CustomElementDescriptor descriptor(tagName.localName());
103 RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create (descriptor, lifecycleCallbacks); 103 RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create (descriptor, lifecycleCallbacks);
104 104
105 if (!constructorBuilder->createConstructor(document, definition.get(), excep tionState)) 105 if (!constructorBuilder->createConstructor(document, definition.get(), excep tionState))
106 return 0; 106 return 0;
107 107
108 m_definitions.add(descriptor, definition); 108 m_definitions.add(descriptor, definition);
109 m_registeredTypeNames.add(descriptor.type());
110 109
111 if (!constructorBuilder->didRegisterDefinition(definition.get())) { 110 if (!constructorBuilder->didRegisterDefinition(definition.get())) {
112 CustomElementException::throwException(CustomElementException::ContextDe stroyedRegisteringDefinition, type, exceptionState); 111 CustomElementException::throwException(CustomElementException::ContextDe stroyedRegisteringDefinition, type, exceptionState);
113 return 0; 112 return 0;
114 } 113 }
115 114
116 return definition.get(); 115 return definition.get();
117 } 116 }
118 117
119 CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript or& descriptor) const 118 CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript or& descriptor) const
120 { 119 {
121 return m_definitions.get(descriptor); 120 return m_definitions.get(descriptor);
122 } 121 }
123 122
124 } // namespace blink 123 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/custom/CustomElementRegistry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698