Advertisement
Guest User

Untitled

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