Jacek Caban : mshtml: Added IHTMLButtonElement::name implementation.

Alexandre Julliard julliard at winehq.org
Mon Mar 25 14:19:38 CDT 2013


Module: wine
Branch: master
Commit: 724b248f988b9a507c17b35ef80a6199960dcf74
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=724b248f988b9a507c17b35ef80a6199960dcf74

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Mar 18 14:06:10 2013 +0100

mshtml: Added IHTMLButtonElement::name implementation.

---

 dlls/mshtml/htmlinput.c |   38 ++++++++++++++++++++++++++++++++------
 dlls/mshtml/nsiface.idl |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index 0ca0e76..d6bd394 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -1417,6 +1417,8 @@ typedef struct {
     HTMLElement element;
 
     IHTMLButtonElement IHTMLButtonElement_iface;
+
+    nsIDOMHTMLButtonElement *nsbutton;
 } HTMLButtonElement;
 
 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
@@ -1504,15 +1506,33 @@ static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BST
 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
 {
     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsAString name_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    nsAString_InitDepend(&name_str, v);
+    nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
+    nsAString_Finish(&name_str);
+    if(NS_FAILED(nsres)) {
+        ERR("SetName failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
 {
     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString name_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&name_str, NULL);
+    nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
+    return return_nsstr(nsres, &name_str, p);
 }
 
 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
@@ -1628,8 +1648,7 @@ static dispex_static_data_t HTMLButtonElement_dispex = {
 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
 {
     HTMLButtonElement *ret;
-
-    ERR("!!!\n");
+    nsresult nsres;
 
     ret = heap_alloc_zero(sizeof(*ret));
     if(!ret)
@@ -1639,6 +1658,13 @@ HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele
     ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
 
     HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
+
+    nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
+
+    /* Share nsbutton reference with nsnode */
+    assert(nsres == NS_OK && (nsIDOMNode*)ret->nsbutton == ret->element.node.nsnode);
+    nsIDOMNode_Release(ret->element.node.nsnode);
+
     *elem = &ret->element;
     return S_OK;
 }
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index 647566f..76f8ed0 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -1690,6 +1690,41 @@ interface nsIDOMHTMLOptionElement : nsIDOMHTMLElement
 
 [
     object,
+    uuid(8e40d4d7-c204-4192-802a-0b5602e9c669),
+    local
+]
+interface nsIDOMHTMLButtonElement : nsIDOMHTMLElement
+{
+    nsresult GetAutofocus(bool *aAutofocus);
+    nsresult SetAutofocus(bool aAutofocus);
+    nsresult GetDisabled(bool *aDisabled);
+    nsresult SetDisabled(bool aDisabled);
+    nsresult GetForm(nsIDOMHTMLFormElement **aForm);
+    nsresult GetFormAction(nsAString *aFormAction);
+    nsresult SetFormAction(const nsAString *aFormAction);
+    nsresult GetFormEnctype(nsAString *aFormEnctype);
+    nsresult SetFormEnctype(const nsAString *aFormEnctype);
+    nsresult GetFormMethod(nsAString *aFormMethod);
+    nsresult SetFormMethod(const nsAString *aFormMethod);
+    nsresult GetFormNoValidate(bool *aFormNoValidate);
+    nsresult SetFormNoValidate(bool aFormNoValidate);
+    nsresult GetFormTarget(nsAString *aFormTarget);
+    nsresult SetFormTarget(const nsAString *aFormTarget);
+    nsresult GetName(nsAString *aName);
+    nsresult SetName(const nsAString *aName);
+    nsresult GetType(nsAString *aType);
+    nsresult SetType(const nsAString *aType);
+    nsresult GetValue(nsAString *aValue);
+    nsresult SetValue(const nsAString *aValue);
+    nsresult GetWillValidate(bool *aWillValidate);
+    nsresult GetValidity(nsIDOMValidityState **aValidity);
+    nsresult GetValidationMessage(nsAString *aValidationMessage);
+    nsresult CheckValidity(bool *_retval);
+    nsresult SetCustomValidity(const nsAString *error);
+}
+
+[
+    object,
     uuid(429b041b-06df-486c-9a3a-a1d901cc76a2),
     local
 ]




More information about the wine-cvs mailing list