Commit 60887201 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Tell wine-gecko about the IE compat document mode.

parent 1e2a24e9
......@@ -1023,6 +1023,7 @@ void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN
HRESULT create_gecko_browser(HTMLDocumentObj*,GeckoBrowser**) DECLSPEC_HIDDEN;
void detach_gecko_browser(GeckoBrowser*) DECLSPEC_HIDDEN;
DWORD get_compat_mode_version(compat_mode_t compat_mode) DECLSPEC_HIDDEN;
compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
......
......@@ -388,6 +388,26 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
return NS_OK;
}
DWORD get_compat_mode_version(compat_mode_t compat_mode)
{
switch(compat_mode) {
case COMPAT_MODE_QUIRKS:
case COMPAT_MODE_IE5:
case COMPAT_MODE_IE7:
return 7;
case COMPAT_MODE_IE8:
return 8;
case COMPAT_MODE_IE9:
return 9;
case COMPAT_MODE_IE10:
return 10;
case COMPAT_MODE_IE11:
return 11;
DEFAULT_UNREACHABLE;
}
return 0;
}
/*
* We may change document mode only in early stage of document lifetime.
* Later attempts will not have an effect.
......@@ -396,7 +416,13 @@ compat_mode_t lock_document_mode(HTMLDocumentNode *doc)
{
TRACE("%p: %d\n", doc, doc->document_mode);
if(!doc->document_mode_locked) {
doc->document_mode_locked = TRUE;
if(doc->html_document)
nsIDOMHTMLDocument_SetIECompatMode(doc->html_document, get_compat_mode_version(doc->document_mode));
}
return doc->document_mode;
}
......
......@@ -1170,30 +1170,8 @@ extern HRESULT WINAPI MapBrowserEmulationModeToUserAgent(const void*,WCHAR**);
/* Retrieves allocated user agent via CoTaskMemAlloc */
static HRESULT get_user_agent(OmNavigator *navigator, WCHAR **user_agent)
{
DWORD version;
switch(dispex_compat_mode(&navigator->dispex)) {
case COMPAT_MODE_QUIRKS:
case COMPAT_MODE_IE5:
case COMPAT_MODE_IE7:
version = 7;
break;
case COMPAT_MODE_IE8:
version = 8;
break;
case COMPAT_MODE_IE9:
version = 9;
break;
case COMPAT_MODE_IE10:
version = 10;
break;
case COMPAT_MODE_IE11:
version = 11;
break;
default:
assert(0);
return E_FAIL;
}
DWORD version = get_compat_mode_version(dispex_compat_mode(&navigator->dispex));
return MapBrowserEmulationModeToUserAgent(&version, user_agent);
}
......
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