Commit 43ae349c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Support SVG element style.

parent 39434794
...@@ -10171,6 +10171,7 @@ static dispex_static_data_t HTMLStyle_dispex = { ...@@ -10171,6 +10171,7 @@ static dispex_static_data_t HTMLStyle_dispex = {
static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret) static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)
{ {
nsIDOMElementCSSInlineStyle *nselemstyle; nsIDOMElementCSSInlineStyle *nselemstyle;
nsIDOMSVGElement *svg_element;
nsresult nsres; nsresult nsres;
if(!elem->dom_element) { if(!elem->dom_element) {
...@@ -10180,16 +10181,29 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration ...@@ -10180,16 +10181,29 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration
nsres = nsIDOMElement_QueryInterface(elem->dom_element, &IID_nsIDOMElementCSSInlineStyle, nsres = nsIDOMElement_QueryInterface(elem->dom_element, &IID_nsIDOMElementCSSInlineStyle,
(void**)&nselemstyle); (void**)&nselemstyle);
assert(nsres == NS_OK); if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, ret);
nsIDOMElementCSSInlineStyle_Release(nselemstyle);
if(NS_FAILED(nsres)) {
ERR("GetStyle failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, ret); nsres = nsIDOMElement_QueryInterface(elem->dom_element, &IID_nsIDOMSVGElement, (void**)&svg_element);
nsIDOMElementCSSInlineStyle_Release(nselemstyle); if(NS_SUCCEEDED(nsres)) {
if(NS_FAILED(nsres)) { nsres = nsIDOMSVGElement_GetStyle(svg_element, ret);
ERR("GetStyle failed: %08x\n", nsres); nsIDOMSVGElement_Release(svg_element);
return E_FAIL; if(NS_FAILED(nsres)) {
ERR("GetStyle failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
} }
return S_OK; FIXME("Unsupported element type\n");
return E_NOTIMPL;
} }
void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, style_qi_t qi, void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, style_qi_t qi,
......
...@@ -1154,6 +1154,19 @@ interface nsIDOMHTMLElement : nsIDOMElement ...@@ -1154,6 +1154,19 @@ interface nsIDOMHTMLElement : nsIDOMElement
[ [
object, object,
uuid(c63517c5-8bab-4cd1-8694-bccafc32a195),
local
]
interface nsIDOMSVGElement : nsIDOMElement
{
nsresult GetOwnerSVGElement(nsIDOMSVGElement **aOwnerSVGElement);
nsresult GetViewportElement(nsIDOMSVGElement **aViewportElement);
nsresult GetSVGClassName(nsISupports **aClassName);
nsresult GetStyle(nsIDOMCSSStyleDeclaration **aStyle);
}
[
object,
uuid(59b80014-00f5-412d-846f-725494122d42), uuid(59b80014-00f5-412d-846f-725494122d42),
local local
] ]
......
...@@ -279,9 +279,11 @@ function test_document_owner() { ...@@ -279,9 +279,11 @@ function test_document_owner() {
} }
function test_style_properties() { function test_style_properties() {
var style = document.body.style; document.body.innerHTML = '<div>test</div><svg></svg>';
var current_style = document.body.currentStyle; var elem = document.body.firstChild;
var computed_style = window.getComputedStyle(document.body); var style = elem.style;
var current_style = elem.currentStyle;
var computed_style = window.getComputedStyle(elem);
var val; var val;
style.cssFloat = "left"; style.cssFloat = "left";
...@@ -350,7 +352,7 @@ function test_style_properties() { ...@@ -350,7 +352,7 @@ function test_style_properties() {
ok(computed_style.clip === "rect(1px, 1px, 10px, 10px)", ok(computed_style.clip === "rect(1px, 1px, 10px, 10px)",
"computed_style.clip = " + current_style.clip); "computed_style.clip = " + current_style.clip);
document.body.style.zIndex = 2; style.zIndex = 2;
ok(current_style.zIndex === 2, "current_style.zIndex = " + current_style.zIndex); ok(current_style.zIndex === 2, "current_style.zIndex = " + current_style.zIndex);
ok(computed_style.zIndex === 2, "computed_style.zIndex = " + computed_style.zIndex); ok(computed_style.zIndex === 2, "computed_style.zIndex = " + computed_style.zIndex);
...@@ -364,6 +366,12 @@ function test_style_properties() { ...@@ -364,6 +366,12 @@ function test_style_properties() {
ok(false, "expected exception"); ok(false, "expected exception");
}catch(e) {} }catch(e) {}
elem = elem.nextSibling;
computed_style = window.getComputedStyle(elem);
elem.style.zIndex = 4;
ok(computed_style.zIndex === 4, "computed_style.zIndex = " + computed_style.zIndex);
next_test(); next_test();
} }
......
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