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

Side by Side Diff: Source/bindings/v8/CustomElementHelpers.cpp

Issue 14834002: Set a bit on Custom Elements on creation to simplify wrapping (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Now avoids hitting assert. Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/CustomElementHelpers.h ('k') | Source/core/dom/CustomElementRegistry.h » ('j') | 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return 0; 235 return 0;
236 if (const QualifiedName* htmlName = findHTMLTagNameOfV8Type(type)) 236 if (const QualifiedName* htmlName = findHTMLTagNameOfV8Type(type))
237 return htmlName; 237 return htmlName;
238 #if ENABLE(SVG) 238 #if ENABLE(SVG)
239 if (const QualifiedName* svgName = findSVGTagNameOfV8Type(type)) 239 if (const QualifiedName* svgName = findSVGTagNameOfV8Type(type))
240 return svgName; 240 return svgName;
241 #endif 241 #endif
242 return 0; 242 return 0;
243 } 243 }
244 244
245 bool CustomElementHelpers::isCustomElement(Element* element)
246 {
247 // FIXME: This dynamically consults the "is" attribute; instead a
248 // bit should be marked on elements that are Custom Elements
249 return CustomElementRegistry::isCustomTagName(element->localName()) || Custo mElementRegistry::isCustomTagName(element->getAttribute(HTMLNames::isAttr));
250 }
251
252 void CustomElementHelpers::invokeReadyCallbackIfNeeded(Element* element, v8::Han dle<v8::Context> context) 245 void CustomElementHelpers::invokeReadyCallbackIfNeeded(Element* element, v8::Han dle<v8::Context> context)
253 { 246 {
254 v8::Handle<v8::Value> wrapperValue = toV8(element, context->Global(), contex t->GetIsolate()); 247 v8::Handle<v8::Value> wrapperValue = toV8(element, context->Global(), contex t->GetIsolate());
255 if (wrapperValue.IsEmpty() || !wrapperValue->IsObject()) 248 if (wrapperValue.IsEmpty() || !wrapperValue->IsObject())
256 return; 249 return;
257 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(wrapperValue); 250 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(wrapperValue);
258 v8::Handle<v8::Value> prototypeValue = wrapper->GetPrototype(); 251 v8::Handle<v8::Value> prototypeValue = wrapper->GetPrototype();
259 if (prototypeValue.IsEmpty() || !prototypeValue->IsObject()) 252 if (prototypeValue.IsEmpty() || !prototypeValue->IsObject())
260 return; 253 return;
261 v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(prototypeVal ue); 254 v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(prototypeVal ue);
(...skipping 19 matching lines...) Expand all
281 return; 274 return;
282 v8::Context::Scope scope(context); 275 v8::Context::Scope scope(context);
283 276
284 for (size_t i = 0; i < invocations.size(); ++i) { 277 for (size_t i = 0; i < invocations.size(); ++i) {
285 ASSERT(executionContext == invocations[i].element()->document()); 278 ASSERT(executionContext == invocations[i].element()->document());
286 invokeReadyCallbackIfNeeded(invocations[i].element(), context); 279 invokeReadyCallbackIfNeeded(invocations[i].element(), context);
287 } 280 }
288 } 281 }
289 282
290 } // namespace WebCore 283 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/CustomElementHelpers.h ('k') | Source/core/dom/CustomElementRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698