mshtml: Added get_compatMode implementation.

oldstable
Jacek Caban 2007-09-26 20:44:14 +02:00 committed by Alexandre Julliard
parent 9ba65105d5
commit cb776f7d5b
3 changed files with 91 additions and 2 deletions

View File

@ -220,8 +220,34 @@ static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface
static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p)
{
HTMLDocument *This = HTMLDOC5_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMDocument *nsdoc;
nsIDOMNSHTMLDocument *nshtmldoc;
nsAString mode_str;
const PRUnichar *mode;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
if(NS_FAILED(nsres))
ERR("GetDocument failed: %08x\n", nsres);
nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMNSHTMLDocument, (void**)&nshtmldoc);
nsIDOMDocument_Release(nsdoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNSHTMLDocument: %08x\n", nsres);
return S_OK;
}
nsAString_Init(&mode_str, NULL);
nsIDOMNSHTMLDocument_GetCompatMode(nshtmldoc, &mode_str);
nsIDOMNSHTMLDocument_Release(nshtmldoc);
nsAString_GetData(&mode_str, &mode, NULL);
*p = SysAllocString(mode);
nsAString_Finish(&mode_str);
return S_OK;
}
#undef HTMLDOC5_THIS

View File

@ -834,6 +834,50 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
nsresult GetElementsByName(const nsAString *elementName, nsIDOMNodeList **_retval);
}
[
object,
uuid(79beb289-3644-4b54-9432-9fb993945629)
/* NOT_FROZEN */
]
interface nsIDOMNSHTMLDocument : nsISupports
{
nsresult GetWidth(PRInt32 *aWidth);
nsresult GetHeight(PRInt32 *aHeight);
nsresult GetAlinkColor(nsAString *aAlinkColor);
nsresult SetAlinkColor(const nsAString *aAlinkColor);
nsresult GetLinkColor(nsAString *aLinkColor);
nsresult SetLinkColor(const nsAString *aLinkColor);
nsresult GetVlinkColor(nsAString *aVlinkColor);
nsresult SetVlinkColor(const nsAString *aVlinkColor);
nsresult GetBgColor(nsAString *aBgColor);
nsresult SetBgColor(const nsAString *aBgColor);
nsresult GetFgColor(nsAString *aFgColor);
nsresult SetFgColor(const nsAString *aFgColor);
nsresult GetDomain(nsAString *aDomain);
nsresult SetDomain(const nsAString *aDomain);
nsresult GetEmbeds(nsIDOMHTMLCollection **aEmbeds);
nsresult GetSelection(nsAString *_retval);
nsresult Open(nsIDOMDocument **_retval);
nsresult Write();
nsresult Writeln();
nsresult Clear();
nsresult CaptureEvents(PRInt32 eventFlags);
nsresult ReleaseEvents(PRInt32 eventFlags);
nsresult RouteEvent(nsIDOMEvent *evt);
nsresult GetCompatMode(nsAString *aCompatMode);
nsresult GetPlugins(nsIDOMHTMLCollection **aPlugins);
nsresult GetDesignMode(nsAString *aDesignMode);
nsresult SetDesignMode(const nsAString *aDesignMode);
nsresult ExecCommand(const nsAString *commandID, PRBool doShowUI, const nsAString *value, PRBool *_retval);
nsresult ExecCommandShowHelp(const nsAString *commandID, PRBool *_retval);
nsresult QueryCommandEnabled(const nsAString *commandID, PRBool *_retval);
nsresult QueryCommandIndeterm(const nsAString *commandID, PRBool *_retval);
nsresult QueryCommandState(const nsAString *commandID, PRBool *_retval);
nsresult QueryCommandSupported(const nsAString *commandID, PRBool *_retval);
nsresult QueryCommandText(const nsAString *commandID, nsAString *_retval);
nsresult QueryCommandValue(const nsAString *commandID, nsAString *_retval);
}
[
object,
uuid(3d9f4973-dd2e-48f5-b5f7-2634e09eadd9)

View File

@ -347,6 +347,24 @@ static void test_txtrange(IHTMLDocument2 *doc)
IHTMLTxtRange_Release(body_range);
}
static void test_compatmode(IHTMLDocument2 *doc)
{
IHTMLDocument5 *doc5;
BSTR mode;
HRESULT hres;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
ok(hres == S_OK, "Could not get IHTMLDocument5 interface: %08x\n", hres);
if(FAILED(hres))
return;
hres = IHTMLDocument5_get_compatMode(doc5, &mode);
IHTMLDocument5_Release(doc5);
ok(hres == S_OK, "get_compatMode failed: %08x\n", hres);
ok(!strcmp_wa(mode, "BackCompat"), "compatMode=%s\n", dbgstr_w(mode));
SysFreeString(mode);
}
static void test_default_style(IHTMLStyle *style)
{
VARIANT_BOOL b;
@ -431,6 +449,7 @@ static void test_defaults(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_style failed: %08x\n", hres);
test_default_style(style);
test_compatmode(doc);
IHTMLStyle_Release(style);