Commit af529308 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Don't assume that nselem is valid in HTMLElement.

parent 791dd955
......@@ -138,6 +138,11 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr
WARN("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags);
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
VariantInit(&AttributeValueChanged);
hres = VariantChangeType(&AttributeValueChanged, &AttributeValue, 0, VT_BSTR);
......@@ -178,6 +183,11 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
WARN("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
V_VT(AttributeValue) = VT_NULL;
nsAString_Init(&attr_str, strAttributeName);
......@@ -245,6 +255,11 @@ static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
nsAString_Init(&class_str, NULL);
nsres = nsIDOMHTMLElement_GetClassName(This->nselem, &class_str);
......@@ -286,6 +301,15 @@ static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->nselem) {
static const WCHAR comment_tagW[] = {'!',0};
WARN("NULL nselem, assuming comment\n");
*p = SysAllocString(comment_tagW);
return S_OK;
}
nsAString_Init(&tag_str, NULL);
nsres = nsIDOMHTMLElement_GetTagName(This->nselem, &tag_str);
if(NS_SUCCEEDED(nsres)) {
......@@ -316,6 +340,11 @@ static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMElementCSSInlineStyle,
(void**)&nselemstyle);
if(NS_FAILED(nsres)) {
......@@ -627,6 +656,11 @@ static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
......@@ -702,6 +736,11 @@ static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsI
static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
nsresult nsres;
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
if (!strcmpiW(where, wszBeforeBegin))
{
nsIDOMNode *unused;
......@@ -1513,6 +1552,9 @@ static BOOL is_elem_name(HTMLElement *elem, LPCWSTR name)
static const PRUnichar nameW[] = {'n','a','m','e',0};
if(!elem->nselem)
return FALSE;
nsAString_Init(&nsstr, NULL);
nsIDOMHTMLElement_GetId(elem->nselem, &nsstr);
nsAString_GetData(&nsstr, &str);
......
......@@ -651,6 +651,11 @@ static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, long v)
TRACE("(%p)->(%ld)\n", This, v);
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_SetScrollTop(nselem, v);
......@@ -677,6 +682,11 @@ static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, long v)
TRACE("(%p)->(%ld)\n", This, v);
if(!This->nselem) {
FIXME("NULL nselem\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_SetScrollLeft(nselem, v);
......
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