Jacek Caban : mshtml: Added IHTMLElement2::get_readyState implementation.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 09:19:39 CST 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov 30 17:58:59 2009 +0100

mshtml: Added IHTMLElement2::get_readyState implementation.

---

 dlls/mshtml/htmlelem2.c      |   23 +++++++++++++++++++++--
 dlls/mshtml/htmliframe.c     |   10 +++++++++-
 dlls/mshtml/htmlimg.c        |   17 +++++++++++++++--
 dlls/mshtml/htmlscript.c     |   17 +++++++++++++++--
 dlls/mshtml/mshtml_private.h |    1 +
 5 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c
index d001eaa..a42b73a 100644
--- a/dlls/mshtml/htmlelem2.c
+++ b/dlls/mshtml/htmlelem2.c
@@ -662,8 +662,27 @@ static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event,
 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
 {
     HTMLElement *This = HTMLELEM2_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    BSTR str;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(This->node.vtbl->get_readystate) {
+        HRESULT hres;
+
+        hres = This->node.vtbl->get_readystate(&This->node, &str);
+        if(FAILED(hres))
+            return hres;
+    }else {
+        static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
+
+        str = SysAllocString(completeW);
+        if(!str)
+            return E_OUTOFMEMORY;
+    }
+
+    V_VT(p) = VT_BSTR;
+    V_BSTR(p) = str;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c
index 8c3c520..382e049 100644
--- a/dlls/mshtml/htmliframe.c
+++ b/dlls/mshtml/htmliframe.c
@@ -72,6 +72,13 @@ static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
     return S_OK;
 }
 
+static HRESULT HTMLIFrame_get_readystate(HTMLDOMNode *iface, BSTR *p)
+{
+    HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
+
+    return IHTMLFrameBase2_get_readyState(HTMLFRAMEBASE2(&This->framebase), p);
+}
+
 #undef HTMLIFRAME_NODE_THIS
 
 static const NodeImplVtbl HTMLIFrameImplVtbl = {
@@ -81,7 +88,8 @@ static const NodeImplVtbl HTMLIFrameImplVtbl = {
     NULL,
     NULL,
     NULL,
-    HTMLIFrame_get_document
+    HTMLIFrame_get_document,
+    HTMLIFrame_get_readystate
 };
 
 static const tid_t HTMLIFrame_iface_tids[] = {
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index bfccdd5..60333c6 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -39,7 +39,7 @@ typedef struct {
     nsIDOMHTMLImageElement *nsimg;
 } HTMLImgElement;
 
-#define HTMLIMG(x)  (&(x)->lpHTMLImgElementVtbl)
+#define HTMLIMG(x)  ((IHTMLImgElement*)  &(x)->lpHTMLImgElementVtbl)
 
 #define HTMLIMG_THIS(iface) DEFINE_THIS(HTMLImgElement, HTMLImgElement, iface)
 
@@ -572,11 +572,24 @@ static void HTMLImgElement_destructor(HTMLDOMNode *iface)
     HTMLElement_destructor(&This->element.node);
 }
 
+static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
+{
+    HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
+
+    return IHTMLImgElement_get_readyState(HTMLIMG(This), p);
+}
+
 #undef HTMLIMG_NODE_THIS
 
 static const NodeImplVtbl HTMLImgElementImplVtbl = {
     HTMLImgElement_QI,
-    HTMLImgElement_destructor
+    HTMLImgElement_destructor,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    HTMLImgElement_get_readystate
 };
 
 static const tid_t HTMLImgElement_iface_tids[] = {
diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c
index a038c55..d86f398 100644
--- a/dlls/mshtml/htmlscript.c
+++ b/dlls/mshtml/htmlscript.c
@@ -39,7 +39,7 @@ typedef struct {
     nsIDOMHTMLScriptElement *nsscript;
 } HTMLScriptElement;
 
-#define HTMLSCRIPT(x)  (&(x)->lpHTMLScriptElementVtbl)
+#define HTMLSCRIPT(x)  ((IHTMLScriptElement*)  &(x)->lpHTMLScriptElementVtbl)
 
 #define HTMLSCRIPT_THIS(iface) DEFINE_THIS(HTMLScriptElement, HTMLScriptElement, iface)
 
@@ -299,11 +299,24 @@ static void HTMLScriptElement_destructor(HTMLDOMNode *iface)
     HTMLElement_destructor(&This->element.node);
 }
 
+static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
+{
+    HTMLScriptElement *This = HTMLSCRIPT_NODE_THIS(iface);
+
+    return IHTMLScriptElement_get_readyState(HTMLSCRIPT(This), p);
+}
+
 #undef HTMLSCRIPT_NODE_THIS
 
 static const NodeImplVtbl HTMLScriptElementImplVtbl = {
     HTMLScriptElement_QI,
-    HTMLScriptElement_destructor
+    HTMLScriptElement_destructor,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    HTMLScriptElement_get_readystate
 };
 
 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d99fb54..cee256e 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -449,6 +449,7 @@ typedef struct {
     HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
     HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
     HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
+    HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
 } NodeImplVtbl;
 
 struct HTMLDOMNode {




More information about the wine-cvs mailing list