Commit c5d3ff58 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mshtml: Add IHTMLDOMRange stub.

parent daf62df9
...@@ -55,13 +55,13 @@ C_SRCS = \ ...@@ -55,13 +55,13 @@ C_SRCS = \
persist.c \ persist.c \
pluginhost.c \ pluginhost.c \
protocol.c \ protocol.c \
range.c \
script.c \ script.c \
secmgr.c \ secmgr.c \
selection.c \ selection.c \
service.c \ service.c \
svg.c \ svg.c \
task.c \ task.c \
txtrange.c \
view.c \ view.c \
xmlhttprequest.c xmlhttprequest.c
......
...@@ -5223,8 +5223,22 @@ static HRESULT WINAPI DocumentRange_Invoke(IDocumentRange *iface, DISPID dispIdM ...@@ -5223,8 +5223,22 @@ static HRESULT WINAPI DocumentRange_Invoke(IDocumentRange *iface, DISPID dispIdM
static HRESULT WINAPI DocumentRange_createRange(IDocumentRange *iface, IHTMLDOMRange **p) static HRESULT WINAPI DocumentRange_createRange(IDocumentRange *iface, IHTMLDOMRange **p)
{ {
HTMLDocument *This = impl_from_IDocumentRange(iface); HTMLDocument *This = impl_from_IDocumentRange(iface);
FIXME("(%p)->(%p)\n", This, p); nsIDOMRange *nsrange;
return E_NOTIMPL; HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
if(NS_FAILED(nsIDOMHTMLDocument_CreateRange(This->doc_node->nsdoc, &nsrange)))
return E_FAIL;
hres = HTMLDOMRange_Create(nsrange, p);
nsIDOMRange_Release(nsrange);
return hres;
} }
static const IDocumentRangeVtbl DocumentRangeVtbl = { static const IDocumentRangeVtbl DocumentRangeVtbl = {
......
...@@ -95,6 +95,7 @@ typedef struct EventTarget EventTarget; ...@@ -95,6 +95,7 @@ typedef struct EventTarget EventTarget;
XDIID(DispHTMLDocument) \ XDIID(DispHTMLDocument) \
XDIID(DispHTMLDOMAttribute) \ XDIID(DispHTMLDOMAttribute) \
XDIID(DispHTMLDOMImplementation) \ XDIID(DispHTMLDOMImplementation) \
XDIID(DispHTMLDOMRange) \
XDIID(DispHTMLDOMTextNode) \ XDIID(DispHTMLDOMTextNode) \
XDIID(DispHTMLElementCollection) \ XDIID(DispHTMLElementCollection) \
XDIID(DispHTMLEmbed) \ XDIID(DispHTMLEmbed) \
...@@ -178,6 +179,7 @@ typedef struct EventTarget EventTarget; ...@@ -178,6 +179,7 @@ typedef struct EventTarget EventTarget;
XIID(IHTMLDOMNode) \ XIID(IHTMLDOMNode) \
XIID(IHTMLDOMNode2) \ XIID(IHTMLDOMNode2) \
XIID(IHTMLDOMNode3) \ XIID(IHTMLDOMNode3) \
XIID(IHTMLDOMRange) \
XIID(IHTMLDOMTextNode) \ XIID(IHTMLDOMTextNode) \
XIID(IHTMLDOMTextNode2) \ XIID(IHTMLDOMTextNode2) \
XIID(IHTMLElement) \ XIID(IHTMLElement) \
...@@ -1008,6 +1010,7 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectio ...@@ -1008,6 +1010,7 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectio
HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN; HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN; IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN; IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
HRESULT HTMLDOMRange_Create(nsIDOMRange*,IHTMLDOMRange**) DECLSPEC_HIDDEN;
void detach_document_node(HTMLDocumentNode*) DECLSPEC_HIDDEN; void detach_document_node(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN; void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
......
...@@ -5938,6 +5938,31 @@ static void test_txtrange(IHTMLDocument2 *doc) ...@@ -5938,6 +5938,31 @@ static void test_txtrange(IHTMLDocument2 *doc)
IHTMLTxtRange_Release(range); IHTMLTxtRange_Release(range);
} }
static void test_range(IHTMLDocument2 *doc)
{
if(is_ie9plus) {
IDocumentRange *doc_range;
IHTMLDOMRange *range;
HRESULT hres;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IDocumentRange, (void **)&doc_range);
ok(hres == S_OK, "Failed to get IDocumentRange: %08x\n", hres);
if (FAILED(hres))
return;
hres = IDocumentRange_createRange(doc_range, &range);
ok(hres == S_OK, "Failed to create range, %08x\n", hres);
test_disp((IUnknown *)range, &DIID_DispHTMLDOMRange, NULL, NULL);
IHTMLDOMRange_Release(range);
IDocumentRange_Release(doc_range);
}
test_txtrange(doc);
}
#define test_compatmode(a,b) _test_compatmode(__LINE__,a,b) #define test_compatmode(a,b) _test_compatmode(__LINE__,a,b)
static void _test_compatmode(unsigned line, IHTMLDocument2 *doc2, const char *excompat) static void _test_compatmode(unsigned line, IHTMLDocument2 *doc2, const char *excompat)
{ {
...@@ -11060,7 +11085,7 @@ START_TEST(dom) ...@@ -11060,7 +11085,7 @@ START_TEST(dom)
run_domtest(doc_str1, test_doc_elem); run_domtest(doc_str1, test_doc_elem);
run_domtest(doc_str1, test_get_set_attr); run_domtest(doc_str1, test_get_set_attr);
run_domtest(doc_blank, test_txtrange); run_domtest(doc_blank, test_range);
if (winetest_interactive || ! is_ie_hardened()) { if (winetest_interactive || ! is_ie_hardened()) {
run_domtest(elem_test_str, test_elems); run_domtest(elem_test_str, test_elems);
run_domtest(elem_test2_str, test_elems2); run_domtest(elem_test2_str, test_elems2);
......
...@@ -420,6 +420,7 @@ interface ILineInfo; ...@@ -420,6 +420,7 @@ interface ILineInfo;
interface IMarkupPointer; interface IMarkupPointer;
interface IMarkupContainer; interface IMarkupContainer;
interface ISVGSVGElement; interface ISVGSVGElement;
interface IHTMLDOMRange;
/***************************************************************************** /*****************************************************************************
* IHTMLCSSStyleDeclaration interface * IHTMLCSSStyleDeclaration interface
...@@ -12205,6 +12206,93 @@ interface IHTMLTxtRange : IDispatch ...@@ -12205,6 +12206,93 @@ interface IHTMLTxtRange : IDispatch
[retval, out] VARIANT_BOOL *pfRet); [retval, out] VARIANT_BOOL *pfRet);
} }
[
hidden,
uuid(3050f5a3-98b5-11cf-bb82-00aa00bdce0b)
]
dispinterface DispHTMLDOMRange
{
properties:
methods:
[propget, id(DISPID_IHTMLDOMRANGE_STARTCONTAINER)]
IHTMLDOMNode *startContainer();
[propget, id(DISPID_IHTMLDOMRANGE_STARTOFFSET)]
long startOffset();
[propget, id(DISPID_IHTMLDOMRANGE_ENDCONTAINER)]
IHTMLDOMNode *endContainer();
[propget, id(DISPID_IHTMLDOMRANGE_ENDOFFSET)]
long endOffset();
[propget, id(DISPID_IHTMLDOMRANGE_COLLAPSED)]
VARIANT_BOOL collapsed();
[propget, id(DISPID_IHTMLDOMRANGE_COMMONANCESTORCONTAINER)]
IHTMLDOMNode *commonAncestorContainer();
[id(DISPID_IHTMLDOMRANGE_SETSTART)]
void setStart([in] IDispatch *node ,[in] long offset);
[id(DISPID_IHTMLDOMRANGE_SETEND)]
void setEnd([in] IDispatch *node, [in] long offset);
[id(DISPID_IHTMLDOMRANGE_SETSTARTBEFORE)]
void setStartBefore([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_SETSTARTAFTER)]
void setStartAfter([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_SETENDBEFORE)]
void setEndBefore([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_SETENDAFTER)]
void setEndAfter([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_COLLAPSE)]
void collapse([in] VARIANT_BOOL tostart);
[id(DISPID_IHTMLDOMRANGE_SELECTNODE)]
void selectNode([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_SELECTNODECONTENTS)]
void selectNodeContents([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_COMPAREBOUNDARYPOINTS)]
long compareBoundaryPoints([in] short how, [in] IDispatch *src_range);
[id(DISPID_IHTMLDOMRANGE_DELETECONTENTS)]
void deleteContents();
[id(DISPID_IHTMLDOMRANGE_EXTRACTCONTENTS)]
IDispatch *extractContents();
[id(DISPID_IHTMLDOMRANGE_CLONECONTENTS)]
IDispatch *cloneContents();
[id(DISPID_IHTMLDOMRANGE_INSERTNODE)]
void insertNode([in] IDispatch *node);
[id(DISPID_IHTMLDOMRANGE_SURROUNDCONTENTS)]
void surroundContents([in] IDispatch *parent);
[id(DISPID_IHTMLDOMRANGE_CLONERANGE)]
IHTMLDOMRange *cloneRange();
[id(DISPID_IHTMLDOMRANGE_TOSTRING)]
BSTR toString();
[id(DISPID_IHTMLDOMRANGE_DETACH)]
void detach();
[id(DISPID_IHTMLDOMRANGE_GETCLIENTRECTS)]
IHTMLRectCollection *getClientRects();
[id(DISPID_IHTMLDOMRANGE_GETBOUNDINGCLIENTRECT)]
IHTMLRect *getBoundingClientRect();
}
/***************************************************************************** /*****************************************************************************
* IHTMLDOMRange interface * IHTMLDOMRange interface
*/ */
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