2007-09-12 23:38:14 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
2012-01-27 15:55:33 +01:00
|
|
|
#include <assert.h>
|
2007-09-12 23:38:14 +02:00
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2011-08-02 11:09:13 +02:00
|
|
|
#include "htmlevent.h"
|
2012-01-27 15:56:00 +01:00
|
|
|
#include "binding.h"
|
2011-08-02 11:09:13 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2007-09-12 23:38:14 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
typedef struct {
|
2007-09-15 16:04:57 +02:00
|
|
|
HTMLElement element;
|
2007-09-12 23:38:14 +02:00
|
|
|
|
2010-12-06 12:34:31 +01:00
|
|
|
IHTMLAnchorElement IHTMLAnchorElement_iface;
|
2009-10-02 13:52:36 +02:00
|
|
|
|
|
|
|
nsIDOMHTMLAnchorElement *nsanchor;
|
2007-09-12 23:38:14 +02:00
|
|
|
} HTMLAnchorElement;
|
|
|
|
|
2012-01-27 15:56:00 +01:00
|
|
|
static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *target)
|
|
|
|
{
|
|
|
|
nsAString href_str;
|
|
|
|
IUri *uri;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
nsAString_Init(&href_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *href;
|
|
|
|
|
|
|
|
nsAString_GetData(&href_str, &href);
|
|
|
|
hres = create_relative_uri(This->element.node.doc->basedoc.window, href, &uri);
|
|
|
|
}else {
|
|
|
|
ERR("Could not get anchor href: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
}
|
|
|
|
nsAString_Finish(&href_str);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2014-12-16 16:13:05 +01:00
|
|
|
hres = navigate_new_window(This->element.node.doc->basedoc.window, uri, target, NULL, NULL);
|
2012-01-27 15:56:00 +01:00
|
|
|
IUri_Release(uri);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2014-03-13 14:47:14 +01:00
|
|
|
HTMLOuterWindow *get_target_window(HTMLOuterWindow *window, nsAString *target_str, BOOL *use_new_window)
|
|
|
|
{
|
|
|
|
HTMLOuterWindow *top_window, *ret_window;
|
|
|
|
const PRUnichar *target;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR _parentW[] = {'_','p','a','r','e','n','t',0};
|
|
|
|
static const WCHAR _selfW[] = {'_','s','e','l','f',0};
|
|
|
|
static const WCHAR _topW[] = {'_','t','o','p',0};
|
|
|
|
|
|
|
|
*use_new_window = FALSE;
|
|
|
|
|
|
|
|
nsAString_GetData(target_str, &target);
|
|
|
|
TRACE("%s\n", debugstr_w(target));
|
|
|
|
|
|
|
|
if(!*target || !strcmpiW(target, _selfW)) {
|
|
|
|
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!strcmpiW(target, _topW)) {
|
|
|
|
get_top_window(window, &top_window);
|
|
|
|
IHTMLWindow2_AddRef(&top_window->base.IHTMLWindow2_iface);
|
|
|
|
return top_window;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!strcmpiW(target, _parentW)) {
|
|
|
|
if(!window->parent) {
|
2014-07-21 16:20:39 +02:00
|
|
|
WARN("Window has no parent, treat as self\n");
|
|
|
|
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
|
|
|
|
return window;
|
2014-03-13 14:47:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
IHTMLWindow2_AddRef(&window->parent->base.IHTMLWindow2_iface);
|
|
|
|
return window->parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
get_top_window(window, &top_window);
|
|
|
|
|
|
|
|
hres = get_frame_by_name(top_window, target, TRUE, &ret_window);
|
|
|
|
if(FAILED(hres) || !ret_window) {
|
|
|
|
*use_new_window = TRUE;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
IHTMLWindow2_AddRef(&ret_window->base.IHTMLWindow2_iface);
|
|
|
|
return ret_window;
|
|
|
|
}
|
|
|
|
|
2011-08-02 11:09:13 +02:00
|
|
|
static HRESULT navigate_anchor(HTMLAnchorElement *This)
|
|
|
|
{
|
|
|
|
nsAString href_str, target_str;
|
2014-03-13 14:47:14 +01:00
|
|
|
HTMLOuterWindow *window;
|
|
|
|
BOOL use_new_window;
|
2011-08-02 11:09:13 +02:00
|
|
|
nsresult nsres;
|
2011-08-22 20:48:33 +02:00
|
|
|
HRESULT hres = E_FAIL;
|
2011-08-02 11:09:13 +02:00
|
|
|
|
2011-12-06 15:11:16 +01:00
|
|
|
|
2011-08-05 10:20:08 +02:00
|
|
|
nsAString_Init(&target_str, NULL);
|
2011-08-02 11:09:13 +02:00
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
|
2014-03-13 14:47:14 +01:00
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
window = get_target_window(This->element.node.doc->basedoc.window, &target_str, &use_new_window);
|
|
|
|
if(!window && use_new_window) {
|
2011-08-05 10:20:08 +02:00
|
|
|
const PRUnichar *target;
|
|
|
|
|
|
|
|
nsAString_GetData(&target_str, &target);
|
2014-03-13 14:47:14 +01:00
|
|
|
hres = navigate_anchor_window(This, target);
|
|
|
|
nsAString_Finish(&target_str);
|
|
|
|
return hres;
|
2011-08-02 11:09:13 +02:00
|
|
|
}
|
2014-03-13 14:47:14 +01:00
|
|
|
|
2011-08-02 11:09:13 +02:00
|
|
|
nsAString_Finish(&target_str);
|
2014-03-13 14:47:14 +01:00
|
|
|
if(!window)
|
|
|
|
return S_OK;
|
2011-08-02 11:09:13 +02:00
|
|
|
|
2011-08-05 10:20:08 +02:00
|
|
|
nsAString_Init(&href_str, NULL);
|
2011-08-02 11:09:13 +02:00
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
|
2011-08-05 10:20:08 +02:00
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *href;
|
|
|
|
|
|
|
|
nsAString_GetData(&href_str, &href);
|
|
|
|
if(*href) {
|
2013-11-29 12:58:41 +01:00
|
|
|
hres = navigate_url(window, href, window->uri_nofrag, BINDING_NAVIGATED);
|
2011-08-05 10:20:08 +02:00
|
|
|
}else {
|
|
|
|
TRACE("empty href\n");
|
|
|
|
hres = S_OK;
|
|
|
|
}
|
2011-08-02 11:09:13 +02:00
|
|
|
}
|
|
|
|
nsAString_Finish(&href_str);
|
2014-03-13 14:47:14 +01:00
|
|
|
IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
|
2011-08-02 11:09:13 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2010-12-06 12:34:31 +01:00
|
|
|
static inline HTMLAnchorElement *impl_from_IHTMLAnchorElement(IHTMLAnchorElement *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLAnchorElement, IHTMLAnchorElement_iface);
|
|
|
|
}
|
2007-09-12 23:38:14 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
|
|
|
|
ppTInfo);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
|
|
|
|
cNames, lcid, rgDispId);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
|
|
|
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2011-02-17 04:29:48 +01:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, v);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_SetHref(This->nsanchor, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-10-02 13:52:36 +02:00
|
|
|
nsAString href_str;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&href_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
const PRUnichar *href;
|
|
|
|
|
|
|
|
nsAString_GetData(&href_str, &href);
|
|
|
|
hres = nsuri_to_url(href, TRUE, p);
|
|
|
|
}else {
|
|
|
|
ERR("GetHref failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&href_str);
|
|
|
|
return hres;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2011-02-18 04:03:41 +01:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, v);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_SetTarget(This->nsanchor, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2011-02-18 04:03:41 +01:00
|
|
|
nsAString target_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&target_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
|
|
|
|
|
|
|
|
return return_nsstr(nsres, &target_str, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2013-05-02 14:05:01 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, v);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_SetRel(This->nsanchor, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2013-05-02 14:05:01 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&nsstr, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetRel(This->nsanchor, &nsstr);
|
|
|
|
return return_nsstr(nsres, &nsstr, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2012-07-13 14:46:08 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, v);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_SetName(This->nsanchor, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2012-07-13 14:46:08 +02:00
|
|
|
nsAString name_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&name_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetName(This->nsanchor, &name_str);
|
|
|
|
|
|
|
|
return return_nsstr(nsres, &name_str, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2013-02-25 12:35:23 +01:00
|
|
|
nsAString hostname_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&hostname_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetHostname(This->nsanchor, &hostname_str);
|
|
|
|
return return_nsstr(nsres, &hostname_str, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2014-09-25 09:51:39 +02:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
nsAString_InitDepend(&nsstr, v);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_SetSearch(This->nsanchor, &nsstr);
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2014-09-25 09:51:39 +02:00
|
|
|
nsAString search_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&search_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetSearch(This->nsanchor, &search_str);
|
|
|
|
return return_nsstr(nsres, &search_str, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2013-08-28 16:02:00 +02:00
|
|
|
nsAString hash_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
nsAString_Init(&hash_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLAnchorElement_GetHash(This->nsanchor, &hash_str);
|
|
|
|
return return_nsstr(nsres, &hash_str, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_put_onblur(&This->element.IHTMLElement2_iface, v);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_get_onblur(&This->element.IHTMLElement2_iface, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_put_onfocus(&This->element.IHTMLElement2_iface, v);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_get_onfocus(&This->element.IHTMLElement2_iface, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_put_accessKey(&This->element.IHTMLElement2_iface, v);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_get_accessKey(&This->element.IHTMLElement2_iface, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_put_tabIndex(&This->element.IHTMLElement2_iface, v);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_get_tabIndex(&This->element.IHTMLElement2_iface, p);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_focus(&This->element.IHTMLElement2_iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
|
|
|
|
{
|
2010-12-06 12:34:31 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
|
2009-11-23 15:37:26 +01:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2010-12-30 01:27:28 +01:00
|
|
|
return IHTMLElement2_blur(&This->element.IHTMLElement2_iface);
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
|
|
|
|
HTMLAnchorElement_QueryInterface,
|
|
|
|
HTMLAnchorElement_AddRef,
|
|
|
|
HTMLAnchorElement_Release,
|
|
|
|
HTMLAnchorElement_GetTypeInfoCount,
|
|
|
|
HTMLAnchorElement_GetTypeInfo,
|
|
|
|
HTMLAnchorElement_GetIDsOfNames,
|
|
|
|
HTMLAnchorElement_Invoke,
|
|
|
|
HTMLAnchorElement_put_href,
|
|
|
|
HTMLAnchorElement_get_href,
|
|
|
|
HTMLAnchorElement_put_target,
|
|
|
|
HTMLAnchorElement_get_target,
|
|
|
|
HTMLAnchorElement_put_rel,
|
|
|
|
HTMLAnchorElement_get_rel,
|
|
|
|
HTMLAnchorElement_put_rev,
|
|
|
|
HTMLAnchorElement_get_rev,
|
|
|
|
HTMLAnchorElement_put_urn,
|
|
|
|
HTMLAnchorElement_get_urn,
|
|
|
|
HTMLAnchorElement_put_Methods,
|
|
|
|
HTMLAnchorElement_get_Methods,
|
|
|
|
HTMLAnchorElement_put_name,
|
|
|
|
HTMLAnchorElement_get_name,
|
|
|
|
HTMLAnchorElement_put_host,
|
|
|
|
HTMLAnchorElement_get_host,
|
|
|
|
HTMLAnchorElement_put_hostname,
|
|
|
|
HTMLAnchorElement_get_hostname,
|
|
|
|
HTMLAnchorElement_put_pathname,
|
|
|
|
HTMLAnchorElement_get_pathname,
|
|
|
|
HTMLAnchorElement_put_port,
|
|
|
|
HTMLAnchorElement_get_port,
|
|
|
|
HTMLAnchorElement_put_protocol,
|
|
|
|
HTMLAnchorElement_get_protocol,
|
|
|
|
HTMLAnchorElement_put_search,
|
|
|
|
HTMLAnchorElement_get_search,
|
|
|
|
HTMLAnchorElement_put_hash,
|
|
|
|
HTMLAnchorElement_get_hash,
|
|
|
|
HTMLAnchorElement_put_onblur,
|
|
|
|
HTMLAnchorElement_get_onblur,
|
|
|
|
HTMLAnchorElement_put_onfocus,
|
|
|
|
HTMLAnchorElement_get_onfocus,
|
|
|
|
HTMLAnchorElement_put_accessKey,
|
|
|
|
HTMLAnchorElement_get_accessKey,
|
|
|
|
HTMLAnchorElement_get_protocolLong,
|
|
|
|
HTMLAnchorElement_get_mimeType,
|
|
|
|
HTMLAnchorElement_get_nameProp,
|
|
|
|
HTMLAnchorElement_put_tabIndex,
|
|
|
|
HTMLAnchorElement_get_tabIndex,
|
|
|
|
HTMLAnchorElement_focus,
|
|
|
|
HTMLAnchorElement_blur
|
|
|
|
};
|
|
|
|
|
2010-12-27 20:13:09 +01:00
|
|
|
static inline HTMLAnchorElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLAnchorElement, element.node);
|
|
|
|
}
|
2007-10-04 02:08:56 +02:00
|
|
|
|
2007-10-04 02:10:36 +02:00
|
|
|
static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
|
2007-10-04 02:10:36 +02:00
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-12-06 12:34:31 +01:00
|
|
|
*ppv = &This->IHTMLAnchorElement_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
2010-12-06 12:34:31 +01:00
|
|
|
*ppv = &This->IHTMLAnchorElement_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
|
2010-12-06 12:34:31 +01:00
|
|
|
*ppv = &This->IHTMLAnchorElement_iface;
|
2007-10-04 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return HTMLElement_QI(&This->element.node, riid, ppv);
|
|
|
|
}
|
|
|
|
|
2012-01-27 15:55:33 +01:00
|
|
|
static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
|
2011-08-02 11:09:13 +02:00
|
|
|
{
|
|
|
|
HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
|
|
|
|
if(eid == EVENTID_CLICK) {
|
2012-01-27 15:55:33 +01:00
|
|
|
nsIDOMMouseEvent *mouse_event;
|
2014-11-03 12:39:59 +01:00
|
|
|
INT16 button;
|
2012-01-27 15:55:33 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
2011-08-02 11:09:13 +02:00
|
|
|
TRACE("CLICK\n");
|
2012-01-27 15:55:33 +01:00
|
|
|
|
|
|
|
nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
|
|
|
|
assert(nsres == NS_OK);
|
|
|
|
|
|
|
|
nsres = nsIDOMMouseEvent_GetButton(mouse_event, &button);
|
|
|
|
assert(nsres == NS_OK);
|
|
|
|
|
|
|
|
nsIDOMMouseEvent_Release(mouse_event);
|
|
|
|
|
|
|
|
switch(button) {
|
|
|
|
case 0:
|
|
|
|
*prevent_default = TRUE;
|
|
|
|
return navigate_anchor(This);
|
2012-01-27 15:56:13 +01:00
|
|
|
case 1:
|
|
|
|
*prevent_default = TRUE;
|
|
|
|
return navigate_anchor_window(This, NULL);
|
2012-01-27 15:55:33 +01:00
|
|
|
default:
|
|
|
|
*prevent_default = FALSE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2011-08-02 11:09:13 +02:00
|
|
|
}
|
|
|
|
|
2012-09-04 13:58:58 +02:00
|
|
|
return HTMLElement_handle_event(&This->element.node, eid, event, prevent_default);
|
2011-08-02 11:09:13 +02:00
|
|
|
}
|
|
|
|
|
2014-09-25 12:10:55 +02:00
|
|
|
static void HTMLAnchorElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
|
|
|
|
{
|
|
|
|
HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
|
|
|
|
if(This->nsanchor)
|
|
|
|
note_cc_edge((nsISupports*)This->nsanchor, "This->nsanchor", cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void HTMLAnchorElement_unlink(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
|
|
|
|
if(This->nsanchor) {
|
|
|
|
nsIDOMHTMLAnchorElement *nsanchor = This->nsanchor;
|
|
|
|
|
|
|
|
This->nsanchor = NULL;
|
|
|
|
nsIDOMHTMLAnchorElement_Release(nsanchor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-04 02:09:48 +02:00
|
|
|
static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
|
2007-10-04 02:10:36 +02:00
|
|
|
HTMLAnchorElement_QI,
|
2012-06-26 12:34:48 +02:00
|
|
|
HTMLElement_destructor,
|
2013-03-15 15:01:53 +01:00
|
|
|
HTMLElement_cpc,
|
2011-08-02 11:09:13 +02:00
|
|
|
HTMLElement_clone,
|
2012-09-04 13:58:58 +02:00
|
|
|
HTMLAnchorElement_handle_event,
|
2014-09-25 12:10:55 +02:00
|
|
|
HTMLElement_get_attr_col,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
HTMLAnchorElement_traverse,
|
|
|
|
HTMLAnchorElement_unlink
|
2007-10-04 02:09:48 +02:00
|
|
|
};
|
|
|
|
|
2009-10-02 13:51:19 +02:00
|
|
|
static const tid_t HTMLAnchorElement_iface_tids[] = {
|
|
|
|
IHTMLAnchorElement_tid,
|
2010-01-28 02:09:02 +01:00
|
|
|
HTMLELEMENT_TIDS,
|
2009-10-02 13:51:19 +02:00
|
|
|
IHTMLUniqueName_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLAnchorElement_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLAnchorElement_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLAnchorElement_iface_tids
|
|
|
|
};
|
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
|
2007-09-12 23:38:14 +02:00
|
|
|
{
|
2010-12-01 22:43:14 +01:00
|
|
|
HTMLAnchorElement *ret;
|
2009-10-02 13:52:36 +02:00
|
|
|
nsresult nsres;
|
2007-09-12 23:38:14 +02:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
|
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2010-12-06 12:34:31 +01:00
|
|
|
ret->IHTMLAnchorElement_iface.lpVtbl = &HTMLAnchorElementVtbl;
|
2007-10-04 02:09:48 +02:00
|
|
|
ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
|
2007-09-12 23:38:14 +02:00
|
|
|
|
2012-06-26 12:34:48 +02:00
|
|
|
HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
|
|
|
|
|
2009-10-02 13:52:36 +02:00
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
|
2014-09-25 12:10:55 +02:00
|
|
|
assert(nsres == NS_OK);
|
2009-10-02 13:52:36 +02:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
*elem = &ret->element;
|
|
|
|
return S_OK;
|
2007-09-12 23:38:14 +02:00
|
|
|
}
|