Module: wine Branch: master Commit: 87f7aea1cad423eb576fec8ea1d508640775d67b URL: http://source.winehq.org/git/wine.git/?a=commit;h=87f7aea1cad423eb576fec8ea1...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Jul 5 22:48:04 2016 +0200
mshtml: Reimplement IHTMLDocument5::get_compatMode based on document mode.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/htmldoc.c | 15 +++++---------- dlls/mshtml/tests/documentmode.js | 5 +++++ 2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 1c0cc35..8fa3f52 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2947,19 +2947,14 @@ static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p) { HTMLDocument *This = impl_from_IHTMLDocument5(iface); - nsAString mode_str; - nsresult nsres;
- TRACE("(%p)->(%p)\n", This, p); + static const WCHAR BackCompatW[] = {'B','a','c','k','C','o','m','p','a','t',0}; + static const WCHAR CSS1CompatW[] = {'C','S','S','1','C','o','m','p','a','t',0};
- if(!This->doc_node->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } + TRACE("(%p)->(%p)\n", This, p);
- nsAString_Init(&mode_str, NULL); - nsres = nsIDOMHTMLDocument_GetCompatMode(This->doc_node->nsdoc, &mode_str); - return return_nsstr(nsres, &mode_str, p); + *p = SysAllocString(This->doc_node->document_mode == COMPAT_MODE_QUIRKS ? BackCompatW : CSS1CompatW); + return *p ? S_OK : E_OUTOFMEMORY; }
static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 89fe0a9..5979514 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -29,6 +29,11 @@ function test_doc_mode() {
ok(opt === document.documentMode, "documentMode = " + document.documentMode);
+ if(document.documentMode > 5) + ok(document.compatMode === "CSS1Compat", "document.compatMode = " + document.compatMode); + else + ok(document.compatMode === "BackCompat", "document.compatMode = " + document.compatMode); + next_test(); }