Module: wine Branch: master Commit: f0649f3731bfd02c348d46876543425b67283cbb URL: http://source.winehq.org/git/wine.git/?a=commit;h=f0649f3731bfd02c348d468765...
Author: Jacek Caban jacek@codeweavers.com Date: Thu May 10 00:34:05 2007 +0200
mshtml: Added IHTMLTxtRange::get_htmlText implementation.
---
dlls/mshtml/nsiface.idl | 10 +++++++++- dlls/mshtml/txtrange.c | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 2d662d1..a4c3fcc 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -97,7 +97,6 @@ typedef nsISupports nsIDOMNamedNodeMap; typedef nsISupports nsIDOMAttr; typedef nsISupports nsIDOMDocumentType; typedef nsISupports nsIDOMDOMImplementation; -typedef nsISupports nsIDOMDocumentFragment; typedef nsISupports nsIDOMComment; typedef nsISupports nsIDOMCDATASection; typedef nsISupports nsIDOMProcessingInstruction; @@ -588,6 +587,15 @@ interface nsIDOMText : nsIDOMCharacterData
[ object, + uuid(a6cf9076-15b3-11d2-932e-00805f8add32) + /* NOT_FROZEN */ +] +interface nsIDOMDocumentFragment : nsIDOMNode +{ +} + +[ + object, uuid(a6cf9075-15b3-11d2-932e-00805f8add32) /* FROZEN */ ] diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c index 70fb1f9..5b54451 100644 --- a/dlls/mshtml/txtrange.c +++ b/dlls/mshtml/txtrange.c @@ -138,8 +138,38 @@ static HRESULT WINAPI HTMLTxtRange_Invoke(IHTMLTxtRange *iface, DISPID dispIdMem static HRESULT WINAPI HTMLTxtRange_get_htmlText(IHTMLTxtRange *iface, BSTR *p) { HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + *p = NULL; + + if(This->nsrange) { + nsIDOMDocumentFragment *fragment; + nsresult nsres; + + nsres = nsIDOMRange_CloneContents(This->nsrange, &fragment); + if(NS_SUCCEEDED(nsres)) { + const PRUnichar *nstext; + nsAString nsstr; + + nsAString_Init(&nsstr, NULL); + nsnode_to_nsstring((nsIDOMNode*)fragment, &nsstr); + nsIDOMDocumentFragment_Release(fragment); + + nsAString_GetData(&nsstr, &nstext, NULL); + *p = SysAllocString(nstext); + + nsAString_Finish(&nsstr); + } + } + + if(!*p) { + const WCHAR emptyW[] = {0}; + *p = SysAllocString(emptyW); + } + + TRACE("return %s\n", debugstr_w(*p)); + return S_OK; }
static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)