Jacek Caban : mshtml: Added IHTMLDocument7::head property implementation.
Alexandre Julliard
julliard at winehq.org
Tue Sep 12 15:40:38 CDT 2017
Module: wine
Branch: master
Commit: b244182bae54d7c46e7a4f46a2868c6983c4b9f7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b244182bae54d7c46e7a4f46a2868c6983c4b9f7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Sep 12 13:15:37 2017 +0200
mshtml: Added IHTMLDocument7::head property implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmldoc.c | 34 ++++++++++++++++++++++++++++++++--
dlls/mshtml/tests/elements.js | 11 ++++++++++-
2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index db6ee57..413b0bd 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -4038,8 +4038,38 @@ static HRESULT WINAPI HTMLDocument7_get_body(IHTMLDocument7 *iface, IHTMLElement
static HRESULT WINAPI HTMLDocument7_get_head(IHTMLDocument7 *iface, IHTMLElement **p)
{
HTMLDocument *This = impl_from_IHTMLDocument7(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ nsIDOMHTMLHeadElement *nshead;
+ nsIDOMElement *nselem;
+ HTMLElement *elem;
+ nsresult nsres;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ if(!This->doc_node->nsdoc) {
+ FIXME("No document\n");
+ return E_FAIL;
+ }
+
+ nsres = nsIDOMHTMLDocument_GetHead(This->doc_node->nsdoc, &nshead);
+ assert(nsres == NS_OK);
+
+ if(!nshead) {
+ *p = NULL;
+ return S_OK;
+ }
+
+ nsres = nsIDOMHTMLHeadElement_QueryInterface(nshead, &IID_nsIDOMElement, (void**)&nselem);
+ nsIDOMHTMLHeadElement_Release(nshead);
+ assert(nsres == NS_OK);
+
+ hres = get_elem(This->doc_node, nselem, &elem);
+ nsIDOMElement_Release(nselem);
+ if(FAILED(hres))
+ return hres;
+
+ *p = &elem->IHTMLElement_iface;
+ return S_OK;
}
static const IHTMLDocument7Vtbl HTMLDocument7Vtbl = {
diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
index ac1e2d0..56c4e2f 100644
--- a/dlls/mshtml/tests/elements.js
+++ b/dlls/mshtml/tests/elements.js
@@ -96,8 +96,17 @@ function test_ElementTraversal() {
next_test();
}
+function test_head() {
+ var h = document.head;
+ ok(h.tagName === "HEAD", "h.tagName = " + h.tagName);
+ ok(h === document.getElementsByTagName("head")[0], "unexpected head element");
+
+ next_test();
+}
+
var tests = [
test_input_selection,
test_textContent,
- test_ElementTraversal
+ test_ElementTraversal,
+ test_head
];
More information about the wine-cvs
mailing list