DOMHTMLClasses.cpp 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620
  1. /*
  2. * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  14. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  17. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #include "config.h"
  26. #include "WebKitDLL.h"
  27. #include "DOMHTMLClasses.h"
  28. #include "WebFrame.h"
  29. #include <WebCore/BString.h>
  30. #include <WebCore/COMPtr.h>
  31. #include <WebCore/Document.h>
  32. #include <WebCore/Element.h>
  33. #include <WebCore/FrameView.h>
  34. #include <WebCore/HTMLCollection.h>
  35. #include <WebCore/HTMLDocument.h>
  36. #include <WebCore/HTMLFormElement.h>
  37. #include <WebCore/HTMLIFrameElement.h>
  38. #include <WebCore/HTMLInputElement.h>
  39. #include <WebCore/HTMLNames.h>
  40. #include <WebCore/HTMLOptionElement.h>
  41. #include <WebCore/HTMLOptionsCollection.h>
  42. #include <WebCore/HTMLSelectElement.h>
  43. #include <WebCore/HTMLTextAreaElement.h>
  44. #include <WebCore/IntRect.h>
  45. #include <WebCore/RenderObject.h>
  46. #include <WebCore/RenderTextControl.h>
  47. using namespace WebCore;
  48. using namespace HTMLNames;
  49. // DOMHTMLCollection
  50. DOMHTMLCollection::DOMHTMLCollection(WebCore::HTMLCollection* c)
  51. : m_collection(c)
  52. {
  53. }
  54. IDOMHTMLCollection* DOMHTMLCollection::createInstance(WebCore::HTMLCollection* c)
  55. {
  56. if (!c)
  57. return 0;
  58. IDOMHTMLCollection* htmlCollection = 0;
  59. DOMHTMLCollection* newCollection = new DOMHTMLCollection(c);
  60. if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLCollection, (void**)&htmlCollection))) {
  61. delete newCollection;
  62. return 0;
  63. }
  64. return htmlCollection;
  65. }
  66. // DOMHTMLCollection - IUnknown -----------------------------------------------
  67. HRESULT STDMETHODCALLTYPE DOMHTMLCollection::QueryInterface(REFIID riid, void** ppvObject)
  68. {
  69. *ppvObject = 0;
  70. if (IsEqualGUID(riid, IID_IDOMHTMLCollection))
  71. *ppvObject = static_cast<IDOMHTMLCollection*>(this);
  72. else
  73. return DOMObject::QueryInterface(riid, ppvObject);
  74. AddRef();
  75. return S_OK;
  76. }
  77. // DOMHTMLCollection ----------------------------------------------------------
  78. HRESULT STDMETHODCALLTYPE DOMHTMLCollection::length(
  79. /* [retval][out] */ UINT* result)
  80. {
  81. *result = 0;
  82. if (!m_collection)
  83. return E_POINTER;
  84. *result = m_collection->length();
  85. return S_OK;
  86. }
  87. HRESULT STDMETHODCALLTYPE DOMHTMLCollection::item(
  88. /* [in] */ UINT index,
  89. /* [retval][out] */ IDOMNode** node)
  90. {
  91. *node = 0;
  92. if (!m_collection)
  93. return E_POINTER;
  94. *node = DOMNode::createInstance(m_collection->item(index));
  95. return *node ? S_OK : E_FAIL;
  96. }
  97. HRESULT STDMETHODCALLTYPE DOMHTMLCollection::namedItem(
  98. /* [in] */ BSTR /*name*/,
  99. /* [retval][out] */ IDOMNode** /*node*/)
  100. {
  101. ASSERT_NOT_REACHED();
  102. return E_NOTIMPL;
  103. }
  104. // DOMHTMLOptionsCollection - IUnknown ----------------------------------------
  105. HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::QueryInterface(REFIID riid, void** ppvObject)
  106. {
  107. *ppvObject = 0;
  108. if (IsEqualGUID(riid, IID_IDOMHTMLOptionsCollection))
  109. *ppvObject = static_cast<IDOMHTMLOptionsCollection*>(this);
  110. else
  111. return DOMObject::QueryInterface(riid, ppvObject);
  112. AddRef();
  113. return S_OK;
  114. }
  115. // DOMHTMLOptionsCollection ---------------------------------------------------
  116. DOMHTMLOptionsCollection::DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection* collection)
  117. : m_collection(collection)
  118. {
  119. }
  120. IDOMHTMLOptionsCollection* DOMHTMLOptionsCollection::createInstance(WebCore::HTMLOptionsCollection* collection)
  121. {
  122. if (!collection)
  123. return 0;
  124. IDOMHTMLOptionsCollection* optionsCollection = 0;
  125. DOMHTMLOptionsCollection* newCollection = new DOMHTMLOptionsCollection(collection);
  126. if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLOptionsCollection, (void**)&optionsCollection))) {
  127. delete newCollection;
  128. return 0;
  129. }
  130. return optionsCollection;
  131. }
  132. HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::length(
  133. /* [retval][out] */ unsigned int* result)
  134. {
  135. if (!result)
  136. return E_POINTER;
  137. *result = m_collection->length();
  138. return S_OK;
  139. }
  140. HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength(
  141. /* [in] */ unsigned int /*length*/)
  142. {
  143. ASSERT_NOT_REACHED();
  144. return E_NOTIMPL;
  145. }
  146. HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::item(
  147. /* [in] */ unsigned int index,
  148. /* [retval][out] */ IDOMNode** result)
  149. {
  150. if (!result)
  151. return E_POINTER;
  152. *result = DOMNode::createInstance(m_collection->item(index));
  153. return *result ? S_OK : E_FAIL;
  154. }
  155. HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::namedItem(
  156. /* [in] */ BSTR /*name*/,
  157. /* [retval][out] */ IDOMNode** /*result*/)
  158. {
  159. ASSERT_NOT_REACHED();
  160. return E_NOTIMPL;
  161. }
  162. // DOMHTMLDocument - IUnknown -------------------------------------------------
  163. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::QueryInterface(REFIID riid, void** ppvObject)
  164. {
  165. *ppvObject = 0;
  166. if (IsEqualGUID(riid, IID_IDOMHTMLDocument))
  167. *ppvObject = static_cast<IDOMHTMLDocument*>(this);
  168. else
  169. return DOMDocument::QueryInterface(riid, ppvObject);
  170. AddRef();
  171. return S_OK;
  172. }
  173. // DOMHTMLDocument ------------------------------------------------------------
  174. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::title(
  175. /* [retval][out] */ BSTR* result)
  176. {
  177. if (!result)
  178. return E_POINTER;
  179. *result = 0;
  180. if (!m_document || !m_document->isHTMLDocument())
  181. return E_FAIL;
  182. *result = BString(m_document->title()).release();
  183. return S_OK;
  184. }
  185. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setTitle(
  186. /* [in] */ BSTR /*title*/)
  187. {
  188. ASSERT_NOT_REACHED();
  189. return E_NOTIMPL;
  190. }
  191. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::referrer(
  192. /* [retval][out] */ BSTR* /*result*/)
  193. {
  194. ASSERT_NOT_REACHED();
  195. return E_NOTIMPL;
  196. }
  197. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::domain(
  198. /* [retval][out] */ BSTR* /*result*/)
  199. {
  200. ASSERT_NOT_REACHED();
  201. return E_NOTIMPL;
  202. }
  203. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::URL(
  204. /* [retval][out] */ BSTR* result)
  205. {
  206. if (!result)
  207. return E_POINTER;
  208. *result = BString(toHTMLDocument(m_document)->url()).release();
  209. return S_OK;
  210. }
  211. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::body(
  212. /* [retval][out] */ IDOMHTMLElement** bodyElement)
  213. {
  214. *bodyElement = 0;
  215. if (!m_document || !m_document->isHTMLDocument())
  216. return E_FAIL;
  217. HTMLDocument* htmlDoc = toHTMLDocument(m_document);
  218. COMPtr<IDOMElement> domElement;
  219. domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc->body()));
  220. if (domElement)
  221. return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) bodyElement);
  222. return E_FAIL;
  223. }
  224. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setBody(
  225. /* [in] */ IDOMHTMLElement* /*body*/)
  226. {
  227. ASSERT_NOT_REACHED();
  228. return E_NOTIMPL;
  229. }
  230. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::images(
  231. /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
  232. {
  233. ASSERT_NOT_REACHED();
  234. return E_NOTIMPL;
  235. }
  236. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::applets(
  237. /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
  238. {
  239. ASSERT_NOT_REACHED();
  240. return E_NOTIMPL;
  241. }
  242. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::links(
  243. /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
  244. {
  245. ASSERT_NOT_REACHED();
  246. return E_NOTIMPL;
  247. }
  248. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::forms(
  249. /* [retval][out] */ IDOMHTMLCollection** collection)
  250. {
  251. *collection = 0;
  252. if (!m_document || !m_document->isHTMLDocument())
  253. return E_FAIL;
  254. HTMLDocument* htmlDoc = toHTMLDocument(m_document);
  255. RefPtr<HTMLCollection> forms = htmlDoc->forms();
  256. *collection = DOMHTMLCollection::createInstance(forms.get());
  257. return S_OK;
  258. }
  259. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::anchors(
  260. /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
  261. {
  262. ASSERT_NOT_REACHED();
  263. return E_NOTIMPL;
  264. }
  265. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::cookie(
  266. /* [retval][out] */ BSTR* /*result*/)
  267. {
  268. ASSERT_NOT_REACHED();
  269. return E_NOTIMPL;
  270. }
  271. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setCookie(
  272. /* [in] */ BSTR /*cookie*/)
  273. {
  274. ASSERT_NOT_REACHED();
  275. return E_NOTIMPL;
  276. }
  277. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::open( void)
  278. {
  279. ASSERT_NOT_REACHED();
  280. return E_NOTIMPL;
  281. }
  282. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::close( void)
  283. {
  284. ASSERT_NOT_REACHED();
  285. return E_NOTIMPL;
  286. }
  287. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::write(
  288. /* [in] */ BSTR /*text*/)
  289. {
  290. ASSERT_NOT_REACHED();
  291. return E_NOTIMPL;
  292. }
  293. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::writeln(
  294. /* [in] */ BSTR /*text*/)
  295. {
  296. ASSERT_NOT_REACHED();
  297. return E_NOTIMPL;
  298. }
  299. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::getElementById_(
  300. /* [in] */ BSTR /*elementId*/,
  301. /* [retval][out] */ IDOMElement** /*element*/)
  302. {
  303. ASSERT_NOT_REACHED();
  304. return E_NOTIMPL;
  305. }
  306. HRESULT STDMETHODCALLTYPE DOMHTMLDocument::getElementsByName(
  307. /* [in] */ BSTR /*elementName*/,
  308. /* [retval][out] */ IDOMNodeList** /*nodeList*/)
  309. {
  310. ASSERT_NOT_REACHED();
  311. return E_NOTIMPL;
  312. }
  313. // DOMHTMLElement - IUnknown --------------------------------------------------
  314. HRESULT STDMETHODCALLTYPE DOMHTMLElement::QueryInterface(REFIID riid, void** ppvObject)
  315. {
  316. *ppvObject = 0;
  317. if (IsEqualGUID(riid, IID_IDOMHTMLElement))
  318. *ppvObject = static_cast<IDOMHTMLElement*>(this);
  319. else
  320. return DOMElement::QueryInterface(riid, ppvObject);
  321. AddRef();
  322. return S_OK;
  323. }
  324. // DOMHTMLElement -------------------------------------------------------------
  325. HRESULT STDMETHODCALLTYPE DOMHTMLElement::idName(
  326. /* [retval][out] */ BSTR* result)
  327. {
  328. if (!result)
  329. return E_POINTER;
  330. ASSERT(m_element && m_element->isHTMLElement());
  331. String idString = toHTMLElement(m_element)->getAttribute(idAttr);
  332. *result = BString(idString).release();
  333. return S_OK;
  334. }
  335. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setIdName(
  336. /* [in] */ BSTR /*idName*/)
  337. {
  338. ASSERT_NOT_REACHED();
  339. return E_NOTIMPL;
  340. }
  341. HRESULT STDMETHODCALLTYPE DOMHTMLElement::title(
  342. /* [retval][out] */ BSTR* /*result*/)
  343. {
  344. ASSERT_NOT_REACHED();
  345. return E_NOTIMPL;
  346. }
  347. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setTitle(
  348. /* [in] */ BSTR /*title*/)
  349. {
  350. ASSERT_NOT_REACHED();
  351. return E_NOTIMPL;
  352. }
  353. HRESULT STDMETHODCALLTYPE DOMHTMLElement::lang(
  354. /* [retval][out] */ BSTR* /*result*/)
  355. {
  356. ASSERT_NOT_REACHED();
  357. return E_NOTIMPL;
  358. }
  359. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setLang(
  360. /* [in] */ BSTR /*lang*/)
  361. {
  362. ASSERT_NOT_REACHED();
  363. return E_NOTIMPL;
  364. }
  365. HRESULT STDMETHODCALLTYPE DOMHTMLElement::dir(
  366. /* [retval][out] */ BSTR* /*result*/)
  367. {
  368. ASSERT_NOT_REACHED();
  369. return E_NOTIMPL;
  370. }
  371. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setDir(
  372. /* [in] */ BSTR /*dir*/)
  373. {
  374. ASSERT_NOT_REACHED();
  375. return E_NOTIMPL;
  376. }
  377. HRESULT STDMETHODCALLTYPE DOMHTMLElement::className(
  378. /* [retval][out] */ BSTR* /*result*/)
  379. {
  380. ASSERT_NOT_REACHED();
  381. return E_NOTIMPL;
  382. }
  383. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setClassName(
  384. /* [in] */ BSTR /*className*/)
  385. {
  386. ASSERT_NOT_REACHED();
  387. return E_NOTIMPL;
  388. }
  389. HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerHTML(
  390. /* [retval][out] */ BSTR* /*result*/)
  391. {
  392. ASSERT_NOT_REACHED();
  393. return E_NOTIMPL;
  394. }
  395. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setInnerHTML(
  396. /* [in] */ BSTR /*html*/)
  397. {
  398. ASSERT_NOT_REACHED();
  399. return E_NOTIMPL;
  400. }
  401. HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerText(
  402. /* [retval][out] */ BSTR* result)
  403. {
  404. ASSERT(m_element && m_element->isHTMLElement());
  405. WTF::String innerTextString = toHTMLElement(m_element)->innerText();
  406. *result = BString(innerTextString.characters(), innerTextString.length()).release();
  407. return S_OK;
  408. }
  409. HRESULT STDMETHODCALLTYPE DOMHTMLElement::setInnerText(
  410. /* [in] */ BSTR text)
  411. {
  412. ASSERT(m_element && m_element->isHTMLElement());
  413. HTMLElement* htmlEle = toHTMLElement(m_element);
  414. WTF::String textString(text, SysStringLen(text));
  415. WebCore::ExceptionCode ec = 0;
  416. htmlEle->setInnerText(textString, ec);
  417. return S_OK;
  418. }
  419. // DOMHTMLFormElement - IUnknown ----------------------------------------------
  420. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::QueryInterface(REFIID riid, void** ppvObject)
  421. {
  422. *ppvObject = 0;
  423. if (IsEqualGUID(riid, IID_IDOMHTMLFormElement))
  424. *ppvObject = static_cast<IDOMHTMLFormElement*>(this);
  425. else
  426. return DOMHTMLElement::QueryInterface(riid, ppvObject);
  427. AddRef();
  428. return S_OK;
  429. }
  430. // DOMHTMLFormElement ---------------------------------------------------------
  431. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::elements(
  432. /* [retval][out] */ IDOMHTMLCollection** /*result*/)
  433. {
  434. ASSERT_NOT_REACHED();
  435. return E_NOTIMPL;
  436. }
  437. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::length(
  438. /* [retval][out] */ int* /*result*/)
  439. {
  440. ASSERT_NOT_REACHED();
  441. return E_NOTIMPL;
  442. }
  443. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::name(
  444. /* [retval][out] */ BSTR* /*result*/)
  445. {
  446. ASSERT_NOT_REACHED();
  447. return E_NOTIMPL;
  448. }
  449. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setName(
  450. /* [in] */ BSTR /*name*/)
  451. {
  452. ASSERT_NOT_REACHED();
  453. return E_NOTIMPL;
  454. }
  455. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::acceptCharset(
  456. /* [retval][out] */ BSTR* /*result*/)
  457. {
  458. ASSERT_NOT_REACHED();
  459. return E_NOTIMPL;
  460. }
  461. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setAcceptCharset(
  462. /* [in] */ BSTR /*acceptCharset*/)
  463. {
  464. ASSERT_NOT_REACHED();
  465. return E_NOTIMPL;
  466. }
  467. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::action(
  468. /* [retval][out] */ BSTR* result)
  469. {
  470. ASSERT(m_element && m_element->hasTagName(formTag));
  471. WTF::String actionString = static_cast<HTMLFormElement*>(m_element)->action();
  472. *result = BString(actionString.characters(), actionString.length()).release();
  473. return S_OK;
  474. }
  475. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setAction(
  476. /* [in] */ BSTR /*action*/)
  477. {
  478. ASSERT_NOT_REACHED();
  479. return E_NOTIMPL;
  480. }
  481. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::encType(
  482. /* [retval][out] */ BSTR* /*result*/)
  483. {
  484. ASSERT_NOT_REACHED();
  485. return E_NOTIMPL;
  486. }
  487. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setEnctype(
  488. /* [retval][out] */ BSTR* /*encType*/)
  489. {
  490. ASSERT_NOT_REACHED();
  491. return E_NOTIMPL;
  492. }
  493. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method(
  494. /* [retval][out] */ BSTR* result)
  495. {
  496. ASSERT(m_element && m_element->hasTagName(formTag));
  497. WTF::String methodString = static_cast<HTMLFormElement*>(m_element)->method();
  498. *result = BString(methodString.characters(), methodString.length()).release();
  499. return S_OK;
  500. }
  501. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setMethod(
  502. /* [in] */ BSTR /*method*/)
  503. {
  504. ASSERT_NOT_REACHED();
  505. return E_NOTIMPL;
  506. }
  507. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::target(
  508. /* [retval][out] */ BSTR* /*result*/)
  509. {
  510. ASSERT_NOT_REACHED();
  511. return E_NOTIMPL;
  512. }
  513. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setTarget(
  514. /* [in] */ BSTR /*target*/)
  515. {
  516. ASSERT_NOT_REACHED();
  517. return E_NOTIMPL;
  518. }
  519. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::submit( void)
  520. {
  521. ASSERT_NOT_REACHED();
  522. return E_NOTIMPL;
  523. }
  524. HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::reset( void)
  525. {
  526. ASSERT_NOT_REACHED();
  527. return E_NOTIMPL;
  528. }
  529. // DOMHTMLSelectElement - IUnknown ----------------------------------------------
  530. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::QueryInterface(REFIID riid, void** ppvObject)
  531. {
  532. *ppvObject = 0;
  533. if (IsEqualGUID(riid, IID_IDOMHTMLSelectElement))
  534. *ppvObject = static_cast<IDOMHTMLSelectElement*>(this);
  535. else if (IsEqualGUID(riid, IID_IFormsAutoFillTransitionSelect))
  536. *ppvObject = static_cast<IFormsAutoFillTransitionSelect*>(this);
  537. else
  538. return DOMHTMLElement::QueryInterface(riid, ppvObject);
  539. AddRef();
  540. return S_OK;
  541. }
  542. // DOMHTMLSelectElement -------------------------------------------------------
  543. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::type(
  544. /* [retval][out] */ BSTR* /*result*/)
  545. {
  546. ASSERT_NOT_REACHED();
  547. return E_NOTIMPL;
  548. }
  549. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::selectedIndex(
  550. /* [retval][out] */ int* /*result*/)
  551. {
  552. ASSERT_NOT_REACHED();
  553. return E_NOTIMPL;
  554. }
  555. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setSelectedIndx(
  556. /* [in] */ int /*selectedIndex*/)
  557. {
  558. ASSERT_NOT_REACHED();
  559. return E_NOTIMPL;
  560. }
  561. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::value(
  562. /* [retval][out] */ BSTR* /*result*/)
  563. {
  564. ASSERT_NOT_REACHED();
  565. return E_NOTIMPL;
  566. }
  567. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setValue(
  568. /* [in] */ BSTR /*value*/)
  569. {
  570. ASSERT_NOT_REACHED();
  571. return E_NOTIMPL;
  572. }
  573. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::length(
  574. /* [retval][out] */ int* /*result*/)
  575. {
  576. ASSERT_NOT_REACHED();
  577. return E_NOTIMPL;
  578. }
  579. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::form(
  580. /* [retval][out] */ IDOMHTMLFormElement** /*result*/)
  581. {
  582. ASSERT_NOT_REACHED();
  583. return E_NOTIMPL;
  584. }
  585. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options(
  586. /* [retval][out] */ IDOMHTMLOptionsCollection** result)
  587. {
  588. if (!result)
  589. return E_POINTER;
  590. *result = 0;
  591. ASSERT(m_element);
  592. ASSERT(m_element->hasTagName(selectTag));
  593. HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);
  594. if (!selectElement->options())
  595. return E_FAIL;
  596. RefPtr<HTMLOptionsCollection> options = selectElement->options();
  597. *result = DOMHTMLOptionsCollection::createInstance(options.get());
  598. return S_OK;
  599. }
  600. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::disabled(
  601. /* [retval][out] */ BOOL* /*result*/)
  602. {
  603. ASSERT_NOT_REACHED();
  604. return E_NOTIMPL;
  605. }
  606. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setDisabled(
  607. /* [in] */ BOOL /*disabled*/)
  608. {
  609. ASSERT_NOT_REACHED();
  610. return E_NOTIMPL;
  611. }
  612. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::multiple(
  613. /* [retval][out] */ BOOL* /*result*/)
  614. {
  615. ASSERT_NOT_REACHED();
  616. return E_NOTIMPL;
  617. }
  618. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setMultiple(
  619. /* [in] */ BOOL /*multiple*/)
  620. {
  621. ASSERT_NOT_REACHED();
  622. return E_NOTIMPL;
  623. }
  624. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::name(
  625. /* [retval][out] */ BSTR* /*result*/)
  626. {
  627. ASSERT_NOT_REACHED();
  628. return E_NOTIMPL;
  629. }
  630. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setName(
  631. /* [in] */ BSTR /*name*/)
  632. {
  633. ASSERT_NOT_REACHED();
  634. return E_NOTIMPL;
  635. }
  636. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::size(
  637. /* [retval][out] */ int* /*size*/)
  638. {
  639. ASSERT_NOT_REACHED();
  640. return E_NOTIMPL;
  641. }
  642. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setSize(
  643. /* [in] */ int /*size*/)
  644. {
  645. ASSERT_NOT_REACHED();
  646. return E_NOTIMPL;
  647. }
  648. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::tabIndex(
  649. /* [retval][out] */ int* /*result*/)
  650. {
  651. ASSERT_NOT_REACHED();
  652. return E_NOTIMPL;
  653. }
  654. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setTabIndex(
  655. /* [in] */ int /*tabIndex*/)
  656. {
  657. ASSERT_NOT_REACHED();
  658. return E_NOTIMPL;
  659. }
  660. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::add(
  661. /* [in] */ IDOMHTMLElement* /*element*/,
  662. /* [in] */ IDOMHTMLElement* /*before*/)
  663. {
  664. ASSERT_NOT_REACHED();
  665. return E_NOTIMPL;
  666. }
  667. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::remove(
  668. /* [in] */ int /*index*/)
  669. {
  670. ASSERT_NOT_REACHED();
  671. return E_NOTIMPL;
  672. }
  673. // DOMHTMLSelectElement - IFormsAutoFillTransitionSelect ----------------------
  674. HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::activateItemAtIndex(
  675. /* [in] */ int index)
  676. {
  677. ASSERT(m_element);
  678. ASSERT(m_element->hasTagName(selectTag));
  679. HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);
  680. if (index >= selectElement->length())
  681. return E_FAIL;
  682. selectElement->setSelectedIndex(index);
  683. return S_OK;
  684. }
  685. // DOMHTMLOptionElement - IUnknown --------------------------------------------
  686. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::QueryInterface(REFIID riid, void** ppvObject)
  687. {
  688. *ppvObject = 0;
  689. if (IsEqualGUID(riid, IID_IDOMHTMLOptionElement))
  690. *ppvObject = static_cast<IDOMHTMLOptionElement*>(this);
  691. else
  692. return DOMHTMLElement::QueryInterface(riid, ppvObject);
  693. AddRef();
  694. return S_OK;
  695. }
  696. // DOMHTMLOptionElement -------------------------------------------------------
  697. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::form(
  698. /* [retval][out] */ IDOMHTMLFormElement** /*result*/)
  699. {
  700. ASSERT_NOT_REACHED();
  701. return E_NOTIMPL;
  702. }
  703. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::defaultSelected(
  704. /* [retval][out] */ BOOL* /*result*/)
  705. {
  706. ASSERT_NOT_REACHED();
  707. return E_NOTIMPL;
  708. }
  709. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDefaultSelected(
  710. /* [in] */ BOOL /*defaultSelected*/)
  711. {
  712. ASSERT_NOT_REACHED();
  713. return E_NOTIMPL;
  714. }
  715. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::text(
  716. /* [retval][out] */ BSTR* result)
  717. {
  718. if (!result)
  719. return E_POINTER;
  720. *result = 0;
  721. ASSERT(m_element);
  722. ASSERT(m_element->hasTagName(optionTag));
  723. HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(m_element);
  724. *result = BString(optionElement->text()).release();
  725. return S_OK;
  726. }
  727. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::index(
  728. /* [retval][out] */ int* /*result*/)
  729. {
  730. ASSERT_NOT_REACHED();
  731. return E_NOTIMPL;
  732. }
  733. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::disabled(
  734. /* [retval][out] */ BOOL* /*result*/)
  735. {
  736. ASSERT_NOT_REACHED();
  737. return E_NOTIMPL;
  738. }
  739. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDisabled(
  740. /* [in] */ BOOL /*disabled*/)
  741. {
  742. ASSERT_NOT_REACHED();
  743. return E_NOTIMPL;
  744. }
  745. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::label(
  746. /* [retval][out] */ BSTR* result)
  747. {
  748. if (!result)
  749. return E_POINTER;
  750. *result = 0;
  751. ASSERT(m_element);
  752. ASSERT(m_element->hasTagName(optionTag));
  753. HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(m_element);
  754. *result = BString(optionElement->label()).release();
  755. return S_OK;
  756. }
  757. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setLabel(
  758. /* [in] */ BSTR /*label*/)
  759. {
  760. ASSERT_NOT_REACHED();
  761. return E_NOTIMPL;
  762. }
  763. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::selected(
  764. /* [retval][out] */ BOOL* /*result*/)
  765. {
  766. ASSERT_NOT_REACHED();
  767. return E_NOTIMPL;
  768. }
  769. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setSelected(
  770. /* [in] */ BOOL /*selected*/)
  771. {
  772. ASSERT_NOT_REACHED();
  773. return E_NOTIMPL;
  774. }
  775. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::value(
  776. /* [retval][out] */ BSTR* /*result*/)
  777. {
  778. ASSERT_NOT_REACHED();
  779. return E_NOTIMPL;
  780. }
  781. HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setValue(
  782. /* [in] */ BSTR /*value*/)
  783. {
  784. ASSERT_NOT_REACHED();
  785. return E_NOTIMPL;
  786. }
  787. // DOMHTMLInputElement - IUnknown ----------------------------------------------
  788. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::QueryInterface(REFIID riid, void** ppvObject)
  789. {
  790. *ppvObject = 0;
  791. if (IsEqualGUID(riid, IID_IDOMHTMLInputElement))
  792. *ppvObject = static_cast<IDOMHTMLInputElement*>(this);
  793. else if (IsEqualGUID(riid, IID_IFormsAutoFillTransition))
  794. *ppvObject = static_cast<IFormsAutoFillTransition*>(this);
  795. else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
  796. *ppvObject = static_cast<IFormPromptAdditions*>(this);
  797. else
  798. return DOMHTMLElement::QueryInterface(riid, ppvObject);
  799. AddRef();
  800. return S_OK;
  801. }
  802. // DOMHTMLInputElement --------------------------------------------------------
  803. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::defaultValue(
  804. /* [retval][out] */ BSTR* /*result*/)
  805. {
  806. ASSERT_NOT_REACHED();
  807. return E_NOTIMPL;
  808. }
  809. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDefaultValue(
  810. /* [in] */ BSTR /*val*/)
  811. {
  812. ASSERT_NOT_REACHED();
  813. return E_NOTIMPL;
  814. }
  815. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::defaultChecked(
  816. /* [retval][out] */ BOOL* /*result*/)
  817. {
  818. ASSERT_NOT_REACHED();
  819. return E_NOTIMPL;
  820. }
  821. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDefaultChecked(
  822. /* [in] */ BSTR /*checked*/)
  823. {
  824. ASSERT_NOT_REACHED();
  825. return E_NOTIMPL;
  826. }
  827. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::form(
  828. /* [retval][out] */ IDOMHTMLElement** result)
  829. {
  830. if (!result)
  831. return E_POINTER;
  832. *result = 0;
  833. ASSERT(m_element && m_element->hasTagName(inputTag));
  834. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  835. COMPtr<IDOMElement> domElement;
  836. domElement.adoptRef(DOMHTMLElement::createInstance(inputElement->form()));
  837. if (domElement)
  838. return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) result);
  839. return E_FAIL;
  840. }
  841. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::accept(
  842. /* [retval][out] */ BSTR* /*result*/)
  843. {
  844. ASSERT_NOT_REACHED();
  845. return E_NOTIMPL;
  846. }
  847. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAccept(
  848. /* [in] */ BSTR /*accept*/)
  849. {
  850. ASSERT_NOT_REACHED();
  851. return E_NOTIMPL;
  852. }
  853. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::accessKey(
  854. /* [retval][out] */ BSTR* /*result*/)
  855. {
  856. ASSERT_NOT_REACHED();
  857. return E_NOTIMPL;
  858. }
  859. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAccessKey(
  860. /* [in] */ BSTR /*key*/)
  861. {
  862. ASSERT_NOT_REACHED();
  863. return E_NOTIMPL;
  864. }
  865. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::align(
  866. /* [retval][out] */ BSTR* /*result*/)
  867. {
  868. ASSERT_NOT_REACHED();
  869. return E_NOTIMPL;
  870. }
  871. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAlign(
  872. /* [in] */ BSTR /*align*/)
  873. {
  874. ASSERT_NOT_REACHED();
  875. return E_NOTIMPL;
  876. }
  877. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::alt(
  878. /* [retval][out] */ BSTR* /*result*/)
  879. {
  880. ASSERT_NOT_REACHED();
  881. return E_NOTIMPL;
  882. }
  883. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAlt(
  884. /* [in] */ BSTR /*alt*/)
  885. {
  886. ASSERT_NOT_REACHED();
  887. return E_NOTIMPL;
  888. }
  889. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::checked(
  890. /* [retval][out] */ BOOL* /*result*/)
  891. {
  892. ASSERT_NOT_REACHED();
  893. return E_NOTIMPL;
  894. }
  895. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setChecked(
  896. /* [in] */ BOOL /*checked*/)
  897. {
  898. ASSERT_NOT_REACHED();
  899. return E_NOTIMPL;
  900. }
  901. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::disabled(
  902. /* [retval][out] */ BOOL* result)
  903. {
  904. ASSERT(m_element && m_element->hasTagName(inputTag));
  905. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  906. *result = inputElement->isDisabledFormControl() ? TRUE : FALSE;
  907. return S_OK;
  908. }
  909. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDisabled(
  910. /* [in] */ BOOL /*disabled*/)
  911. {
  912. ASSERT_NOT_REACHED();
  913. return E_NOTIMPL;
  914. }
  915. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::maxLength(
  916. /* [retval][out] */ int* /*result*/)
  917. {
  918. ASSERT_NOT_REACHED();
  919. return E_NOTIMPL;
  920. }
  921. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setMaxLength(
  922. /* [in] */ int /*maxLength*/)
  923. {
  924. ASSERT_NOT_REACHED();
  925. return E_NOTIMPL;
  926. }
  927. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::name(
  928. /* [retval][out] */ BSTR* /*name*/)
  929. {
  930. ASSERT_NOT_REACHED();
  931. return E_NOTIMPL;
  932. }
  933. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setName(
  934. /* [in] */ BSTR /*name*/)
  935. {
  936. ASSERT_NOT_REACHED();
  937. return E_NOTIMPL;
  938. }
  939. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::readOnly(
  940. /* [retval][out] */ BOOL* result)
  941. {
  942. ASSERT(m_element && m_element->hasTagName(inputTag));
  943. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  944. *result = inputElement->isReadOnly() ? TRUE : FALSE;
  945. return S_OK;
  946. }
  947. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setReadOnly(
  948. /* [in] */ BOOL /*readOnly*/)
  949. {
  950. ASSERT_NOT_REACHED();
  951. return E_NOTIMPL;
  952. }
  953. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::size(
  954. /* [retval][out] */ unsigned int* /*result*/)
  955. {
  956. ASSERT_NOT_REACHED();
  957. return E_NOTIMPL;
  958. }
  959. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSize(
  960. /* [in] */ unsigned int /*size*/)
  961. {
  962. ASSERT_NOT_REACHED();
  963. return E_NOTIMPL;
  964. }
  965. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::src(
  966. /* [retval][out] */ BSTR* /*result*/)
  967. {
  968. ASSERT_NOT_REACHED();
  969. return E_NOTIMPL;
  970. }
  971. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSrc(
  972. /* [in] */ BSTR /*src*/)
  973. {
  974. ASSERT_NOT_REACHED();
  975. return E_NOTIMPL;
  976. }
  977. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::tabIndex(
  978. /* [retval][out] */ int* /*result*/)
  979. {
  980. ASSERT_NOT_REACHED();
  981. return E_NOTIMPL;
  982. }
  983. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setTabIndex(
  984. /* [in] */ int /*tabIndex*/)
  985. {
  986. ASSERT_NOT_REACHED();
  987. return E_NOTIMPL;
  988. }
  989. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::type(
  990. /* [retval][out] */ BSTR* /*result*/)
  991. {
  992. ASSERT_NOT_REACHED();
  993. return E_NOTIMPL;
  994. }
  995. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setType(
  996. /* [in] */ BSTR type)
  997. {
  998. ASSERT(m_element && m_element->hasTagName(inputTag));
  999. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1000. WTF::String typeString(type, SysStringLen(type));
  1001. inputElement->setType(typeString);
  1002. return S_OK;
  1003. }
  1004. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::useMap(
  1005. /* [retval][out] */ BSTR* /*result*/)
  1006. {
  1007. ASSERT_NOT_REACHED();
  1008. return E_NOTIMPL;
  1009. }
  1010. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setUseMap(
  1011. /* [in] */ BSTR /*useMap*/)
  1012. {
  1013. ASSERT_NOT_REACHED();
  1014. return E_NOTIMPL;
  1015. }
  1016. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value(
  1017. /* [retval][out] */ BSTR* result)
  1018. {
  1019. ASSERT(m_element && m_element->hasTagName(inputTag));
  1020. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1021. WTF::String valueString = inputElement->value();
  1022. *result = BString(valueString.characters(), valueString.length()).release();
  1023. if (valueString.length() && !*result)
  1024. return E_OUTOFMEMORY;
  1025. return S_OK;
  1026. }
  1027. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValue(
  1028. /* [in] */ BSTR value)
  1029. {
  1030. ASSERT(m_element && m_element->hasTagName(inputTag));
  1031. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1032. inputElement->setValue(String((UChar*) value, SysStringLen(value)));
  1033. return S_OK;
  1034. }
  1035. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValueForUser(
  1036. /* [in] */ BSTR value)
  1037. {
  1038. ASSERT(m_element);
  1039. ASSERT(m_element->hasTagName(inputTag));
  1040. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1041. inputElement->setValueForUser(String(static_cast<UChar*>(value), SysStringLen(value)));
  1042. return S_OK;
  1043. }
  1044. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::select( void)
  1045. {
  1046. ASSERT(m_element && m_element->hasTagName(inputTag));
  1047. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1048. inputElement->select();
  1049. return S_OK;
  1050. }
  1051. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::click( void)
  1052. {
  1053. ASSERT_NOT_REACHED();
  1054. return E_NOTIMPL;
  1055. }
  1056. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionStart(
  1057. /* [in] */ long start)
  1058. {
  1059. ASSERT(m_element && m_element->hasTagName(inputTag));
  1060. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1061. inputElement->setSelectionStart(start);
  1062. return S_OK;
  1063. }
  1064. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionStart(
  1065. /* [retval][out] */ long *start)
  1066. {
  1067. ASSERT(m_element && m_element->hasTagName(inputTag));
  1068. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1069. *start = inputElement->selectionStart();
  1070. return S_OK;
  1071. }
  1072. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionEnd(
  1073. /* [in] */ long end)
  1074. {
  1075. ASSERT(m_element && m_element->hasTagName(inputTag));
  1076. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1077. inputElement->setSelectionEnd(end);
  1078. return S_OK;
  1079. }
  1080. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionEnd(
  1081. /* [retval][out] */ long *end)
  1082. {
  1083. ASSERT(m_element && m_element->hasTagName(inputTag));
  1084. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1085. *end = inputElement->selectionEnd();
  1086. return S_OK;
  1087. }
  1088. // DOMHTMLInputElement -- IFormsAutoFillTransition ----------------------------
  1089. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isTextField(
  1090. /* [retval][out] */ BOOL* result)
  1091. {
  1092. ASSERT(m_element);
  1093. ASSERT(m_element->hasTagName(inputTag));
  1094. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1095. *result = inputElement->isTextField() ? TRUE : FALSE;
  1096. return S_OK;
  1097. }
  1098. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::rectOnScreen(
  1099. /* [retval][out] */ LPRECT rect)
  1100. {
  1101. ASSERT(m_element);
  1102. ASSERT(m_element->hasTagName(inputTag));
  1103. rect->left = rect->top = rect->right = rect->bottom = 0;
  1104. RenderObject* renderer = m_element->renderer();
  1105. FrameView* view = m_element->document()->view();
  1106. if (!renderer || !view)
  1107. return E_FAIL;
  1108. IntRect coreRect = view->contentsToScreen(renderer->absoluteBoundingBoxRect());
  1109. rect->left = coreRect.x();
  1110. rect->top = coreRect.y();
  1111. rect->right = coreRect.maxX();
  1112. rect->bottom = coreRect.maxY();
  1113. return S_OK;
  1114. }
  1115. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::replaceCharactersInRange(
  1116. /* [in] */ int startTarget,
  1117. /* [in] */ int endTarget,
  1118. /* [in] */ BSTR replacementString,
  1119. /* [in] */ int index)
  1120. {
  1121. if (!replacementString)
  1122. return E_POINTER;
  1123. ASSERT(m_element);
  1124. ASSERT(m_element->hasTagName(inputTag));
  1125. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1126. String newValue = inputElement->value();
  1127. String webCoreReplacementString(static_cast<UChar*>(replacementString), SysStringLen(replacementString));
  1128. newValue.replace(startTarget, endTarget - startTarget, webCoreReplacementString);
  1129. inputElement->setValue(newValue);
  1130. inputElement->setSelectionRange(index, newValue.length());
  1131. return S_OK;
  1132. }
  1133. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange(
  1134. /* [out] */ int* start,
  1135. /* [out] */ int* end)
  1136. {
  1137. ASSERT(m_element);
  1138. ASSERT(m_element->hasTagName(inputTag));
  1139. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1140. *start = inputElement->selectionStart();
  1141. *end = inputElement->selectionEnd();
  1142. return S_OK;
  1143. }
  1144. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAutofilled(
  1145. /* [in] */ BOOL filled)
  1146. {
  1147. ASSERT(m_element);
  1148. ASSERT(m_element->hasTagName(inputTag));
  1149. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1150. inputElement->setAutofilled(!!filled);
  1151. return S_OK;
  1152. }
  1153. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isAutofilled(
  1154. /* [retval][out] */ BOOL* result)
  1155. {
  1156. ASSERT(m_element);
  1157. ASSERT(m_element->hasTagName(inputTag));
  1158. HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
  1159. *result = inputElement->isAutofilled() ? TRUE : FALSE;
  1160. return S_OK;
  1161. }
  1162. // DOMHTMLInputElement -- IFormPromptAdditions ------------------------------------
  1163. HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited(
  1164. /* [retval][out] */ BOOL *result)
  1165. {
  1166. if (!result)
  1167. return E_POINTER;
  1168. *result = FALSE;
  1169. ASSERT(m_element && m_element->hasTagName(inputTag));
  1170. BOOL textField = FALSE;
  1171. if (FAILED(isTextField(&textField)) || !textField)
  1172. return S_OK;
  1173. if (static_cast<HTMLInputElement*>(m_element)->lastChangeWasUserEdit())
  1174. *result = TRUE;
  1175. return S_OK;
  1176. }
  1177. // DOMHTMLTextAreaElement - IUnknown ----------------------------------------------
  1178. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::QueryInterface(REFIID riid, void** ppvObject)
  1179. {
  1180. *ppvObject = 0;
  1181. if (IsEqualGUID(riid, IID_IDOMHTMLTextAreaElement))
  1182. *ppvObject = static_cast<IDOMHTMLTextAreaElement*>(this);
  1183. else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
  1184. *ppvObject = static_cast<IFormPromptAdditions*>(this);
  1185. else
  1186. return DOMHTMLElement::QueryInterface(riid, ppvObject);
  1187. AddRef();
  1188. return S_OK;
  1189. }
  1190. // DOMHTMLTextAreaElement -----------------------------------------------------
  1191. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::defaultValue(
  1192. /* [retval][out] */ BSTR* /*result*/)
  1193. {
  1194. ASSERT_NOT_REACHED();
  1195. return E_NOTIMPL;
  1196. }
  1197. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setDefaultValue(
  1198. /* [in] */ BSTR /*val*/)
  1199. {
  1200. ASSERT_NOT_REACHED();
  1201. return E_NOTIMPL;
  1202. }
  1203. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::form(
  1204. /* [retval][out] */ IDOMHTMLElement** result)
  1205. {
  1206. if (!result)
  1207. return E_POINTER;
  1208. *result = 0;
  1209. ASSERT(m_element && m_element->hasTagName(textareaTag));
  1210. HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
  1211. COMPtr<IDOMElement> domElement;
  1212. domElement.adoptRef(DOMHTMLElement::createInstance(textareaElement->form()));
  1213. if (domElement)
  1214. return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) result);
  1215. return E_FAIL;
  1216. }
  1217. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::accessKey(
  1218. /* [retval][out] */ BSTR* /*result*/)
  1219. {
  1220. ASSERT_NOT_REACHED();
  1221. return E_NOTIMPL;
  1222. }
  1223. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setAccessKey(
  1224. /* [in] */ BSTR /*key*/)
  1225. {
  1226. ASSERT_NOT_REACHED();
  1227. return E_NOTIMPL;
  1228. }
  1229. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::cols(
  1230. /* [retval][out] */ int* /*result*/)
  1231. {
  1232. ASSERT_NOT_REACHED();
  1233. return E_NOTIMPL;
  1234. }
  1235. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setCols(
  1236. /* [in] */ int /*cols*/)
  1237. {
  1238. ASSERT_NOT_REACHED();
  1239. return E_NOTIMPL;
  1240. }
  1241. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::disabled(
  1242. /* [retval][out] */ BOOL* /*result*/)
  1243. {
  1244. ASSERT_NOT_REACHED();
  1245. return E_NOTIMPL;
  1246. }
  1247. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setDisabled(
  1248. /* [in] */ BOOL /*disabled*/)
  1249. {
  1250. ASSERT_NOT_REACHED();
  1251. return E_NOTIMPL;
  1252. }
  1253. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::name(
  1254. /* [retval][out] */ BSTR* /*name*/)
  1255. {
  1256. ASSERT_NOT_REACHED();
  1257. return E_NOTIMPL;
  1258. }
  1259. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setName(
  1260. /* [in] */ BSTR /*name*/)
  1261. {
  1262. ASSERT_NOT_REACHED();
  1263. return E_NOTIMPL;
  1264. }
  1265. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::readOnly(
  1266. /* [retval][out] */ BOOL* /*result*/)
  1267. {
  1268. ASSERT_NOT_REACHED();
  1269. return E_NOTIMPL;
  1270. }
  1271. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setReadOnly(
  1272. /* [in] */ BOOL /*readOnly*/)
  1273. {
  1274. ASSERT_NOT_REACHED();
  1275. return E_NOTIMPL;
  1276. }
  1277. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::rows(
  1278. /* [retval][out] */ int* /*result*/)
  1279. {
  1280. ASSERT_NOT_REACHED();
  1281. return E_NOTIMPL;
  1282. }
  1283. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setRows(
  1284. /* [in] */ int /*rows*/)
  1285. {
  1286. ASSERT_NOT_REACHED();
  1287. return E_NOTIMPL;
  1288. }
  1289. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::tabIndex(
  1290. /* [retval][out] */ int* /*result*/)
  1291. {
  1292. ASSERT_NOT_REACHED();
  1293. return E_NOTIMPL;
  1294. }
  1295. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setTabIndex(
  1296. /* [in] */ int /*tabIndex*/)
  1297. {
  1298. ASSERT_NOT_REACHED();
  1299. return E_NOTIMPL;
  1300. }
  1301. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::type(
  1302. /* [retval][out] */ BSTR* /*result*/)
  1303. {
  1304. ASSERT_NOT_REACHED();
  1305. return E_NOTIMPL;
  1306. }
  1307. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value(
  1308. /* [retval][out] */ BSTR* result)
  1309. {
  1310. ASSERT(m_element && m_element->hasTagName(textareaTag));
  1311. HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
  1312. WTF::String valueString = textareaElement->value();
  1313. *result = BString(valueString.characters(), valueString.length()).release();
  1314. if (valueString.length() && !*result)
  1315. return E_OUTOFMEMORY;
  1316. return S_OK;
  1317. }
  1318. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setValue(
  1319. /* [in] */ BSTR value)
  1320. {
  1321. ASSERT(m_element && m_element->hasTagName(textareaTag));
  1322. HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
  1323. textareaElement->setValue(String((UChar*) value, SysStringLen(value)));
  1324. return S_OK;
  1325. }
  1326. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::select( void)
  1327. {
  1328. ASSERT(m_element && m_element->hasTagName(textareaTag));
  1329. HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
  1330. textareaElement->select();
  1331. return S_OK;
  1332. }
  1333. // DOMHTMLTextAreaElement -- IFormPromptAdditions ------------------------------------
  1334. HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited(
  1335. /* [retval][out] */ BOOL *result)
  1336. {
  1337. if (!result)
  1338. return E_POINTER;
  1339. *result = FALSE;
  1340. ASSERT(m_element && m_element->hasTagName(textareaTag));
  1341. if (static_cast<HTMLTextAreaElement*>(m_element)->lastChangeWasUserEdit())
  1342. *result = TRUE;
  1343. return S_OK;
  1344. }
  1345. // DOMHTMLIFrameElement - IUnknown --------------------------------------------------
  1346. HRESULT STDMETHODCALLTYPE DOMHTMLIFrameElement::QueryInterface(REFIID riid, void** ppvObject)
  1347. {
  1348. *ppvObject = 0;
  1349. if (IsEqualGUID(riid, IID_IDOMHTMLIFrameElement))
  1350. *ppvObject = static_cast<IDOMHTMLIFrameElement*>(this);
  1351. else
  1352. return DOMHTMLElement::QueryInterface(riid, ppvObject);
  1353. AddRef();
  1354. return S_OK;
  1355. }
  1356. // DOMHTMLIFrameElement -------------------------------------------------------------
  1357. HRESULT STDMETHODCALLTYPE DOMHTMLIFrameElement::contentFrame(
  1358. /* [retval][out] */ IWebFrame **result)
  1359. {
  1360. if (!result)
  1361. return E_POINTER;
  1362. *result = 0;
  1363. ASSERT(m_element);
  1364. HTMLIFrameElement* iFrameElement = toHTMLIFrameElement(m_element);
  1365. COMPtr<IWebFrame> webFrame = kit(iFrameElement->contentFrame());
  1366. if (!webFrame)
  1367. return E_FAIL;
  1368. return webFrame.copyRefTo(result);
  1369. }