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

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: 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
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return 0; 237 return 0;
238 if (const QualifiedName* htmlName = findHTMLTagNameOfV8Type(type)) 238 if (const QualifiedName* htmlName = findHTMLTagNameOfV8Type(type))
239 return htmlName; 239 return htmlName;
240 #if ENABLE(SVG) 240 #if ENABLE(SVG)
241 if (const QualifiedName* svgName = findSVGTagNameOfV8Type(type)) 241 if (const QualifiedName* svgName = findSVGTagNameOfV8Type(type))
242 return svgName; 242 return svgName;
243 #endif 243 #endif
244 return 0; 244 return 0;
245 } 245 }
246 246
247 bool CustomElementHelpers::isCustomElement(Element* element)
248 {
249 // FIXME: This dynamically consults the "is" attribute; instead a
250 // bit should be marked on elements that are Custom Elements
251 return CustomElementRegistry::isCustomTagName(element->localName()) || Custo mElementRegistry::isCustomTagName(element->getAttribute(HTMLNames::isAttr));
252 }
253
254 void CustomElementHelpers::invokeReadyCallbackIfNeeded(Element* element, v8::Han dle<v8::Context> context) 247 void CustomElementHelpers::invokeReadyCallbackIfNeeded(Element* element, v8::Han dle<v8::Context> context)
255 { 248 {
256 v8::Handle<v8::Value> wrapperValue = toV8(element, context->Global(), contex t->GetIsolate()); 249 v8::Handle<v8::Value> wrapperValue = toV8(element, context->Global(), contex t->GetIsolate());
257 if (wrapperValue.IsEmpty() || !wrapperValue->IsObject()) 250 if (wrapperValue.IsEmpty() || !wrapperValue->IsObject())
258 return; 251 return;
259 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(wrapperValue); 252 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(wrapperValue);
260 v8::Handle<v8::Value> prototypeValue = wrapper->GetPrototype(); 253 v8::Handle<v8::Value> prototypeValue = wrapper->GetPrototype();
261 if (prototypeValue.IsEmpty() || !prototypeValue->IsObject()) 254 if (prototypeValue.IsEmpty() || !prototypeValue->IsObject())
262 return; 255 return;
263 v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(prototypeVal ue); 256 v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(prototypeVal ue);
(...skipping 19 matching lines...) Expand all
283 return; 276 return;
284 v8::Context::Scope scope(context); 277 v8::Context::Scope scope(context);
285 278
286 for (size_t i = 0; i < invocations.size(); ++i) { 279 for (size_t i = 0; i < invocations.size(); ++i) {
287 ASSERT(executionContext == invocations[i].element()->document()); 280 ASSERT(executionContext == invocations[i].element()->document());
288 invokeReadyCallbackIfNeeded(invocations[i].element(), context); 281 invokeReadyCallbackIfNeeded(invocations[i].element(), context);
289 } 282 }
290 } 283 }
291 284
292 } // namespace WebCore 285 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698