Module: wine Branch: master Commit: 407e54be8957733feccae5ae609d86a6ecf0ec01 URL: http://source.winehq.org/git/wine.git/?a=commit;h=407e54be8957733feccae5ae60...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Oct 2 13:52:36 2009 +0200
mshtml: Added IHTMLAnchorElement::get_href implementation.
---
dlls/mshtml/htmlanchor.c | 33 +++++++++++++++++++++++++++++++-- dlls/mshtml/nsiface.idl | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 7797e7e..09c7eda 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 cb8f768..571c023 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1353,6 +1353,42 @@ interface nsIDOMHTMLImageElement : nsIDOMHTMLElement
[ 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), local /* FROZEN */