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;
77 HRESULT hres = E_FAIL;
79 static const WCHAR _parentW[] = {'p','a','r','e','n','t',0};
80 static const WCHAR _selfW[] = {'_','s','e','l','f',0};
81 static const WCHAR _topW[] = {'_','t','o','p',0};
83 nsAString_Init(&target_str, NULL);
84 nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
85 if(NS_SUCCEEDED(nsres)) {
86 const PRUnichar *target;
88 nsAString_GetData(&target_str, &target);
89 if(*target && strcmpiW(target, _selfW)) {
90 if(strcmpiW(target, _parentW) && strcmpiW(target, _topW)) {
91 hres = navigate_anchor_window(This, target);
93 FIXME("Navigating to target %s is not implemented\n", debugstr_w(target));
96 nsAString_Finish(&target_str);
100 nsAString_Finish(&target_str);
102 nsAString_Init(&href_str, NULL);
103 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
104 if(NS_SUCCEEDED(nsres)) {
105 const PRUnichar *href;
107 nsAString_GetData(&href_str, &href);
109 HTMLWindow *window = This->element.node.doc->basedoc.window;
110 hres = navigate_url(window, href, window->url);
112 TRACE("empty href\n");
116 nsAString_Finish(&href_str);
120 static inline HTMLAnchorElement *impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
122 return CONTAINING_RECORD(iface, HTMLAnchorElement, IHTMLAnchorElement_iface);
125 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
126 REFIID riid, void **ppv)
128 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
130 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
133 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
135 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
137 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
140 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
142 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
144 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
147 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
149 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
150 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
153 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
154 LCID lcid, ITypeInfo **ppTInfo)
156 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
157 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
161 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
162 LPOLESTR *rgszNames, UINT cNames,
163 LCID lcid, DISPID *rgDispId)
165 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
166 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
167 cNames, lcid, rgDispId);
170 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
171 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
172 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
174 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
175 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
176 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
179 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
181 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
185 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
187 nsAString_InitDepend(&nsstr, v);
188 nsres = nsIDOMHTMLAnchorElement_SetHref(This->nsanchor, &nsstr);
189 nsAString_Finish(&nsstr);
196 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
198 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
203 TRACE("(%p)->(%p)\n", This, p);
205 nsAString_Init(&href_str, NULL);
206 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
207 if(NS_SUCCEEDED(nsres)) {
208 const PRUnichar *href;
210 nsAString_GetData(&href_str, &href);
211 hres = nsuri_to_url(href, TRUE, p);
213 ERR("GetHref failed: %08x\n", nsres);
217 nsAString_Finish(&href_str);
221 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
223 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
227 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
229 nsAString_InitDepend(&nsstr, v);
230 nsres = nsIDOMHTMLAnchorElement_SetTarget(This->nsanchor, &nsstr);
231 nsAString_Finish(&nsstr);
238 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
240 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
241 nsAString target_str;
244 TRACE("(%p)->(%p)\n", This, p);
246 nsAString_Init(&target_str, NULL);
247 nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
249 return return_nsstr(nsres, &target_str, p);
252 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
254 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
255 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
259 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
261 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
262 FIXME("(%p)->(%p)\n", This, p);
266 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
268 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
269 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
273 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
275 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
276 FIXME("(%p)->(%p)\n", This, p);
280 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
282 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
283 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
287 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
289 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
290 FIXME("(%p)->(%p)\n", This, p);
294 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
296 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
297 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
301 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
303 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
304 FIXME("(%p)->(%p)\n", This, p);
308 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
310 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
311 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
315 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
317 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
318 FIXME("(%p)->(%p)\n", This, p);
322 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
324 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
325 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
329 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
331 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
332 FIXME("(%p)->(%p)\n", This, p);
336 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
338 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
339 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
343 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
345 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
346 FIXME("(%p)->(%p)\n", This, p);
350 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
352 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
353 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
357 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
359 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
360 FIXME("(%p)->(%p)\n", This, p);
364 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
366 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
367 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
371 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
373 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
374 FIXME("(%p)->(%p)\n", This, p);
378 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
380 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
381 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
385 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
387 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
388 FIXME("(%p)->(%p)\n", This, p);
392 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
394 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
395 FIXME("(%p)->(%p)\n", This, debugstr_w(v));
399 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
401 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
402 FIXME("(%p)->(%p)\n", This, p);
406 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
408 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
409 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
413 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
415 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
416 FIXME("(%p)->(%p)\n", This, p);
420 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
422 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
424 TRACE("(%p)->()\n", This);
426 return IHTMLElement2_put_onblur(&This->element.IHTMLElement2_iface, v);
429 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
431 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
433 TRACE("(%p)->(%p)\n", This, p);
435 return IHTMLElement2_get_onblur(&This->element.IHTMLElement2_iface, p);
438 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
440 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
442 TRACE("(%p)->()\n", This);
444 return IHTMLElement2_put_onfocus(&This->element.IHTMLElement2_iface, v);
447 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
449 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
451 TRACE("(%p)->(%p)\n", This, p);
453 return IHTMLElement2_get_onfocus(&This->element.IHTMLElement2_iface, p);
456 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
458 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
460 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
462 return IHTMLElement2_put_accessKey(&This->element.IHTMLElement2_iface, v);
465 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
467 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
469 TRACE("(%p)->(%p)\n", This, p);
471 return IHTMLElement2_get_accessKey(&This->element.IHTMLElement2_iface, p);
474 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
476 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
477 FIXME("(%p)->(%p)\n", This, p);
481 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
483 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
484 FIXME("(%p)->(%p)\n", This, p);
488 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
490 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
491 FIXME("(%p)->(%p)\n", This, p);
495 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
497 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
499 TRACE("(%p)->()\n", This);
501 return IHTMLElement2_put_tabIndex(&This->element.IHTMLElement2_iface, v);
504 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
506 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
508 TRACE("(%p)->(%p)\n", This, p);
510 return IHTMLElement2_get_tabIndex(&This->element.IHTMLElement2_iface, p);
513 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
515 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
517 TRACE("(%p)\n", This);
519 return IHTMLElement2_focus(&This->element.IHTMLElement2_iface);
522 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
524 HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
526 TRACE("(%p)\n", This);
528 return IHTMLElement2_blur(&This->element.IHTMLElement2_iface);
531 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
532 HTMLAnchorElement_QueryInterface,
533 HTMLAnchorElement_AddRef,
534 HTMLAnchorElement_Release,
535 HTMLAnchorElement_GetTypeInfoCount,
536 HTMLAnchorElement_GetTypeInfo,
537 HTMLAnchorElement_GetIDsOfNames,
538 HTMLAnchorElement_Invoke,
539 HTMLAnchorElement_put_href,
540 HTMLAnchorElement_get_href,
541 HTMLAnchorElement_put_target,
542 HTMLAnchorElement_get_target,
543 HTMLAnchorElement_put_rel,
544 HTMLAnchorElement_get_rel,
545 HTMLAnchorElement_put_rev,
546 HTMLAnchorElement_get_rev,
547 HTMLAnchorElement_put_urn,
548 HTMLAnchorElement_get_urn,
549 HTMLAnchorElement_put_Methods,
550 HTMLAnchorElement_get_Methods,
551 HTMLAnchorElement_put_name,
552 HTMLAnchorElement_get_name,
553 HTMLAnchorElement_put_host,
554 HTMLAnchorElement_get_host,
555 HTMLAnchorElement_put_hostname,
556 HTMLAnchorElement_get_hostname,
557 HTMLAnchorElement_put_pathname,
558 HTMLAnchorElement_get_pathname,
559 HTMLAnchorElement_put_port,
560 HTMLAnchorElement_get_port,
561 HTMLAnchorElement_put_protocol,
562 HTMLAnchorElement_get_protocol,
563 HTMLAnchorElement_put_search,
564 HTMLAnchorElement_get_search,
565 HTMLAnchorElement_put_hash,
566 HTMLAnchorElement_get_hash,
567 HTMLAnchorElement_put_onblur,
568 HTMLAnchorElement_get_onblur,
569 HTMLAnchorElement_put_onfocus,
570 HTMLAnchorElement_get_onfocus,
571 HTMLAnchorElement_put_accessKey,
572 HTMLAnchorElement_get_accessKey,
573 HTMLAnchorElement_get_protocolLong,
574 HTMLAnchorElement_get_mimeType,
575 HTMLAnchorElement_get_nameProp,
576 HTMLAnchorElement_put_tabIndex,
577 HTMLAnchorElement_get_tabIndex,
578 HTMLAnchorElement_focus,
579 HTMLAnchorElement_blur
582 static inline HTMLAnchorElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
584 return CONTAINING_RECORD(iface, HTMLAnchorElement, element.node);
587 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
589 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
593 if(IsEqualGUID(&IID_IUnknown, riid)) {
594 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
595 *ppv = &This->IHTMLAnchorElement_iface;
596 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
597 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
598 *ppv = &This->IHTMLAnchorElement_iface;
599 }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
600 TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
601 *ppv = &This->IHTMLAnchorElement_iface;
605 IUnknown_AddRef((IUnknown*)*ppv);
609 return HTMLElement_QI(&This->element.node, riid, ppv);
612 static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
614 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
617 nsIDOMHTMLAnchorElement_Release(This->nsanchor);
619 HTMLElement_destructor(&This->element.node);
622 static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
624 HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
626 if(eid == EVENTID_CLICK) {
627 nsIDOMMouseEvent *mouse_event;
633 nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
634 assert(nsres == NS_OK);
636 nsres = nsIDOMMouseEvent_GetButton(mouse_event, &button);
637 assert(nsres == NS_OK);
639 nsIDOMMouseEvent_Release(mouse_event);
643 *prevent_default = TRUE;
644 return navigate_anchor(This);
646 *prevent_default = TRUE;
647 return navigate_anchor_window(This, NULL);
649 *prevent_default = FALSE;
657 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
658 HTMLAnchorElement_QI,
659 HTMLAnchorElement_destructor,
661 HTMLElement_get_attr_col,
664 HTMLAnchorElement_handle_event
667 static const tid_t HTMLAnchorElement_iface_tids[] = {
668 IHTMLAnchorElement_tid,
670 IHTMLTextContainer_tid,
675 static dispex_static_data_t HTMLAnchorElement_dispex = {
677 DispHTMLAnchorElement_tid,
679 HTMLAnchorElement_iface_tids
682 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
684 HTMLAnchorElement *ret;
687 ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
689 return E_OUTOFMEMORY;
691 ret->IHTMLAnchorElement_iface.lpVtbl = &HTMLAnchorElementVtbl;
692 ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
694 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
695 if(NS_FAILED(nsres)) {
696 ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
701 HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
703 *elem = &ret->element;