Advertisement
Guest User

Untitled

a guest
Apr 29th, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 132.30 KB | None | 0 0
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4.  
  5. // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
  6.  
  7. #include "config.h"
  8. #include "V8Element.h"
  9.  
  10. #include "HTMLNames.h"
  11. #include "RuntimeEnabledFeatures.h"
  12. #include "V8AnimationEffect.h"
  13. #include "V8AnimationPlayer.h"
  14. #include "V8Attr.h"
  15. #include "V8CSSStyleDeclaration.h"
  16. #include "V8ClientRect.h"
  17. #include "V8ClientRectList.h"
  18. #include "V8DOMStringMap.h"
  19. #include "V8DOMTokenList.h"
  20. #include "V8HTMLCollection.h"
  21. #include "V8HTMLElement.h"
  22. #include "V8NamedNodeMap.h"
  23. #include "V8NodeList.h"
  24. #include "V8SVGElement.h"
  25. #include "V8ShadowRoot.h"
  26. #include "bindings/v8/Dictionary.h"
  27. #include "bindings/v8/ExceptionState.h"
  28. #include "bindings/v8/V8AbstractEventListener.h"
  29. #include "bindings/v8/V8DOMActivityLogger.h"
  30. #include "bindings/v8/V8DOMConfiguration.h"
  31. #include "bindings/v8/V8EventListenerList.h"
  32. #include "bindings/v8/V8HiddenValue.h"
  33. #include "bindings/v8/V8ObjectConstructor.h"
  34. #include "core/animation/ElementAnimation.h"
  35. #include "core/dom/ChildNode.h"
  36. #include "core/dom/ContextFeatures.h"
  37. #include "core/dom/Document.h"
  38. #include "core/dom/ParentNode.h"
  39. #include "core/dom/custom/CustomElementCallbackDispatcher.h"
  40. #include "core/frame/UseCounter.h"
  41. #include "platform/TraceEvent.h"
  42. #include "wtf/GetPtr.h"
  43. #include "wtf/RefPtr.h"
  44.  
  45. namespace WebCore {
  46.  
  47. static void initializeScriptWrappableForInterface(Element* object)
  48. {
  49.     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
  50.         ScriptWrappable::fromObject(object)->setTypeInfo(&V8Element::wrapperTypeInfo);
  51.     else
  52.         ASSERT_NOT_REACHED();
  53. }
  54.  
  55. } // namespace WebCore
  56.  
  57. void webCoreInitializeScriptWrappableForInterface(WebCore::Element* object)
  58. {
  59.     WebCore::initializeScriptWrappableForInterface(object);
  60. }
  61.  
  62. namespace WebCore {
  63. const WrapperTypeInfo V8Element::wrapperTypeInfo = { gin::kEmbedderBlink, V8Element::domTemplate, V8Element::derefObject, 0, V8Element::toEventTarget, 0, V8Element::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, RefCountedObject };
  64.  
  65. namespace ElementV8Internal {
  66.  
  67. template <typename T> void V8_USE(T) { }
  68.  
  69. static void tagNameAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  70. {
  71.     v8::Handle<v8::Object> holder = info.Holder();
  72.     Element* impl = V8Element::toNative(holder);
  73.     v8SetReturnValueStringOrNull(info, impl->tagName(), info.GetIsolate());
  74. }
  75.  
  76. static void tagNameAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  77. {
  78.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  79.     ElementV8Internal::tagNameAttributeGetter(info);
  80.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  81. }
  82.  
  83. static void tagNameAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  84. {
  85.     v8::Handle<v8::Object> holder = info.Holder();
  86.     Element* impl = V8Element::toNative(holder);
  87.     v8SetReturnValueStringOrNull(info, impl->tagName(), info.GetIsolate());
  88. }
  89.  
  90. static void tagNameAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  91. {
  92.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  93.     ElementV8Internal::tagNameAttributeGetterForMainWorld(info);
  94.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  95. }
  96.  
  97. static void attributesAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  98. {
  99.     v8::Handle<v8::Object> holder = info.Holder();
  100.     Element* impl = V8Element::toNative(holder);
  101.     v8SetReturnValueFast(info, WTF::getPtr(impl->attributes()), impl);
  102. }
  103.  
  104. static void attributesAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  105. {
  106.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  107.     ElementV8Internal::attributesAttributeGetter(info);
  108.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  109. }
  110.  
  111. static void attributesAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  112. {
  113.     v8::Handle<v8::Object> holder = info.Holder();
  114.     Element* impl = V8Element::toNative(holder);
  115.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->attributes()));
  116. }
  117.  
  118. static void attributesAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  119. {
  120.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  121.     ElementV8Internal::attributesAttributeGetterForMainWorld(info);
  122.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  123. }
  124.  
  125. static void styleAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  126. {
  127.     v8::Handle<v8::Object> holder = info.Holder();
  128.     Element* impl = V8Element::toNative(holder);
  129.     v8SetReturnValueFast(info, WTF::getPtr(impl->style()), impl);
  130. }
  131.  
  132. static void styleAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  133. {
  134.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  135.     ElementV8Internal::styleAttributeGetter(info);
  136.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  137. }
  138.  
  139. static void styleAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  140. {
  141.     v8::Handle<v8::Object> holder = info.Holder();
  142.     Element* impl = V8Element::toNative(holder);
  143.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->style()));
  144. }
  145.  
  146. static void styleAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  147. {
  148.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  149.     ElementV8Internal::styleAttributeGetterForMainWorld(info);
  150.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  151. }
  152.  
  153. static void idAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  154. {
  155.     v8::Handle<v8::Object> holder = info.Holder();
  156.     Element* impl = V8Element::toNative(holder);
  157.     v8SetReturnValueString(info, impl->getIdAttribute(), info.GetIsolate());
  158. }
  159.  
  160. static void idAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  161. {
  162.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  163.     ElementV8Internal::idAttributeGetter(info);
  164.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  165. }
  166.  
  167. static void idAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  168. {
  169.     v8::Handle<v8::Object> holder = info.Holder();
  170.     Element* impl = V8Element::toNative(holder);
  171.     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
  172.     impl->setAttribute(HTMLNames::idAttr, cppValue);
  173. }
  174.  
  175. static void idAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  176. {
  177.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  178.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  179.     ElementV8Internal::idAttributeSetter(v8Value, info);
  180.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  181. }
  182.  
  183. static void idAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  184. {
  185.     v8::Handle<v8::Object> holder = info.Holder();
  186.     Element* impl = V8Element::toNative(holder);
  187.     v8SetReturnValueString(info, impl->getIdAttribute(), info.GetIsolate());
  188. }
  189.  
  190. static void idAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  191. {
  192.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  193.     ElementV8Internal::idAttributeGetterForMainWorld(info);
  194.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  195. }
  196.  
  197. static void idAttributeSetterForMainWorld(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  198. {
  199.     v8::Handle<v8::Object> holder = info.Holder();
  200.     Element* impl = V8Element::toNative(holder);
  201.     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
  202.     impl->setAttribute(HTMLNames::idAttr, cppValue);
  203. }
  204.  
  205. static void idAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  206. {
  207.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  208.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  209.     ElementV8Internal::idAttributeSetterForMainWorld(v8Value, info);
  210.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  211. }
  212.  
  213. static void namespaceURIAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  214. {
  215.     v8::Handle<v8::Object> holder = info.Holder();
  216.     Element* impl = V8Element::toNative(holder);
  217.     v8SetReturnValueStringOrNull(info, impl->namespaceURI(), info.GetIsolate());
  218. }
  219.  
  220. static void namespaceURIAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  221. {
  222.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  223.     ElementV8Internal::namespaceURIAttributeGetter(info);
  224.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  225. }
  226.  
  227. static void namespaceURIAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  228. {
  229.     v8::Handle<v8::Object> holder = info.Holder();
  230.     Element* impl = V8Element::toNative(holder);
  231.     v8SetReturnValueStringOrNull(info, impl->namespaceURI(), info.GetIsolate());
  232. }
  233.  
  234. static void namespaceURIAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  235. {
  236.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  237.     ElementV8Internal::namespaceURIAttributeGetterForMainWorld(info);
  238.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  239. }
  240.  
  241. static void prefixAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  242. {
  243.     v8::Handle<v8::Object> holder = info.Holder();
  244.     Element* impl = V8Element::toNative(holder);
  245.     v8SetReturnValueStringOrNull(info, impl->prefix(), info.GetIsolate());
  246. }
  247.  
  248. static void prefixAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  249. {
  250.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  251.     ElementV8Internal::prefixAttributeGetter(info);
  252.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  253. }
  254.  
  255. static void prefixAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  256. {
  257.     v8::Handle<v8::Object> holder = info.Holder();
  258.     ExceptionState exceptionState(ExceptionState::SetterContext, "prefix", "Element", holder, info.GetIsolate());
  259.     Element* impl = V8Element::toNative(holder);
  260.     TOSTRING_VOID(V8StringResource<WithNullCheck>, cppValue, v8Value);
  261.     impl->setPrefix(cppValue, exceptionState);
  262.     exceptionState.throwIfNeeded();
  263. }
  264.  
  265. static void prefixAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  266. {
  267.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  268.     ElementV8Internal::prefixAttributeSetter(v8Value, info);
  269.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  270. }
  271.  
  272. static void prefixAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  273. {
  274.     v8::Handle<v8::Object> holder = info.Holder();
  275.     Element* impl = V8Element::toNative(holder);
  276.     v8SetReturnValueStringOrNull(info, impl->prefix(), info.GetIsolate());
  277. }
  278.  
  279. static void prefixAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  280. {
  281.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  282.     ElementV8Internal::prefixAttributeGetterForMainWorld(info);
  283.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  284. }
  285.  
  286. static void prefixAttributeSetterForMainWorld(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  287. {
  288.     v8::Handle<v8::Object> holder = info.Holder();
  289.     ExceptionState exceptionState(ExceptionState::SetterContext, "prefix", "Element", holder, info.GetIsolate());
  290.     Element* impl = V8Element::toNative(holder);
  291.     TOSTRING_VOID(V8StringResource<WithNullCheck>, cppValue, v8Value);
  292.     impl->setPrefix(cppValue, exceptionState);
  293.     exceptionState.throwIfNeeded();
  294. }
  295.  
  296. static void prefixAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  297. {
  298.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  299.     ElementV8Internal::prefixAttributeSetterForMainWorld(v8Value, info);
  300.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  301. }
  302.  
  303. static void localNameAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  304. {
  305.     v8::Handle<v8::Object> holder = info.Holder();
  306.     Element* impl = V8Element::toNative(holder);
  307.     v8SetReturnValueStringOrNull(info, impl->localName(), info.GetIsolate());
  308. }
  309.  
  310. static void localNameAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  311. {
  312.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  313.     ElementV8Internal::localNameAttributeGetter(info);
  314.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  315. }
  316.  
  317. static void localNameAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  318. {
  319.     v8::Handle<v8::Object> holder = info.Holder();
  320.     Element* impl = V8Element::toNative(holder);
  321.     v8SetReturnValueStringOrNull(info, impl->localName(), info.GetIsolate());
  322. }
  323.  
  324. static void localNameAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  325. {
  326.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  327.     ElementV8Internal::localNameAttributeGetterForMainWorld(info);
  328.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  329. }
  330.  
  331. static void offsetLeftAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  332. {
  333.     v8::Handle<v8::Object> holder = info.Holder();
  334.     Element* impl = V8Element::toNative(holder);
  335.     v8SetReturnValueInt(info, impl->offsetLeft());
  336. }
  337.  
  338. static void offsetLeftAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  339. {
  340.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  341.     ElementV8Internal::offsetLeftAttributeGetter(info);
  342.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  343. }
  344.  
  345. static void offsetLeftAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  346. {
  347.     v8::Handle<v8::Object> holder = info.Holder();
  348.     Element* impl = V8Element::toNative(holder);
  349.     v8SetReturnValueInt(info, impl->offsetLeft());
  350. }
  351.  
  352. static void offsetLeftAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  353. {
  354.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  355.     ElementV8Internal::offsetLeftAttributeGetterForMainWorld(info);
  356.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  357. }
  358.  
  359. static void offsetTopAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  360. {
  361.     v8::Handle<v8::Object> holder = info.Holder();
  362.     Element* impl = V8Element::toNative(holder);
  363.     v8SetReturnValueInt(info, impl->offsetTop());
  364. }
  365.  
  366. static void offsetTopAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  367. {
  368.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  369.     ElementV8Internal::offsetTopAttributeGetter(info);
  370.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  371. }
  372.  
  373. static void offsetTopAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  374. {
  375.     v8::Handle<v8::Object> holder = info.Holder();
  376.     Element* impl = V8Element::toNative(holder);
  377.     v8SetReturnValueInt(info, impl->offsetTop());
  378. }
  379.  
  380. static void offsetTopAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  381. {
  382.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  383.     ElementV8Internal::offsetTopAttributeGetterForMainWorld(info);
  384.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  385. }
  386.  
  387. static void offsetWidthAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  388. {
  389.     v8::Handle<v8::Object> holder = info.Holder();
  390.     Element* impl = V8Element::toNative(holder);
  391.     v8SetReturnValueInt(info, impl->offsetWidth());
  392. }
  393.  
  394. static void offsetWidthAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  395. {
  396.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  397.     ElementV8Internal::offsetWidthAttributeGetter(info);
  398.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  399. }
  400.  
  401. static void offsetWidthAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  402. {
  403.     v8::Handle<v8::Object> holder = info.Holder();
  404.     Element* impl = V8Element::toNative(holder);
  405.     v8SetReturnValueInt(info, impl->offsetWidth());
  406. }
  407.  
  408. static void offsetWidthAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  409. {
  410.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  411.     ElementV8Internal::offsetWidthAttributeGetterForMainWorld(info);
  412.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  413. }
  414.  
  415. static void offsetHeightAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  416. {
  417.     v8::Handle<v8::Object> holder = info.Holder();
  418.     Element* impl = V8Element::toNative(holder);
  419.     v8SetReturnValueInt(info, impl->offsetHeight());
  420. }
  421.  
  422. static void offsetHeightAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  423. {
  424.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  425.     ElementV8Internal::offsetHeightAttributeGetter(info);
  426.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  427. }
  428.  
  429. static void offsetHeightAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  430. {
  431.     v8::Handle<v8::Object> holder = info.Holder();
  432.     Element* impl = V8Element::toNative(holder);
  433.     v8SetReturnValueInt(info, impl->offsetHeight());
  434. }
  435.  
  436. static void offsetHeightAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  437. {
  438.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  439.     ElementV8Internal::offsetHeightAttributeGetterForMainWorld(info);
  440.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  441. }
  442.  
  443. static void offsetParentAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  444. {
  445.     v8::Handle<v8::Object> holder = info.Holder();
  446.     Element* impl = V8Element::toNative(holder);
  447.     v8SetReturnValueFast(info, WTF::getPtr(impl->offsetParentForBindings()), impl);
  448. }
  449.  
  450. static void offsetParentAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  451. {
  452.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  453.     ElementV8Internal::offsetParentAttributeGetter(info);
  454.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  455. }
  456.  
  457. static void offsetParentAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  458. {
  459.     v8::Handle<v8::Object> holder = info.Holder();
  460.     Element* impl = V8Element::toNative(holder);
  461.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->offsetParentForBindings()));
  462. }
  463.  
  464. static void offsetParentAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  465. {
  466.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  467.     ElementV8Internal::offsetParentAttributeGetterForMainWorld(info);
  468.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  469. }
  470.  
  471. static void clientLeftAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  472. {
  473.     v8::Handle<v8::Object> holder = info.Holder();
  474.     Element* impl = V8Element::toNative(holder);
  475.     v8SetReturnValueInt(info, impl->clientLeft());
  476. }
  477.  
  478. static void clientLeftAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  479. {
  480.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  481.     ElementV8Internal::clientLeftAttributeGetter(info);
  482.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  483. }
  484.  
  485. static void clientLeftAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  486. {
  487.     v8::Handle<v8::Object> holder = info.Holder();
  488.     Element* impl = V8Element::toNative(holder);
  489.     v8SetReturnValueInt(info, impl->clientLeft());
  490. }
  491.  
  492. static void clientLeftAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  493. {
  494.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  495.     ElementV8Internal::clientLeftAttributeGetterForMainWorld(info);
  496.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  497. }
  498.  
  499. static void clientTopAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  500. {
  501.     v8::Handle<v8::Object> holder = info.Holder();
  502.     Element* impl = V8Element::toNative(holder);
  503.     v8SetReturnValueInt(info, impl->clientTop());
  504. }
  505.  
  506. static void clientTopAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  507. {
  508.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  509.     ElementV8Internal::clientTopAttributeGetter(info);
  510.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  511. }
  512.  
  513. static void clientTopAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  514. {
  515.     v8::Handle<v8::Object> holder = info.Holder();
  516.     Element* impl = V8Element::toNative(holder);
  517.     v8SetReturnValueInt(info, impl->clientTop());
  518. }
  519.  
  520. static void clientTopAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  521. {
  522.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  523.     ElementV8Internal::clientTopAttributeGetterForMainWorld(info);
  524.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  525. }
  526.  
  527. static void clientWidthAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  528. {
  529.     v8::Handle<v8::Object> holder = info.Holder();
  530.     Element* impl = V8Element::toNative(holder);
  531.     v8SetReturnValueInt(info, impl->clientWidth());
  532. }
  533.  
  534. static void clientWidthAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  535. {
  536.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  537.     ElementV8Internal::clientWidthAttributeGetter(info);
  538.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  539. }
  540.  
  541. static void clientWidthAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  542. {
  543.     v8::Handle<v8::Object> holder = info.Holder();
  544.     Element* impl = V8Element::toNative(holder);
  545.     v8SetReturnValueInt(info, impl->clientWidth());
  546. }
  547.  
  548. static void clientWidthAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  549. {
  550.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  551.     ElementV8Internal::clientWidthAttributeGetterForMainWorld(info);
  552.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  553. }
  554.  
  555. static void clientHeightAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  556. {
  557.     v8::Handle<v8::Object> holder = info.Holder();
  558.     Element* impl = V8Element::toNative(holder);
  559.     v8SetReturnValueInt(info, impl->clientHeight());
  560. }
  561.  
  562. static void clientHeightAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  563. {
  564.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  565.     ElementV8Internal::clientHeightAttributeGetter(info);
  566.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  567. }
  568.  
  569. static void clientHeightAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  570. {
  571.     v8::Handle<v8::Object> holder = info.Holder();
  572.     Element* impl = V8Element::toNative(holder);
  573.     v8SetReturnValueInt(info, impl->clientHeight());
  574. }
  575.  
  576. static void clientHeightAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  577. {
  578.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  579.     ElementV8Internal::clientHeightAttributeGetterForMainWorld(info);
  580.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  581. }
  582.  
  583. static void scrollLeftAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  584. {
  585.     v8::Handle<v8::Object> holder = info.Holder();
  586.     Element* impl = V8Element::toNative(holder);
  587.     v8SetReturnValueInt(info, impl->scrollLeft());
  588. }
  589.  
  590. static void scrollLeftAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  591. {
  592.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  593.     ElementV8Internal::scrollLeftAttributeGetter(info);
  594.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  595. }
  596.  
  597. static void scrollLeftAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  598. {
  599.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  600.     V8Element::scrollLeftAttributeSetterCustom(v8Value, info);
  601.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  602. }
  603.  
  604. static void scrollLeftAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  605. {
  606.     v8::Handle<v8::Object> holder = info.Holder();
  607.     Element* impl = V8Element::toNative(holder);
  608.     v8SetReturnValueInt(info, impl->scrollLeft());
  609. }
  610.  
  611. static void scrollLeftAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  612. {
  613.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  614.     ElementV8Internal::scrollLeftAttributeGetterForMainWorld(info);
  615.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  616. }
  617.  
  618. static void scrollLeftAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  619. {
  620.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  621.     V8Element::scrollLeftAttributeSetterCustom(v8Value, info);
  622.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  623. }
  624.  
  625. static void scrollTopAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  626. {
  627.     v8::Handle<v8::Object> holder = info.Holder();
  628.     Element* impl = V8Element::toNative(holder);
  629.     v8SetReturnValueInt(info, impl->scrollTop());
  630. }
  631.  
  632. static void scrollTopAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  633. {
  634.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  635.     ElementV8Internal::scrollTopAttributeGetter(info);
  636.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  637. }
  638.  
  639. static void scrollTopAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  640. {
  641.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  642.     V8Element::scrollTopAttributeSetterCustom(v8Value, info);
  643.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  644. }
  645.  
  646. static void scrollTopAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  647. {
  648.     v8::Handle<v8::Object> holder = info.Holder();
  649.     Element* impl = V8Element::toNative(holder);
  650.     v8SetReturnValueInt(info, impl->scrollTop());
  651. }
  652.  
  653. static void scrollTopAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  654. {
  655.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  656.     ElementV8Internal::scrollTopAttributeGetterForMainWorld(info);
  657.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  658. }
  659.  
  660. static void scrollTopAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  661. {
  662.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  663.     V8Element::scrollTopAttributeSetterCustom(v8Value, info);
  664.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  665. }
  666.  
  667. static void scrollWidthAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  668. {
  669.     v8::Handle<v8::Object> holder = info.Holder();
  670.     Element* impl = V8Element::toNative(holder);
  671.     v8SetReturnValueInt(info, impl->scrollWidth());
  672. }
  673.  
  674. static void scrollWidthAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  675. {
  676.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  677.     ElementV8Internal::scrollWidthAttributeGetter(info);
  678.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  679. }
  680.  
  681. static void scrollWidthAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  682. {
  683.     v8::Handle<v8::Object> holder = info.Holder();
  684.     Element* impl = V8Element::toNative(holder);
  685.     v8SetReturnValueInt(info, impl->scrollWidth());
  686. }
  687.  
  688. static void scrollWidthAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  689. {
  690.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  691.     ElementV8Internal::scrollWidthAttributeGetterForMainWorld(info);
  692.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  693. }
  694.  
  695. static void scrollHeightAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  696. {
  697.     v8::Handle<v8::Object> holder = info.Holder();
  698.     Element* impl = V8Element::toNative(holder);
  699.     v8SetReturnValueInt(info, impl->scrollHeight());
  700. }
  701.  
  702. static void scrollHeightAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  703. {
  704.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  705.     ElementV8Internal::scrollHeightAttributeGetter(info);
  706.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  707. }
  708.  
  709. static void scrollHeightAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  710. {
  711.     v8::Handle<v8::Object> holder = info.Holder();
  712.     Element* impl = V8Element::toNative(holder);
  713.     v8SetReturnValueInt(info, impl->scrollHeight());
  714. }
  715.  
  716. static void scrollHeightAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  717. {
  718.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  719.     ElementV8Internal::scrollHeightAttributeGetterForMainWorld(info);
  720.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  721. }
  722.  
  723. static void innerHTMLAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  724. {
  725.     v8::Handle<v8::Object> holder = info.Holder();
  726.     Element* impl = V8Element::toNative(holder);
  727.     v8SetReturnValueString(info, impl->innerHTML(), info.GetIsolate());
  728. }
  729.  
  730. static void innerHTMLAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  731. {
  732.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  733.     ElementV8Internal::innerHTMLAttributeGetter(info);
  734.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  735. }
  736.  
  737. static void innerHTMLAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  738. {
  739.     v8::Handle<v8::Object> holder = info.Holder();
  740.     ExceptionState exceptionState(ExceptionState::SetterContext, "innerHTML", "Element", holder, info.GetIsolate());
  741.     Element* impl = V8Element::toNative(holder);
  742.     TOSTRING_VOID(V8StringResource<WithNullCheck>, cppValue, v8Value);
  743.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  744.     impl->setInnerHTML(cppValue, exceptionState);
  745.     exceptionState.throwIfNeeded();
  746. }
  747.  
  748. static void innerHTMLAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  749. {
  750.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  751.     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
  752.     if (contextData && contextData->activityLogger()) {
  753.         v8::Handle<v8::Value> loggerArg[] = { v8Value };
  754.         contextData->activityLogger()->log("Element.innerHTML", 1, &loggerArg[0], "Setter");
  755.     }
  756.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  757.     ElementV8Internal::innerHTMLAttributeSetter(v8Value, info);
  758.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  759. }
  760.  
  761. static void innerHTMLAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  762. {
  763.     v8::Handle<v8::Object> holder = info.Holder();
  764.     Element* impl = V8Element::toNative(holder);
  765.     v8SetReturnValueString(info, impl->innerHTML(), info.GetIsolate());
  766. }
  767.  
  768. static void innerHTMLAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  769. {
  770.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  771.     ElementV8Internal::innerHTMLAttributeGetterForMainWorld(info);
  772.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  773. }
  774.  
  775. static void innerHTMLAttributeSetterForMainWorld(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  776. {
  777.     v8::Handle<v8::Object> holder = info.Holder();
  778.     ExceptionState exceptionState(ExceptionState::SetterContext, "innerHTML", "Element", holder, info.GetIsolate());
  779.     Element* impl = V8Element::toNative(holder);
  780.     TOSTRING_VOID(V8StringResource<WithNullCheck>, cppValue, v8Value);
  781.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  782.     impl->setInnerHTML(cppValue, exceptionState);
  783.     exceptionState.throwIfNeeded();
  784. }
  785.  
  786. static void innerHTMLAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  787. {
  788.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  789.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  790.     ElementV8Internal::innerHTMLAttributeSetterForMainWorld(v8Value, info);
  791.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  792. }
  793.  
  794. static void outerHTMLAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  795. {
  796.     v8::Handle<v8::Object> holder = info.Holder();
  797.     Element* impl = V8Element::toNative(holder);
  798.     v8SetReturnValueString(info, impl->outerHTML(), info.GetIsolate());
  799. }
  800.  
  801. static void outerHTMLAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  802. {
  803.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  804.     ElementV8Internal::outerHTMLAttributeGetter(info);
  805.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  806. }
  807.  
  808. static void outerHTMLAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  809. {
  810.     v8::Handle<v8::Object> holder = info.Holder();
  811.     ExceptionState exceptionState(ExceptionState::SetterContext, "outerHTML", "Element", holder, info.GetIsolate());
  812.     Element* impl = V8Element::toNative(holder);
  813.     TOSTRING_VOID(V8StringResource<WithNullCheck>, cppValue, v8Value);
  814.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  815.     impl->setOuterHTML(cppValue, exceptionState);
  816.     exceptionState.throwIfNeeded();
  817. }
  818.  
  819. static void outerHTMLAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  820. {
  821.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  822.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  823.     ElementV8Internal::outerHTMLAttributeSetter(v8Value, info);
  824.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  825. }
  826.  
  827. static void classNameAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  828. {
  829.     v8::Handle<v8::Object> holder = info.Holder();
  830.     Element* impl = V8Element::toNative(holder);
  831.     v8SetReturnValueString(info, impl->getClassAttribute(), info.GetIsolate());
  832. }
  833.  
  834. static void classNameAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  835. {
  836.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  837.     ElementV8Internal::classNameAttributeGetter(info);
  838.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  839. }
  840.  
  841. static void classNameAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  842. {
  843.     v8::Handle<v8::Object> holder = info.Holder();
  844.     Element* impl = V8Element::toNative(holder);
  845.     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
  846.     impl->setAttribute(HTMLNames::classAttr, cppValue);
  847. }
  848.  
  849. static void classNameAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  850. {
  851.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  852.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  853.     ElementV8Internal::classNameAttributeSetter(v8Value, info);
  854.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  855. }
  856.  
  857. static void classNameAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  858. {
  859.     v8::Handle<v8::Object> holder = info.Holder();
  860.     Element* impl = V8Element::toNative(holder);
  861.     v8SetReturnValueString(info, impl->getClassAttribute(), info.GetIsolate());
  862. }
  863.  
  864. static void classNameAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  865. {
  866.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  867.     ElementV8Internal::classNameAttributeGetterForMainWorld(info);
  868.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  869. }
  870.  
  871. static void classNameAttributeSetterForMainWorld(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  872. {
  873.     v8::Handle<v8::Object> holder = info.Holder();
  874.     Element* impl = V8Element::toNative(holder);
  875.     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
  876.     impl->setAttribute(HTMLNames::classAttr, cppValue);
  877. }
  878.  
  879. static void classNameAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  880. {
  881.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  882.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  883.     ElementV8Internal::classNameAttributeSetterForMainWorld(v8Value, info);
  884.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  885. }
  886.  
  887. static void classListAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  888. {
  889.     v8::Handle<v8::Object> holder = info.Holder();
  890.     Element* impl = V8Element::toNative(holder);
  891.     v8SetReturnValueFast(info, WTF::getPtr(impl->classList()), impl);
  892. }
  893.  
  894. static void classListAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  895. {
  896.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  897.     ElementV8Internal::classListAttributeGetter(info);
  898.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  899. }
  900.  
  901. static void classListAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  902. {
  903.     v8::Handle<v8::Object> holder = info.Holder();
  904.     Element* impl = V8Element::toNative(holder);
  905.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->classList()));
  906. }
  907.  
  908. static void classListAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  909. {
  910.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  911.     ElementV8Internal::classListAttributeGetterForMainWorld(info);
  912.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  913. }
  914.  
  915. static void datasetAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  916. {
  917.     v8::Handle<v8::Object> holder = info.Holder();
  918.     Element* impl = V8Element::toNative(holder);
  919.     v8SetReturnValueFast(info, WTF::getPtr(impl->dataset()), impl);
  920. }
  921.  
  922. static void datasetAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  923. {
  924.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  925.     ElementV8Internal::datasetAttributeGetter(info);
  926.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  927. }
  928.  
  929. static void datasetAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  930. {
  931.     v8::Handle<v8::Object> holder = info.Holder();
  932.     Element* impl = V8Element::toNative(holder);
  933.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->dataset()));
  934. }
  935.  
  936. static void datasetAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  937. {
  938.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  939.     ElementV8Internal::datasetAttributeGetterForMainWorld(info);
  940.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  941. }
  942.  
  943. static void shadowRootAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  944. {
  945.     v8::Handle<v8::Object> holder = info.Holder();
  946.     Element* impl = V8Element::toNative(holder);
  947.     v8SetReturnValueFast(info, WTF::getPtr(impl->shadowRoot()), impl);
  948. }
  949.  
  950. static void shadowRootAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  951. {
  952.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  953.     ElementV8Internal::shadowRootAttributeGetter(info);
  954.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  955. }
  956.  
  957. static void shadowRootAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  958. {
  959.     v8::Handle<v8::Object> holder = info.Holder();
  960.     Element* impl = V8Element::toNative(holder);
  961.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->shadowRoot()));
  962. }
  963.  
  964. static void shadowRootAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  965. {
  966.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  967.     ElementV8Internal::shadowRootAttributeGetterForMainWorld(info);
  968.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  969. }
  970.  
  971. static void onbeforecopyAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  972. {
  973.     v8::Handle<v8::Object> holder = info.Holder();
  974.     Element* impl = V8Element::toNative(holder);
  975.     EventListener* v8Value = impl->onbeforecopy();
  976.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  977. }
  978.  
  979. static void onbeforecopyAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  980. {
  981.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  982.     ElementV8Internal::onbeforecopyAttributeGetter(info);
  983.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  984. }
  985.  
  986. static void onbeforecopyAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  987. {
  988.     v8::Handle<v8::Object> holder = info.Holder();
  989.     Element* impl = V8Element::toNative(holder);
  990.     impl->setOnbeforecopy(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  991. }
  992.  
  993. static void onbeforecopyAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  994. {
  995.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  996.     ElementV8Internal::onbeforecopyAttributeSetter(v8Value, info);
  997.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  998. }
  999.  
  1000. static void onbeforecutAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1001. {
  1002.     v8::Handle<v8::Object> holder = info.Holder();
  1003.     Element* impl = V8Element::toNative(holder);
  1004.     EventListener* v8Value = impl->onbeforecut();
  1005.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1006. }
  1007.  
  1008. static void onbeforecutAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1009. {
  1010.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1011.     ElementV8Internal::onbeforecutAttributeGetter(info);
  1012.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1013. }
  1014.  
  1015. static void onbeforecutAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1016. {
  1017.     v8::Handle<v8::Object> holder = info.Holder();
  1018.     Element* impl = V8Element::toNative(holder);
  1019.     impl->setOnbeforecut(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1020. }
  1021.  
  1022. static void onbeforecutAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1023. {
  1024.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1025.     ElementV8Internal::onbeforecutAttributeSetter(v8Value, info);
  1026.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1027. }
  1028.  
  1029. static void onbeforepasteAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1030. {
  1031.     v8::Handle<v8::Object> holder = info.Holder();
  1032.     Element* impl = V8Element::toNative(holder);
  1033.     EventListener* v8Value = impl->onbeforepaste();
  1034.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1035. }
  1036.  
  1037. static void onbeforepasteAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1038. {
  1039.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1040.     ElementV8Internal::onbeforepasteAttributeGetter(info);
  1041.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1042. }
  1043.  
  1044. static void onbeforepasteAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1045. {
  1046.     v8::Handle<v8::Object> holder = info.Holder();
  1047.     Element* impl = V8Element::toNative(holder);
  1048.     impl->setOnbeforepaste(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1049. }
  1050.  
  1051. static void onbeforepasteAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1052. {
  1053.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1054.     ElementV8Internal::onbeforepasteAttributeSetter(v8Value, info);
  1055.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1056. }
  1057.  
  1058. static void oncopyAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1059. {
  1060.     v8::Handle<v8::Object> holder = info.Holder();
  1061.     Element* impl = V8Element::toNative(holder);
  1062.     EventListener* v8Value = impl->oncopy();
  1063.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1064. }
  1065.  
  1066. static void oncopyAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1067. {
  1068.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1069.     ElementV8Internal::oncopyAttributeGetter(info);
  1070.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1071. }
  1072.  
  1073. static void oncopyAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1074. {
  1075.     v8::Handle<v8::Object> holder = info.Holder();
  1076.     Element* impl = V8Element::toNative(holder);
  1077.     impl->setOncopy(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1078. }
  1079.  
  1080. static void oncopyAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1081. {
  1082.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1083.     ElementV8Internal::oncopyAttributeSetter(v8Value, info);
  1084.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1085. }
  1086.  
  1087. static void oncutAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1088. {
  1089.     v8::Handle<v8::Object> holder = info.Holder();
  1090.     Element* impl = V8Element::toNative(holder);
  1091.     EventListener* v8Value = impl->oncut();
  1092.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1093. }
  1094.  
  1095. static void oncutAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1096. {
  1097.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1098.     ElementV8Internal::oncutAttributeGetter(info);
  1099.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1100. }
  1101.  
  1102. static void oncutAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1103. {
  1104.     v8::Handle<v8::Object> holder = info.Holder();
  1105.     Element* impl = V8Element::toNative(holder);
  1106.     impl->setOncut(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1107. }
  1108.  
  1109. static void oncutAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1110. {
  1111.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1112.     ElementV8Internal::oncutAttributeSetter(v8Value, info);
  1113.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1114. }
  1115.  
  1116. static void onpasteAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1117. {
  1118.     v8::Handle<v8::Object> holder = info.Holder();
  1119.     Element* impl = V8Element::toNative(holder);
  1120.     EventListener* v8Value = impl->onpaste();
  1121.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1122. }
  1123.  
  1124. static void onpasteAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1125. {
  1126.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1127.     ElementV8Internal::onpasteAttributeGetter(info);
  1128.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1129. }
  1130.  
  1131. static void onpasteAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1132. {
  1133.     v8::Handle<v8::Object> holder = info.Holder();
  1134.     Element* impl = V8Element::toNative(holder);
  1135.     impl->setOnpaste(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1136. }
  1137.  
  1138. static void onpasteAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1139. {
  1140.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1141.     ElementV8Internal::onpasteAttributeSetter(v8Value, info);
  1142.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1143. }
  1144.  
  1145. static void onsearchAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1146. {
  1147.     v8::Handle<v8::Object> holder = info.Holder();
  1148.     Element* impl = V8Element::toNative(holder);
  1149.     EventListener* v8Value = impl->onsearch();
  1150.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1151. }
  1152.  
  1153. static void onsearchAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1154. {
  1155.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1156.     ElementV8Internal::onsearchAttributeGetter(info);
  1157.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1158. }
  1159.  
  1160. static void onsearchAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1161. {
  1162.     v8::Handle<v8::Object> holder = info.Holder();
  1163.     Element* impl = V8Element::toNative(holder);
  1164.     impl->setOnsearch(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1165. }
  1166.  
  1167. static void onsearchAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1168. {
  1169.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1170.     ElementV8Internal::onsearchAttributeSetter(v8Value, info);
  1171.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1172. }
  1173.  
  1174. static void onselectstartAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1175. {
  1176.     v8::Handle<v8::Object> holder = info.Holder();
  1177.     Element* impl = V8Element::toNative(holder);
  1178.     EventListener* v8Value = impl->onselectstart();
  1179.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1180. }
  1181.  
  1182. static void onselectstartAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1183. {
  1184.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1185.     ElementV8Internal::onselectstartAttributeGetter(info);
  1186.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1187. }
  1188.  
  1189. static void onselectstartAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1190. {
  1191.     v8::Handle<v8::Object> holder = info.Holder();
  1192.     Element* impl = V8Element::toNative(holder);
  1193.     impl->setOnselectstart(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1194. }
  1195.  
  1196. static void onselectstartAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1197. {
  1198.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1199.     ElementV8Internal::onselectstartAttributeSetter(v8Value, info);
  1200.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1201. }
  1202.  
  1203. static void ontouchcancelAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1204. {
  1205.     v8::Handle<v8::Object> holder = info.Holder();
  1206.     Element* impl = V8Element::toNative(holder);
  1207.     EventListener* v8Value = impl->ontouchcancel();
  1208.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1209. }
  1210.  
  1211. static void ontouchcancelAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1212. {
  1213.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1214.     ElementV8Internal::ontouchcancelAttributeGetter(info);
  1215.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1216. }
  1217.  
  1218. static void ontouchcancelAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1219. {
  1220.     v8::Handle<v8::Object> holder = info.Holder();
  1221.     Element* impl = V8Element::toNative(holder);
  1222.     impl->setOntouchcancel(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1223. }
  1224.  
  1225. static void ontouchcancelAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1226. {
  1227.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1228.     ElementV8Internal::ontouchcancelAttributeSetter(v8Value, info);
  1229.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1230. }
  1231.  
  1232. static void ontouchendAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1233. {
  1234.     v8::Handle<v8::Object> holder = info.Holder();
  1235.     Element* impl = V8Element::toNative(holder);
  1236.     EventListener* v8Value = impl->ontouchend();
  1237.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1238. }
  1239.  
  1240. static void ontouchendAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1241. {
  1242.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1243.     ElementV8Internal::ontouchendAttributeGetter(info);
  1244.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1245. }
  1246.  
  1247. static void ontouchendAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1248. {
  1249.     v8::Handle<v8::Object> holder = info.Holder();
  1250.     Element* impl = V8Element::toNative(holder);
  1251.     impl->setOntouchend(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1252. }
  1253.  
  1254. static void ontouchendAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1255. {
  1256.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1257.     ElementV8Internal::ontouchendAttributeSetter(v8Value, info);
  1258.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1259. }
  1260.  
  1261. static void ontouchmoveAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1262. {
  1263.     v8::Handle<v8::Object> holder = info.Holder();
  1264.     Element* impl = V8Element::toNative(holder);
  1265.     EventListener* v8Value = impl->ontouchmove();
  1266.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1267. }
  1268.  
  1269. static void ontouchmoveAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1270. {
  1271.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1272.     ElementV8Internal::ontouchmoveAttributeGetter(info);
  1273.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1274. }
  1275.  
  1276. static void ontouchmoveAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1277. {
  1278.     v8::Handle<v8::Object> holder = info.Holder();
  1279.     Element* impl = V8Element::toNative(holder);
  1280.     impl->setOntouchmove(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1281. }
  1282.  
  1283. static void ontouchmoveAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1284. {
  1285.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1286.     ElementV8Internal::ontouchmoveAttributeSetter(v8Value, info);
  1287.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1288. }
  1289.  
  1290. static void ontouchstartAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1291. {
  1292.     v8::Handle<v8::Object> holder = info.Holder();
  1293.     Element* impl = V8Element::toNative(holder);
  1294.     EventListener* v8Value = impl->ontouchstart();
  1295.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1296. }
  1297.  
  1298. static void ontouchstartAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1299. {
  1300.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1301.     ElementV8Internal::ontouchstartAttributeGetter(info);
  1302.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1303. }
  1304.  
  1305. static void ontouchstartAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1306. {
  1307.     v8::Handle<v8::Object> holder = info.Holder();
  1308.     Element* impl = V8Element::toNative(holder);
  1309.     impl->setOntouchstart(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1310. }
  1311.  
  1312. static void ontouchstartAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1313. {
  1314.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1315.     ElementV8Internal::ontouchstartAttributeSetter(v8Value, info);
  1316.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1317. }
  1318.  
  1319. static void onwebkitfullscreenchangeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1320. {
  1321.     v8::Handle<v8::Object> holder = info.Holder();
  1322.     Element* impl = V8Element::toNative(holder);
  1323.     EventListener* v8Value = impl->onwebkitfullscreenchange();
  1324.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1325. }
  1326.  
  1327. static void onwebkitfullscreenchangeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1328. {
  1329.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1330.     ElementV8Internal::onwebkitfullscreenchangeAttributeGetter(info);
  1331.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1332. }
  1333.  
  1334. static void onwebkitfullscreenchangeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1335. {
  1336.     v8::Handle<v8::Object> holder = info.Holder();
  1337.     Element* impl = V8Element::toNative(holder);
  1338.     impl->setOnwebkitfullscreenchange(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1339. }
  1340.  
  1341. static void onwebkitfullscreenchangeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1342. {
  1343.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1344.     ElementV8Internal::onwebkitfullscreenchangeAttributeSetter(v8Value, info);
  1345.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1346. }
  1347.  
  1348. static void onwebkitfullscreenerrorAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1349. {
  1350.     v8::Handle<v8::Object> holder = info.Holder();
  1351.     Element* impl = V8Element::toNative(holder);
  1352.     EventListener* v8Value = impl->onwebkitfullscreenerror();
  1353.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1354. }
  1355.  
  1356. static void onwebkitfullscreenerrorAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1357. {
  1358.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1359.     ElementV8Internal::onwebkitfullscreenerrorAttributeGetter(info);
  1360.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1361. }
  1362.  
  1363. static void onwebkitfullscreenerrorAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1364. {
  1365.     v8::Handle<v8::Object> holder = info.Holder();
  1366.     Element* impl = V8Element::toNative(holder);
  1367.     impl->setOnwebkitfullscreenerror(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1368. }
  1369.  
  1370. static void onwebkitfullscreenerrorAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1371. {
  1372.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1373.     ElementV8Internal::onwebkitfullscreenerrorAttributeSetter(v8Value, info);
  1374.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1375. }
  1376.  
  1377. static void onwheelAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1378. {
  1379.     v8::Handle<v8::Object> holder = info.Holder();
  1380.     Element* impl = V8Element::toNative(holder);
  1381.     EventListener* v8Value = impl->onwheel();
  1382.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1383. }
  1384.  
  1385. static void onwheelAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1386. {
  1387.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1388.     ElementV8Internal::onwheelAttributeGetter(info);
  1389.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1390. }
  1391.  
  1392. static void onwheelAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1393. {
  1394.     v8::Handle<v8::Object> holder = info.Holder();
  1395.     Element* impl = V8Element::toNative(holder);
  1396.     impl->setOnwheel(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1397. }
  1398.  
  1399. static void onwheelAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1400. {
  1401.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1402.     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
  1403.     if (contextData && contextData->activityLogger()) {
  1404.         v8::Handle<v8::Value> loggerArg[] = { v8Value };
  1405.         contextData->activityLogger()->log("Element.onwheel", 1, &loggerArg[0], "Setter");
  1406.     }
  1407.     ElementV8Internal::onwheelAttributeSetter(v8Value, info);
  1408.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1409. }
  1410.  
  1411. static void onwheelAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1412. {
  1413.     v8::Handle<v8::Object> holder = info.Holder();
  1414.     Element* impl = V8Element::toNative(holder);
  1415.     EventListener* v8Value = impl->onwheel();
  1416.     v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
  1417. }
  1418.  
  1419. static void onwheelAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1420. {
  1421.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1422.     ElementV8Internal::onwheelAttributeGetterForMainWorld(info);
  1423.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1424. }
  1425.  
  1426. static void onwheelAttributeSetterForMainWorld(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1427. {
  1428.     v8::Handle<v8::Object> holder = info.Holder();
  1429.     Element* impl = V8Element::toNative(holder);
  1430.     impl->setOnwheel(V8EventListenerList::getEventListener(v8Value, true, ListenerFindOrCreate));
  1431. }
  1432.  
  1433. static void onwheelAttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
  1434. {
  1435.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
  1436.     ElementV8Internal::onwheelAttributeSetterForMainWorld(v8Value, info);
  1437.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1438. }
  1439.  
  1440. static void previousElementSiblingAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1441. {
  1442.     v8::Handle<v8::Object> holder = info.Holder();
  1443.     Element* impl = V8Element::toNative(holder);
  1444.     ASSERT(impl);
  1445.     v8SetReturnValueFast(info, WTF::getPtr(ChildNode::previousElementSibling(*impl)), impl);
  1446. }
  1447.  
  1448. static void previousElementSiblingAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1449. {
  1450.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1451.     ElementV8Internal::previousElementSiblingAttributeGetter(info);
  1452.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1453. }
  1454.  
  1455. static void previousElementSiblingAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1456. {
  1457.     v8::Handle<v8::Object> holder = info.Holder();
  1458.     Element* impl = V8Element::toNative(holder);
  1459.     ASSERT(impl);
  1460.     v8SetReturnValueForMainWorld(info, WTF::getPtr(ChildNode::previousElementSibling(*impl)));
  1461. }
  1462.  
  1463. static void previousElementSiblingAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1464. {
  1465.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1466.     ElementV8Internal::previousElementSiblingAttributeGetterForMainWorld(info);
  1467.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1468. }
  1469.  
  1470. static void nextElementSiblingAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1471. {
  1472.     v8::Handle<v8::Object> holder = info.Holder();
  1473.     Element* impl = V8Element::toNative(holder);
  1474.     ASSERT(impl);
  1475.     v8SetReturnValueFast(info, WTF::getPtr(ChildNode::nextElementSibling(*impl)), impl);
  1476. }
  1477.  
  1478. static void nextElementSiblingAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1479. {
  1480.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1481.     ElementV8Internal::nextElementSiblingAttributeGetter(info);
  1482.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1483. }
  1484.  
  1485. static void nextElementSiblingAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1486. {
  1487.     v8::Handle<v8::Object> holder = info.Holder();
  1488.     Element* impl = V8Element::toNative(holder);
  1489.     ASSERT(impl);
  1490.     v8SetReturnValueForMainWorld(info, WTF::getPtr(ChildNode::nextElementSibling(*impl)));
  1491. }
  1492.  
  1493. static void nextElementSiblingAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1494. {
  1495.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1496.     ElementV8Internal::nextElementSiblingAttributeGetterForMainWorld(info);
  1497.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1498. }
  1499.  
  1500. static void childrenAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1501. {
  1502.     v8::Handle<v8::Object> holder = info.Holder();
  1503.     Element* impl = V8Element::toNative(holder);
  1504.     ASSERT(impl);
  1505.     v8SetReturnValueFast(info, WTF::getPtr(ParentNode::children(*impl)), impl);
  1506. }
  1507.  
  1508. static void childrenAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1509. {
  1510.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1511.     ElementV8Internal::childrenAttributeGetter(info);
  1512.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1513. }
  1514.  
  1515. static void childrenAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1516. {
  1517.     v8::Handle<v8::Object> holder = info.Holder();
  1518.     Element* impl = V8Element::toNative(holder);
  1519.     ASSERT(impl);
  1520.     v8SetReturnValueForMainWorld(info, WTF::getPtr(ParentNode::children(*impl)));
  1521. }
  1522.  
  1523. static void childrenAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1524. {
  1525.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1526.     ElementV8Internal::childrenAttributeGetterForMainWorld(info);
  1527.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1528. }
  1529.  
  1530. static void firstElementChildAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1531. {
  1532.     v8::Handle<v8::Object> holder = info.Holder();
  1533.     Element* impl = V8Element::toNative(holder);
  1534.     ASSERT(impl);
  1535.     v8SetReturnValueFast(info, WTF::getPtr(ParentNode::firstElementChild(*impl)), impl);
  1536. }
  1537.  
  1538. static void firstElementChildAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1539. {
  1540.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1541.     ElementV8Internal::firstElementChildAttributeGetter(info);
  1542.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1543. }
  1544.  
  1545. static void firstElementChildAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1546. {
  1547.     v8::Handle<v8::Object> holder = info.Holder();
  1548.     Element* impl = V8Element::toNative(holder);
  1549.     ASSERT(impl);
  1550.     v8SetReturnValueForMainWorld(info, WTF::getPtr(ParentNode::firstElementChild(*impl)));
  1551. }
  1552.  
  1553. static void firstElementChildAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1554. {
  1555.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1556.     ElementV8Internal::firstElementChildAttributeGetterForMainWorld(info);
  1557.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1558. }
  1559.  
  1560. static void lastElementChildAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1561. {
  1562.     v8::Handle<v8::Object> holder = info.Holder();
  1563.     Element* impl = V8Element::toNative(holder);
  1564.     ASSERT(impl);
  1565.     v8SetReturnValueFast(info, WTF::getPtr(ParentNode::lastElementChild(*impl)), impl);
  1566. }
  1567.  
  1568. static void lastElementChildAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1569. {
  1570.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1571.     ElementV8Internal::lastElementChildAttributeGetter(info);
  1572.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1573. }
  1574.  
  1575. static void lastElementChildAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1576. {
  1577.     v8::Handle<v8::Object> holder = info.Holder();
  1578.     Element* impl = V8Element::toNative(holder);
  1579.     ASSERT(impl);
  1580.     v8SetReturnValueForMainWorld(info, WTF::getPtr(ParentNode::lastElementChild(*impl)));
  1581. }
  1582.  
  1583. static void lastElementChildAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1584. {
  1585.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1586.     ElementV8Internal::lastElementChildAttributeGetterForMainWorld(info);
  1587.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1588. }
  1589.  
  1590. static void childElementCountAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
  1591. {
  1592.     v8::Handle<v8::Object> holder = info.Holder();
  1593.     Element* impl = V8Element::toNative(holder);
  1594.     ASSERT(impl);
  1595.     v8SetReturnValueUnsigned(info, ParentNode::childElementCount(*impl));
  1596. }
  1597.  
  1598. static void childElementCountAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1599. {
  1600.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1601.     ElementV8Internal::childElementCountAttributeGetter(info);
  1602.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1603. }
  1604.  
  1605. static void childElementCountAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
  1606. {
  1607.     v8::Handle<v8::Object> holder = info.Holder();
  1608.     Element* impl = V8Element::toNative(holder);
  1609.     ASSERT(impl);
  1610.     v8SetReturnValueUnsigned(info, ParentNode::childElementCount(*impl));
  1611. }
  1612.  
  1613. static void childElementCountAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
  1614. {
  1615.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
  1616.     ElementV8Internal::childElementCountAttributeGetterForMainWorld(info);
  1617.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1618. }
  1619.  
  1620. static void getAttributeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1621. {
  1622.     if (UNLIKELY(info.Length() < 1)) {
  1623.         throwArityTypeErrorForMethod("getAttribute", "Element", 1, info.Length(), info.GetIsolate());
  1624.         return;
  1625.     }
  1626.     Element* impl = V8Element::toNative(info.Holder());
  1627.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1628.     v8SetReturnValueStringOrNull(info, impl->getAttribute(name), info.GetIsolate());
  1629. }
  1630.  
  1631. static void getAttributeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1632. {
  1633.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1634.     ElementV8Internal::getAttributeMethod(info);
  1635.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1636. }
  1637.  
  1638. static void setAttributeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1639. {
  1640.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "setAttribute", "Element", info.Holder(), info.GetIsolate());
  1641.     if (UNLIKELY(info.Length() < 2)) {
  1642.         throwArityTypeError(exceptionState, 2, info.Length());
  1643.         return;
  1644.     }
  1645.     Element* impl = V8Element::toNative(info.Holder());
  1646.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1647.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1648.     TOSTRING_VOID(V8StringResource<>, value, info[1]);
  1649.     impl->setAttribute(name, value, exceptionState);
  1650.     if (exceptionState.throwIfNeeded())
  1651.         return;
  1652. }
  1653.  
  1654. static void setAttributeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1655. {
  1656.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1657.     ElementV8Internal::setAttributeMethod(info);
  1658.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1659. }
  1660.  
  1661. static void removeAttributeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1662. {
  1663.     if (UNLIKELY(info.Length() < 1)) {
  1664.         throwArityTypeErrorForMethod("removeAttribute", "Element", 1, info.Length(), info.GetIsolate());
  1665.         return;
  1666.     }
  1667.     Element* impl = V8Element::toNative(info.Holder());
  1668.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1669.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1670.     impl->removeAttribute(name);
  1671. }
  1672.  
  1673. static void removeAttributeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1674. {
  1675.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1676.     ElementV8Internal::removeAttributeMethod(info);
  1677.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1678. }
  1679.  
  1680. static void getAttributeNodeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1681. {
  1682.     Element* impl = V8Element::toNative(info.Holder());
  1683.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1684.     v8SetReturnValueFast(info, WTF::getPtr(impl->getAttributeNode(name)), impl);
  1685. }
  1686.  
  1687. static void getAttributeNodeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1688. {
  1689.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1690.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::ElementGetAttributeNode);
  1691.     ElementV8Internal::getAttributeNodeMethod(info);
  1692.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1693. }
  1694.  
  1695. static void setAttributeNodeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1696. {
  1697.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "setAttributeNode", "Element", info.Holder(), info.GetIsolate());
  1698.     Element* impl = V8Element::toNative(info.Holder());
  1699.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1700.     TONATIVE_VOID(Attr*, newAttr, V8Attr::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
  1701.     RefPtr<Attr> result = impl->setAttributeNode(newAttr, exceptionState);
  1702.     if (exceptionState.throwIfNeeded())
  1703.         return;
  1704.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  1705. }
  1706.  
  1707. static void setAttributeNodeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1708. {
  1709.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1710.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::ElementSetAttributeNode);
  1711.     ElementV8Internal::setAttributeNodeMethod(info);
  1712.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1713. }
  1714.  
  1715. static void removeAttributeNodeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1716. {
  1717.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeAttributeNode", "Element", info.Holder(), info.GetIsolate());
  1718.     Element* impl = V8Element::toNative(info.Holder());
  1719.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1720.     TONATIVE_VOID(Attr*, oldAttr, V8Attr::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
  1721.     RefPtr<Attr> result = impl->removeAttributeNode(oldAttr, exceptionState);
  1722.     if (exceptionState.throwIfNeeded())
  1723.         return;
  1724.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  1725. }
  1726.  
  1727. static void removeAttributeNodeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1728. {
  1729.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1730.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::ElementRemoveAttributeNode);
  1731.     ElementV8Internal::removeAttributeNodeMethod(info);
  1732.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1733. }
  1734.  
  1735. static void getElementsByTagNameMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1736. {
  1737.     if (UNLIKELY(info.Length() < 1)) {
  1738.         throwArityTypeErrorForMethod("getElementsByTagName", "Element", 1, info.Length(), info.GetIsolate());
  1739.         return;
  1740.     }
  1741.     Element* impl = V8Element::toNative(info.Holder());
  1742.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1743.     v8SetReturnValueFast(info, WTF::getPtr(impl->getElementsByTagName(name)), impl);
  1744. }
  1745.  
  1746. static void getElementsByTagNameMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1747. {
  1748.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1749.     ElementV8Internal::getElementsByTagNameMethod(info);
  1750.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1751. }
  1752.  
  1753. static void getElementsByTagNameMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  1754. {
  1755.     if (UNLIKELY(info.Length() < 1)) {
  1756.         throwArityTypeErrorForMethod("getElementsByTagName", "Element", 1, info.Length(), info.GetIsolate());
  1757.         return;
  1758.     }
  1759.     Element* impl = V8Element::toNative(info.Holder());
  1760.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1761.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->getElementsByTagName(name)));
  1762. }
  1763.  
  1764. static void getElementsByTagNameMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  1765. {
  1766.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1767.     ElementV8Internal::getElementsByTagNameMethodForMainWorld(info);
  1768.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1769. }
  1770.  
  1771. static void hasAttributesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1772. {
  1773.     Element* impl = V8Element::toNative(info.Holder());
  1774.     v8SetReturnValueBool(info, impl->hasAttributes());
  1775. }
  1776.  
  1777. static void hasAttributesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1778. {
  1779.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1780.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::HasAttributes);
  1781.     ElementV8Internal::hasAttributesMethod(info);
  1782.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1783. }
  1784.  
  1785. static void getAttributeNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1786. {
  1787.     if (UNLIKELY(info.Length() < 2)) {
  1788.         throwArityTypeErrorForMethod("getAttributeNS", "Element", 2, info.Length(), info.GetIsolate());
  1789.         return;
  1790.     }
  1791.     Element* impl = V8Element::toNative(info.Holder());
  1792.     TOSTRING_VOID(V8StringResource<WithNullCheck>, namespaceURI, info[0]);
  1793.     TOSTRING_VOID(V8StringResource<>, localName, info[1]);
  1794.     v8SetReturnValueStringOrNull(info, impl->getAttributeNS(namespaceURI, localName), info.GetIsolate());
  1795. }
  1796.  
  1797. static void getAttributeNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1798. {
  1799.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1800.     ElementV8Internal::getAttributeNSMethod(info);
  1801.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1802. }
  1803.  
  1804. static void setAttributeNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1805. {
  1806.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "setAttributeNS", "Element", info.Holder(), info.GetIsolate());
  1807.     if (UNLIKELY(info.Length() < 3)) {
  1808.         throwArityTypeError(exceptionState, 3, info.Length());
  1809.         return;
  1810.     }
  1811.     Element* impl = V8Element::toNative(info.Holder());
  1812.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1813.     TOSTRING_VOID(V8StringResource<WithNullCheck>, namespaceURI, info[0]);
  1814.     TOSTRING_VOID(V8StringResource<>, qualifiedName, info[1]);
  1815.     TOSTRING_VOID(V8StringResource<>, value, info[2]);
  1816.     impl->setAttributeNS(namespaceURI, qualifiedName, value, exceptionState);
  1817.     if (exceptionState.throwIfNeeded())
  1818.         return;
  1819. }
  1820.  
  1821. static void setAttributeNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1822. {
  1823.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1824.     ElementV8Internal::setAttributeNSMethod(info);
  1825.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1826. }
  1827.  
  1828. static void removeAttributeNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1829. {
  1830.     if (UNLIKELY(info.Length() < 2)) {
  1831.         throwArityTypeErrorForMethod("removeAttributeNS", "Element", 2, info.Length(), info.GetIsolate());
  1832.         return;
  1833.     }
  1834.     Element* impl = V8Element::toNative(info.Holder());
  1835.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1836.     TOSTRING_VOID(V8StringResource<WithNullCheck>, namespaceURI, info[0]);
  1837.     TOSTRING_VOID(V8StringResource<>, localName, info[1]);
  1838.     impl->removeAttributeNS(namespaceURI, localName);
  1839. }
  1840.  
  1841. static void removeAttributeNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1842. {
  1843.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1844.     ElementV8Internal::removeAttributeNSMethod(info);
  1845.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1846. }
  1847.  
  1848. static void getElementsByTagNameNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1849. {
  1850.     if (UNLIKELY(info.Length() < 2)) {
  1851.         throwArityTypeErrorForMethod("getElementsByTagNameNS", "Element", 2, info.Length(), info.GetIsolate());
  1852.         return;
  1853.     }
  1854.     Element* impl = V8Element::toNative(info.Holder());
  1855.     TOSTRING_VOID(V8StringResource<WithNullCheck>, namespaceURI, info[0]);
  1856.     TOSTRING_VOID(V8StringResource<>, localName, info[1]);
  1857.     v8SetReturnValueFast(info, WTF::getPtr(impl->getElementsByTagNameNS(namespaceURI, localName)), impl);
  1858. }
  1859.  
  1860. static void getElementsByTagNameNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1861. {
  1862.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1863.     ElementV8Internal::getElementsByTagNameNSMethod(info);
  1864.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1865. }
  1866.  
  1867. static void getAttributeNodeNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1868. {
  1869.     Element* impl = V8Element::toNative(info.Holder());
  1870.     TOSTRING_VOID(V8StringResource<WithNullCheck>, namespaceURI, info[0]);
  1871.     TOSTRING_VOID(V8StringResource<>, localName, info[1]);
  1872.     v8SetReturnValueFast(info, WTF::getPtr(impl->getAttributeNodeNS(namespaceURI, localName)), impl);
  1873. }
  1874.  
  1875. static void getAttributeNodeNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1876. {
  1877.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1878.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::ElementGetAttributeNodeNS);
  1879.     ElementV8Internal::getAttributeNodeNSMethod(info);
  1880.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1881. }
  1882.  
  1883. static void setAttributeNodeNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1884. {
  1885.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "setAttributeNodeNS", "Element", info.Holder(), info.GetIsolate());
  1886.     Element* impl = V8Element::toNative(info.Holder());
  1887.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  1888.     TONATIVE_VOID(Attr*, newAttr, V8Attr::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
  1889.     RefPtr<Attr> result = impl->setAttributeNodeNS(newAttr, exceptionState);
  1890.     if (exceptionState.throwIfNeeded())
  1891.         return;
  1892.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  1893. }
  1894.  
  1895. static void setAttributeNodeNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1896. {
  1897.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1898.     UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::ElementSetAttributeNodeNS);
  1899.     ElementV8Internal::setAttributeNodeNSMethod(info);
  1900.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1901. }
  1902.  
  1903. static void hasAttributeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1904. {
  1905.     if (UNLIKELY(info.Length() < 1)) {
  1906.         throwArityTypeErrorForMethod("hasAttribute", "Element", 1, info.Length(), info.GetIsolate());
  1907.         return;
  1908.     }
  1909.     Element* impl = V8Element::toNative(info.Holder());
  1910.     TOSTRING_VOID(V8StringResource<>, name, info[0]);
  1911.     v8SetReturnValueBool(info, impl->hasAttribute(name));
  1912. }
  1913.  
  1914. static void hasAttributeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1915. {
  1916.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1917.     ElementV8Internal::hasAttributeMethod(info);
  1918.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1919. }
  1920.  
  1921. static void hasAttributeNSMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1922. {
  1923.     if (UNLIKELY(info.Length() < 2)) {
  1924.         throwArityTypeErrorForMethod("hasAttributeNS", "Element", 2, info.Length(), info.GetIsolate());
  1925.         return;
  1926.     }
  1927.     Element* impl = V8Element::toNative(info.Holder());
  1928.     TOSTRING_VOID(V8StringResource<WithNullCheck>, namespaceURI, info[0]);
  1929.     TOSTRING_VOID(V8StringResource<>, localName, info[1]);
  1930.     v8SetReturnValueBool(info, impl->hasAttributeNS(namespaceURI, localName));
  1931. }
  1932.  
  1933. static void hasAttributeNSMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1934. {
  1935.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1936.     ElementV8Internal::hasAttributeNSMethod(info);
  1937.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1938. }
  1939.  
  1940. static void matchesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1941. {
  1942.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "matches", "Element", info.Holder(), info.GetIsolate());
  1943.     if (UNLIKELY(info.Length() < 1)) {
  1944.         throwArityTypeError(exceptionState, 1, info.Length());
  1945.         return;
  1946.     }
  1947.     Element* impl = V8Element::toNative(info.Holder());
  1948.     TOSTRING_VOID(V8StringResource<>, selectors, info[0]);
  1949.     bool result = impl->matches(selectors, exceptionState);
  1950.     if (exceptionState.throwIfNeeded())
  1951.         return;
  1952.     v8SetReturnValueBool(info, result);
  1953. }
  1954.  
  1955. static void matchesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1956. {
  1957.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1958.     ElementV8Internal::matchesMethod(info);
  1959.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1960. }
  1961.  
  1962. static void focusMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1963. {
  1964.     Element* impl = V8Element::toNative(info.Holder());
  1965.     impl->focus();
  1966. }
  1967.  
  1968. static void focusMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1969. {
  1970.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1971.     ElementV8Internal::focusMethod(info);
  1972.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1973. }
  1974.  
  1975. static void blurMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1976. {
  1977.     Element* impl = V8Element::toNative(info.Holder());
  1978.     impl->blur();
  1979. }
  1980.  
  1981. static void blurMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  1982. {
  1983.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  1984.     ElementV8Internal::blurMethod(info);
  1985.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  1986. }
  1987.  
  1988. static void scrollIntoViewMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  1989. {
  1990.     Element* impl = V8Element::toNative(info.Holder());
  1991.     if (UNLIKELY(info.Length() <= 0)) {
  1992.         impl->scrollIntoView();
  1993.         return;
  1994.     }
  1995.     TONATIVE_VOID(bool, alignWithTop, info[0]->BooleanValue());
  1996.     impl->scrollIntoView(alignWithTop);
  1997. }
  1998.  
  1999. static void scrollIntoViewMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2000. {
  2001.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2002.     ElementV8Internal::scrollIntoViewMethod(info);
  2003.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2004. }
  2005.  
  2006. static void scrollIntoViewIfNeededMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2007. {
  2008.     Element* impl = V8Element::toNative(info.Holder());
  2009.     if (UNLIKELY(info.Length() <= 0)) {
  2010.         impl->scrollIntoViewIfNeeded();
  2011.         return;
  2012.     }
  2013.     TONATIVE_VOID(bool, centerIfNeeded, info[0]->BooleanValue());
  2014.     impl->scrollIntoViewIfNeeded(centerIfNeeded);
  2015. }
  2016.  
  2017. static void scrollIntoViewIfNeededMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2018. {
  2019.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2020.     ElementV8Internal::scrollIntoViewIfNeededMethod(info);
  2021.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2022. }
  2023.  
  2024. static void scrollByLinesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2025. {
  2026.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "scrollByLines", "Element", info.Holder(), info.GetIsolate());
  2027.     Element* impl = V8Element::toNative(info.Holder());
  2028.     TONATIVE_VOID_EXCEPTIONSTATE(int, lines, toInt32(info[0], exceptionState), exceptionState);
  2029.     impl->scrollByLines(lines);
  2030. }
  2031.  
  2032. static void scrollByLinesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2033. {
  2034.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2035.     ElementV8Internal::scrollByLinesMethod(info);
  2036.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2037. }
  2038.  
  2039. static void scrollByPagesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2040. {
  2041.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "scrollByPages", "Element", info.Holder(), info.GetIsolate());
  2042.     Element* impl = V8Element::toNative(info.Holder());
  2043.     TONATIVE_VOID_EXCEPTIONSTATE(int, pages, toInt32(info[0], exceptionState), exceptionState);
  2044.     impl->scrollByPages(pages);
  2045. }
  2046.  
  2047. static void scrollByPagesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2048. {
  2049.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2050.     ElementV8Internal::scrollByPagesMethod(info);
  2051.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2052. }
  2053.  
  2054. static void getElementsByClassNameMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2055. {
  2056.     if (UNLIKELY(info.Length() < 1)) {
  2057.         throwArityTypeErrorForMethod("getElementsByClassName", "Element", 1, info.Length(), info.GetIsolate());
  2058.         return;
  2059.     }
  2060.     Element* impl = V8Element::toNative(info.Holder());
  2061.     TOSTRING_VOID(V8StringResource<>, classNames, info[0]);
  2062.     v8SetReturnValueFast(info, WTF::getPtr(impl->getElementsByClassName(classNames)), impl);
  2063. }
  2064.  
  2065. static void getElementsByClassNameMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2066. {
  2067.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2068.     ElementV8Internal::getElementsByClassNameMethod(info);
  2069.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2070. }
  2071.  
  2072. static void insertAdjacentElementMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2073. {
  2074.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertAdjacentElement", "Element", info.Holder(), info.GetIsolate());
  2075.     if (UNLIKELY(info.Length() < 2)) {
  2076.         throwArityTypeError(exceptionState, 2, info.Length());
  2077.         return;
  2078.     }
  2079.     Element* impl = V8Element::toNative(info.Holder());
  2080.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  2081.     TOSTRING_VOID(V8StringResource<>, where, info[0]);
  2082.     TONATIVE_VOID(Element*, element, V8Element::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
  2083.     RefPtr<Element> result = impl->insertAdjacentElement(where, element, exceptionState);
  2084.     if (exceptionState.throwIfNeeded())
  2085.         return;
  2086.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2087. }
  2088.  
  2089. static void insertAdjacentElementMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2090. {
  2091.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2092.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::InsertAdjacentElement);
  2093.     ElementV8Internal::insertAdjacentElementMethod(info);
  2094.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2095. }
  2096.  
  2097. static void insertAdjacentTextMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2098. {
  2099.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertAdjacentText", "Element", info.Holder(), info.GetIsolate());
  2100.     if (UNLIKELY(info.Length() < 2)) {
  2101.         throwArityTypeError(exceptionState, 2, info.Length());
  2102.         return;
  2103.     }
  2104.     Element* impl = V8Element::toNative(info.Holder());
  2105.     TOSTRING_VOID(V8StringResource<>, where, info[0]);
  2106.     TOSTRING_VOID(V8StringResource<>, text, info[1]);
  2107.     impl->insertAdjacentText(where, text, exceptionState);
  2108.     if (exceptionState.throwIfNeeded())
  2109.         return;
  2110. }
  2111.  
  2112. static void insertAdjacentTextMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2113. {
  2114.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2115.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::InsertAdjacentText);
  2116.     ElementV8Internal::insertAdjacentTextMethod(info);
  2117.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2118. }
  2119.  
  2120. static void insertAdjacentHTMLMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2121. {
  2122.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertAdjacentHTML", "Element", info.Holder(), info.GetIsolate());
  2123.     if (UNLIKELY(info.Length() < 2)) {
  2124.         throwArityTypeError(exceptionState, 2, info.Length());
  2125.         return;
  2126.     }
  2127.     Element* impl = V8Element::toNative(info.Holder());
  2128.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  2129.     TOSTRING_VOID(V8StringResource<>, where, info[0]);
  2130.     TOSTRING_VOID(V8StringResource<>, html, info[1]);
  2131.     impl->insertAdjacentHTML(where, html, exceptionState);
  2132.     if (exceptionState.throwIfNeeded())
  2133.         return;
  2134. }
  2135.  
  2136. static void insertAdjacentHTMLMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2137. {
  2138.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2139.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::InsertAdjacentHTML);
  2140.     ElementV8Internal::insertAdjacentHTMLMethod(info);
  2141.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2142. }
  2143.  
  2144. static void webkitMatchesSelectorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2145. {
  2146.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "webkitMatchesSelector", "Element", info.Holder(), info.GetIsolate());
  2147.     if (UNLIKELY(info.Length() < 1)) {
  2148.         throwArityTypeError(exceptionState, 1, info.Length());
  2149.         return;
  2150.     }
  2151.     Element* impl = V8Element::toNative(info.Holder());
  2152.     TOSTRING_VOID(V8StringResource<>, selectors, info[0]);
  2153.     bool result = impl->matches(selectors, exceptionState);
  2154.     if (exceptionState.throwIfNeeded())
  2155.         return;
  2156.     v8SetReturnValueBool(info, result);
  2157. }
  2158.  
  2159. static void webkitMatchesSelectorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2160. {
  2161.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2162.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::ElementPrefixedMatchesSelector);
  2163.     ElementV8Internal::webkitMatchesSelectorMethod(info);
  2164.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2165. }
  2166.  
  2167. static void createShadowRootMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2168. {
  2169.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "createShadowRoot", "Element", info.Holder(), info.GetIsolate());
  2170.     Element* impl = V8Element::toNative(info.Holder());
  2171.     RefPtr<ShadowRoot> result = impl->createShadowRoot(exceptionState);
  2172.     if (exceptionState.throwIfNeeded())
  2173.         return;
  2174.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2175. }
  2176.  
  2177. static void createShadowRootMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2178. {
  2179.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2180.     ElementV8Internal::createShadowRootMethod(info);
  2181.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2182. }
  2183.  
  2184. static void getDestinationInsertionPointsMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2185. {
  2186.     Element* impl = V8Element::toNative(info.Holder());
  2187.     v8SetReturnValueFast(info, WTF::getPtr(impl->getDestinationInsertionPoints()), impl);
  2188. }
  2189.  
  2190. static void getDestinationInsertionPointsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2191. {
  2192.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2193.     ElementV8Internal::getDestinationInsertionPointsMethod(info);
  2194.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2195. }
  2196.  
  2197. static void getDestinationInsertionPointsMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  2198. {
  2199.     Element* impl = V8Element::toNative(info.Holder());
  2200.     v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->getDestinationInsertionPoints()));
  2201. }
  2202.  
  2203. static void getDestinationInsertionPointsMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  2204. {
  2205.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2206.     ElementV8Internal::getDestinationInsertionPointsMethodForMainWorld(info);
  2207.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2208. }
  2209.  
  2210. static void getClientRectsMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2211. {
  2212.     Element* impl = V8Element::toNative(info.Holder());
  2213.     v8SetReturnValueFast(info, WTF::getPtr(impl->getClientRects()), impl);
  2214. }
  2215.  
  2216. static void getClientRectsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2217. {
  2218.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2219.     ElementV8Internal::getClientRectsMethod(info);
  2220.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2221. }
  2222.  
  2223. static void getBoundingClientRectMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2224. {
  2225.     Element* impl = V8Element::toNative(info.Holder());
  2226.     v8SetReturnValueFast(info, WTF::getPtr(impl->getBoundingClientRect()), impl);
  2227. }
  2228.  
  2229. static void getBoundingClientRectMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2230. {
  2231.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2232.     ElementV8Internal::getBoundingClientRectMethod(info);
  2233.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2234. }
  2235.  
  2236. static void webkitRequestFullScreenMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2237. {
  2238.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "webkitRequestFullScreen", "Element", info.Holder(), info.GetIsolate());
  2239.     Element* impl = V8Element::toNative(info.Holder());
  2240.     TONATIVE_VOID_EXCEPTIONSTATE(unsigned, flags, toUInt16(info[0], exceptionState), exceptionState);
  2241.     impl->webkitRequestFullScreen(flags);
  2242. }
  2243.  
  2244. static void webkitRequestFullScreenMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2245. {
  2246.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2247.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::PrefixedElementRequestFullScreen);
  2248.     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
  2249.     if (contextData && contextData->activityLogger()) {
  2250.         Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle<v8::Value> >(info, 0);
  2251.         contextData->activityLogger()->log("Element.webkitRequestFullScreen", info.Length(), loggerArgs.data(), "Method");
  2252.     }
  2253.     ElementV8Internal::webkitRequestFullScreenMethod(info);
  2254.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2255. }
  2256.  
  2257. static void webkitRequestFullScreenMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  2258. {
  2259.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "webkitRequestFullScreen", "Element", info.Holder(), info.GetIsolate());
  2260.     Element* impl = V8Element::toNative(info.Holder());
  2261.     TONATIVE_VOID_EXCEPTIONSTATE(unsigned, flags, toUInt16(info[0], exceptionState), exceptionState);
  2262.     impl->webkitRequestFullScreen(flags);
  2263. }
  2264.  
  2265. static void webkitRequestFullScreenMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  2266. {
  2267.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2268.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::PrefixedElementRequestFullScreen);
  2269.     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
  2270.     if (contextData && contextData->activityLogger()) {
  2271.         Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle<v8::Value> >(info, 0);
  2272.         contextData->activityLogger()->log("Element.webkitRequestFullScreen", info.Length(), loggerArgs.data(), "Method");
  2273.     }
  2274.     ElementV8Internal::webkitRequestFullScreenMethodForMainWorld(info);
  2275.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2276. }
  2277.  
  2278. static void webkitRequestFullscreenMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2279. {
  2280.     Element* impl = V8Element::toNative(info.Holder());
  2281.     impl->webkitRequestFullscreen();
  2282. }
  2283.  
  2284. static void webkitRequestFullscreenMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2285. {
  2286.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2287.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::PrefixedElementRequestFullscreen);
  2288.     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
  2289.     if (contextData && contextData->activityLogger()) {
  2290.         Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle<v8::Value> >(info, 0);
  2291.         contextData->activityLogger()->log("Element.webkitRequestFullscreen", info.Length(), loggerArgs.data(), "Method");
  2292.     }
  2293.     ElementV8Internal::webkitRequestFullscreenMethod(info);
  2294.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2295. }
  2296.  
  2297. static void webkitRequestFullscreenMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  2298. {
  2299.     Element* impl = V8Element::toNative(info.Holder());
  2300.     impl->webkitRequestFullscreen();
  2301. }
  2302.  
  2303. static void webkitRequestFullscreenMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
  2304. {
  2305.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2306.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::PrefixedElementRequestFullscreen);
  2307.     V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
  2308.     if (contextData && contextData->activityLogger()) {
  2309.         Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle<v8::Value> >(info, 0);
  2310.         contextData->activityLogger()->log("Element.webkitRequestFullscreen", info.Length(), loggerArgs.data(), "Method");
  2311.     }
  2312.     ElementV8Internal::webkitRequestFullscreenMethodForMainWorld(info);
  2313.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2314. }
  2315.  
  2316. static void webkitRequestPointerLockMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2317. {
  2318.     Element* impl = V8Element::toNative(info.Holder());
  2319.     impl->webkitRequestPointerLock();
  2320. }
  2321.  
  2322. static void webkitRequestPointerLockMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2323. {
  2324.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2325.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::PrefixedElementRequestPointerLock);
  2326.     ElementV8Internal::webkitRequestPointerLockMethod(info);
  2327.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2328. }
  2329.  
  2330. static void animate1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
  2331. {
  2332.     if (UNLIKELY(info.Length() < 2)) {
  2333.         throwArityTypeErrorForMethod("animate", "Element", 2, info.Length(), info.GetIsolate());
  2334.         return;
  2335.     }
  2336.     Element* impl = V8Element::toNative(info.Holder());
  2337.     TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
  2338.     TONATIVE_VOID(Dictionary, timingInput, Dictionary(info[1], info.GetIsolate()));
  2339.     if (!timingInput.isUndefinedOrNull() && !timingInput.isObject()) {
  2340.         throwTypeError(ExceptionMessages::failedToExecute("animate", "Element", "parameter 2 ('timingInput') is not an object."), info.GetIsolate());
  2341.         return;
  2342.     }
  2343.     ASSERT(impl);
  2344.     v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effect, timingInput)), impl);
  2345. }
  2346.  
  2347. static void animate2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
  2348. {
  2349.     if (UNLIKELY(info.Length() < 2)) {
  2350.         throwArityTypeErrorForMethod("animate", "Element", 2, info.Length(), info.GetIsolate());
  2351.         return;
  2352.     }
  2353.     Element* impl = V8Element::toNative(info.Holder());
  2354.     TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
  2355.     TONATIVE_VOID(double, duration, static_cast<double>(info[1]->NumberValue()));
  2356.     ASSERT(impl);
  2357.     v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effect, duration)), impl);
  2358. }
  2359.  
  2360. static void animate3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
  2361. {
  2362.     if (UNLIKELY(info.Length() < 1)) {
  2363.         throwArityTypeErrorForMethod("animate", "Element", 1, info.Length(), info.GetIsolate());
  2364.         return;
  2365.     }
  2366.     Element* impl = V8Element::toNative(info.Holder());
  2367.     TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
  2368.     ASSERT(impl);
  2369.     v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effect)), impl);
  2370. }
  2371.  
  2372. static void animate4Method(const v8::FunctionCallbackInfo<v8::Value>& info)
  2373. {
  2374.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", "Element", info.Holder(), info.GetIsolate());
  2375.     if (UNLIKELY(info.Length() < 2)) {
  2376.         throwArityTypeError(exceptionState, 2, info.Length());
  2377.         return;
  2378.     }
  2379.     Element* impl = V8Element::toNative(info.Holder());
  2380.     TONATIVE_VOID(Vector<Dictionary>, keyframes, toNativeArray<Dictionary>(info[0], 1, info.GetIsolate()));
  2381.     TONATIVE_VOID(Dictionary, timingInput, Dictionary(info[1], info.GetIsolate()));
  2382.     if (!timingInput.isUndefinedOrNull() && !timingInput.isObject()) {
  2383.         exceptionState.throwTypeError("parameter 2 ('timingInput') is not an object.");
  2384.         exceptionState.throwIfNeeded();
  2385.         return;
  2386.     }
  2387.     ASSERT(impl);
  2388.     RefPtr<AnimationPlayer> result = ElementAnimation::animate(*impl, keyframes, timingInput, exceptionState);
  2389.     if (exceptionState.throwIfNeeded())
  2390.         return;
  2391.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2392. }
  2393.  
  2394. static void animate5Method(const v8::FunctionCallbackInfo<v8::Value>& info)
  2395. {
  2396.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", "Element", info.Holder(), info.GetIsolate());
  2397.     if (UNLIKELY(info.Length() < 2)) {
  2398.         throwArityTypeError(exceptionState, 2, info.Length());
  2399.         return;
  2400.     }
  2401.     Element* impl = V8Element::toNative(info.Holder());
  2402.     TONATIVE_VOID(Vector<Dictionary>, keyframes, toNativeArray<Dictionary>(info[0], 1, info.GetIsolate()));
  2403.     TONATIVE_VOID(double, duration, static_cast<double>(info[1]->NumberValue()));
  2404.     ASSERT(impl);
  2405.     RefPtr<AnimationPlayer> result = ElementAnimation::animate(*impl, keyframes, duration, exceptionState);
  2406.     if (exceptionState.throwIfNeeded())
  2407.         return;
  2408.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2409. }
  2410.  
  2411. static void animate6Method(const v8::FunctionCallbackInfo<v8::Value>& info)
  2412. {
  2413.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", "Element", info.Holder(), info.GetIsolate());
  2414.     if (UNLIKELY(info.Length() < 1)) {
  2415.         throwArityTypeError(exceptionState, 1, info.Length());
  2416.         return;
  2417.     }
  2418.     Element* impl = V8Element::toNative(info.Holder());
  2419.     TONATIVE_VOID(Vector<Dictionary>, keyframes, toNativeArray<Dictionary>(info[0], 1, info.GetIsolate()));
  2420.     ASSERT(impl);
  2421.     RefPtr<AnimationPlayer> result = ElementAnimation::animate(*impl, keyframes, exceptionState);
  2422.     if (exceptionState.throwIfNeeded())
  2423.         return;
  2424.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2425. }
  2426.  
  2427. static void animateMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2428. {
  2429.     if (((info.Length() == 2) && (info[0]->IsNull() || V8AnimationEffect::hasInstance(info[0], info.GetIsolate())) && (info[1]->IsObject()))) {
  2430.         animate1Method(info);
  2431.         return;
  2432.     }
  2433.     if (((info.Length() == 2) && (info[0]->IsNull() || V8AnimationEffect::hasInstance(info[0], info.GetIsolate())))) {
  2434.         animate2Method(info);
  2435.         return;
  2436.     }
  2437.     if (((info.Length() == 1) && (info[0]->IsNull() || V8AnimationEffect::hasInstance(info[0], info.GetIsolate())))) {
  2438.         animate3Method(info);
  2439.         return;
  2440.     }
  2441.     if (((info.Length() == 2) && (info[0]->IsArray()) && (info[1]->IsObject()))) {
  2442.         animate4Method(info);
  2443.         return;
  2444.     }
  2445.     if (((info.Length() == 2) && (info[0]->IsArray()))) {
  2446.         animate5Method(info);
  2447.         return;
  2448.     }
  2449.     if (((info.Length() == 1) && (info[0]->IsArray()))) {
  2450.         animate6Method(info);
  2451.         return;
  2452.     }
  2453.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", "Element", info.Holder(), info.GetIsolate());
  2454.     if (UNLIKELY(info.Length() < 1)) {
  2455.         throwArityTypeError(exceptionState, 1, info.Length());
  2456.         return;
  2457.     }
  2458.     exceptionState.throwTypeError("No function was found that matched the signature provided.");
  2459.     exceptionState.throwIfNeeded();
  2460. }
  2461.  
  2462. static void animateMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2463. {
  2464.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2465.     UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::ElementAnimateKeyframeListEffectNoTiming);
  2466.     ElementV8Internal::animateMethod(info);
  2467.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2468. }
  2469.  
  2470. static void removeMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2471. {
  2472.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "remove", "Element", info.Holder(), info.GetIsolate());
  2473.     Element* impl = V8Element::toNative(info.Holder());
  2474.     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
  2475.     ASSERT(impl);
  2476.     ChildNode::remove(*impl, exceptionState);
  2477.     if (exceptionState.throwIfNeeded())
  2478.         return;
  2479. }
  2480.  
  2481. static void removeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2482. {
  2483.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2484.     ElementV8Internal::removeMethod(info);
  2485.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2486. }
  2487.  
  2488. static void querySelectorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2489. {
  2490.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "querySelector", "Element", info.Holder(), info.GetIsolate());
  2491.     if (UNLIKELY(info.Length() < 1)) {
  2492.         throwArityTypeError(exceptionState, 1, info.Length());
  2493.         return;
  2494.     }
  2495.     Element* impl = V8Element::toNative(info.Holder());
  2496.     TOSTRING_VOID(V8StringResource<>, selectors, info[0]);
  2497.     ASSERT(impl);
  2498.     RefPtr<Element> result = ParentNode::querySelector(*impl, selectors, exceptionState);
  2499.     if (exceptionState.throwIfNeeded())
  2500.         return;
  2501.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2502. }
  2503.  
  2504. static void querySelectorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2505. {
  2506.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2507.     ElementV8Internal::querySelectorMethod(info);
  2508.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2509. }
  2510.  
  2511. static void querySelectorAllMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
  2512. {
  2513.     ExceptionState exceptionState(ExceptionState::ExecutionContext, "querySelectorAll", "Element", info.Holder(), info.GetIsolate());
  2514.     if (UNLIKELY(info.Length() < 1)) {
  2515.         throwArityTypeError(exceptionState, 1, info.Length());
  2516.         return;
  2517.     }
  2518.     Element* impl = V8Element::toNative(info.Holder());
  2519.     TOSTRING_VOID(V8StringResource<>, selectors, info[0]);
  2520.     ASSERT(impl);
  2521.     RefPtr<NodeList> result = ParentNode::querySelectorAll(*impl, selectors, exceptionState);
  2522.     if (exceptionState.throwIfNeeded())
  2523.         return;
  2524.     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
  2525. }
  2526.  
  2527. static void querySelectorAllMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  2528. {
  2529.     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
  2530.     ElementV8Internal::querySelectorAllMethod(info);
  2531.     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
  2532. }
  2533.  
  2534. } // namespace ElementV8Internal
  2535.  
  2536. static const V8DOMConfiguration::AttributeConfiguration V8ElementAttributes[] = {
  2537.     {"tagName", ElementV8Internal::tagNameAttributeGetterCallback, 0, ElementV8Internal::tagNameAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2538.     {"attributes", ElementV8Internal::attributesAttributeGetterCallback, 0, ElementV8Internal::attributesAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2539.     {"style", ElementV8Internal::styleAttributeGetterCallback, 0, ElementV8Internal::styleAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2540.     {"id", ElementV8Internal::idAttributeGetterCallback, ElementV8Internal::idAttributeSetterCallback, ElementV8Internal::idAttributeGetterCallbackForMainWorld, ElementV8Internal::idAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2541.     {"namespaceURI", ElementV8Internal::namespaceURIAttributeGetterCallback, 0, ElementV8Internal::namespaceURIAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2542.     {"prefix", ElementV8Internal::prefixAttributeGetterCallback, ElementV8Internal::prefixAttributeSetterCallback, ElementV8Internal::prefixAttributeGetterCallbackForMainWorld, ElementV8Internal::prefixAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2543.     {"localName", ElementV8Internal::localNameAttributeGetterCallback, 0, ElementV8Internal::localNameAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2544.     {"offsetLeft", ElementV8Internal::offsetLeftAttributeGetterCallback, 0, ElementV8Internal::offsetLeftAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2545.     {"offsetTop", ElementV8Internal::offsetTopAttributeGetterCallback, 0, ElementV8Internal::offsetTopAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2546.     {"offsetWidth", ElementV8Internal::offsetWidthAttributeGetterCallback, 0, ElementV8Internal::offsetWidthAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2547.     {"offsetHeight", ElementV8Internal::offsetHeightAttributeGetterCallback, 0, ElementV8Internal::offsetHeightAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2548.     {"offsetParent", ElementV8Internal::offsetParentAttributeGetterCallback, 0, ElementV8Internal::offsetParentAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2549.     {"clientLeft", ElementV8Internal::clientLeftAttributeGetterCallback, 0, ElementV8Internal::clientLeftAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2550.     {"clientTop", ElementV8Internal::clientTopAttributeGetterCallback, 0, ElementV8Internal::clientTopAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2551.     {"clientWidth", ElementV8Internal::clientWidthAttributeGetterCallback, 0, ElementV8Internal::clientWidthAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2552.     {"clientHeight", ElementV8Internal::clientHeightAttributeGetterCallback, 0, ElementV8Internal::clientHeightAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2553.     {"scrollLeft", ElementV8Internal::scrollLeftAttributeGetterCallback, ElementV8Internal::scrollLeftAttributeSetterCallback, ElementV8Internal::scrollLeftAttributeGetterCallbackForMainWorld, ElementV8Internal::scrollLeftAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2554.     {"scrollTop", ElementV8Internal::scrollTopAttributeGetterCallback, ElementV8Internal::scrollTopAttributeSetterCallback, ElementV8Internal::scrollTopAttributeGetterCallbackForMainWorld, ElementV8Internal::scrollTopAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2555.     {"scrollWidth", ElementV8Internal::scrollWidthAttributeGetterCallback, 0, ElementV8Internal::scrollWidthAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2556.     {"scrollHeight", ElementV8Internal::scrollHeightAttributeGetterCallback, 0, ElementV8Internal::scrollHeightAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2557.     {"innerHTML", ElementV8Internal::innerHTMLAttributeGetterCallback, ElementV8Internal::innerHTMLAttributeSetterCallback, ElementV8Internal::innerHTMLAttributeGetterCallbackForMainWorld, ElementV8Internal::innerHTMLAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2558.     {"outerHTML", ElementV8Internal::outerHTMLAttributeGetterCallback, ElementV8Internal::outerHTMLAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2559.     {"className", ElementV8Internal::classNameAttributeGetterCallback, ElementV8Internal::classNameAttributeSetterCallback, ElementV8Internal::classNameAttributeGetterCallbackForMainWorld, ElementV8Internal::classNameAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2560.     {"classList", ElementV8Internal::classListAttributeGetterCallback, 0, ElementV8Internal::classListAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2561.     {"dataset", ElementV8Internal::datasetAttributeGetterCallback, 0, ElementV8Internal::datasetAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2562.     {"shadowRoot", ElementV8Internal::shadowRootAttributeGetterCallback, 0, ElementV8Internal::shadowRootAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2563.     {"onbeforecopy", ElementV8Internal::onbeforecopyAttributeGetterCallback, ElementV8Internal::onbeforecopyAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2564.     {"onbeforecut", ElementV8Internal::onbeforecutAttributeGetterCallback, ElementV8Internal::onbeforecutAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2565.     {"onbeforepaste", ElementV8Internal::onbeforepasteAttributeGetterCallback, ElementV8Internal::onbeforepasteAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2566.     {"oncopy", ElementV8Internal::oncopyAttributeGetterCallback, ElementV8Internal::oncopyAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2567.     {"oncut", ElementV8Internal::oncutAttributeGetterCallback, ElementV8Internal::oncutAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2568.     {"onpaste", ElementV8Internal::onpasteAttributeGetterCallback, ElementV8Internal::onpasteAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2569.     {"onsearch", ElementV8Internal::onsearchAttributeGetterCallback, ElementV8Internal::onsearchAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2570.     {"onselectstart", ElementV8Internal::onselectstartAttributeGetterCallback, ElementV8Internal::onselectstartAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2571.     {"onwebkitfullscreenchange", ElementV8Internal::onwebkitfullscreenchangeAttributeGetterCallback, ElementV8Internal::onwebkitfullscreenchangeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2572.     {"onwebkitfullscreenerror", ElementV8Internal::onwebkitfullscreenerrorAttributeGetterCallback, ElementV8Internal::onwebkitfullscreenerrorAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2573.     {"onwheel", ElementV8Internal::onwheelAttributeGetterCallback, ElementV8Internal::onwheelAttributeSetterCallback, ElementV8Internal::onwheelAttributeGetterCallbackForMainWorld, ElementV8Internal::onwheelAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2574.     {"previousElementSibling", ElementV8Internal::previousElementSiblingAttributeGetterCallback, 0, ElementV8Internal::previousElementSiblingAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2575.     {"nextElementSibling", ElementV8Internal::nextElementSiblingAttributeGetterCallback, 0, ElementV8Internal::nextElementSiblingAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2576.     {"children", ElementV8Internal::childrenAttributeGetterCallback, 0, ElementV8Internal::childrenAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2577.     {"firstElementChild", ElementV8Internal::firstElementChildAttributeGetterCallback, 0, ElementV8Internal::firstElementChildAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2578.     {"lastElementChild", ElementV8Internal::lastElementChildAttributeGetterCallback, 0, ElementV8Internal::lastElementChildAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2579.     {"childElementCount", ElementV8Internal::childElementCountAttributeGetterCallback, 0, ElementV8Internal::childElementCountAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
  2580. };
  2581.  
  2582. static const V8DOMConfiguration::MethodConfiguration V8ElementMethods[] = {
  2583.     {"getAttribute", ElementV8Internal::getAttributeMethodCallback, 0, 1},
  2584.     {"setAttribute", ElementV8Internal::setAttributeMethodCallback, 0, 2},
  2585.     {"removeAttribute", ElementV8Internal::removeAttributeMethodCallback, 0, 1},
  2586.     {"getAttributeNode", ElementV8Internal::getAttributeNodeMethodCallback, 0, 0},
  2587.     {"setAttributeNode", ElementV8Internal::setAttributeNodeMethodCallback, 0, 0},
  2588.     {"removeAttributeNode", ElementV8Internal::removeAttributeNodeMethodCallback, 0, 0},
  2589.     {"getElementsByTagName", ElementV8Internal::getElementsByTagNameMethodCallback, ElementV8Internal::getElementsByTagNameMethodCallbackForMainWorld, 1},
  2590.     {"hasAttributes", ElementV8Internal::hasAttributesMethodCallback, 0, 0},
  2591.     {"getAttributeNS", ElementV8Internal::getAttributeNSMethodCallback, 0, 2},
  2592.     {"setAttributeNS", ElementV8Internal::setAttributeNSMethodCallback, 0, 3},
  2593.     {"removeAttributeNS", ElementV8Internal::removeAttributeNSMethodCallback, 0, 2},
  2594.     {"getElementsByTagNameNS", ElementV8Internal::getElementsByTagNameNSMethodCallback, 0, 2},
  2595.     {"getAttributeNodeNS", ElementV8Internal::getAttributeNodeNSMethodCallback, 0, 0},
  2596.     {"setAttributeNodeNS", ElementV8Internal::setAttributeNodeNSMethodCallback, 0, 0},
  2597.     {"hasAttribute", ElementV8Internal::hasAttributeMethodCallback, 0, 1},
  2598.     {"hasAttributeNS", ElementV8Internal::hasAttributeNSMethodCallback, 0, 2},
  2599.     {"matches", ElementV8Internal::matchesMethodCallback, 0, 1},
  2600.     {"focus", ElementV8Internal::focusMethodCallback, 0, 0},
  2601.     {"blur", ElementV8Internal::blurMethodCallback, 0, 0},
  2602.     {"scrollIntoView", ElementV8Internal::scrollIntoViewMethodCallback, 0, 0},
  2603.     {"scrollIntoViewIfNeeded", ElementV8Internal::scrollIntoViewIfNeededMethodCallback, 0, 0},
  2604.     {"scrollByLines", ElementV8Internal::scrollByLinesMethodCallback, 0, 0},
  2605.     {"scrollByPages", ElementV8Internal::scrollByPagesMethodCallback, 0, 0},
  2606.     {"getElementsByClassName", ElementV8Internal::getElementsByClassNameMethodCallback, 0, 1},
  2607.     {"insertAdjacentElement", ElementV8Internal::insertAdjacentElementMethodCallback, 0, 2},
  2608.     {"insertAdjacentText", ElementV8Internal::insertAdjacentTextMethodCallback, 0, 2},
  2609.     {"insertAdjacentHTML", ElementV8Internal::insertAdjacentHTMLMethodCallback, 0, 2},
  2610.     {"webkitMatchesSelector", ElementV8Internal::webkitMatchesSelectorMethodCallback, 0, 1},
  2611.     {"createShadowRoot", ElementV8Internal::createShadowRootMethodCallback, 0, 0},
  2612.     {"getDestinationInsertionPoints", ElementV8Internal::getDestinationInsertionPointsMethodCallback, ElementV8Internal::getDestinationInsertionPointsMethodCallbackForMainWorld, 0},
  2613.     {"getClientRects", ElementV8Internal::getClientRectsMethodCallback, 0, 0},
  2614.     {"getBoundingClientRect", ElementV8Internal::getBoundingClientRectMethodCallback, 0, 0},
  2615.     {"webkitRequestFullScreen", ElementV8Internal::webkitRequestFullScreenMethodCallback, ElementV8Internal::webkitRequestFullScreenMethodCallbackForMainWorld, 0},
  2616.     {"webkitRequestFullscreen", ElementV8Internal::webkitRequestFullscreenMethodCallback, ElementV8Internal::webkitRequestFullscreenMethodCallbackForMainWorld, 0},
  2617.     {"webkitRequestPointerLock", ElementV8Internal::webkitRequestPointerLockMethodCallback, 0, 0},
  2618.     {"animate", ElementV8Internal::animateMethodCallback, 0, 2},
  2619.     {"remove", ElementV8Internal::removeMethodCallback, 0, 0},
  2620.     {"querySelector", ElementV8Internal::querySelectorMethodCallback, 0, 1},
  2621.     {"querySelectorAll", ElementV8Internal::querySelectorAllMethodCallback, 0, 1},
  2622. };
  2623.  
  2624. static void configureV8ElementTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
  2625. {
  2626.     functionTemplate->ReadOnlyPrototype();
  2627.  
  2628.     v8::Local<v8::Signature> defaultSignature;
  2629.     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "Element", V8Node::domTemplate(isolate), V8Element::internalFieldCount,
  2630.         V8ElementAttributes, WTF_ARRAY_LENGTH(V8ElementAttributes),
  2631.         0, 0,
  2632.         V8ElementMethods, WTF_ARRAY_LENGTH(V8ElementMethods),
  2633.         isolate);
  2634.     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
  2635.     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
  2636.     if (RuntimeEnabledFeatures::touchEnabled()) {
  2637.         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
  2638.         {"ontouchcancel", ElementV8Internal::ontouchcancelAttributeGetterCallback, ElementV8Internal::ontouchcancelAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
  2639.         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
  2640.     }
  2641.     if (RuntimeEnabledFeatures::touchEnabled()) {
  2642.         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
  2643.         {"ontouchend", ElementV8Internal::ontouchendAttributeGetterCallback, ElementV8Internal::ontouchendAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
  2644.         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
  2645.     }
  2646.     if (RuntimeEnabledFeatures::touchEnabled()) {
  2647.         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
  2648.         {"ontouchmove", ElementV8Internal::ontouchmoveAttributeGetterCallback, ElementV8Internal::ontouchmoveAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
  2649.         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
  2650.     }
  2651.     if (RuntimeEnabledFeatures::touchEnabled()) {
  2652.         static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
  2653.         {"ontouchstart", ElementV8Internal::ontouchstartAttributeGetterCallback, ElementV8Internal::ontouchstartAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
  2654.         V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
  2655.     }
  2656.     static const V8DOMConfiguration::ConstantConfiguration V8ElementConstants[] = {
  2657.         {"ALLOW_KEYBOARD_INPUT", 1},
  2658.     };
  2659.     V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8ElementConstants, WTF_ARRAY_LENGTH(V8ElementConstants), isolate);
  2660.     COMPILE_ASSERT(1 == Element::ALLOW_KEYBOARD_INPUT, TheValueOfElement_ALLOW_KEYBOARD_INPUTDoesntMatchWithImplementation);
  2661.  
  2662.     // Custom toString template
  2663.     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
  2664. }
  2665.  
  2666. v8::Handle<v8::FunctionTemplate> V8Element::domTemplate(v8::Isolate* isolate)
  2667. {
  2668.     V8PerIsolateData* data = V8PerIsolateData::from(isolate);
  2669.     v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo));
  2670.     if (!result.IsEmpty())
  2671.         return result;
  2672.  
  2673.     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
  2674.     result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
  2675.     configureV8ElementTemplate(result, isolate);
  2676.     data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result);
  2677.     return result;
  2678. }
  2679.  
  2680. bool V8Element::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
  2681. {
  2682.     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
  2683. }
  2684.  
  2685. v8::Handle<v8::Object> V8Element::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
  2686. {
  2687.     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
  2688. }
  2689.  
  2690. Element* V8Element::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
  2691. {
  2692.     return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
  2693. }
  2694.  
  2695. EventTarget* V8Element::toEventTarget(v8::Handle<v8::Object> object)
  2696. {
  2697.     return toNative(object);
  2698. }
  2699.  
  2700. v8::Handle<v8::Object> wrap(Element* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
  2701. {
  2702.     ASSERT(impl);
  2703.     if (impl->isHTMLElement())
  2704.         return wrap(toHTMLElement(impl), creationContext, isolate);
  2705.     if (impl->isSVGElement())
  2706.         return wrap(toSVGElement(impl), creationContext, isolate);
  2707.     v8::Handle<v8::Object> wrapper = V8Element::createWrapper(impl, creationContext, isolate);
  2708.     return wrapper;
  2709. }
  2710.  
  2711. v8::Handle<v8::Object> V8Element::createWrapper(PassRefPtr<Element> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
  2712. {
  2713.     ASSERT(impl);
  2714.     ASSERT(!DOMDataStore::containsWrapper<V8Element>(impl.get(), isolate));
  2715.     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
  2716.         const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
  2717.         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
  2718.         // the same object de-ref functions, though, so use that as the basis of the check.
  2719.         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
  2720.     }
  2721.  
  2722.     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
  2723.     if (UNLIKELY(wrapper.IsEmpty()))
  2724.         return wrapper;
  2725.  
  2726.     installPerContextEnabledProperties(wrapper, impl.get(), isolate);
  2727.     V8DOMWrapper::associateObjectWithWrapper<V8Element>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
  2728.     return wrapper;
  2729. }
  2730.  
  2731. void V8Element::derefObject(void* object)
  2732. {
  2733.     fromInternalPointer(object)->deref();
  2734. }
  2735.  
  2736. template<>
  2737. v8::Handle<v8::Value> toV8NoInline(Element* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
  2738. {
  2739.     return toV8(impl, creationContext, isolate);
  2740. }
  2741.  
  2742. } // namespace WebCore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement