Jacek Caban : mshtml: Support SVG element style.
Alexandre Julliard
julliard at winehq.org
Thu Mar 28 18:35:12 CDT 2019
Module: wine
Branch: master
Commit: 43ae349c96564b8afe65a5bb30877e558673f851
URL: https://source.winehq.org/git/wine.git/?a=commit;h=43ae349c96564b8afe65a5bb30877e558673f851
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Mar 28 15:56:29 2019 +0100
mshtml: Support SVG element style.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlstyle.c | 28 +++++++++++++++++++++-------
dlls/mshtml/nsiface.idl | 13 +++++++++++++
dlls/mshtml/tests/elements.js | 16 ++++++++++++----
3 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 1a3f7b9..003ef8f 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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,
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index 560fcd1..09148aa 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -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
]
diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
index 9645c0b..1df2b07 100644
--- a/dlls/mshtml/tests/elements.js
+++ b/dlls/mshtml/tests/elements.js
@@ -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();
}
More information about the wine-cvs
mailing list