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