comctl32/tests: Make impl_from_IStream() static.
[wine/multimedia.git] / dlls / mshtml / htmlanchor.c
bloba1dc8c35ff662d54e3b0dac5826476b6dfd950c1
1 /*
2 * Copyright 2007 Jacek Caban for CodeWeavers
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.
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.
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
19 #include <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "mshtml_private.h"
30 #include "htmlevent.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 typedef struct {
37 HTMLElement element;
39 IHTMLAnchorElement IHTMLAnchorElement_iface;
41 nsIDOMHTMLAnchorElement *nsanchor;
42 } HTMLAnchorElement;
44 static HRESULT navigate_anchor(HTMLAnchorElement *This)
46 nsAString href_str, target_str;
47 nsresult nsres;
48 HRESULT hres = E_FAIL;
50 nsAString_Init(&target_str, NULL);
51 nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
52 if(NS_SUCCEEDED(nsres)) {
53 const PRUnichar *target;
55 nsAString_GetData(&target_str, &target);
56 if(*target) {
57 FIXME("Navigating to target %s is not implemented\n", debugstr_w(target));
58 nsAString_Finish(&target_str);
59 return S_OK;
62 nsAString_Finish(&target_str);
64 nsAString_Init(&href_str, NULL);
65 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
66 if(NS_SUCCEEDED(nsres)) {
67 const PRUnichar *href;
69 nsAString_GetData(&href_str, &href);
70 if(*href) {
71 HTMLWindow *window = This->element.node.doc->basedoc.window;
72 hres = navigate_url(window, href, window->url);
73 }else {
74 TRACE("empty href\n");
75 hres = S_OK;
78 nsAString_Finish(&href_str);
79 return hres;
82 static inline HTMLAnchorElement *impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
84 return CONTAINING_RECORD(iface, HTMLAnchorElement, IHTMLAnchorElement_iface);
87 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
88 REFIID riid, void **ppv)
90 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
92 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
95 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
97 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
99 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
102 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
104 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
106 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
109 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
111 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
112 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
115 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
116 LCID lcid, ITypeInfo **ppTInfo)
118 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
119 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
120 ppTInfo);
123 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
124 LPOLESTR *rgszNames, UINT cNames,
125 LCID lcid, DISPID *rgDispId)
127 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
128 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
129 cNames, lcid, rgDispId);
132 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
133 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
134 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
136 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
137 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
138 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
141 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
143 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
144 nsAString nsstr;
145 nsresult nsres;
147 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
149 nsAString_InitDepend(&nsstr, v);
150 nsres = nsIDOMHTMLAnchorElement_SetHref(This->nsanchor, &nsstr);
151 nsAString_Finish(&nsstr);
152 if(NS_FAILED(nsres))
153 return E_FAIL;
155 return S_OK;
158 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
160 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
161 nsAString href_str;
162 nsresult nsres;
163 HRESULT hres;
165 TRACE("(%p)->(%p)\n", This, p);
167 nsAString_Init(&href_str, NULL);
168 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
169 if(NS_SUCCEEDED(nsres)) {
170 const PRUnichar *href;
172 nsAString_GetData(&href_str, &href);
173 hres = nsuri_to_url(href, TRUE, p);
174 }else {
175 ERR("GetHref failed: %08x\n", nsres);
176 hres = E_FAIL;
179 nsAString_Finish(&href_str);
180 return hres;
183 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
185 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
186 nsAString nsstr;
187 nsresult nsres;
189 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
191 nsAString_InitDepend(&nsstr, v);
192 nsres = nsIDOMHTMLAnchorElement_SetTarget(This->nsanchor, &nsstr);
193 nsAString_Finish(&nsstr);
194 if(NS_FAILED(nsres))
195 return E_FAIL;
197 return S_OK;
200 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
202 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
203 nsAString target_str;
204 nsresult nsres;
206 TRACE("(%p)->(%p)\n", This, p);
208 nsAString_Init(&target_str, NULL);
209 nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
211 return return_nsstr(nsres, &target_str, p);
214 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
216 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
217 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
218 return E_NOTIMPL;
221 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
223 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
224 FIXME("(%p)->(%p)\n", This, p);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
230 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
231 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
232 return E_NOTIMPL;
235 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
237 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
238 FIXME("(%p)->(%p)\n", This, p);
239 return E_NOTIMPL;
242 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
244 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
245 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
246 return E_NOTIMPL;
249 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
251 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
252 FIXME("(%p)->(%p)\n", This, p);
253 return E_NOTIMPL;
256 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
258 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
259 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
260 return E_NOTIMPL;
263 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
265 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
266 FIXME("(%p)->(%p)\n", This, p);
267 return E_NOTIMPL;
270 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
272 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
273 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
274 return E_NOTIMPL;
277 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
279 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
280 FIXME("(%p)->(%p)\n", This, p);
281 return E_NOTIMPL;
284 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
286 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
287 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
288 return E_NOTIMPL;
291 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
293 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
294 FIXME("(%p)->(%p)\n", This, p);
295 return E_NOTIMPL;
298 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
300 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
301 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
302 return E_NOTIMPL;
305 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
307 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
308 FIXME("(%p)->(%p)\n", This, p);
309 return E_NOTIMPL;
312 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
314 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
315 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
316 return E_NOTIMPL;
319 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
321 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
322 FIXME("(%p)->(%p)\n", This, p);
323 return E_NOTIMPL;
326 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
328 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
329 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
330 return E_NOTIMPL;
333 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
335 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
336 FIXME("(%p)->(%p)\n", This, p);
337 return E_NOTIMPL;
340 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
342 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
343 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
344 return E_NOTIMPL;
347 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
349 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
350 FIXME("(%p)->(%p)\n", This, p);
351 return E_NOTIMPL;
354 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
356 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
357 FIXME("(%p)->(%p)\n", This, debugstr_w(v));
358 return E_NOTIMPL;
361 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
363 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
364 FIXME("(%p)->(%p)\n", This, p);
365 return E_NOTIMPL;
368 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
370 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
371 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
372 return E_NOTIMPL;
375 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
377 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
378 FIXME("(%p)->(%p)\n", This, p);
379 return E_NOTIMPL;
382 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
384 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
386 TRACE("(%p)->()\n", This);
388 return IHTMLElement2_put_onblur(&This->element.IHTMLElement2_iface, v);
391 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
393 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
395 TRACE("(%p)->(%p)\n", This, p);
397 return IHTMLElement2_get_onblur(&This->element.IHTMLElement2_iface, p);
400 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
402 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
404 TRACE("(%p)->()\n", This);
406 return IHTMLElement2_put_onfocus(&This->element.IHTMLElement2_iface, v);
409 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
411 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
413 TRACE("(%p)->(%p)\n", This, p);
415 return IHTMLElement2_get_onfocus(&This->element.IHTMLElement2_iface, p);
418 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
420 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
422 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
424 return IHTMLElement2_put_accessKey(&This->element.IHTMLElement2_iface, v);
427 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
429 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
431 TRACE("(%p)->(%p)\n", This, p);
433 return IHTMLElement2_get_accessKey(&This->element.IHTMLElement2_iface, p);
436 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
438 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
439 FIXME("(%p)->(%p)\n", This, p);
440 return E_NOTIMPL;
443 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
445 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
446 FIXME("(%p)->(%p)\n", This, p);
447 return E_NOTIMPL;
450 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
452 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
453 FIXME("(%p)->(%p)\n", This, p);
454 return E_NOTIMPL;
457 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
459 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
461 TRACE("(%p)->()\n", This);
463 return IHTMLElement2_put_tabIndex(&This->element.IHTMLElement2_iface, v);
466 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
468 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
470 TRACE("(%p)->(%p)\n", This, p);
472 return IHTMLElement2_get_tabIndex(&This->element.IHTMLElement2_iface, p);
475 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
477 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
479 TRACE("(%p)\n", This);
481 return IHTMLElement2_focus(&This->element.IHTMLElement2_iface);
484 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
486 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
488 TRACE("(%p)\n", This);
490 return IHTMLElement2_blur(&This->element.IHTMLElement2_iface);
493 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
494 HTMLAnchorElement_QueryInterface,
495 HTMLAnchorElement_AddRef,
496 HTMLAnchorElement_Release,
497 HTMLAnchorElement_GetTypeInfoCount,
498 HTMLAnchorElement_GetTypeInfo,
499 HTMLAnchorElement_GetIDsOfNames,
500 HTMLAnchorElement_Invoke,
501 HTMLAnchorElement_put_href,
502 HTMLAnchorElement_get_href,
503 HTMLAnchorElement_put_target,
504 HTMLAnchorElement_get_target,
505 HTMLAnchorElement_put_rel,
506 HTMLAnchorElement_get_rel,
507 HTMLAnchorElement_put_rev,
508 HTMLAnchorElement_get_rev,
509 HTMLAnchorElement_put_urn,
510 HTMLAnchorElement_get_urn,
511 HTMLAnchorElement_put_Methods,
512 HTMLAnchorElement_get_Methods,
513 HTMLAnchorElement_put_name,
514 HTMLAnchorElement_get_name,
515 HTMLAnchorElement_put_host,
516 HTMLAnchorElement_get_host,
517 HTMLAnchorElement_put_hostname,
518 HTMLAnchorElement_get_hostname,
519 HTMLAnchorElement_put_pathname,
520 HTMLAnchorElement_get_pathname,
521 HTMLAnchorElement_put_port,
522 HTMLAnchorElement_get_port,
523 HTMLAnchorElement_put_protocol,
524 HTMLAnchorElement_get_protocol,
525 HTMLAnchorElement_put_search,
526 HTMLAnchorElement_get_search,
527 HTMLAnchorElement_put_hash,
528 HTMLAnchorElement_get_hash,
529 HTMLAnchorElement_put_onblur,
530 HTMLAnchorElement_get_onblur,
531 HTMLAnchorElement_put_onfocus,
532 HTMLAnchorElement_get_onfocus,
533 HTMLAnchorElement_put_accessKey,
534 HTMLAnchorElement_get_accessKey,
535 HTMLAnchorElement_get_protocolLong,
536 HTMLAnchorElement_get_mimeType,
537 HTMLAnchorElement_get_nameProp,
538 HTMLAnchorElement_put_tabIndex,
539 HTMLAnchorElement_get_tabIndex,
540 HTMLAnchorElement_focus,
541 HTMLAnchorElement_blur
544 static inline HTMLAnchorElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
546 return CONTAINING_RECORD(iface, HTMLAnchorElement, element.node);
549 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
551 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
553 *ppv = NULL;
555 if(IsEqualGUID(&IID_IUnknown, riid)) {
556 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
557 *ppv = &This->IHTMLAnchorElement_iface;
558 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
559 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
560 *ppv = &This->IHTMLAnchorElement_iface;
561 }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
562 TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
563 *ppv = &This->IHTMLAnchorElement_iface;
566 if(*ppv) {
567 IUnknown_AddRef((IUnknown*)*ppv);
568 return S_OK;
571 return HTMLElement_QI(&This->element.node, riid, ppv);
574 static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
576 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
578 if(This->nsanchor)
579 nsIDOMHTMLAnchorElement_Release(This->nsanchor);
581 HTMLElement_destructor(&This->element.node);
584 static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, BOOL *prevent_default)
586 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
588 if(eid == EVENTID_CLICK) {
589 TRACE("CLICK\n");
590 *prevent_default = TRUE;
591 return navigate_anchor(This);
594 return S_OK;
597 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
598 HTMLAnchorElement_QI,
599 HTMLAnchorElement_destructor,
600 HTMLElement_clone,
601 HTMLElement_get_attr_col,
602 NULL,
603 NULL,
604 HTMLAnchorElement_handle_event
607 static const tid_t HTMLAnchorElement_iface_tids[] = {
608 IHTMLAnchorElement_tid,
609 HTMLELEMENT_TIDS,
610 IHTMLTextContainer_tid,
611 IHTMLUniqueName_tid,
615 static dispex_static_data_t HTMLAnchorElement_dispex = {
616 NULL,
617 DispHTMLAnchorElement_tid,
618 NULL,
619 HTMLAnchorElement_iface_tids
622 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
624 HTMLAnchorElement *ret;
625 nsresult nsres;
627 ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
628 if(!ret)
629 return E_OUTOFMEMORY;
631 ret->IHTMLAnchorElement_iface.lpVtbl = &HTMLAnchorElementVtbl;
632 ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
634 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
635 if(NS_FAILED(nsres)) {
636 ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
637 heap_free(ret);
638 return E_FAIL;
641 HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
643 *elem = &ret->element;
644 return S_OK;