Commit 11d62d7f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLTxtRange::expand("TextEdit") implementation.

parent f02a0157
......@@ -43,6 +43,7 @@ static const char doc_str3[] =
static const WCHAR noneW[] = {'N','o','n','e',0};
static WCHAR characterW[] = {'c','h','a','r','a','c','t','e','r',0};
static WCHAR texteditW[] = {'t','e','x','t','e','d','i','t',0};
static WCHAR wordW[] = {'w','o','r','d',0};
typedef enum {
......@@ -873,6 +874,8 @@ static void test_txtrange(IHTMLDocument2 *doc)
test_range_moveend(range, characterW, 3, 3);
test_range_text(range, "wor");
test_range_parent(range, ET_BODY);
test_range_expand(range, texteditW, VARIANT_TRUE, "wordabc 123\r\nit's text");
test_range_expand(range, texteditW, VARIANT_TRUE, "wordabc 123\r\nit's text");
IHTMLTxtRange_Release(range);
}
......
......@@ -1073,12 +1073,12 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
if(unit == RU_UNKNOWN)
return E_INVALIDARG;
*Success = VARIANT_FALSE;
switch(unit) {
case RU_WORD: {
dompos_t end_pos, start_pos, new_pos;
*Success = VARIANT_FALSE;
get_cur_pos(This, TRUE, &start_pos);
get_cur_pos(This, FALSE, &end_pos);
if(find_next_space(&end_pos, TRUE, &new_pos)) {
......@@ -1097,6 +1097,40 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
break;
}
case RU_TEXTEDIT: {
nsIDOMDocument *nsdoc;
nsIDOMHTMLDocument *nshtmldoc;
nsIDOMHTMLElement *nsbody = NULL;
nsresult nsres;
nsres = nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &nsdoc);
if(NS_FAILED(nsres) || !nsdoc) {
ERR("GetDocument failed: %08x\n", nsres);
break;
}
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
nsIDOMDocument_Release(nsdoc);
nsres = nsIDOMHTMLDocument_GetBody(nshtmldoc, &nsbody);
nsIDOMHTMLDocument_Release(nshtmldoc);
if(NS_FAILED(nsres) || !nsbody) {
ERR("Could not get body: %08x\n", nsres);
break;
}
nsres = nsIDOMRange_SelectNodeContents(This->nsrange, (nsIDOMNode*)nsbody);
nsIDOMHTMLElement_Release(nsbody);
if(NS_FAILED(nsres)) {
ERR("Collapse failed: %08x\n", nsres);
break;
}
*Success = VARIANT_TRUE;
break;
}
default:
FIXME("Unimplemented unit %s\n", debugstr_w(Unit));
}
......
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