mshtml: Expose IHTMLStyleSheet4 to scripts.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9756574f88
commit
1afbe2e1ea
|
@ -1102,6 +1102,12 @@ static const IHTMLStyleSheet4Vtbl HTMLStyleSheet4Vtbl = {
|
||||||
HTMLStyleSheet4_deleteRule,
|
HTMLStyleSheet4_deleteRule,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void HTMLStyleSheet_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
|
||||||
|
{
|
||||||
|
if(mode >= COMPAT_MODE_IE9)
|
||||||
|
dispex_info_add_interface(info, IHTMLStyleSheet4_tid, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static const tid_t HTMLStyleSheet_iface_tids[] = {
|
static const tid_t HTMLStyleSheet_iface_tids[] = {
|
||||||
IHTMLStyleSheet_tid,
|
IHTMLStyleSheet_tid,
|
||||||
0
|
0
|
||||||
|
@ -1109,7 +1115,8 @@ static const tid_t HTMLStyleSheet_iface_tids[] = {
|
||||||
static dispex_static_data_t HTMLStyleSheet_dispex = {
|
static dispex_static_data_t HTMLStyleSheet_dispex = {
|
||||||
NULL,
|
NULL,
|
||||||
DispHTMLStyleSheet_tid,
|
DispHTMLStyleSheet_tid,
|
||||||
HTMLStyleSheet_iface_tids
|
HTMLStyleSheet_iface_tids,
|
||||||
|
HTMLStyleSheet_init_dispex_info
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_mode, IHTMLStyleSheet **ret)
|
HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_mode, IHTMLStyleSheet **ret)
|
||||||
|
|
|
@ -134,6 +134,42 @@ sync_test("xhr_props", function() {
|
||||||
test_exposed("dispatchEvent", v >= 9);
|
test_exposed("dispatchEvent", v >= 9);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sync_test("stylesheet_props", function() {
|
||||||
|
var v = document.documentMode;
|
||||||
|
var elem = document.createElement("style");
|
||||||
|
document.body.appendChild(elem);
|
||||||
|
var sheet = v >= 9 ? elem.sheet : elem.styleSheet;
|
||||||
|
|
||||||
|
function test_exposed(prop, expect) {
|
||||||
|
if(expect)
|
||||||
|
ok(prop in sheet, prop + " not found in style sheet.");
|
||||||
|
else
|
||||||
|
ok(!(prop in sheet), prop + " found in style sheet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
test_exposed("href", true);
|
||||||
|
test_exposed("title", true);
|
||||||
|
test_exposed("type", true);
|
||||||
|
test_exposed("media", true);
|
||||||
|
test_exposed("ownerNode", v >= 9);
|
||||||
|
test_exposed("ownerRule", v >= 9);
|
||||||
|
test_exposed("cssRules", v >= 9);
|
||||||
|
test_exposed("insertRule", v >= 9);
|
||||||
|
test_exposed("deleteRule", v >= 9);
|
||||||
|
test_exposed("disabled", true);
|
||||||
|
test_exposed("parentStyleSheet", true);
|
||||||
|
test_exposed("owningElement", true);
|
||||||
|
test_exposed("readOnly", true);
|
||||||
|
test_exposed("imports", true);
|
||||||
|
test_exposed("id", true);
|
||||||
|
test_exposed("addImport", true);
|
||||||
|
test_exposed("addRule", true);
|
||||||
|
test_exposed("removeImport", true);
|
||||||
|
test_exposed("removeRule", true);
|
||||||
|
test_exposed("cssText", true);
|
||||||
|
test_exposed("rules", true);
|
||||||
|
});
|
||||||
|
|
||||||
sync_test("xhr open", function() {
|
sync_test("xhr open", function() {
|
||||||
var e = false;
|
var e = false;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -381,6 +381,7 @@ sync_test("style_properties", function() {
|
||||||
|
|
||||||
sync_test("stylesheets", function() {
|
sync_test("stylesheets", function() {
|
||||||
document.body.innerHTML = '<style>.div { margin-right: 1px; }</style>';
|
document.body.innerHTML = '<style>.div { margin-right: 1px; }</style>';
|
||||||
|
var elem = document.body.firstChild;
|
||||||
|
|
||||||
ok(document.styleSheets.length === 1, "document.styleSheets.length = " + document.styleSheets.length);
|
ok(document.styleSheets.length === 1, "document.styleSheets.length = " + document.styleSheets.length);
|
||||||
|
|
||||||
|
@ -393,6 +394,17 @@ sync_test("stylesheets", function() {
|
||||||
stylesheet.rules.item(1);
|
stylesheet.rules.item(1);
|
||||||
ok(false, "expected exception");
|
ok(false, "expected exception");
|
||||||
}catch(e) {}
|
}catch(e) {}
|
||||||
|
|
||||||
|
ok(stylesheet.href === null, "stylesheet.href = " + stylesheet.href);
|
||||||
|
|
||||||
|
var id = stylesheet.insertRule(".input { margin-left: 1px; }", 0);
|
||||||
|
ok(id === 0, "id = " + id);
|
||||||
|
ok(document.styleSheets.length === 1, "document.styleSheets.length = " + document.styleSheets.length);
|
||||||
|
|
||||||
|
try {
|
||||||
|
stylesheet.insertRule(".input { margin-left: 1px; }", 3);
|
||||||
|
ok(false, "expected exception");
|
||||||
|
}catch(e) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
sync_test("storage", function() {
|
sync_test("storage", function() {
|
||||||
|
|
Loading…
Reference in New Issue