mshtml: Added IHTMLAnchorElement::get_href implementation.
authorJacek Caban <jacek@codeweavers.com>
Fri, 2 Oct 2009 11:52:36 +0000 (13:52 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 2 Oct 2009 13:06:58 +0000 (15:06 +0200)
dlls/mshtml/htmlanchor.c
dlls/mshtml/nsiface.idl

index 7797e7e695bba0ed8d3ac808fd999bfbd41c5cab..09c7eda8d0b05531755f49aa21e41e066b9446b6 100644 (file)
@@ -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;
 }
index cb8f76839b400dfb20a02a0cef62302eb522575c..571c0230b097d4475ea62d873b3d8a19c25db596 100644 (file)
@@ -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),