Module: wine Branch: master Commit: a9ebca282baeae17f5cb63c5b4ace1e22781ab1c URL: http://source.winehq.org/git/wine.git/?a=commit;h=a9ebca282baeae17f5cb63c5b4...
Author: Rob Shearman rob@codeweavers.com Date: Sun Jun 24 09:18:41 2007 +0100
mshtml: Implement HTMLElement_setAttribute.
---
dlls/mshtml/htmlelem.c | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 516a0d0..ccdad8c 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -135,8 +135,40 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr VARIANT AttributeValue, LONG lFlags) { HTMLElement *This = HTMLELEM_THIS(iface); - FIXME("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags); - return E_NOTIMPL; + nsAString attr_str; + nsAString value_str; + nsresult nsres; + HRESULT hres; + VARIANT AttributeValueChanged; + + WARN("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags); + + VariantInit(&AttributeValueChanged); + + hres = VariantChangeType(&AttributeValueChanged, &AttributeValue, 0, VT_BSTR); + if (FAILED(hres)) { + WARN("couldn't convert input attribute value %d to VT_BSTR\n", V_VT(&AttributeValue)); + return hres; + } + + nsAString_Init(&attr_str, strAttributeName); + nsAString_Init(&value_str, V_BSTR(&AttributeValueChanged)); + + TRACE("setting %s to %s\n", debugstr_w(strAttributeName), + debugstr_w(V_BSTR(&AttributeValueChanged))); + + nsres = nsIDOMHTMLElement_SetAttribute(This->nselem, &attr_str, &value_str); + nsAString_Finish(&attr_str); + nsAString_Finish(&value_str); + + if(NS_SUCCEEDED(nsres)) { + hres = S_OK; + }else { + ERR("SetAttribute failed: %08x\n", nsres); + hres = E_FAIL; + } + + return hres; }
static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,