Commit 845f5ccc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved READYSTATE to string conversion to separated function.

parent 87efdc30
......@@ -592,27 +592,13 @@ static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0};
static const WCHAR wszLoaded[] = {'l','o','a','d','e','d',0};
static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
static const WCHAR wszComplete[] = {'c','o','m','p','l','e','t','e',0};
static const LPCWSTR readystate_str[] = {
wszUninitialized,
wszLoading,
wszLoaded,
wszInteractive,
wszComplete
};
TRACE("(%p)->(%p)\n", iface, p);
if(!p)
return E_POINTER;
*p = SysAllocString(readystate_str[This->window->readystate]);
return S_OK;
return get_readystate_string(This->window->readystate, p);
}
static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
......
......@@ -218,6 +218,27 @@ HRESULT elem_string_attr_setter(HTMLElement *elem, const WCHAR *name, const WCHA
return S_OK;
}
HRESULT get_readystate_string(READYSTATE readystate, BSTR *p)
{
static const WCHAR uninitializedW[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
static const WCHAR loadingW[] = {'l','o','a','d','i','n','g',0};
static const WCHAR loadedW[] = {'l','o','a','d','e','d',0};
static const WCHAR interactiveW[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
static const LPCWSTR readystate_strs[] = {
uninitializedW,
loadingW,
loadedW,
interactiveW,
completeW
};
assert(readystate <= READYSTATE_COMPLETE);
*p = SysAllocString(readystate_strs[readystate]);
return *p ? S_OK : E_OUTOFMEMORY;
}
typedef struct
{
DispatchEx dispex;
......
......@@ -851,6 +851,7 @@ void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment