From: Jacek Caban Date: Fri, 2 Oct 2009 11:52:36 +0000 (+0200) Subject: mshtml: Added IHTMLAnchorElement::get_href implementation. X-Git-Tag: wine-1.1.31~281 X-Git-Url: http://git.etersoft.ru/projects/?a=commitdiff_plain;h=407e54be8957733feccae5ae609d86a6ecf0ec01;p=wine%2Feterwine.git mshtml: Added IHTMLAnchorElement::get_href implementation. --- diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 7797e7e695..09c7eda8d0 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -36,6 +36,8 @@ typedef struct { HTMLElement element; const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl; + + nsIDOMHTMLAnchorElement *nsanchor; } HTMLAnchorElement; #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) { HTMLAnchorElement *This = HTMLANCHOR_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + 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; } 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) { HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface); + + if(This->nsanchor) + nsIDOMHTMLAnchorElement_Release(This->nsanchor); + HTMLElement_destructor(&This->element.node); } @@ -497,11 +521,16 @@ static dispex_static_data_t HTMLAnchorElement_dispex = { HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem) { HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement)); + nsresult nsres; ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl; ret->element.node.vtbl = &HTMLAnchorElementImplVtbl; 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; } diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index cb8f76839b..571c0230b0 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1351,6 +1351,42 @@ interface nsIDOMHTMLImageElement : nsIDOMHTMLElement 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, uuid(a6cf90b2-15b3-11d2-932e-00805f8add32),