ReactOS  0.4.13-dev-464-g6b95727
htmlanchor.c
Go to the documentation of this file.
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 "mshtml_private.h"
20 
21 typedef struct {
23 
24  IHTMLAnchorElement IHTMLAnchorElement_iface;
25 
28 
30 {
31  const PRUnichar *href;
32  IUri *uri;
33  HRESULT hres;
34 
35  nsAString_GetData(href_str, &href);
36  hres = create_relative_uri(element->node.doc->basedoc.window, href, &uri);
37  if(FAILED(hres))
38  return hres;
39 
40  hres = navigate_new_window(element->node.doc->basedoc.window, uri, target, NULL, NULL);
41  IUri_Release(uri);
42  return hres;
43 }
44 
46 {
47  HTMLOuterWindow *top_window, *ret_window;
48  const PRUnichar *target;
49  HRESULT hres;
50 
51  static const WCHAR _parentW[] = {'_','p','a','r','e','n','t',0};
52  static const WCHAR _selfW[] = {'_','s','e','l','f',0};
53  static const WCHAR _topW[] = {'_','t','o','p',0};
54 
55  *use_new_window = FALSE;
56 
57  nsAString_GetData(target_str, &target);
58  TRACE("%s\n", debugstr_w(target));
59 
60  if(!*target || !strcmpiW(target, _selfW)) {
61  IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
62  return window;
63  }
64 
65  if(!strcmpiW(target, _topW)) {
66  get_top_window(window, &top_window);
67  IHTMLWindow2_AddRef(&top_window->base.IHTMLWindow2_iface);
68  return top_window;
69  }
70 
71  if(!strcmpiW(target, _parentW)) {
72  if(!window->parent) {
73  WARN("Window has no parent, treat as self\n");
74  IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
75  return window;
76  }
77 
78  IHTMLWindow2_AddRef(&window->parent->base.IHTMLWindow2_iface);
79  return window->parent;
80  }
81 
82  get_top_window(window, &top_window);
83 
84  hres = get_frame_by_name(top_window, target, TRUE, &ret_window);
85  if(FAILED(hres) || !ret_window) {
86  *use_new_window = TRUE;
87  return NULL;
88  }
89 
90  IHTMLWindow2_AddRef(&ret_window->base.IHTMLWindow2_iface);
91  return ret_window;
92 }
93 
94 static HRESULT navigate_href(HTMLElement *element, nsAString *href_str, nsAString *target_str)
95 {
97  BOOL use_new_window;
98  const PRUnichar *href;
99  HRESULT hres;
100 
101  window = get_target_window(element->node.doc->basedoc.window, target_str, &use_new_window);
102  if(!window) {
103  if(use_new_window) {
104  const PRUnichar *target;
105  nsAString_GetData(target_str, &target);
106  return navigate_href_new_window(element, href_str, target);
107  }else {
108  return S_OK;
109  }
110  }
111 
112  nsAString_GetData(href_str, &href);
113  if(*href) {
114  hres = navigate_url(window, href, window->uri_nofrag, BINDING_NAVIGATED);
115  }else {
116  TRACE("empty href\n");
117  hres = S_OK;
118  }
119  IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
120  return hres;
121 }
122 
124  nsIDOMEvent *event, BOOL *prevent_default)
125 {
127  INT16 button;
128  nsresult nsres;
129  HRESULT hres;
130 
131  TRACE("CLICK\n");
132 
133  nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
134  assert(nsres == NS_OK);
135 
136  nsres = nsIDOMMouseEvent_GetButton(mouse_event, &button);
137  assert(nsres == NS_OK);
138 
139  nsIDOMMouseEvent_Release(mouse_event);
140 
141  switch(button) {
142  case 0:
143  *prevent_default = TRUE;
144  hres = navigate_href(element, href_str, target_str);
145  break;
146  case 1:
147  *prevent_default = TRUE;
149  break;
150  default:
151  *prevent_default = FALSE;
152  hres = S_OK;
153  }
154 
155  nsAString_Finish(href_str);
156  nsAString_Finish(target_str);
157  return hres;
158 }
159 
160 static inline HTMLAnchorElement *impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
161 {
162  return CONTAINING_RECORD(iface, HTMLAnchorElement, IHTMLAnchorElement_iface);
163 }
164 
165 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
166  REFIID riid, void **ppv)
167 {
169 
170  return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
171 }
172 
173 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
174 {
176 
177  return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
178 }
179 
180 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
181 {
183 
184  return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
185 }
186 
187 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
188 {
190  return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
191 }
192 
193 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
194  LCID lcid, ITypeInfo **ppTInfo)
195 {
197  return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
198  ppTInfo);
199 }
200 
201 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
202  LPOLESTR *rgszNames, UINT cNames,
203  LCID lcid, DISPID *rgDispId)
204 {
206  return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
207  cNames, lcid, rgDispId);
208 }
209 
210 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
211  REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
212  VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
213 {
215  return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
216  lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
217 }
218 
219 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
220 {
222  nsAString nsstr;
223  nsresult nsres;
224 
225  TRACE("(%p)->(%s)\n", This, debugstr_w(v));
226 
227  nsAString_InitDepend(&nsstr, v);
228  nsres = nsIDOMHTMLAnchorElement_SetHref(This->nsanchor, &nsstr);
229  nsAString_Finish(&nsstr);
230  if(NS_FAILED(nsres))
231  return E_FAIL;
232 
233  return S_OK;
234 }
235 
236 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
237 {
239  nsAString href_str;
240  nsresult nsres;
241  HRESULT hres;
242 
243  TRACE("(%p)->(%p)\n", This, p);
244 
245  nsAString_Init(&href_str, NULL);
246  nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
247  if(NS_SUCCEEDED(nsres)) {
248  const PRUnichar *href;
249 
250  nsAString_GetData(&href_str, &href);
251  hres = nsuri_to_url(href, TRUE, p);
252  }else {
253  ERR("GetHref failed: %08x\n", nsres);
254  hres = E_FAIL;
255  }
256 
257  nsAString_Finish(&href_str);
258  return hres;
259 }
260 
261 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
262 {
264  nsAString nsstr;
265  nsresult nsres;
266 
267  TRACE("(%p)->(%s)\n", This, debugstr_w(v));
268 
269  nsAString_InitDepend(&nsstr, v);
270  nsres = nsIDOMHTMLAnchorElement_SetTarget(This->nsanchor, &nsstr);
271  nsAString_Finish(&nsstr);
272  if(NS_FAILED(nsres))
273  return E_FAIL;
274 
275  return S_OK;
276 }
277 
278 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
279 {
281  nsAString target_str;
282  nsresult nsres;
283 
284  TRACE("(%p)->(%p)\n", This, p);
285 
286  nsAString_Init(&target_str, NULL);
287  nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
288 
289  return return_nsstr(nsres, &target_str, p);
290 }
291 
292 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
293 {
295  nsAString nsstr;
296  nsresult nsres;
297 
298  TRACE("(%p)->(%s)\n", This, debugstr_w(v));
299 
300  nsAString_InitDepend(&nsstr, v);
301  nsres = nsIDOMHTMLAnchorElement_SetRel(This->nsanchor, &nsstr);
302  nsAString_Finish(&nsstr);
303  if(NS_FAILED(nsres))
304  return E_FAIL;
305 
306  return S_OK;
307 }
308 
309 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
310 {
312  nsAString nsstr;
313  nsresult nsres;
314 
315  TRACE("(%p)->(%p)\n", This, p);
316 
317  nsAString_Init(&nsstr, NULL);
318  nsres = nsIDOMHTMLAnchorElement_GetRel(This->nsanchor, &nsstr);
319  return return_nsstr(nsres, &nsstr, p);
320 }
321 
322 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
323 {
325  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
326  return E_NOTIMPL;
327 }
328 
329 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
330 {
332  FIXME("(%p)->(%p)\n", This, p);
333  return E_NOTIMPL;
334 }
335 
336 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
337 {
339  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
340  return E_NOTIMPL;
341 }
342 
343 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
344 {
346  FIXME("(%p)->(%p)\n", This, p);
347  return E_NOTIMPL;
348 }
349 
350 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
351 {
353  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
354  return E_NOTIMPL;
355 }
356 
357 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
358 {
360  FIXME("(%p)->(%p)\n", This, p);
361  return E_NOTIMPL;
362 }
363 
364 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
365 {
367  nsAString nsstr;
368  nsresult nsres;
369 
370  TRACE("(%p)->(%s)\n", This, debugstr_w(v));
371 
372  nsAString_InitDepend(&nsstr, v);
373  nsres = nsIDOMHTMLAnchorElement_SetName(This->nsanchor, &nsstr);
374  nsAString_Finish(&nsstr);
375  if(NS_FAILED(nsres))
376  return E_FAIL;
377 
378  return S_OK;
379 }
380 
381 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
382 {
384  nsAString name_str;
385  nsresult nsres;
386 
387  TRACE("(%p)->(%p)\n", This, p);
388 
389  nsAString_Init(&name_str, NULL);
390  nsres = nsIDOMHTMLAnchorElement_GetName(This->nsanchor, &name_str);
391 
392  return return_nsstr(nsres, &name_str, p);
393 }
394 
395 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
396 {
398  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
399  return E_NOTIMPL;
400 }
401 
402 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
403 {
405  FIXME("(%p)->(%p)\n", This, p);
406  return E_NOTIMPL;
407 }
408 
409 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
410 {
412  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
413  return E_NOTIMPL;
414 }
415 
416 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
417 {
419  nsAString hostname_str;
420  nsresult nsres;
421 
422  TRACE("(%p)->(%p)\n", This, p);
423 
424  nsAString_Init(&hostname_str, NULL);
425  nsres = nsIDOMHTMLAnchorElement_GetHostname(This->nsanchor, &hostname_str);
426  return return_nsstr(nsres, &hostname_str, p);
427 }
428 
429 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
430 {
432  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
433  return E_NOTIMPL;
434 }
435 
436 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
437 {
439  FIXME("(%p)->(%p)\n", This, p);
440  return E_NOTIMPL;
441 }
442 
443 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
444 {
446  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
447  return E_NOTIMPL;
448 }
449 
450 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
451 {
453  FIXME("(%p)->(%p)\n", This, p);
454  return E_NOTIMPL;
455 }
456 
457 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
458 {
460  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
461  return E_NOTIMPL;
462 }
463 
464 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
465 {
467  FIXME("(%p)->(%p)\n", This, p);
468  return E_NOTIMPL;
469 }
470 
471 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
472 {
474  nsAString nsstr;
475  nsresult nsres;
476 
477  TRACE("(%p)->(%s)\n", This, debugstr_w(v));
478 
479  nsAString_InitDepend(&nsstr, v);
480  nsres = nsIDOMHTMLAnchorElement_SetSearch(This->nsanchor, &nsstr);
481  nsAString_Finish(&nsstr);
482  if(NS_FAILED(nsres))
483  return E_FAIL;
484 
485  return S_OK;
486 }
487 
488 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
489 {
491  nsAString search_str;
492  nsresult nsres;
493 
494  TRACE("(%p)->(%p)\n", This, p);
495 
496  nsAString_Init(&search_str, NULL);
497  nsres = nsIDOMHTMLAnchorElement_GetSearch(This->nsanchor, &search_str);
498  return return_nsstr(nsres, &search_str, p);
499 }
500 
501 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
502 {
504  FIXME("(%p)->(%s)\n", This, debugstr_w(v));
505  return E_NOTIMPL;
506 }
507 
508 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
509 {
511  nsAString hash_str;
512  nsresult nsres;
513 
514  TRACE("(%p)->(%p)\n", This, p);
515 
516  nsAString_Init(&hash_str, NULL);
517  nsres = nsIDOMHTMLAnchorElement_GetHash(This->nsanchor, &hash_str);
518  return return_nsstr(nsres, &hash_str, p);
519 }
520 
521 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
522 {
524 
525  TRACE("(%p)->()\n", This);
526 
527  return IHTMLElement2_put_onblur(&This->element.IHTMLElement2_iface, v);
528 }
529 
530 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
531 {
533 
534  TRACE("(%p)->(%p)\n", This, p);
535 
536  return IHTMLElement2_get_onblur(&This->element.IHTMLElement2_iface, p);
537 }
538 
539 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
540 {
542 
543  TRACE("(%p)->()\n", This);
544 
545  return IHTMLElement2_put_onfocus(&This->element.IHTMLElement2_iface, v);
546 }
547 
548 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
549 {
551 
552  TRACE("(%p)->(%p)\n", This, p);
553 
554  return IHTMLElement2_get_onfocus(&This->element.IHTMLElement2_iface, p);
555 }
556 
557 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
558 {
560 
561  TRACE("(%p)->(%s)\n", This, debugstr_w(v));
562 
563  return IHTMLElement2_put_accessKey(&This->element.IHTMLElement2_iface, v);
564 }
565 
566 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
567 {
569 
570  TRACE("(%p)->(%p)\n", This, p);
571 
572  return IHTMLElement2_get_accessKey(&This->element.IHTMLElement2_iface, p);
573 }
574 
575 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
576 {
578  FIXME("(%p)->(%p)\n", This, p);
579  return E_NOTIMPL;
580 }
581 
582 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
583 {
585  FIXME("(%p)->(%p)\n", This, p);
586  return E_NOTIMPL;
587 }
588 
589 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
590 {
592  FIXME("(%p)->(%p)\n", This, p);
593  return E_NOTIMPL;
594 }
595 
596 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
597 {
599 
600  TRACE("(%p)->()\n", This);
601 
602  return IHTMLElement2_put_tabIndex(&This->element.IHTMLElement2_iface, v);
603 }
604 
605 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
606 {
608 
609  TRACE("(%p)->(%p)\n", This, p);
610 
611  return IHTMLElement2_get_tabIndex(&This->element.IHTMLElement2_iface, p);
612 }
613 
614 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
615 {
617 
618  TRACE("(%p)\n", This);
619 
620  return IHTMLElement2_focus(&This->element.IHTMLElement2_iface);
621 }
622 
623 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
624 {
626 
627  TRACE("(%p)\n", This);
628 
629  return IHTMLElement2_blur(&This->element.IHTMLElement2_iface);
630 }
631 
632 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
681 };
682 
684 {
685  return CONTAINING_RECORD(iface, HTMLAnchorElement, element.node);
686 }
687 
689 {
691 
692  *ppv = NULL;
693 
694  if(IsEqualGUID(&IID_IUnknown, riid)) {
695  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
696  *ppv = &This->IHTMLAnchorElement_iface;
697  }else if(IsEqualGUID(&IID_IDispatch, riid)) {
698  TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
699  *ppv = &This->IHTMLAnchorElement_iface;
700  }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
701  TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
702  *ppv = &This->IHTMLAnchorElement_iface;
703  }
704 
705  if(*ppv) {
706  IUnknown_AddRef((IUnknown*)*ppv);
707  return S_OK;
708  }
709 
710  return HTMLElement_QI(&This->element.node, riid, ppv);
711 }
712 
714 {
716  nsAString href_str, target_str;
717  nsresult nsres;
718 
719  if(eid == EVENTID_CLICK) {
720  nsAString_Init(&href_str, NULL);
721  nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
722  if (NS_FAILED(nsres)) {
723  ERR("Could not get anchor href: %08x\n", nsres);
724  goto fallback;
725  }
726 
727  nsAString_Init(&target_str, NULL);
728  nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
729  if (NS_FAILED(nsres)) {
730  ERR("Could not get anchor target: %08x\n", nsres);
731  goto fallback;
732  }
733 
734  return handle_link_click_event(&This->element, &href_str, &target_str, event, prevent_default);
735 
736 fallback:
737  nsAString_Finish(&href_str);
738  nsAString_Finish(&target_str);
739  }
740 
741  return HTMLElement_handle_event(&This->element.node, eid, event, prevent_default);
742 }
743 
745 {
747 
748  if(This->nsanchor)
749  note_cc_edge((nsISupports*)This->nsanchor, "This->nsanchor", cb);
750 }
751 
753 {
755 
756  if(This->nsanchor) {
757  nsIDOMHTMLAnchorElement *nsanchor = This->nsanchor;
758 
759  This->nsanchor = NULL;
760  nsIDOMHTMLAnchorElement_Release(nsanchor);
761  }
762 }
763 
771  NULL,
772  NULL,
773  NULL,
774  NULL,
775  NULL,
776  NULL,
777  NULL,
778  NULL,
779  NULL,
782 };
783 
785  IHTMLAnchorElement_tid,
787  IHTMLUniqueName_tid,
788  0
789 };
790 
792  NULL,
793  DispHTMLAnchorElement_tid,
794  NULL,
796 };
797 
799 {
801  nsresult nsres;
802 
803  ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
804  if(!ret)
805  return E_OUTOFMEMORY;
806 
807  ret->IHTMLAnchorElement_iface.lpVtbl = &HTMLAnchorElementVtbl;
808  ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
809 
810  HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
811 
812  nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
813  assert(nsres == NS_OK);
814 
815  *elem = &ret->element;
816  return S_OK;
817 }
static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
Definition: htmlanchor.c:187
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:443
static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:589
void get_top_window(HTMLOuterWindow *window, HTMLOuterWindow **ret)
Definition: htmlwindow.c:59
IHTMLAnchorElement IHTMLAnchorElement_iface
Definition: htmlanchor.c:24
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlelem.c:3815
static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:309
static HRESULT navigate_url(HHInfo *info, LPCWSTR surl)
Definition: help.c:189
const cpc_entry_t HTMLElement_cpc[]
Definition: htmlelem.c:3847
const char * uri
Definition: sec_mgr.c:1594
REFIID riid
Definition: precomp.h:44
static void HTMLAnchorElement_unlink(HTMLDOMNode *iface)
Definition: htmlanchor.c:752
tid_t
Definition: ieframe.h:311
static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlanchor.c:193
#define WARN(fmt,...)
Definition: debug.h:111
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:429
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
Definition: htmlanchor.c:623
HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlelem.c:3738
static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl
Definition: htmlanchor.c:632
nsIDOMHTMLAnchorElement * nsanchor
Definition: htmlanchor.c:26
#define assert(x)
Definition: debug.h:53
static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlanchor.c:713
static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:336
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1934
static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:381
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:357
static dispex_static_data_t HTMLAnchorElement_dispex
Definition: htmlanchor.c:791
HTMLOuterWindow * get_target_window(HTMLOuterWindow *window, nsAString *target_str, BOOL *use_new_window)
Definition: htmlanchor.c:45
static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
Definition: htmlanchor.c:173
HTMLElement element
Definition: htmlanchor.c:22
static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:582
#define NS_OK
static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:471
static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:343
#define HTMLELEMENT_TIDS
static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlanchor.c:201
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const tid_t HTMLAnchorElement_iface_tids[]
Definition: htmlanchor.c:784
unsigned int BOOL
Definition: ntddk_ex.h:94
static HRESULT navigate_href_new_window(HTMLElement *element, nsAString *href_str, const WCHAR *target)
Definition: htmlanchor.c:29
static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
Definition: htmlanchor.c:614
static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:575
#define debugstr_w
Definition: kernel32.h:32
static size_t elem
Definition: string.c:68
HRESULT nsuri_to_url(LPCWSTR, BOOL, BSTR *) DECLSPEC_HIDDEN
Definition: nsio.c:175
#define FIXME(fmt,...)
Definition: debug.h:110
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:278
static HRESULT navigate_href(HTMLElement *element, nsAString *href_str, nsAString *target_str)
Definition: htmlanchor.c:94
smooth NULL
Definition: ftsmooth.c:416
static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:292
static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:395
static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:501
HRESULT navigate_new_window(HTMLOuterWindow *, IUri *, const WCHAR *, request_data_t *, IHTMLWindow2 **) DECLSPEC_HIDDEN
Definition: navigate.c:2132
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:450
#define NS_FAILED(res)
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841
static HTMLAnchorElement * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
Definition: htmlanchor.c:683
static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
Definition: htmlanchor.c:548
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:508
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
Definition: htmlanchor.c:530
static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
Definition: htmlanchor.c:539
#define WINAPI
Definition: msvc.h:8
static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:566
unsigned short WORD
Definition: ntddk_ex.h:93
void HTMLElement_destructor(HTMLDOMNode *iface)
Definition: htmlelem.c:3764
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NS_SUCCEEDED(res)
HRESULT create_relative_uri(HTMLOuterWindow *, const WCHAR *, IUri **) DECLSPEC_HIDDEN
Definition: persist.c:163
static DWORD cb
Definition: integrity.c:41
static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:402
static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
Definition: htmlanchor.c:521
const GUID IID_IDispatch
int ret
static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:219
static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlanchor.c:688
static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:464
void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
Definition: htmlelem.c:4008
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
static IHTMLWindow2 * window
Definition: events.c:77
struct _cl_event * event
Definition: glext.h:7739
#define strcmpiW(s1, s2)
Definition: unicode.h:39
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface, REFIID riid, void **ppv)
Definition: htmlanchor.c:165
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
struct stdole::EXCEPINFO EXCEPINFO
static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
Definition: htmlanchor.c:596
HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
Definition: htmlanchor.c:798
static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
Definition: htmlanchor.c:605
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmlanchor.c:210
const GLdouble * v
Definition: gl.h:2040
static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:409
static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:236
struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:436
#define E_NOTIMPL
Definition: ddrawi.h:99
#define BINDING_NAVIGATED
Definition: binding.h:127
HRESULT handle_link_click_event(HTMLElement *element, nsAString *href_str, nsAString *target_str, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlanchor.c:123
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:261
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:416
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:457
static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:488
struct stdole::DISPPARAMS DISPPARAMS
IHTMLWindow2 IHTMLWindow2_iface
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR PRUnichar
Definition: nsiface.idl:48
unsigned int ULONG
Definition: retypes.h:1
static const NodeImplVtbl HTMLAnchorElementImplVtbl
Definition: htmlanchor.c:764
GLenum target
Definition: glext.h:7315
static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
Definition: htmlanchor.c:329
static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:322
static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:350
HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, HTMLOuterWindow **ret)
Definition: htmlwindow.c:343
static HTMLAnchorElement * impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
Definition: htmlanchor.c:160
GLfloat GLfloat p
Definition: glext.h:8902
static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:557
static void HTMLAnchorElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
Definition: htmlanchor.c:744
static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
Definition: htmlanchor.c:364
static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
Definition: htmlanchor.c:180
signed short INT16