Jacek Caban : mshtml: Added IHTMLOptionElement::get_value implementation.

Alexandre Julliard julliard at winehq.org
Mon Oct 15 11:27:54 CDT 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Oct 13 04:00:26 2007 +0200

mshtml: Added IHTMLOptionElement::get_value implementation.

---

 dlls/mshtml/htmloption.c |   31 +++++++++++++++++++++++++++++--
 dlls/mshtml/nsiface.idl  |   22 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index 5a0293b..a356531 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -39,6 +39,8 @@ typedef struct {
     HTMLElement element;
 
     const IHTMLOptionElementVtbl *lpHTMLOptionElementVtbl;
+
+    nsIDOMHTMLOptionElement *nsoption;
 } HTMLOptionElement;
 
 #define HTMLOPTION(x)  ((IHTMLOptionElement*)  &(x)->lpHTMLOptionElementVtbl)
@@ -126,8 +128,24 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
 static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BSTR *p)
 {
     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString value_str;
+    const PRUnichar *value;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&value_str, NULL);
+    nsres = nsIDOMHTMLOptionElement_GetValue(This->nsoption, &value_str);
+    if(NS_SUCCEEDED(nsres)) {
+        nsAString_GetData(&value_str, &value, NULL);
+        *p = SysAllocString(value);
+    }else {
+        ERR("GetValue failed: %08x\n", nsres);
+        *p = NULL;
+    }
+    nsAString_Finish(&value_str);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLOptionElement_put_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL v)
@@ -232,6 +250,10 @@ static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
 static void HTMLOptionElement_destructor(HTMLDOMNode *iface)
 {
     HTMLOptionElement *This = HTMLOPTION_NODE_THIS(iface);
+
+    if(This->nsoption)
+        nsIDOMHTMLOptionElement_Release(This->nsoption);
+
     HTMLElement_destructor(&This->element.node);
 }
 
@@ -245,10 +267,15 @@ static const NodeImplVtbl HTMLOptionElementImplVtbl = {
 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement *nselem)
 {
     HTMLOptionElement *ret = mshtml_alloc(sizeof(HTMLOptionElement));
+    nsresult nsres;
 
     ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl;
     ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
 
+    nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
+    if(NS_FAILED(nsres))
+        ERR("Could not get nsIDOMHTMLOptionElement interface: %08x\n", nsres);
+
     return &ret->element;
 }
 
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index 1d36197..8b00fbd 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -1078,6 +1078,28 @@ interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
 
 [
     object,
+    uuid(a6cf9092-15b3-11d2-932e-00805f8add32)
+    /* FROZEN */
+]
+interface nsIDOMHTMLOptionElement : nsIDOMHTMLElement
+{
+    nsresult GetForm(nsIDOMHTMLFormElement **aForm);
+    nsresult GetDefaultSelected(PRBool *aDefaultSelected);
+    nsresult SetDefaultSelected(PRBool aDefaultSelected);
+    nsresult GetText(nsAString *aText);
+    nsresult GetIndex(PRInt32 *aIndex);
+    nsresult GetDisabled(PRBool *aDisabled);
+    nsresult SetDisabled(PRBool aDisabled);
+    nsresult GetLabel(nsAString *aLabel);
+    nsresult SetLabel(const nsAString *aLabel);
+    nsresult GetSelected(PRBool *aSelected);
+    nsresult SetSelected(PRBool aSelected);
+    nsresult GetValue(nsAString *aValue);
+    nsresult SetValue(const nsAString *aValue);
+}
+
+[
+    object,
     uuid(a6cf9090-15b3-11d2-932e-00805f8add32)
     /* FROZEN */
 ]




More information about the wine-cvs mailing list