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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp

Issue 2024073002: Add callbacks to ScriptCustomElementDefinition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make ScriptCustomElementDefinitionBuilder friend to ScriptCustomElementDefinition Created 4 years, 6 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
OLDNEW
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/CustomElementsRegistry.h" 5 #include "core/dom/custom/CustomElementsRegistry.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" 8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ElementRegistrationOptions.h" 10 #include "core/dom/ElementRegistrationOptions.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 "this name has already been used with this registry"); 77 "this name has already been used with this registry");
78 return; 78 return;
79 } 79 }
80 80
81 if (!builder.checkConstructorNotRegistered()) 81 if (!builder.checkConstructorNotRegistered())
82 return; 82 return;
83 83
84 // TODO(dominicc): Implement steps: 84 // TODO(dominicc): Implement steps:
85 // 5: localName 85 // 5: localName
86 // 6-7: extends processing 86 // 6-7: extends processing
87 // 8-9: observed attributes caching 87
88 // 8-9: observed attributes caching is done below, together with callbacks.
dominicc (has gone to gerrit) 2016/06/02 00:31:27 Do these tests in order. Authors can observe this
88 89
89 // TODO(dominicc): Add a test where the prototype getter destroys 90 // TODO(dominicc): Add a test where the prototype getter destroys
90 // the context. 91 // the context.
91 92
92 if (!builder.checkPrototype()) 93 if (!builder.checkPrototype())
93 return; 94 return;
94 95
95 // TODO(dominicc): Implement steps: 96 // 8-9: observed attributes caching
dominicc (has gone to gerrit) 2016/06/02 00:31:27 I think we can remove this comment; it might be us
96 // 12-13: connected callback 97 // 12-13: connected callback
97 // 14-15: disconnected callback 98 // 14-15: disconnected callback
98 // 16-17: attribute changed callback 99 // 16-17: attribute changed callback
99 100
101 if (!builder.cacheProperties())
102 return;
103
100 // TODO(dominicc): Add a test where retrieving the prototype 104 // TODO(dominicc): Add a test where retrieving the prototype
101 // recursively calls define with the same name. 105 // recursively calls define with the same name.
102 106
103 CustomElementDescriptor descriptor(name, name); 107 CustomElementDescriptor descriptor(name, name);
104 CustomElementDefinition* definition = builder.build(descriptor); 108 CustomElementDefinition* definition = builder.build(descriptor);
105 CHECK(!exceptionState.hadException()); 109 CHECK(!exceptionState.hadException());
106 CHECK(definition->descriptor() == descriptor); 110 CHECK(definition->descriptor() == descriptor);
107 DefinitionMap::AddResult result = 111 DefinitionMap::AddResult result =
108 m_definitions.add(descriptor.name(), definition); 112 m_definitions.add(descriptor.name(), definition);
109 CHECK(result.isNewEntry); 113 CHECK(result.isNewEntry);
110 114
111 // TODO(dominicc): Implement steps: 115 // TODO(dominicc): Implement steps:
112 // 20: when-defined promise processing 116 // 20: when-defined promise processing
113 } 117 }
114 118
115 bool CustomElementsRegistry::v0NameIsDefined(const AtomicString& name) const 119 bool CustomElementsRegistry::v0NameIsDefined(const AtomicString& name) const
116 { 120 {
117 if (!m_v0) 121 if (!m_v0)
118 return false; 122 return false;
119 return m_v0->nameIsDefined(name); 123 return m_v0->nameIsDefined(name);
120 } 124 }
121 125
122 CustomElementDefinition* CustomElementsRegistry::definitionForName( 126 CustomElementDefinition* CustomElementsRegistry::definitionForName(
123 const AtomicString& name) const 127 const AtomicString& name) const
124 { 128 {
125 return m_definitions.get(name); 129 return m_definitions.get(name);
126 } 130 }
127 131
128 } // namespace blink 132 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698