Jacek Caban : mshtml: Added IHTMLTxtRange::compareEndPoints
implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 17 06:30:48 CDT 2007
Module: wine
Branch: master
Commit: d6e29316e6afeec229e9343f1545296cb9c79ed9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d6e29316e6afeec229e9343f1545296cb9c79ed9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Aug 17 02:40:33 2007 +0200
mshtml: Added IHTMLTxtRange::compareEndPoints implementation.
---
dlls/mshtml/nsiface.idl | 7 ++++++
dlls/mshtml/txtrange.c | 51 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index f402b36..120c2f6 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -819,6 +819,13 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
]
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 GetStartOffset(PRInt32 *aStartOffset);
nsresult GetEndContainer(nsIDOMNode **aEndContainer);
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 373b7b6..37a836d 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -49,6 +49,34 @@ typedef struct {
#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)
static HRESULT WINAPI HTMLTxtRange_QueryInterface(IHTMLTxtRange *iface, REFIID riid, void **ppv)
@@ -383,8 +411,27 @@ static HRESULT WINAPI HTMLTxtRange_compareEndPoints(IHTMLTxtRange *iface, BSTR h
IHTMLTxtRange *SourceRange, long *ret)
{
HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
- FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(how), SourceRange, ret);
- return E_NOTIMPL;
+ HTMLTxtRange *src_range;
+ 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,
More information about the wine-cvs
mailing list