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 = {
static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)
{
nsIDOMElementCSSInlineStyle *nselemstyle;
nsIDOMSVGElement *svg_element;
nsresult nsres;
if(!elem->dom_element) {
......@@ -10180,16 +10181,29 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration
nsres = nsIDOMElement_QueryInterface(elem->dom_element, &IID_nsIDOMElementCSSInlineStyle,
(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);
nsIDOMElementCSSInlineStyle_Release(nselemstyle);
if(NS_FAILED(nsres)) {
ERR("GetStyle failed: %08x\n", nsres);
return E_FAIL;
nsres = nsIDOMElement_QueryInterface(elem->dom_element, &IID_nsIDOMSVGElement, (void**)&svg_element);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMSVGElement_GetStyle(svg_element, ret);
nsIDOMSVGElement_Release(svg_element);
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,
......
......@@ -1154,6 +1154,19 @@ interface nsIDOMHTMLElement : nsIDOMElement
[
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),
local
]
......
......@@ -279,9 +279,11 @@ function test_document_owner() {
}
function test_style_properties() {
var style = document.body.style;
var current_style = document.body.currentStyle;
var computed_style = window.getComputedStyle(document.body);
document.body.innerHTML = '<div>test</div><svg></svg>';
var elem = document.body.firstChild;
var style = elem.style;
var current_style = elem.currentStyle;
var computed_style = window.getComputedStyle(elem);
var val;
style.cssFloat = "left";
......@@ -350,7 +352,7 @@ function test_style_properties() {
ok(computed_style.clip === "rect(1px, 1px, 10px, 10px)",
"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(computed_style.zIndex === 2, "computed_style.zIndex = " + computed_style.zIndex);
......@@ -364,6 +366,12 @@ function test_style_properties() {
ok(false, "expected exception");
}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();
}
......
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