msi/tests: Remove win9x hacks.
[wine] / dlls / mshtml / htmlanchor.c
1 /*
2  * Copyright 2007 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 <stdarg.h>
20 #include <stdio.h>
21
22 #define COBJMACROS
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28
29 #include "wine/debug.h"
30
31 #include "mshtml_private.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 typedef struct {
36     HTMLElement element;
37
38     IHTMLAnchorElement IHTMLAnchorElement_iface;
39
40     nsIDOMHTMLAnchorElement *nsanchor;
41 } HTMLAnchorElement;
42
43 static inline HTMLAnchorElement *impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
44 {
45     return CONTAINING_RECORD(iface, HTMLAnchorElement, IHTMLAnchorElement_iface);
46 }
47
48 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
49         REFIID riid, void **ppv)
50 {
51     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
52
53     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
54 }
55
56 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
57 {
58     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
59
60     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
61 }
62
63 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
64 {
65     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
66
67     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
68 }
69
70 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
71 {
72     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
73     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
74 }
75
76 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
77                                               LCID lcid, ITypeInfo **ppTInfo)
78 {
79     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
80     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
81             ppTInfo);
82 }
83
84 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
85                                                 LPOLESTR *rgszNames, UINT cNames,
86                                                 LCID lcid, DISPID *rgDispId)
87 {
88     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
89     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
90             cNames, lcid, rgDispId);
91 }
92
93 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
94                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
95                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
96 {
97     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
98     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
99             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
100 }
101
102 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
103 {
104     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
105     nsAString nsstr;
106     nsresult nsres;
107
108     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
109
110     nsAString_InitDepend(&nsstr, v);
111     nsres = nsIDOMHTMLAnchorElement_SetHref(This->nsanchor, &nsstr);
112     nsAString_Finish(&nsstr);
113     if(NS_FAILED(nsres))
114         return E_FAIL;
115
116     return S_OK;
117 }
118
119 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
120 {
121     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
122     nsAString href_str;
123     nsresult nsres;
124     HRESULT hres;
125
126     TRACE("(%p)->(%p)\n", This, p);
127
128     nsAString_Init(&href_str, NULL);
129     nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
130     if(NS_SUCCEEDED(nsres)) {
131         const PRUnichar *href;
132
133         nsAString_GetData(&href_str, &href);
134         hres = nsuri_to_url(href, TRUE, p);
135     }else {
136         ERR("GetHref failed: %08x\n", nsres);
137         hres = E_FAIL;
138     }
139
140     nsAString_Finish(&href_str);
141     return hres;
142 }
143
144 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
145 {
146     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
147     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
148     return E_NOTIMPL;
149 }
150
151 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
152 {
153     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
154     FIXME("(%p)->(%p)\n", This, p);
155     return E_NOTIMPL;
156 }
157
158 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
159 {
160     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
161     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
162     return E_NOTIMPL;
163 }
164
165 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
166 {
167     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
168     FIXME("(%p)->(%p)\n", This, p);
169     return E_NOTIMPL;
170 }
171
172 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
173 {
174     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
175     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
176     return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
180 {
181     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
182     FIXME("(%p)->(%p)\n", This, p);
183     return E_NOTIMPL;
184 }
185
186 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
187 {
188     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
189     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
190     return E_NOTIMPL;
191 }
192
193 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
194 {
195     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
196     FIXME("(%p)->(%p)\n", This, p);
197     return E_NOTIMPL;
198 }
199
200 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
201 {
202     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
203     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
204     return E_NOTIMPL;
205 }
206
207 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
208 {
209     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
210     FIXME("(%p)->(%p)\n", This, p);
211     return E_NOTIMPL;
212 }
213
214 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
215 {
216     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
217     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
218     return E_NOTIMPL;
219 }
220
221 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
222 {
223     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
224     FIXME("(%p)->(%p)\n", This, p);
225     return E_NOTIMPL;
226 }
227
228 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
229 {
230     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
231     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
232     return E_NOTIMPL;
233 }
234
235 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
236 {
237     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
238     FIXME("(%p)->(%p)\n", This, p);
239     return E_NOTIMPL;
240 }
241
242 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
243 {
244     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
245     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
246     return E_NOTIMPL;
247 }
248
249 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
250 {
251     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
252     FIXME("(%p)->(%p)\n", This, p);
253     return E_NOTIMPL;
254 }
255
256 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
257 {
258     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
259     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
260     return E_NOTIMPL;
261 }
262
263 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
264 {
265     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
266     FIXME("(%p)->(%p)\n", This, p);
267     return E_NOTIMPL;
268 }
269
270 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
271 {
272     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
273     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
274     return E_NOTIMPL;
275 }
276
277 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
278 {
279     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
280     FIXME("(%p)->(%p)\n", This, p);
281     return E_NOTIMPL;
282 }
283
284 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
285 {
286     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
287     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
288     return E_NOTIMPL;
289 }
290
291 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
292 {
293     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
294     FIXME("(%p)->(%p)\n", This, p);
295     return E_NOTIMPL;
296 }
297
298 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
299 {
300     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
301     FIXME("(%p)->(%p)\n", This, debugstr_w(v));
302     return E_NOTIMPL;
303 }
304
305 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
306 {
307     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
308     FIXME("(%p)->(%p)\n", This, p);
309     return E_NOTIMPL;
310 }
311
312 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
313 {
314     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
315     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
316     return E_NOTIMPL;
317 }
318
319 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
320 {
321     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
322     FIXME("(%p)->(%p)\n", This, p);
323     return E_NOTIMPL;
324 }
325
326 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
327 {
328     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
329
330     TRACE("(%p)->()\n", This);
331
332     return IHTMLElement2_put_onblur(&This->element.IHTMLElement2_iface, v);
333 }
334
335 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
336 {
337     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
338
339     TRACE("(%p)->(%p)\n", This, p);
340
341     return IHTMLElement2_get_onblur(&This->element.IHTMLElement2_iface, p);
342 }
343
344 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
345 {
346     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
347
348     TRACE("(%p)->()\n", This);
349
350     return IHTMLElement2_put_onfocus(&This->element.IHTMLElement2_iface, v);
351 }
352
353 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
354 {
355     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
356
357     TRACE("(%p)->(%p)\n", This, p);
358
359     return IHTMLElement2_get_onfocus(&This->element.IHTMLElement2_iface, p);
360 }
361
362 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
363 {
364     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
365
366     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
367
368     return IHTMLElement2_put_accessKey(&This->element.IHTMLElement2_iface, v);
369 }
370
371 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
372 {
373     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
374
375     TRACE("(%p)->(%p)\n", This, p);
376
377     return IHTMLElement2_get_accessKey(&This->element.IHTMLElement2_iface, p);
378 }
379
380 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
381 {
382     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
383     FIXME("(%p)->(%p)\n", This, p);
384     return E_NOTIMPL;
385 }
386
387 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
388 {
389     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
390     FIXME("(%p)->(%p)\n", This, p);
391     return E_NOTIMPL;
392 }
393
394 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
395 {
396     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
397     FIXME("(%p)->(%p)\n", This, p);
398     return E_NOTIMPL;
399 }
400
401 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
402 {
403     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
404
405     TRACE("(%p)->()\n", This);
406
407     return IHTMLElement2_put_tabIndex(&This->element.IHTMLElement2_iface, v);
408 }
409
410 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
411 {
412     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
413
414     TRACE("(%p)->(%p)\n", This, p);
415
416     return IHTMLElement2_get_tabIndex(&This->element.IHTMLElement2_iface, p);
417 }
418
419 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
420 {
421     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
422
423     TRACE("(%p)\n", This);
424
425     return IHTMLElement2_focus(&This->element.IHTMLElement2_iface);
426 }
427
428 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
429 {
430     HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
431
432     TRACE("(%p)\n", This);
433
434     return IHTMLElement2_blur(&This->element.IHTMLElement2_iface);
435 }
436
437 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
438     HTMLAnchorElement_QueryInterface,
439     HTMLAnchorElement_AddRef,
440     HTMLAnchorElement_Release,
441     HTMLAnchorElement_GetTypeInfoCount,
442     HTMLAnchorElement_GetTypeInfo,
443     HTMLAnchorElement_GetIDsOfNames,
444     HTMLAnchorElement_Invoke,
445     HTMLAnchorElement_put_href,
446     HTMLAnchorElement_get_href,
447     HTMLAnchorElement_put_target,
448     HTMLAnchorElement_get_target,
449     HTMLAnchorElement_put_rel,
450     HTMLAnchorElement_get_rel,
451     HTMLAnchorElement_put_rev,
452     HTMLAnchorElement_get_rev,
453     HTMLAnchorElement_put_urn,
454     HTMLAnchorElement_get_urn,
455     HTMLAnchorElement_put_Methods,
456     HTMLAnchorElement_get_Methods,
457     HTMLAnchorElement_put_name,
458     HTMLAnchorElement_get_name,
459     HTMLAnchorElement_put_host,
460     HTMLAnchorElement_get_host,
461     HTMLAnchorElement_put_hostname,
462     HTMLAnchorElement_get_hostname,
463     HTMLAnchorElement_put_pathname,
464     HTMLAnchorElement_get_pathname,
465     HTMLAnchorElement_put_port,
466     HTMLAnchorElement_get_port,
467     HTMLAnchorElement_put_protocol,
468     HTMLAnchorElement_get_protocol,
469     HTMLAnchorElement_put_search,
470     HTMLAnchorElement_get_search,
471     HTMLAnchorElement_put_hash,
472     HTMLAnchorElement_get_hash,
473     HTMLAnchorElement_put_onblur,
474     HTMLAnchorElement_get_onblur,
475     HTMLAnchorElement_put_onfocus,
476     HTMLAnchorElement_get_onfocus,
477     HTMLAnchorElement_put_accessKey,
478     HTMLAnchorElement_get_accessKey,
479     HTMLAnchorElement_get_protocolLong,
480     HTMLAnchorElement_get_mimeType,
481     HTMLAnchorElement_get_nameProp,
482     HTMLAnchorElement_put_tabIndex,
483     HTMLAnchorElement_get_tabIndex,
484     HTMLAnchorElement_focus,
485     HTMLAnchorElement_blur
486 };
487
488 static inline HTMLAnchorElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
489 {
490     return CONTAINING_RECORD(iface, HTMLAnchorElement, element.node);
491 }
492
493 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
494 {
495     HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
496
497     *ppv = NULL;
498
499     if(IsEqualGUID(&IID_IUnknown, riid)) {
500         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
501         *ppv = &This->IHTMLAnchorElement_iface;
502     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
503         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
504         *ppv = &This->IHTMLAnchorElement_iface;
505     }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
506         TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
507         *ppv = &This->IHTMLAnchorElement_iface;
508     }
509
510     if(*ppv) {
511         IUnknown_AddRef((IUnknown*)*ppv);
512         return S_OK;
513     }
514
515     return HTMLElement_QI(&This->element.node, riid, ppv);
516 }
517
518 static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
519 {
520     HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
521
522     if(This->nsanchor)
523         nsIDOMHTMLAnchorElement_Release(This->nsanchor);
524
525     HTMLElement_destructor(&This->element.node);
526 }
527
528 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
529     HTMLAnchorElement_QI,
530     HTMLAnchorElement_destructor,
531     HTMLElement_clone
532 };
533
534 static const tid_t HTMLAnchorElement_iface_tids[] = {
535     IHTMLAnchorElement_tid,
536     HTMLELEMENT_TIDS,
537     IHTMLTextContainer_tid,
538     IHTMLUniqueName_tid,
539     0
540 };
541
542 static dispex_static_data_t HTMLAnchorElement_dispex = {
543     NULL,
544     DispHTMLAnchorElement_tid,
545     NULL,
546     HTMLAnchorElement_iface_tids
547 };
548
549 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
550 {
551     HTMLAnchorElement *ret;
552     nsresult nsres;
553
554     ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
555     if(!ret)
556         return E_OUTOFMEMORY;
557
558     ret->IHTMLAnchorElement_iface.lpVtbl = &HTMLAnchorElementVtbl;
559     ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
560
561     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
562     if(NS_FAILED(nsres)) {
563         ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
564         heap_free(ret);
565         return E_FAIL;
566     }
567
568     HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
569
570     *elem = &ret->element;
571     return S_OK;
572 }