зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1368240: Very basic smoketests for this. r=heycam
I need to add an API to WindowUtils to test this further I fear. MozReview-Commit-ID: CdUhcp545a7
This commit is contained in:
Родитель
0970b24aee
Коммит
29c3b7700c
|
@ -224,6 +224,8 @@ skip-if = toolkit == 'android'
|
|||
[test_initial_computation.html]
|
||||
skip-if = toolkit == 'android'
|
||||
[test_initial_storage.html]
|
||||
[test_invalidation_basic.html]
|
||||
skip-if = !stylo
|
||||
[test_keyframes_rules.html]
|
||||
[test_keyframes_vendor_prefix.html]
|
||||
[test_load_events_on_stylesheets.html]
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
Test for bug 1368240: We only invalidate style as little as needed
|
||||
</title>
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<style>
|
||||
.foo .bar {
|
||||
color: red;
|
||||
}
|
||||
#container ~ .bar {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
// TODO(emilio): Add an API to get the style contexts we've recreated, to make
|
||||
// more elaborated tests.
|
||||
document.documentElement.offsetTop;
|
||||
const initialRestyleGeneration = utils.restyleGeneration;
|
||||
|
||||
// Normally we'd restyle the whole subtree in this case, but we should go down
|
||||
// the tree invalidating as little as needed (nothing in this case).
|
||||
container.classList.add("foo");
|
||||
document.documentElement.offsetTop;
|
||||
is(utils.restyleGeneration, initialRestyleGeneration,
|
||||
"Shouldn't have restyled any descendant");
|
||||
|
||||
container.setAttribute("id", "");
|
||||
document.documentElement.offsetTop;
|
||||
is(utils.restyleGeneration, initialRestyleGeneration,
|
||||
"Shouldn't have restyled any sibling");
|
||||
|
||||
SimpleTest.finish();
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче