Commit d6e29316 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLTxtRange::compareEndPoints implementation.

parent cbfef318
...@@ -819,6 +819,13 @@ interface nsIDOMHTMLDocument : nsIDOMDocument ...@@ -819,6 +819,13 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
] ]
interface nsIDOMRange : nsISupports interface nsIDOMRange : nsISupports
{ {
enum {
NS_START_TO_START,
NS_START_TO_END,
NS_END_TO_END,
NS_END_TO_START
};
nsresult GetStartContainer(nsIDOMNode **aStartContainer); nsresult GetStartContainer(nsIDOMNode **aStartContainer);
nsresult GetStartOffset(PRInt32 *aStartOffset); nsresult GetStartOffset(PRInt32 *aStartOffset);
nsresult GetEndContainer(nsIDOMNode **aEndContainer); nsresult GetEndContainer(nsIDOMNode **aEndContainer);
......
...@@ -49,6 +49,34 @@ typedef struct { ...@@ -49,6 +49,34 @@ typedef struct {
#define HTMLTXTRANGE(x) ((IHTMLTxtRange*) &(x)->lpHTMLTxtRangeVtbl) #define HTMLTXTRANGE(x) ((IHTMLTxtRange*) &(x)->lpHTMLTxtRangeVtbl)
static HTMLTxtRange *get_range_object(HTMLDocument *doc, IHTMLTxtRange *iface)
{
HTMLTxtRange *iter;
LIST_FOR_EACH_ENTRY(iter, &doc->range_list, HTMLTxtRange, entry) {
if(HTMLTXTRANGE(iter) == iface)
return iter;
}
ERR("Could not find range in document\n");
return NULL;
}
static int string_to_nscmptype(LPCWSTR str)
{
static const WCHAR seW[] = {'S','t','a','r','t','T','o','E','n','d',0};
static const WCHAR ssW[] = {'S','t','a','r','t','T','o','S','t','a','r','t',0};
static const WCHAR esW[] = {'E','n','d','T','o','S','t','a','r','t',0};
static const WCHAR eeW[] = {'E','n','d','T','o','E','n','d',0};
if(!strcmpiW(str, seW)) return NS_START_TO_END;
if(!strcmpiW(str, ssW)) return NS_START_TO_START;
if(!strcmpiW(str, esW)) return NS_END_TO_START;
if(!strcmpiW(str, eeW)) return NS_END_TO_END;
return -1;
}
#define HTMLTXTRANGE_THIS(iface) DEFINE_THIS(HTMLTxtRange, HTMLTxtRange, iface) #define HTMLTXTRANGE_THIS(iface) DEFINE_THIS(HTMLTxtRange, HTMLTxtRange, iface)
static HRESULT WINAPI HTMLTxtRange_QueryInterface(IHTMLTxtRange *iface, REFIID riid, void **ppv) static HRESULT WINAPI HTMLTxtRange_QueryInterface(IHTMLTxtRange *iface, REFIID riid, void **ppv)
...@@ -383,8 +411,27 @@ static HRESULT WINAPI HTMLTxtRange_compareEndPoints(IHTMLTxtRange *iface, BSTR h ...@@ -383,8 +411,27 @@ static HRESULT WINAPI HTMLTxtRange_compareEndPoints(IHTMLTxtRange *iface, BSTR h
IHTMLTxtRange *SourceRange, long *ret) IHTMLTxtRange *SourceRange, long *ret)
{ {
HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface); HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(how), SourceRange, ret); HTMLTxtRange *src_range;
return E_NOTIMPL; PRInt16 nsret = 0;
int nscmpt;
nsresult nsres;
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(how), SourceRange, ret);
nscmpt = string_to_nscmptype(how);
if(nscmpt == -1)
return E_INVALIDARG;
src_range = get_range_object(This->doc, SourceRange);
if(!src_range)
return E_FAIL;
nsres = nsIDOMRange_CompareBoundaryPoints(This->nsrange, nscmpt, src_range->nsrange, &nsret);
if(NS_FAILED(nsres))
ERR("CompareBoundaryPoints failed: %08x\n", nsres);
*ret = nsret;
return S_OK;
} }
static HRESULT WINAPI HTMLTxtRange_findText(IHTMLTxtRange *iface, BSTR String, static HRESULT WINAPI HTMLTxtRange_findText(IHTMLTxtRange *iface, BSTR String,
......
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