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
30 #include "mshtml_private.h"
31 #include "htmlevent.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
41 IHTMLAnchorElement IHTMLAnchorElement_iface;
43 nsIDOMHTMLAnchorElement *nsanchor;
46 static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *target)
53 nsAString_Init(&href_str, NULL);
54 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
55 if(NS_SUCCEEDED(nsres)) {
56 const PRUnichar *href;
58 nsAString_GetData(&href_str, &href);
59 hres = create_relative_uri(This->element.node.doc->basedoc.window, href, &uri);
61 ERR("Could not get anchor href: %08x\n", nsres);
64 nsAString_Finish(&href_str);
68 hres = navigate_new_window(This->element.node.doc->basedoc.window, uri, target, NULL);
73 static HRESULT navigate_anchor(HTMLAnchorElement *This)
75 nsAString href_str, target_str;
76 HTMLOuterWindow *window = NULL;
78 HRESULT hres = E_FAIL;
80 static const WCHAR _parentW[] = {'p','a','r','e','n','t',0};
81 static const WCHAR _selfW[] = {'_','s','e','l','f',0};
82 static const WCHAR _topW[] = {'_','t','o','p',0};
84 nsAString_Init(&target_str, NULL);
85 nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
86 if(NS_SUCCEEDED(nsres)) {
87 const PRUnichar *target;
89 TRACE("target %s\n", debugstr_w(target));
91 nsAString_GetData(&target_str, &target);
92 if(*target && strcmpiW(target, _selfW)) {
93 if(!strcmpiW(target, _topW)) {
94 TRACE("target _top\n");
95 get_top_window(This->element.node.doc->basedoc.window, &window);
96 }else if(!strcmpiW(target, _parentW)) {
97 FIXME("Navigating to target _parent is not implemented\n");
98 nsAString_Finish(&target_str);
101 HTMLOuterWindow *top_window;
103 get_top_window(This->element.node.doc->basedoc.window, &top_window);
105 hres = get_frame_by_name(top_window, target, TRUE, &window);
106 if(FAILED(hres) || !window) {
107 hres = navigate_anchor_window(This, target);
108 nsAString_Finish(&target_str);
114 nsAString_Finish(&target_str);
116 nsAString_Init(&href_str, NULL);
117 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
118 if(NS_SUCCEEDED(nsres)) {
119 const PRUnichar *href;
121 nsAString_GetData(&href_str, &href);
124 window = This->element.node.doc->basedoc.window;
125 hres = navigate_url(window, href, window->url);
127 TRACE("empty href\n");
131 nsAString_Finish(&href_str);
135 static inline HTMLAnchorElement *impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
137 return CONTAINING_RECORD(iface, HTMLAnchorElement, IHTMLAnchorElement_iface);
140 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
141 REFIID riid, void **ppv)
143 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
145 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
148 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
150 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
152 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
155 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
157 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
159 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
162 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
164 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
165 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
168 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
169 LCID lcid, ITypeInfo **ppTInfo)
171 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
172 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
176 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
177 LPOLESTR *rgszNames, UINT cNames,
178 LCID lcid, DISPID *rgDispId)
180 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
181 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
182 cNames, lcid, rgDispId);
185 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
186 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
187 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
189 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
190 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
191 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
194 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
196 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
200 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
202 nsAString_InitDepend(&nsstr, v);
203 nsres = nsIDOMHTMLAnchorElement_SetHref(This->nsanchor, &nsstr);
204 nsAString_Finish(&nsstr);
211 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
213 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
218 TRACE("(%p)->(%p)\n", This, p);
220 nsAString_Init(&href_str, NULL);
221 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
222 if(NS_SUCCEEDED(nsres)) {
223 const PRUnichar *href;
225 nsAString_GetData(&href_str, &href);
226 hres = nsuri_to_url(href, TRUE, p);
228 ERR("GetHref failed: %08x\n", nsres);
232 nsAString_Finish(&href_str);
236 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
238 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
242 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
244 nsAString_InitDepend(&nsstr, v);
245 nsres = nsIDOMHTMLAnchorElement_SetTarget(This->nsanchor, &nsstr);
246 nsAString_Finish(&nsstr);
253 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
255 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
256 nsAString target_str;
259 TRACE("(%p)->(%p)\n", This, p);
261 nsAString_Init(&target_str, NULL);
262 nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
264 return return_nsstr(nsres, &target_str, p);
267 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
269 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
270 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
274 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
276 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
277 FIXME("(%p)->(%p)\n", This, p);
281 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
283 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
284 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
288 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
290 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
291 FIXME("(%p)->(%p)\n", This, p);
295 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
297 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
298 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
302 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
304 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
305 FIXME("(%p)->(%p)\n", This, p);
309 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
311 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
312 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
316 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
318 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
319 FIXME("(%p)->(%p)\n", This, p);
323 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
325 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
329 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
331 nsAString_InitDepend(&nsstr, v);
332 nsres = nsIDOMHTMLAnchorElement_SetName(This->nsanchor, &nsstr);
333 nsAString_Finish(&nsstr);
340 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
342 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
346 TRACE("(%p)->(%p)\n", This, p);
348 nsAString_Init(&name_str, NULL);
349 nsres = nsIDOMHTMLAnchorElement_GetName(This->nsanchor, &name_str);
351 return return_nsstr(nsres, &name_str, p);
354 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
356 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
357 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
361 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
363 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
364 FIXME("(%p)->(%p)\n", This, p);
368 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
370 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
371 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
375 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
377 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
378 FIXME("(%p)->(%p)\n", This, p);
382 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
384 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
385 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
389 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
391 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
392 FIXME("(%p)->(%p)\n", This, p);
396 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
398 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
399 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
403 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
405 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
406 FIXME("(%p)->(%p)\n", This, p);
410 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
412 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
413 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
417 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
419 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
420 FIXME("(%p)->(%p)\n", This, p);
424 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
426 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
427 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
431 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
433 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
434 FIXME("(%p)->(%p)\n", This, p);
438 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
440 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
441 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
445 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
447 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
448 FIXME("(%p)->(%p)\n", This, p);
452 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
454 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
456 TRACE("(%p)->()\n", This);
458 return IHTMLElement2_put_onblur(&This->element.IHTMLElement2_iface, v);
461 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
463 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
465 TRACE("(%p)->(%p)\n", This, p);
467 return IHTMLElement2_get_onblur(&This->element.IHTMLElement2_iface, p);
470 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
472 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
474 TRACE("(%p)->()\n", This);
476 return IHTMLElement2_put_onfocus(&This->element.IHTMLElement2_iface, v);
479 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
481 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
483 TRACE("(%p)->(%p)\n", This, p);
485 return IHTMLElement2_get_onfocus(&This->element.IHTMLElement2_iface, p);
488 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
490 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
492 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
494 return IHTMLElement2_put_accessKey(&This->element.IHTMLElement2_iface, v);
497 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
499 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
501 TRACE("(%p)->(%p)\n", This, p);
503 return IHTMLElement2_get_accessKey(&This->element.IHTMLElement2_iface, p);
506 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
508 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
509 FIXME("(%p)->(%p)\n", This, p);
513 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
515 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
516 FIXME("(%p)->(%p)\n", This, p);
520 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
522 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
523 FIXME("(%p)->(%p)\n", This, p);
527 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
529 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
531 TRACE("(%p)->()\n", This);
533 return IHTMLElement2_put_tabIndex(&This->element.IHTMLElement2_iface, v);
536 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
538 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
540 TRACE("(%p)->(%p)\n", This, p);
542 return IHTMLElement2_get_tabIndex(&This->element.IHTMLElement2_iface, p);
545 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
547 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
549 TRACE("(%p)\n", This);
551 return IHTMLElement2_focus(&This->element.IHTMLElement2_iface);
554 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
556 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
558 TRACE("(%p)\n", This);
560 return IHTMLElement2_blur(&This->element.IHTMLElement2_iface);
563 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
564 HTMLAnchorElement_QueryInterface,
565 HTMLAnchorElement_AddRef,
566 HTMLAnchorElement_Release,
567 HTMLAnchorElement_GetTypeInfoCount,
568 HTMLAnchorElement_GetTypeInfo,
569 HTMLAnchorElement_GetIDsOfNames,
570 HTMLAnchorElement_Invoke,
571 HTMLAnchorElement_put_href,
572 HTMLAnchorElement_get_href,
573 HTMLAnchorElement_put_target,
574 HTMLAnchorElement_get_target,
575 HTMLAnchorElement_put_rel,
576 HTMLAnchorElement_get_rel,
577 HTMLAnchorElement_put_rev,
578 HTMLAnchorElement_get_rev,
579 HTMLAnchorElement_put_urn,
580 HTMLAnchorElement_get_urn,
581 HTMLAnchorElement_put_Methods,
582 HTMLAnchorElement_get_Methods,
583 HTMLAnchorElement_put_name,
584 HTMLAnchorElement_get_name,
585 HTMLAnchorElement_put_host,
586 HTMLAnchorElement_get_host,
587 HTMLAnchorElement_put_hostname,
588 HTMLAnchorElement_get_hostname,
589 HTMLAnchorElement_put_pathname,
590 HTMLAnchorElement_get_pathname,
591 HTMLAnchorElement_put_port,
592 HTMLAnchorElement_get_port,
593 HTMLAnchorElement_put_protocol,
594 HTMLAnchorElement_get_protocol,
595 HTMLAnchorElement_put_search,
596 HTMLAnchorElement_get_search,
597 HTMLAnchorElement_put_hash,
598 HTMLAnchorElement_get_hash,
599 HTMLAnchorElement_put_onblur,
600 HTMLAnchorElement_get_onblur,
601 HTMLAnchorElement_put_onfocus,
602 HTMLAnchorElement_get_onfocus,
603 HTMLAnchorElement_put_accessKey,
604 HTMLAnchorElement_get_accessKey,
605 HTMLAnchorElement_get_protocolLong,
606 HTMLAnchorElement_get_mimeType,
607 HTMLAnchorElement_get_nameProp,
608 HTMLAnchorElement_put_tabIndex,
609 HTMLAnchorElement_get_tabIndex,
610 HTMLAnchorElement_focus,
611 HTMLAnchorElement_blur
614 static inline HTMLAnchorElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
616 return CONTAINING_RECORD(iface, HTMLAnchorElement, element.node);
619 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
621 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
625 if(IsEqualGUID(&IID_IUnknown, riid)) {
626 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
627 *ppv = &This->IHTMLAnchorElement_iface;
628 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
629 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
630 *ppv = &This->IHTMLAnchorElement_iface;
631 }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
632 TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
633 *ppv = &This->IHTMLAnchorElement_iface;
637 IUnknown_AddRef((IUnknown*)*ppv);
641 return HTMLElement_QI(&This->element.node, riid, ppv);
644 static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
646 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
648 if(eid == EVENTID_CLICK) {
649 nsIDOMMouseEvent *mouse_event;
655 nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
656 assert(nsres == NS_OK);
658 nsres = nsIDOMMouseEvent_GetButton(mouse_event, &button);
659 assert(nsres == NS_OK);
661 nsIDOMMouseEvent_Release(mouse_event);
665 *prevent_default = TRUE;
666 return navigate_anchor(This);
668 *prevent_default = TRUE;
669 return navigate_anchor_window(This, NULL);
671 *prevent_default = FALSE;
676 return HTMLElement_handle_event(&This->element.node, eid, event, prevent_default);
679 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
680 HTMLAnchorElement_QI,
681 HTMLElement_destructor,
683 HTMLAnchorElement_handle_event,
684 HTMLElement_get_attr_col
687 static const tid_t HTMLAnchorElement_iface_tids[] = {
688 IHTMLAnchorElement_tid,
690 IHTMLTextContainer_tid,
695 static dispex_static_data_t HTMLAnchorElement_dispex = {
697 DispHTMLAnchorElement_tid,
699 HTMLAnchorElement_iface_tids
702 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
704 HTMLAnchorElement *ret;
707 ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
709 return E_OUTOFMEMORY;
711 ret->IHTMLAnchorElement_iface.lpVtbl = &HTMLAnchorElementVtbl;
712 ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
714 HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
716 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
718 /* Shere the reference with nsnode */
719 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsanchor == ret->element.node.nsnode);
720 nsIDOMNode_Release(ret->element.node.nsnode);
722 *elem = &ret->element;