Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 96ff703

Browse files
emiliomoz-wptsync-bot
authored andcommitted
Fix needs_frame() check to account for the case where an ancestor of us has been reconstructed regularly, not via lazy frame construction.
This is a pre-existing bug, and this would be enough to fix the website, but this is still not 100% correct. More on that in a second. Differential Revision: https://phabricator.services.mozilla.com/D48134 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1585882 gecko-commit: df80909c82323e153691e01b3a15d19f4929cba0 gecko-integration-branch: autoland gecko-reviewers: heycam
1 parent 0d58de5 commit 96ff703

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!doctype html>
2+
<title>getComputedStyle() returns the right style for animating nodes that have been just inserted into the document, and that have an ancestor whose layout tree was recreated (like an IB-split)</title>
3+
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
4+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1585882">
5+
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
6+
<link rel="author" title="Mozilla" href="https://mozilla.org">
7+
<script src=/resources/testharness.js></script>
8+
<script src=/resources/testharnessreport.js></script>
9+
<style>
10+
@keyframes my-animation {
11+
from { color: green; }
12+
to { color: green; }
13+
}
14+
div {
15+
color: red;
16+
animation: my-animation 1s infinite linear paused;
17+
}
18+
</style>
19+
<span>
20+
<div></div>
21+
</span>
22+
<script>
23+
test(() => {
24+
let oldDiv = document.querySelector("div");
25+
window.unused = oldDiv.getBoundingClientRect(); // update layout
26+
27+
assert_equals(getComputedStyle(oldDiv).color, "rgb(0, 128, 0)", "Should take color from the animation");
28+
29+
let newDiv = document.createElement("div");
30+
oldDiv.replaceWith(newDiv);
31+
32+
assert_equals(getComputedStyle(newDiv).color, "rgb(0, 128, 0)", "Should take color from the animation (just inserted into the document)");
33+
}, "getComputedStyle() should return animation styles for nodes just inserted into the document, even if they're in an IB-split");
34+
</script>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!doctype html>
2+
<title>getComputedStyle() returns the right style for layout-dependent properties for nodes that have been just inserted into the document, and that have an ancestor whose layout tree was recreated (like an IB-split)</title>
3+
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
4+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1585882">
5+
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
6+
<link rel="author" title="Mozilla" href="https://mozilla.org">
7+
<script src=/resources/testharness.js></script>
8+
<script src=/resources/testharnessreport.js></script>
9+
<style>
10+
div {
11+
width: 100%;
12+
}
13+
</style>
14+
<span>
15+
<div></div>
16+
</span>
17+
<script>
18+
test(() => {
19+
let oldDiv = document.querySelector("div");
20+
window.unused = oldDiv.getBoundingClientRect(); // update layout
21+
22+
let oldWidth = getComputedStyle(oldDiv).width;
23+
assert_true(oldWidth.indexOf("px") !== -1, "Should return the used value for width");
24+
25+
let newDiv = document.createElement("div");
26+
oldDiv.replaceWith(newDiv);
27+
28+
assert_equals(getComputedStyle(newDiv).width, oldWidth, "Should return the used value for width (just inserted into the document)");
29+
}, "getComputedStyle() should return used value correctly for nodes just inserted into the document, even if they're in an IB-split");
30+
</script>

0 commit comments

Comments
 (0)