1 /* 2 * Copyright 2006 Jacek Caban for CodeWeavers 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #include "mshtml_private.h" 20 21 #include <limits.h> 22 23 typedef struct { 24 HTMLElement element; 25 26 IHTMLInputElement IHTMLInputElement_iface; 27 IHTMLInputTextElement IHTMLInputTextElement_iface; 28 29 nsIDOMHTMLInputElement *nsinput; 30 } HTMLInputElement; 31 32 static const WCHAR forW[] = {'f','o','r',0}; 33 34 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface) 35 { 36 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface); 37 } 38 39 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface) 40 { 41 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface); 42 } 43 44 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface, 45 REFIID riid, void **ppv) 46 { 47 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 48 49 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); 50 } 51 52 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface) 53 { 54 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 55 56 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); 57 } 58 59 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface) 60 { 61 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 62 63 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); 64 } 65 66 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo) 67 { 68 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 69 70 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); 71 } 72 73 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo, 74 LCID lcid, ITypeInfo **ppTInfo) 75 { 76 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 77 78 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, 79 ppTInfo); 80 } 81 82 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid, 83 LPOLESTR *rgszNames, UINT cNames, 84 LCID lcid, DISPID *rgDispId) 85 { 86 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 87 88 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, 89 cNames, lcid, rgDispId); 90 } 91 92 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember, 93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 95 { 96 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 97 98 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, 99 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 100 } 101 102 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v) 103 { 104 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 105 nsAString type_str; 106 nsresult nsres; 107 108 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 109 110 /* 111 * FIXME: 112 * On IE setting type works only on dynamically created elements before adding them to DOM tree. 113 */ 114 nsAString_InitDepend(&type_str, v); 115 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str); 116 nsAString_Finish(&type_str); 117 if(NS_FAILED(nsres)) { 118 ERR("SetType failed: %08x\n", nsres); 119 return E_FAIL; 120 } 121 122 return S_OK; 123 } 124 125 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p) 126 { 127 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 128 nsAString type_str; 129 nsresult nsres; 130 131 TRACE("(%p)->(%p)\n", This, p); 132 133 nsAString_Init(&type_str, NULL); 134 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str); 135 return return_nsstr(nsres, &type_str, p); 136 } 137 138 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v) 139 { 140 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 141 nsAString val_str; 142 nsresult nsres; 143 144 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 145 146 nsAString_InitDepend(&val_str, v); 147 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str); 148 nsAString_Finish(&val_str); 149 if(NS_FAILED(nsres)) 150 ERR("SetValue failed: %08x\n", nsres); 151 152 return S_OK; 153 } 154 155 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p) 156 { 157 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 158 nsAString value_str; 159 nsresult nsres; 160 161 TRACE("(%p)->(%p)\n", This, p); 162 163 nsAString_Init(&value_str, NULL); 164 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str); 165 return return_nsstr(nsres, &value_str, p); 166 } 167 168 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v) 169 { 170 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 171 nsAString name_str; 172 nsresult nsres; 173 174 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 175 176 nsAString_InitDepend(&name_str, v); 177 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str); 178 nsAString_Finish(&name_str); 179 if(NS_FAILED(nsres)) { 180 ERR("SetName failed: %08x\n", nsres); 181 return E_FAIL; 182 } 183 184 return S_OK; 185 } 186 187 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p) 188 { 189 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 190 nsAString name_str; 191 nsresult nsres; 192 193 TRACE("(%p)->(%p)\n", This, p); 194 195 nsAString_Init(&name_str, NULL); 196 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str); 197 return return_nsstr(nsres, &name_str, p); 198 } 199 200 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v) 201 { 202 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 203 FIXME("(%p)->(%x)\n", This, v); 204 return E_NOTIMPL; 205 } 206 207 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p) 208 { 209 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 210 FIXME("(%p)->(%p)\n", This, p); 211 return E_NOTIMPL; 212 } 213 214 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v) 215 { 216 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 217 nsresult nsres; 218 219 TRACE("(%p)->(%x)\n", This, v); 220 221 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE); 222 if(NS_FAILED(nsres)) 223 ERR("SetDisabled failed: %08x\n", nsres); 224 225 return S_OK; 226 } 227 228 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p) 229 { 230 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 231 cpp_bool disabled = FALSE; 232 233 TRACE("(%p)->(%p)\n", This, p); 234 235 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled); 236 237 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE; 238 return S_OK; 239 } 240 241 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p) 242 { 243 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 244 nsIDOMHTMLFormElement *nsform; 245 nsIDOMNode *form_node; 246 HTMLDOMNode *node; 247 HRESULT hres; 248 nsresult nsres; 249 250 TRACE("(%p)->(%p)\n", This, p); 251 252 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform); 253 if (NS_FAILED(nsres) || nsform == NULL) { 254 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform); 255 *p = NULL; 256 return E_FAIL; 257 } 258 259 nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node); 260 nsIDOMHTMLFormElement_Release(nsform); 261 assert(nsres == NS_OK); 262 263 hres = get_node(This->element.node.doc, form_node, TRUE, &node); 264 nsIDOMNode_Release(form_node); 265 if (FAILED(hres)) 266 return hres; 267 268 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p); 269 270 node_release(node); 271 return hres; 272 } 273 274 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v) 275 { 276 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 277 UINT32 val = v; 278 nsresult nsres; 279 280 TRACE("(%p)->(%d)\n", This, v); 281 if (v <= 0) 282 return CTL_E_INVALIDPROPERTYVALUE; 283 284 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val); 285 if (NS_FAILED(nsres)) { 286 ERR("Set Size(%u) failed: %08x\n", val, nsres); 287 return E_FAIL; 288 } 289 return S_OK; 290 } 291 292 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p) 293 { 294 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 295 UINT32 val; 296 nsresult nsres; 297 298 TRACE("(%p)->(%p)\n", This, p); 299 if (p == NULL) 300 return E_INVALIDARG; 301 302 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val); 303 if (NS_FAILED(nsres)) { 304 ERR("Get Size failed: %08x\n", nsres); 305 return E_FAIL; 306 } 307 *p = val; 308 return S_OK; 309 } 310 311 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v) 312 { 313 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 314 nsresult nsres; 315 316 TRACE("(%p)->(%d)\n", This, v); 317 318 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v); 319 if(NS_FAILED(nsres)) { 320 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */ 321 FIXME("SetMaxLength failed\n"); 322 return E_FAIL; 323 } 324 325 return S_OK; 326 } 327 328 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p) 329 { 330 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 331 LONG max_length; 332 nsresult nsres; 333 334 TRACE("(%p)->(%p)\n", This, p); 335 336 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length); 337 assert(nsres == NS_OK); 338 339 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */ 340 *p = max_length == -1 ? INT_MAX : max_length; 341 return S_OK; 342 } 343 344 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface) 345 { 346 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 347 nsresult nsres; 348 349 TRACE("(%p)\n", This); 350 351 nsres = nsIDOMHTMLInputElement_Select(This->nsinput); 352 if(NS_FAILED(nsres)) { 353 ERR("Select failed: %08x\n", nsres); 354 return E_FAIL; 355 } 356 357 return S_OK; 358 } 359 360 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v) 361 { 362 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 363 364 TRACE("(%p)->()\n", This); 365 366 return set_node_event(&This->element.node, EVENTID_CHANGE, &v); 367 } 368 369 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p) 370 { 371 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 372 373 TRACE("(%p)->(%p)\n", This, p); 374 375 return get_node_event(&This->element.node, EVENTID_CHANGE, p); 376 } 377 378 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v) 379 { 380 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 381 FIXME("(%p)->()\n", This); 382 return E_NOTIMPL; 383 } 384 385 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p) 386 { 387 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 388 FIXME("(%p)->(%p)\n", This, p); 389 return E_NOTIMPL; 390 } 391 392 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v) 393 { 394 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 395 nsAString nsstr; 396 nsresult nsres; 397 398 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 399 400 nsAString_InitDepend(&nsstr, v); 401 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr); 402 nsAString_Finish(&nsstr); 403 if(NS_FAILED(nsres)) { 404 ERR("SetValue failed: %08x\n", nsres); 405 return E_FAIL; 406 } 407 408 return S_OK; 409 } 410 411 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p) 412 { 413 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 414 nsAString nsstr; 415 nsresult nsres; 416 417 TRACE("(%p)->(%p)\n", This, p); 418 419 nsAString_Init(&nsstr, NULL); 420 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr); 421 return return_nsstr(nsres, &nsstr, p); 422 } 423 424 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v) 425 { 426 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 427 nsresult nsres; 428 429 TRACE("(%p)->(%x)\n", This, v); 430 431 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE); 432 if (NS_FAILED(nsres)) { 433 ERR("Set ReadOnly Failed: %08x\n", nsres); 434 return E_FAIL; 435 } 436 return S_OK; 437 } 438 439 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p) 440 { 441 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 442 nsresult nsres; 443 cpp_bool b; 444 445 TRACE("(%p)->(%p)\n", This, p); 446 447 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b); 448 if (NS_FAILED(nsres)) { 449 ERR("Get ReadOnly Failed: %08x\n", nsres); 450 return E_FAIL; 451 } 452 *p = b ? VARIANT_TRUE : VARIANT_FALSE; 453 return S_OK; 454 } 455 456 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range) 457 { 458 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 459 FIXME("(%p)->(%p)\n", This, range); 460 return E_NOTIMPL; 461 } 462 463 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v) 464 { 465 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 466 FIXME("(%p)->(%x)\n", This, v); 467 return E_NOTIMPL; 468 } 469 470 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p) 471 { 472 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 473 FIXME("(%p)->(%p)\n", This, p); 474 return E_NOTIMPL; 475 } 476 477 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v) 478 { 479 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 480 nsresult nsres; 481 482 TRACE("(%p)->(%x)\n", This, v); 483 484 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE); 485 if(NS_FAILED(nsres)) { 486 ERR("SetDefaultChecked failed: %08x\n", nsres); 487 return E_FAIL; 488 } 489 490 return S_OK; 491 } 492 493 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p) 494 { 495 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 496 cpp_bool default_checked = FALSE; 497 nsresult nsres; 498 499 TRACE("(%p)->(%p)\n", This, p); 500 501 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked); 502 if(NS_FAILED(nsres)) { 503 ERR("GetDefaultChecked failed: %08x\n", nsres); 504 return E_FAIL; 505 } 506 507 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE; 508 return S_OK; 509 } 510 511 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v) 512 { 513 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 514 nsresult nsres; 515 516 TRACE("(%p)->(%x)\n", This, v); 517 518 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE); 519 if(NS_FAILED(nsres)) { 520 ERR("SetChecked failed: %08x\n", nsres); 521 return E_FAIL; 522 } 523 524 return S_OK; 525 } 526 527 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p) 528 { 529 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 530 cpp_bool checked; 531 nsresult nsres; 532 533 TRACE("(%p)->(%p)\n", This, p); 534 535 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked); 536 if(NS_FAILED(nsres)) { 537 ERR("GetChecked failed: %08x\n", nsres); 538 return E_FAIL; 539 } 540 541 *p = checked ? VARIANT_TRUE : VARIANT_FALSE; 542 TRACE("checked=%x\n", *p); 543 return S_OK; 544 } 545 546 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v) 547 { 548 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 549 FIXME("(%p)->()\n", This); 550 return E_NOTIMPL; 551 } 552 553 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p) 554 { 555 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 556 FIXME("(%p)->(%p)\n", This, p); 557 return E_NOTIMPL; 558 } 559 560 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v) 561 { 562 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 563 FIXME("(%p)->(%d)\n", This, v); 564 return E_NOTIMPL; 565 } 566 567 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p) 568 { 569 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 570 FIXME("(%p)->(%p)\n", This, p); 571 return E_NOTIMPL; 572 } 573 574 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v) 575 { 576 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 577 FIXME("(%p)->(%d)\n", This, v); 578 return E_NOTIMPL; 579 } 580 581 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p) 582 { 583 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 584 FIXME("(%p)->(%p)\n", This, p); 585 return E_NOTIMPL; 586 } 587 588 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v) 589 { 590 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 591 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 592 return E_NOTIMPL; 593 } 594 595 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p) 596 { 597 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 598 FIXME("(%p)->(%p)\n", This, p); 599 return E_NOTIMPL; 600 } 601 602 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v) 603 { 604 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 605 nsAString nsstr; 606 nsresult nsres; 607 608 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 609 610 nsAString_InitDepend(&nsstr, v); 611 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr); 612 nsAString_Finish(&nsstr); 613 if(NS_FAILED(nsres)) 614 ERR("SetSrc failed: %08x\n", nsres); 615 616 return S_OK; 617 } 618 619 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p) 620 { 621 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 622 const PRUnichar *src; 623 nsAString src_str; 624 nsresult nsres; 625 HRESULT hres; 626 627 TRACE("(%p)->(%p)\n", This, p); 628 629 nsAString_Init(&src_str, NULL); 630 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str); 631 if(NS_FAILED(nsres)) { 632 ERR("GetSrc failed: %08x\n", nsres); 633 return E_FAIL; 634 } 635 636 nsAString_GetData(&src_str, &src); 637 hres = nsuri_to_url(src, FALSE, p); 638 nsAString_Finish(&src_str); 639 640 return hres; 641 } 642 643 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v) 644 { 645 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 646 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 647 return E_NOTIMPL; 648 } 649 650 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p) 651 { 652 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 653 FIXME("(%p)->(%p)\n", This, p); 654 return E_NOTIMPL; 655 } 656 657 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v) 658 { 659 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 660 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 661 return E_NOTIMPL; 662 } 663 664 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p) 665 { 666 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 667 FIXME("(%p)->(%p)\n", This, p); 668 return E_NOTIMPL; 669 } 670 671 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v) 672 { 673 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 674 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 675 return E_NOTIMPL; 676 } 677 678 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p) 679 { 680 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 681 FIXME("(%p)->(%p)\n", This, p); 682 return E_NOTIMPL; 683 } 684 685 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p) 686 { 687 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 688 FIXME("(%p)->(%p)\n", This, p); 689 return E_NOTIMPL; 690 } 691 692 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p) 693 { 694 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 695 FIXME("(%p)->(%p)\n", This, p); 696 return E_NOTIMPL; 697 } 698 699 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v) 700 { 701 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 702 FIXME("(%p)->()\n", This); 703 return E_NOTIMPL; 704 } 705 706 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p) 707 { 708 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 709 FIXME("(%p)->(%p)\n", This, p); 710 return E_NOTIMPL; 711 } 712 713 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v) 714 { 715 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 716 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 717 return E_NOTIMPL; 718 } 719 720 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p) 721 { 722 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 723 FIXME("(%p)->(%p)\n", This, p); 724 return E_NOTIMPL; 725 } 726 727 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v) 728 { 729 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 730 FIXME("(%p)->()\n", This); 731 return E_NOTIMPL; 732 } 733 734 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p) 735 { 736 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 737 FIXME("(%p)->(%p)\n", This, p); 738 return E_NOTIMPL; 739 } 740 741 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v) 742 { 743 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 744 FIXME("(%p)->()\n", This); 745 return E_NOTIMPL; 746 } 747 748 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p) 749 { 750 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 751 FIXME("(%p)->(%p)\n", This, p); 752 return E_NOTIMPL; 753 } 754 755 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v) 756 { 757 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 758 FIXME("(%p)->()\n", This); 759 return E_NOTIMPL; 760 } 761 762 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p) 763 { 764 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 765 FIXME("(%p)->(%p)\n", This, p); 766 return E_NOTIMPL; 767 } 768 769 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v) 770 { 771 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 772 FIXME("(%p)->(%d)\n", This, v); 773 return E_NOTIMPL; 774 } 775 776 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p) 777 { 778 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 779 FIXME("(%p)->(%p)\n", This, p); 780 return E_NOTIMPL; 781 } 782 783 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v) 784 { 785 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 786 FIXME("(%p)->(%d)\n", This, v); 787 return E_NOTIMPL; 788 } 789 790 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p) 791 { 792 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 793 FIXME("(%p)->(%p)\n", This, p); 794 return E_NOTIMPL; 795 } 796 797 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v) 798 { 799 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 800 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 801 return E_NOTIMPL; 802 } 803 804 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p) 805 { 806 HTMLInputElement *This = impl_from_IHTMLInputElement(iface); 807 FIXME("(%p)->(%p)\n", This, p); 808 return E_NOTIMPL; 809 } 810 811 static const IHTMLInputElementVtbl HTMLInputElementVtbl = { 812 HTMLInputElement_QueryInterface, 813 HTMLInputElement_AddRef, 814 HTMLInputElement_Release, 815 HTMLInputElement_GetTypeInfoCount, 816 HTMLInputElement_GetTypeInfo, 817 HTMLInputElement_GetIDsOfNames, 818 HTMLInputElement_Invoke, 819 HTMLInputElement_put_type, 820 HTMLInputElement_get_type, 821 HTMLInputElement_put_value, 822 HTMLInputElement_get_value, 823 HTMLInputElement_put_name, 824 HTMLInputElement_get_name, 825 HTMLInputElement_put_status, 826 HTMLInputElement_get_status, 827 HTMLInputElement_put_disabled, 828 HTMLInputElement_get_disabled, 829 HTMLInputElement_get_form, 830 HTMLInputElement_put_size, 831 HTMLInputElement_get_size, 832 HTMLInputElement_put_maxLength, 833 HTMLInputElement_get_maxLength, 834 HTMLInputElement_select, 835 HTMLInputElement_put_onchange, 836 HTMLInputElement_get_onchange, 837 HTMLInputElement_put_onselect, 838 HTMLInputElement_get_onselect, 839 HTMLInputElement_put_defaultValue, 840 HTMLInputElement_get_defaultValue, 841 HTMLInputElement_put_readOnly, 842 HTMLInputElement_get_readOnly, 843 HTMLInputElement_createTextRange, 844 HTMLInputElement_put_indeterminate, 845 HTMLInputElement_get_indeterminate, 846 HTMLInputElement_put_defaultChecked, 847 HTMLInputElement_get_defaultChecked, 848 HTMLInputElement_put_checked, 849 HTMLInputElement_get_checked, 850 HTMLInputElement_put_border, 851 HTMLInputElement_get_border, 852 HTMLInputElement_put_vspace, 853 HTMLInputElement_get_vspace, 854 HTMLInputElement_put_hspace, 855 HTMLInputElement_get_hspace, 856 HTMLInputElement_put_alt, 857 HTMLInputElement_get_alt, 858 HTMLInputElement_put_src, 859 HTMLInputElement_get_src, 860 HTMLInputElement_put_lowsrc, 861 HTMLInputElement_get_lowsrc, 862 HTMLInputElement_put_vrml, 863 HTMLInputElement_get_vrml, 864 HTMLInputElement_put_dynsrc, 865 HTMLInputElement_get_dynsrc, 866 HTMLInputElement_get_readyState, 867 HTMLInputElement_get_complete, 868 HTMLInputElement_put_loop, 869 HTMLInputElement_get_loop, 870 HTMLInputElement_put_align, 871 HTMLInputElement_get_align, 872 HTMLInputElement_put_onload, 873 HTMLInputElement_get_onload, 874 HTMLInputElement_put_onerror, 875 HTMLInputElement_get_onerror, 876 HTMLInputElement_put_onabort, 877 HTMLInputElement_get_onabort, 878 HTMLInputElement_put_width, 879 HTMLInputElement_get_width, 880 HTMLInputElement_put_height, 881 HTMLInputElement_get_height, 882 HTMLInputElement_put_start, 883 HTMLInputElement_get_start 884 }; 885 886 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface, 887 REFIID riid, void **ppv) 888 { 889 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 890 891 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); 892 } 893 894 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface) 895 { 896 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 897 898 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); 899 } 900 901 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface) 902 { 903 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 904 905 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); 906 } 907 908 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo) 909 { 910 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 911 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); 912 } 913 914 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo, 915 LCID lcid, ITypeInfo **ppTInfo) 916 { 917 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 918 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, 919 ppTInfo); 920 } 921 922 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid, 923 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 924 { 925 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 926 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, 927 cNames, lcid, rgDispId); 928 } 929 930 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember, 931 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 932 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 933 { 934 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 935 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, 936 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 937 } 938 939 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p) 940 { 941 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 942 943 TRACE("(%p)->(%p)\n", This, p); 944 945 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p); 946 } 947 948 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v) 949 { 950 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 951 952 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 953 954 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v); 955 } 956 957 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p) 958 { 959 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 960 961 TRACE("(%p)->(%p)\n", This, p); 962 963 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p); 964 } 965 966 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v) 967 { 968 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 969 970 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 971 972 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v); 973 } 974 975 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p) 976 { 977 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 978 979 TRACE("(%p)->(%p)\n", This, p); 980 981 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p); 982 } 983 984 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v) 985 { 986 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 987 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); 988 return E_NOTIMPL; 989 } 990 991 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p) 992 { 993 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 994 TRACE("(%p)->(%p)\n", This, p); 995 return E_NOTIMPL; 996 } 997 998 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v) 999 { 1000 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1001 1002 TRACE("(%p)->(%x)\n", This, v); 1003 1004 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v); 1005 } 1006 1007 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p) 1008 { 1009 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1010 1011 TRACE("(%p)->(%p)\n", This, p); 1012 1013 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p); 1014 } 1015 1016 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p) 1017 { 1018 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1019 1020 TRACE("(%p)->(%p)\n", This, p); 1021 1022 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p); 1023 } 1024 1025 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v) 1026 { 1027 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1028 1029 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 1030 1031 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v); 1032 } 1033 1034 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p) 1035 { 1036 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1037 1038 TRACE("(%p)->(%p)\n", This, p); 1039 1040 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p); 1041 } 1042 1043 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v) 1044 { 1045 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1046 1047 TRACE("(%p)->(%d)\n", This, v); 1048 1049 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v); 1050 } 1051 1052 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p) 1053 { 1054 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1055 1056 TRACE("(%p)->(%p)\n", This, p); 1057 1058 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p); 1059 } 1060 1061 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v) 1062 { 1063 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1064 1065 TRACE("(%p)->(%d)\n", This, v); 1066 1067 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v); 1068 } 1069 1070 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p) 1071 { 1072 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1073 1074 TRACE("(%p)->(%p)\n", This, p); 1075 1076 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p); 1077 } 1078 1079 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface) 1080 { 1081 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1082 1083 TRACE("(%p)\n", This); 1084 1085 return IHTMLInputElement_select(&This->IHTMLInputElement_iface); 1086 } 1087 1088 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v) 1089 { 1090 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1091 1092 TRACE("(%p)->()\n", This); 1093 1094 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v); 1095 } 1096 1097 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p) 1098 { 1099 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1100 1101 TRACE("(%p)->(%p)\n", This, p); 1102 1103 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p); 1104 } 1105 1106 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v) 1107 { 1108 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1109 1110 TRACE("(%p)->()\n", This); 1111 1112 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v); 1113 } 1114 1115 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p) 1116 { 1117 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1118 1119 TRACE("(%p)->(%p)\n", This, p); 1120 1121 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p); 1122 } 1123 1124 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v) 1125 { 1126 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1127 1128 TRACE("(%p)->(%x)\n", This, v); 1129 1130 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v); 1131 } 1132 1133 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p) 1134 { 1135 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1136 1137 TRACE("(%p)->(%p)\n", This, p); 1138 1139 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p); 1140 } 1141 1142 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range) 1143 { 1144 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface); 1145 1146 TRACE("(%p)->(%p)\n", This, range); 1147 1148 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range); 1149 } 1150 1151 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = { 1152 HTMLInputTextElement_QueryInterface, 1153 HTMLInputTextElement_AddRef, 1154 HTMLInputTextElement_Release, 1155 HTMLInputTextElement_GetTypeInfoCount, 1156 HTMLInputTextElement_GetTypeInfo, 1157 HTMLInputTextElement_GetIDsOfNames, 1158 HTMLInputTextElement_Invoke, 1159 HTMLInputTextElement_get_type, 1160 HTMLInputTextElement_put_value, 1161 HTMLInputTextElement_get_value, 1162 HTMLInputTextElement_put_name, 1163 HTMLInputTextElement_get_name, 1164 HTMLInputTextElement_put_status, 1165 HTMLInputTextElement_get_status, 1166 HTMLInputTextElement_put_disabled, 1167 HTMLInputTextElement_get_disabled, 1168 HTMLInputTextElement_get_form, 1169 HTMLInputTextElement_put_defaultValue, 1170 HTMLInputTextElement_get_defaultValue, 1171 HTMLInputTextElement_put_size, 1172 HTMLInputTextElement_get_size, 1173 HTMLInputTextElement_put_maxLength, 1174 HTMLInputTextElement_get_maxLength, 1175 HTMLInputTextElement_select, 1176 HTMLInputTextElement_put_onchange, 1177 HTMLInputTextElement_get_onchange, 1178 HTMLInputTextElement_put_onselect, 1179 HTMLInputTextElement_get_onselect, 1180 HTMLInputTextElement_put_readOnly, 1181 HTMLInputTextElement_get_readOnly, 1182 HTMLInputTextElement_createTextRange 1183 }; 1184 1185 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) 1186 { 1187 return CONTAINING_RECORD(iface, HTMLInputElement, element.node); 1188 } 1189 1190 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) 1191 { 1192 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1193 1194 *ppv = NULL; 1195 1196 if(IsEqualGUID(&IID_IUnknown, riid)) { 1197 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); 1198 *ppv = &This->IHTMLInputElement_iface; 1199 }else if(IsEqualGUID(&IID_IDispatch, riid)) { 1200 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); 1201 *ppv = &This->IHTMLInputElement_iface; 1202 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) { 1203 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv); 1204 *ppv = &This->IHTMLInputElement_iface; 1205 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) { 1206 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv); 1207 *ppv = &This->IHTMLInputTextElement_iface; 1208 } 1209 1210 if(*ppv) { 1211 IUnknown_AddRef((IUnknown*)*ppv); 1212 return S_OK; 1213 } 1214 1215 return HTMLElement_QI(&This->element.node, riid, ppv); 1216 } 1217 1218 #ifndef __REACTOS__ 1219 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled) 1220 #else 1221 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, DWORD eid, BOOL *handled) 1222 #endif 1223 { 1224 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1225 1226 if(eid == EVENTID_CLICK) { 1227 nsresult nsres; 1228 1229 *handled = TRUE; 1230 1231 nsres = nsIDOMHTMLElement_Click(This->element.nselem); 1232 if(NS_FAILED(nsres)) { 1233 ERR("Click failed: %08x\n", nsres); 1234 return E_FAIL; 1235 } 1236 } 1237 1238 return S_OK; 1239 } 1240 1241 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v) 1242 { 1243 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1244 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v); 1245 } 1246 1247 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p) 1248 { 1249 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1250 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p); 1251 } 1252 1253 static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface) 1254 { 1255 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1256 const PRUnichar *type; 1257 nsAString nsstr; 1258 nsresult nsres; 1259 BOOL ret = FALSE; 1260 1261 static const WCHAR buttonW[] = {'b','u','t','t','o','n',0}; 1262 static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0}; 1263 static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0}; 1264 static const WCHAR resetW[] = {'r','e','s','e','t',0}; 1265 static const WCHAR submitW[] = {'s','u','b','m','i','t',0}; 1266 static const WCHAR textW[] = {'t','e','x','t',0}; 1267 1268 nsAString_Init(&nsstr, NULL); 1269 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr); 1270 if(NS_SUCCEEDED(nsres)) { 1271 nsAString_GetData(&nsstr, &type); 1272 ret = !strcmpW(type, buttonW) || !strcmpW(type, hiddenW) || !strcmpW(type, passwordW) 1273 || !strcmpW(type, resetW) || !strcmpW(type, submitW) || !strcmpW(type, textW); 1274 } 1275 nsAString_Finish(&nsstr); 1276 return ret; 1277 } 1278 1279 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb) 1280 { 1281 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1282 1283 if(This->nsinput) 1284 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb); 1285 } 1286 1287 static void HTMLInputElement_unlink(HTMLDOMNode *iface) 1288 { 1289 HTMLInputElement *This = impl_from_HTMLDOMNode(iface); 1290 1291 if(This->nsinput) { 1292 nsIDOMHTMLInputElement *nsinput = This->nsinput; 1293 1294 This->nsinput = NULL; 1295 nsIDOMHTMLInputElement_Release(nsinput); 1296 } 1297 } 1298 1299 static const NodeImplVtbl HTMLInputElementImplVtbl = { 1300 HTMLInputElement_QI, 1301 HTMLElement_destructor, 1302 HTMLElement_cpc, 1303 HTMLElement_clone, 1304 HTMLElement_handle_event, 1305 HTMLElement_get_attr_col, 1306 NULL, 1307 HTMLInputElementImpl_fire_event, 1308 HTMLInputElementImpl_put_disabled, 1309 HTMLInputElementImpl_get_disabled, 1310 NULL, 1311 NULL, 1312 NULL, 1313 NULL, 1314 NULL, 1315 HTMLInputElement_traverse, 1316 HTMLInputElement_unlink, 1317 HTMLInputElement_is_text_edit 1318 }; 1319 1320 static const tid_t HTMLInputElement_iface_tids[] = { 1321 HTMLELEMENT_TIDS, 1322 IHTMLInputElement_tid, 1323 0 1324 }; 1325 static dispex_static_data_t HTMLInputElement_dispex = { 1326 NULL, 1327 DispHTMLInputElement_tid, 1328 NULL, 1329 HTMLInputElement_iface_tids 1330 }; 1331 1332 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem) 1333 { 1334 HTMLInputElement *ret; 1335 nsresult nsres; 1336 1337 ret = heap_alloc_zero(sizeof(HTMLInputElement)); 1338 if(!ret) 1339 return E_OUTOFMEMORY; 1340 1341 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl; 1342 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl; 1343 ret->element.node.vtbl = &HTMLInputElementImplVtbl; 1344 1345 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex); 1346 1347 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput); 1348 assert(nsres == NS_OK); 1349 1350 *elem = &ret->element; 1351 return S_OK; 1352 } 1353 1354 typedef struct { 1355 HTMLElement element; 1356 1357 IHTMLLabelElement IHTMLLabelElement_iface; 1358 } HTMLLabelElement; 1359 1360 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface) 1361 { 1362 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface); 1363 } 1364 1365 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface, 1366 REFIID riid, void **ppv) 1367 { 1368 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1369 1370 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); 1371 } 1372 1373 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface) 1374 { 1375 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1376 1377 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); 1378 } 1379 1380 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface) 1381 { 1382 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1383 1384 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); 1385 } 1386 1387 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo) 1388 { 1389 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1390 1391 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); 1392 } 1393 1394 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo, 1395 LCID lcid, ITypeInfo **ppTInfo) 1396 { 1397 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1398 1399 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); 1400 } 1401 1402 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid, 1403 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 1404 { 1405 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1406 1407 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, 1408 cNames, lcid, rgDispId); 1409 } 1410 1411 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember, 1412 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 1413 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 1414 { 1415 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1416 1417 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, 1418 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 1419 } 1420 1421 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v) 1422 { 1423 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1424 nsAString for_str, val_str; 1425 nsresult nsres; 1426 1427 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 1428 1429 nsAString_InitDepend(&for_str, forW); 1430 nsAString_InitDepend(&val_str, v); 1431 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str); 1432 nsAString_Finish(&for_str); 1433 nsAString_Finish(&val_str); 1434 if(NS_FAILED(nsres)) { 1435 ERR("SetAttribute failed: %08x\n", nsres); 1436 return E_FAIL; 1437 } 1438 1439 return S_OK; 1440 } 1441 1442 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p) 1443 { 1444 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1445 1446 TRACE("(%p)->(%p)\n", This, p); 1447 1448 return elem_string_attr_getter(&This->element, forW, FALSE, p); 1449 } 1450 1451 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v) 1452 { 1453 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1454 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 1455 return E_NOTIMPL; 1456 } 1457 1458 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p) 1459 { 1460 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface); 1461 FIXME("(%p)->(%p)\n", This, p); 1462 return E_NOTIMPL; 1463 } 1464 1465 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = { 1466 HTMLLabelElement_QueryInterface, 1467 HTMLLabelElement_AddRef, 1468 HTMLLabelElement_Release, 1469 HTMLLabelElement_GetTypeInfoCount, 1470 HTMLLabelElement_GetTypeInfo, 1471 HTMLLabelElement_GetIDsOfNames, 1472 HTMLLabelElement_Invoke, 1473 HTMLLabelElement_put_htmlFor, 1474 HTMLLabelElement_get_htmlFor, 1475 HTMLLabelElement_put_accessKey, 1476 HTMLLabelElement_get_accessKey 1477 }; 1478 1479 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface) 1480 { 1481 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node); 1482 } 1483 1484 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) 1485 { 1486 HTMLLabelElement *This = label_from_HTMLDOMNode(iface); 1487 1488 *ppv = NULL; 1489 1490 if(IsEqualGUID(&IID_IUnknown, riid)) { 1491 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); 1492 *ppv = &This->IHTMLLabelElement_iface; 1493 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) { 1494 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv); 1495 *ppv = &This->IHTMLLabelElement_iface; 1496 }else { 1497 return HTMLElement_QI(&This->element.node, riid, ppv); 1498 } 1499 1500 IUnknown_AddRef((IUnknown*)*ppv); 1501 return S_OK; 1502 } 1503 1504 static const NodeImplVtbl HTMLLabelElementImplVtbl = { 1505 HTMLLabelElement_QI, 1506 HTMLElement_destructor, 1507 HTMLElement_cpc, 1508 HTMLElement_clone, 1509 HTMLElement_handle_event, 1510 HTMLElement_get_attr_col, 1511 }; 1512 1513 static const tid_t HTMLLabelElement_iface_tids[] = { 1514 HTMLELEMENT_TIDS, 1515 IHTMLLabelElement_tid, 1516 0 1517 }; 1518 1519 static dispex_static_data_t HTMLLabelElement_dispex = { 1520 NULL, 1521 DispHTMLLabelElement_tid, 1522 NULL, 1523 HTMLLabelElement_iface_tids 1524 }; 1525 1526 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem) 1527 { 1528 HTMLLabelElement *ret; 1529 1530 ret = heap_alloc_zero(sizeof(*ret)); 1531 if(!ret) 1532 return E_OUTOFMEMORY; 1533 1534 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl; 1535 ret->element.node.vtbl = &HTMLLabelElementImplVtbl; 1536 1537 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex); 1538 *elem = &ret->element; 1539 return S_OK; 1540 } 1541 1542 typedef struct { 1543 HTMLElement element; 1544 1545 IHTMLButtonElement IHTMLButtonElement_iface; 1546 1547 nsIDOMHTMLButtonElement *nsbutton; 1548 } HTMLButtonElement; 1549 1550 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface) 1551 { 1552 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface); 1553 } 1554 1555 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface, 1556 REFIID riid, void **ppv) 1557 { 1558 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1559 1560 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); 1561 } 1562 1563 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface) 1564 { 1565 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1566 1567 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); 1568 } 1569 1570 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface) 1571 { 1572 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1573 1574 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); 1575 } 1576 1577 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo) 1578 { 1579 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1580 1581 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); 1582 } 1583 1584 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo, 1585 LCID lcid, ITypeInfo **ppTInfo) 1586 { 1587 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1588 1589 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); 1590 } 1591 1592 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid, 1593 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 1594 { 1595 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1596 1597 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, 1598 cNames, lcid, rgDispId); 1599 } 1600 1601 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember, 1602 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 1603 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 1604 { 1605 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1606 1607 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, 1608 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 1609 } 1610 1611 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p) 1612 { 1613 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1614 FIXME("(%p)->(%p)\n", This, p); 1615 return E_NOTIMPL; 1616 } 1617 1618 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v) 1619 { 1620 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1621 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 1622 return E_NOTIMPL; 1623 } 1624 1625 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p) 1626 { 1627 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1628 FIXME("(%p)->(%p)\n", This, p); 1629 return E_NOTIMPL; 1630 } 1631 1632 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v) 1633 { 1634 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1635 nsAString name_str; 1636 nsresult nsres; 1637 1638 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 1639 1640 nsAString_InitDepend(&name_str, v); 1641 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str); 1642 nsAString_Finish(&name_str); 1643 if(NS_FAILED(nsres)) { 1644 ERR("SetName failed: %08x\n", nsres); 1645 return E_FAIL; 1646 } 1647 1648 return S_OK; 1649 } 1650 1651 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p) 1652 { 1653 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1654 nsAString name_str; 1655 nsresult nsres; 1656 1657 TRACE("(%p)->(%p)\n", This, p); 1658 1659 nsAString_Init(&name_str, NULL); 1660 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str); 1661 return return_nsstr(nsres, &name_str, p); 1662 } 1663 1664 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v) 1665 { 1666 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1667 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); 1668 return E_NOTIMPL; 1669 } 1670 1671 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p) 1672 { 1673 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1674 FIXME("(%p)->(%p)\n", This, p); 1675 return E_NOTIMPL; 1676 } 1677 1678 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v) 1679 { 1680 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1681 nsresult nsres; 1682 1683 TRACE("(%p)->(%x)\n", This, v); 1684 1685 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v); 1686 if(NS_FAILED(nsres)) { 1687 ERR("SetDisabled failed: %08x\n", nsres); 1688 return E_FAIL; 1689 } 1690 1691 return S_OK; 1692 } 1693 1694 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p) 1695 { 1696 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1697 cpp_bool disabled; 1698 nsresult nsres; 1699 1700 TRACE("(%p)->(%p)\n", This, p); 1701 1702 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled); 1703 if(NS_FAILED(nsres)) { 1704 ERR("GetDisabled failed: %08x\n", nsres); 1705 return E_FAIL; 1706 } 1707 1708 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE; 1709 return S_OK; 1710 } 1711 1712 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p) 1713 { 1714 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1715 FIXME("(%p)->(%p)\n", This, p); 1716 return E_NOTIMPL; 1717 } 1718 1719 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range) 1720 { 1721 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface); 1722 FIXME("(%p)->(%p)\n", This, range); 1723 return E_NOTIMPL; 1724 } 1725 1726 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = { 1727 HTMLButtonElement_QueryInterface, 1728 HTMLButtonElement_AddRef, 1729 HTMLButtonElement_Release, 1730 HTMLButtonElement_GetTypeInfoCount, 1731 HTMLButtonElement_GetTypeInfo, 1732 HTMLButtonElement_GetIDsOfNames, 1733 HTMLButtonElement_Invoke, 1734 HTMLButtonElement_get_type, 1735 HTMLButtonElement_put_value, 1736 HTMLButtonElement_get_value, 1737 HTMLButtonElement_put_name, 1738 HTMLButtonElement_get_name, 1739 HTMLButtonElement_put_status, 1740 HTMLButtonElement_get_status, 1741 HTMLButtonElement_put_disabled, 1742 HTMLButtonElement_get_disabled, 1743 HTMLButtonElement_get_form, 1744 HTMLButtonElement_createTextRange 1745 }; 1746 1747 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface) 1748 { 1749 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node); 1750 } 1751 1752 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) 1753 { 1754 HTMLButtonElement *This = button_from_HTMLDOMNode(iface); 1755 1756 *ppv = NULL; 1757 1758 if(IsEqualGUID(&IID_IUnknown, riid)) { 1759 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); 1760 *ppv = &This->IHTMLButtonElement_iface; 1761 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) { 1762 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv); 1763 *ppv = &This->IHTMLButtonElement_iface; 1764 }else { 1765 return HTMLElement_QI(&This->element.node, riid, ppv); 1766 } 1767 1768 IUnknown_AddRef((IUnknown*)*ppv); 1769 return S_OK; 1770 } 1771 1772 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v) 1773 { 1774 HTMLButtonElement *This = button_from_HTMLDOMNode(iface); 1775 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v); 1776 } 1777 1778 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p) 1779 { 1780 HTMLButtonElement *This = button_from_HTMLDOMNode(iface); 1781 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p); 1782 } 1783 1784 static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface) 1785 { 1786 return TRUE; 1787 } 1788 1789 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb) 1790 { 1791 HTMLButtonElement *This = button_from_HTMLDOMNode(iface); 1792 1793 if(This->nsbutton) 1794 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb); 1795 } 1796 1797 static void HTMLButtonElement_unlink(HTMLDOMNode *iface) 1798 { 1799 HTMLButtonElement *This = button_from_HTMLDOMNode(iface); 1800 1801 if(This->nsbutton) { 1802 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton; 1803 1804 This->nsbutton = NULL; 1805 nsIDOMHTMLButtonElement_Release(nsbutton); 1806 } 1807 } 1808 1809 static const NodeImplVtbl HTMLButtonElementImplVtbl = { 1810 HTMLButtonElement_QI, 1811 HTMLElement_destructor, 1812 HTMLElement_cpc, 1813 HTMLElement_clone, 1814 HTMLElement_handle_event, 1815 HTMLElement_get_attr_col, 1816 NULL, 1817 NULL, 1818 HTMLButtonElementImpl_put_disabled, 1819 HTMLButtonElementImpl_get_disabled, 1820 NULL, 1821 NULL, 1822 NULL, 1823 NULL, 1824 NULL, 1825 HTMLButtonElement_traverse, 1826 HTMLButtonElement_unlink, 1827 HTMLButtonElement_is_text_edit 1828 }; 1829 1830 static const tid_t HTMLButtonElement_iface_tids[] = { 1831 HTMLELEMENT_TIDS, 1832 IHTMLButtonElement_tid, 1833 0 1834 }; 1835 1836 static dispex_static_data_t HTMLButtonElement_dispex = { 1837 NULL, 1838 DispHTMLButtonElement_tid, 1839 NULL, 1840 HTMLButtonElement_iface_tids 1841 }; 1842 1843 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem) 1844 { 1845 HTMLButtonElement *ret; 1846 nsresult nsres; 1847 1848 ret = heap_alloc_zero(sizeof(*ret)); 1849 if(!ret) 1850 return E_OUTOFMEMORY; 1851 1852 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl; 1853 ret->element.node.vtbl = &HTMLButtonElementImplVtbl; 1854 1855 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex); 1856 1857 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton); 1858 assert(nsres == NS_OK); 1859 1860 *elem = &ret->element; 1861 return S_OK; 1862 } 1863