mshtml: Added IHTMLAnchorElement::get_href implementation.

This commit is contained in:
Jacek Caban 2009-10-02 13:52:36 +02:00 committed by Alexandre Julliard
parent 8085b7085c
commit 407e54be89
2 changed files with 67 additions and 2 deletions

View File

@ -36,6 +36,8 @@ typedef struct {
HTMLElement element; HTMLElement element;
const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl; const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
nsIDOMHTMLAnchorElement *nsanchor;
} HTMLAnchorElement; } HTMLAnchorElement;
#define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl) #define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl)
@ -104,8 +106,26 @@ static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR
static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p) static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
{ {
HTMLAnchorElement *This = HTMLANCHOR_THIS(iface); HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); nsAString href_str;
return E_NOTIMPL; 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;
} }
static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v) static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
@ -464,6 +484,10 @@ static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static void HTMLAnchorElement_destructor(HTMLDOMNode *iface) static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
{ {
HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface); HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
if(This->nsanchor)
nsIDOMHTMLAnchorElement_Release(This->nsanchor);
HTMLElement_destructor(&This->element.node); HTMLElement_destructor(&This->element.node);
} }
@ -497,11 +521,16 @@ static dispex_static_data_t HTMLAnchorElement_dispex = {
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem) HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
{ {
HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement)); HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
nsresult nsres;
ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl; ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
ret->element.node.vtbl = &HTMLAnchorElementImplVtbl; ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
HTMLElement_Init(&ret->element, &HTMLAnchorElement_dispex); HTMLElement_Init(&ret->element, &HTMLAnchorElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
return &ret->element; return &ret->element;
} }

View File

@ -1351,6 +1351,42 @@ interface nsIDOMHTMLImageElement : nsIDOMHTMLElement
nsresult SetWidth(PRInt32 aWidth); nsresult SetWidth(PRInt32 aWidth);
} }
[
object,
uuid(a6cf90aa-15b3-11d2-932e-00805f8add32),
local
/* FROZEN */
]
interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement
{
nsresult GetAccessKey(nsAString *aAccessKey);
nsresult SetAccessKey(const nsAString *aAccessKey);
nsresult GetCharset(nsAString *aCharset);
nsresult SetCharset(const nsAString *aCharset);
nsresult GetCoords(nsAString *aCoords);
nsresult SetCoords(const nsAString *aCoords);
nsresult GetHref(nsAString *aHref);
nsresult SetHref(const nsAString *aHref);
nsresult GetHreflang(nsAString *aHreflang);
nsresult SetHreflang(const nsAString *aHreflang);
nsresult GetName(nsAString *aName);
nsresult SetName(const nsAString *aName);
nsresult GetRel(nsAString *aRel);
nsresult SetRel(const nsAString *aRel);
nsresult GetRev(nsAString *aRev);
nsresult SetRev(const nsAString *aRev);
nsresult GetShape(nsAString *aShape);
nsresult SetShape(const nsAString *aShape);
nsresult GetTabIndex(PRInt32 *aTabIndex);
nsresult SetTabIndex(PRInt32 aTabIndex);
nsresult GetTarget(nsAString *aTarget);
nsresult SetTarget(const nsAString *aTarget);
nsresult GetType(nsAString *aType);
nsresult SetType(const nsAString *aType);
nsresult Blur();
nsresult Focus();
}
[ [
object, object,
uuid(a6cf90b2-15b3-11d2-932e-00805f8add32), uuid(a6cf90b2-15b3-11d2-932e-00805f8add32),