Module: wine Branch: master Commit: 954d4477b5054498282c039dcdcc7f3b205165e3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=954d4477b5054498282c039dcd...
Author: Jacek Caban jacek@codeweavers.com Date: Sat Oct 13 03:58:55 2007 +0200
mshtml: Added IHTMLWindow2::get_option implementation.
---
dlls/mshtml/htmldoc.c | 8 +++- dlls/mshtml/htmloption.c | 121 ++++++++++++++++++++++++++++++++++++++++++ dlls/mshtml/htmlwindow.c | 12 ++++- dlls/mshtml/mshtml_private.h | 13 +++++ 4 files changed, 151 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 4faeb6e..e6c16a7 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -174,6 +174,11 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) if(This->hwnd) DestroyWindow(This->hwnd);
+ if(This->option_factory) { + This->option_factory->doc = NULL; + IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This->option_factory)); + } + if(This->window) IHTMLWindow2_Release(HTMLWINDOW2(This->window));
@@ -736,7 +741,7 @@ static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BS }
static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag, - IHTMLElement **newElem) + IHTMLElement **newElem) { FIXME("(%p)->(%s %p)\n", iface, debugstr_w(eTag), newElem); return E_NOTIMPL; @@ -1175,6 +1180,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) ret->nodes = NULL; ret->readystate = READYSTATE_UNINITIALIZED; ret->window = NULL; + ret->option_factory = NULL;
list_init(&ret->selection_list); list_init(&ret->range_list); diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c index 5e707ad..5a0293b 100644 --- a/dlls/mshtml/htmloption.c +++ b/dlls/mshtml/htmloption.c @@ -251,3 +251,124 @@ HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement *nselem)
return &ret->element; } + +#define HTMLOPTFACTORY_THIS(iface) DEFINE_THIS(HTMLOptionElementFactory, HTMLOptionElementFactory, iface) + +static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElementFactory *iface, + REFIID riid, void **ppv) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + + *ppv = NULL; + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = HTMLOPTFACTORY(This); + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = HTMLOPTFACTORY(This); + }else if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) { + TRACE("(%p)->(IID_IHTMLOptionElementFactory %p)\n", This, ppv); + *ppv = HTMLOPTFACTORY(This); + } + + if(*ppv) { + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + + WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + mshtml_free(This); + + return ref; +} + +static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionElementFactory *iface, UINT *pctinfo) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + FIXME("(%p)->(%p)\n", This, pctinfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfo(IHTMLOptionElementFactory *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementFactory *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, + lcid, rgDispId); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory *iface, + VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected, + IHTMLOptionElement **optelem) +{ + HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); + FIXME("(%p)->(v v v v %p)\n", This, optelem); + return E_NOTIMPL; +} + +#undef HTMLOPTFACTORY_THIS + +static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = { + HTMLOptionElementFactory_QueryInterface, + HTMLOptionElementFactory_AddRef, + HTMLOptionElementFactory_Release, + HTMLOptionElementFactory_GetTypeInfoCount, + HTMLOptionElementFactory_GetTypeInfo, + HTMLOptionElementFactory_GetIDsOfNames, + HTMLOptionElementFactory_Invoke, + HTMLOptionElementFactory_create +}; + +HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument *doc) +{ + HTMLOptionElementFactory *ret; + + ret = mshtml_alloc(sizeof(HTMLOptionElementFactory)); + ret->lpHTMLOptionElementFactoryVtbl = &HTMLOptionElementFactoryVtbl; + ret->ref = 1; + ret->doc = doc; + + return ret; +} diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 369a09c..fee2297 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -534,8 +534,16 @@ static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen ** static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p) { HTMLWindow *This = HTMLWINDOW2_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->doc->option_factory) + This->doc->option_factory = HTMLOptionElementFactory_Create(This->doc); + + *p = HTMLOPTFACTORY(This->doc->option_factory); + IHTMLOptionElementFactory_AddRef(*p); + + return S_OK; }
static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 68e7e14..48e0d4c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -94,6 +94,14 @@ struct ConnectionPoint { ConnectionPoint *next; };
+typedef struct { + const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl; + + LONG ref; + + HTMLDocument *doc; +} HTMLOptionElementFactory; + struct HTMLDocument { const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl; const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl; @@ -152,6 +160,8 @@ struct HTMLDocument { ConnectionPoint cp_htmldocevents2; ConnectionPoint cp_propnotif;
+ HTMLOptionElementFactory *option_factory; + struct list selection_list; struct list range_list;
@@ -330,6 +340,8 @@ typedef struct {
#define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
+#define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl) + #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
@@ -338,6 +350,7 @@ HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
HTMLWindow *HTMLWindow_Create(HTMLDocument*); HTMLWindow *nswindow_to_window(const nsIDOMWindow*); +HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*); void setup_nswindow(HTMLWindow*);
void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);