mshtml: Added IHTMLDOMNode3::compareDocumentPosition implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
52a5acaefb
commit
664e861cda
|
@ -1341,8 +1341,25 @@ static HRESULT WINAPI HTMLDOMNode3_isSameNode(IHTMLDOMNode3 *iface, IHTMLDOMNode
|
||||||
static HRESULT WINAPI HTMLDOMNode3_compareDocumentPosition(IHTMLDOMNode3 *iface, IHTMLDOMNode *otherNode, USHORT *flags)
|
static HRESULT WINAPI HTMLDOMNode3_compareDocumentPosition(IHTMLDOMNode3 *iface, IHTMLDOMNode *otherNode, USHORT *flags)
|
||||||
{
|
{
|
||||||
HTMLDOMNode *This = impl_from_IHTMLDOMNode3(iface);
|
HTMLDOMNode *This = impl_from_IHTMLDOMNode3(iface);
|
||||||
FIXME("(%p)->()\n", This);
|
HTMLDOMNode *other;
|
||||||
return E_NOTIMPL;
|
UINT16 position;
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
|
TRACE("(%p)->()\n", This);
|
||||||
|
|
||||||
|
other = get_node_obj(otherNode);
|
||||||
|
if(!other)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
nsres = nsIDOMNode_CompareDocumentPosition(This->nsnode, other->nsnode, &position);
|
||||||
|
IHTMLDOMNode_Release(&other->IHTMLDOMNode_iface);
|
||||||
|
if(NS_FAILED(nsres)) {
|
||||||
|
ERR("failed: %08x\n", nsres);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*flags = position;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLDOMNode3_isSupported(IHTMLDOMNode3 *iface, BSTR feature, VARIANT version, VARIANT_BOOL *pfisSupported)
|
static HRESULT WINAPI HTMLDOMNode3_isSupported(IHTMLDOMNode3 *iface, BSTR feature, VARIANT version, VARIANT_BOOL *pfisSupported)
|
||||||
|
|
|
@ -148,11 +148,36 @@ function test_query_selector() {
|
||||||
next_test();
|
next_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_compare_position() {
|
||||||
|
document.body.innerHTML = '<div><div></div><div></div></div>';
|
||||||
|
|
||||||
|
var parent = document.body.firstChild;
|
||||||
|
var child1 = parent.firstChild;
|
||||||
|
var child2 = child1.nextSibling;
|
||||||
|
var elem = document.createElement("div");
|
||||||
|
|
||||||
|
function compare_position(node1, node2, expected_result, ignore_mask) {
|
||||||
|
var cmp = node1.compareDocumentPosition(node2);
|
||||||
|
ok((cmp & ~ignore_mask) == expected_result,
|
||||||
|
"compareDocumentPosition returned " + cmp + " expected " + expected_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
compare_position(child1, child2, 4);
|
||||||
|
compare_position(child2, child1, 2);
|
||||||
|
compare_position(parent, child1, 0x14);
|
||||||
|
compare_position(parent, child2, 0x14);
|
||||||
|
compare_position(parent, elem, 0x21, 6);
|
||||||
|
compare_position(elem, parent, 0x21, 6);
|
||||||
|
|
||||||
|
next_test();
|
||||||
|
}
|
||||||
|
|
||||||
var tests = [
|
var tests = [
|
||||||
test_input_selection,
|
test_input_selection,
|
||||||
test_textContent,
|
test_textContent,
|
||||||
test_ElementTraversal,
|
test_ElementTraversal,
|
||||||
test_getElementsByClassName,
|
test_getElementsByClassName,
|
||||||
test_head,
|
test_head,
|
||||||
test_query_selector
|
test_query_selector,
|
||||||
|
test_compare_position
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue