mshtml: Implement IHTMLDocument5 createComment (resend)

Jacek Caban jacek at codeweavers.com
Thu Jan 15 17:57:11 CST 2009


Hi Alistair,

Alistair Leslie-Hughes wrote:
> Hi,
>
> Can I get some feedback on this please?
>   

Sure, sorry that I didn't look carefully enough to find problems with 
it, overall mshtml part looks good.

> "Alistair Leslie-Hughes" <leslie_alistair at hotmail.com> wrote in message 
> news:496D1EBF.2000800 at hotmail.com...
>   
>> Hi,
>>
>> Changelog:
>> mshtml: Implement IHTMLDocument5 createComment
>>
>> Best Regards
>>  Alistair Leslie-Hughes
>>
>>
>>
>>
>>     
>
>
> --------------------------------------------------------------------------------
>
>
>   
>> From 98f08b3836336d2f129413beada591fb8f2f1094 Mon Sep 17 00:00:00 2001
>> From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
>> Date: Tue, 16 Dec 2008 21:49:25 +1100
>> Subject: [PATCH] Implement IHTMLDocument5 createComment
>> To: wine-patches <wine-patches at winehq.org>
>>
>> ---
>> dlls/mshtml/htmldoc5.c  |   28 ++++++++++++++++++++++++++--
>> dlls/mshtml/tests/dom.c |   11 +++++++++++
>> 2 files changed, 37 insertions(+), 2 deletions(-)
>>
>> diff --git a/dlls/mshtml/htmldoc5.c b/dlls/mshtml/htmldoc5.c
>> index 34dc4e0..8fdfb68 100644
>> --- a/dlls/mshtml/htmldoc5.c
>> +++ b/dlls/mshtml/htmldoc5.c
>> @@ -124,8 +124,32 @@ static HRESULT WINAPI 
>> HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
>>         IHTMLDOMNode **ppRetNode)
>> {
>>     HTMLDocument *This = HTMLDOC5_THIS(iface);
>> -    FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
>> -    return E_NOTIMPL;
>> +    nsIDOMComment *nsComment;
>>     

Please use better name (consistent with the rest of code) like nscomment.

>> +    HTMLDOMNode *node;
>> +    nsAString str;
>> +    nsresult nsres;
>> +
>> +    TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
>> +
>> +    if(!This->nsdoc) {
>> +        WARN("NULL nsdoc\n");
>> +        return E_UNEXPECTED;
>> +    }
>> +
>> +    nsAString_Init(&str, bstrdata);
>> +    nsres = nsIDOMHTMLDocument_CreateComment(This->nsdoc, &str, 
>> &nsComment);
>> +    nsAString_Finish(&str);
>> +    if(NS_FAILED(nsres)) {
>> +        ERR("CreateTextNode failed: %08x\n", nsres);
>> +        return E_FAIL;
>> +    }
>> +
>> +    node = &HTMLCommentElement_Create(This, 
>> (nsIDOMNode*)nsComment)->node;
>> +    nsIDOMElement_Release(nsComment);
>> +
>> +    *ppRetNode = HTMLDOMNODE(node);
>> +    IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
>> +    return S_OK;
>> }
>>
>> static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, 
>> VARIANT v)
>> diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
>> index 3decd4b..400f83b 100644
>> --- a/dlls/mshtml/tests/dom.c
>> +++ b/dlls/mshtml/tests/dom.c
>> @@ -410,7 +410,9 @@ static IHTMLDocument2 *create_document(void)
>> {
>>     IHTMLDocument2 *doc;
>>     IHTMLDocument5 *doc5;
>> +    IHTMLDOMNode   *comment;
>>     HRESULT hres;
>> +    BSTR str;
>>
>>     hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, 
>> CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
>>             &IID_IHTMLDocument2, (void**)&doc);
>> @@ -423,6 +425,15 @@ static IHTMLDocument2 *create_document(void)
>>         return NULL;
>>     }
>>
>> +    str = a2bstr("testing");
>> +    hres = IHTMLDocument5_createComment(doc5, str, &comment);
>> +    SysFreeString(str);
>> +    ok(hres == S_OK, "createComment failed: %08x\n", hres);
>> +    if(hres == S_OK)
>> +    {
>> +        IHTMLDOMNode_Release(comment);
>> +    }

That's wrong place to test it. test_create_elems is probably a good 
place. Also it would be nice to do anything with created node like 
testing it by get_node_type.


Jacek



More information about the wine-devel mailing list