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

Commit e0289a9

Browse files
emiliomoz-wptsync-bot
authored andcommitted
Fix the case where where a node with an up-to-date style loses its frame due to a DOM mutation of siblings.
This fixes another edge-case that I thought of while debugging this, I think this makes our behavior correct now. The comment and test-case should be self-descriptive. Differential Revision: https://phabricator.services.mozilla.com/D48135 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1585882 gecko-commit: ea10c9b6a81d795ab96a16e07ea2c64f0a0de247 gecko-integration-branch: autoland gecko-reviewers: heycam
1 parent 96ff703 commit e0289a9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
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 had an IB sibling removed</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+
<div></div>
17+
</span>
18+
<script>
19+
test(() => {
20+
let first = document.querySelector("div");
21+
let second = document.querySelector("div + div");
22+
23+
let oldWidth = getComputedStyle(second).width;
24+
assert_true(oldWidth.indexOf("px") !== -1, "Should return the used value for width");
25+
26+
first.remove();
27+
28+
assert_equals(getComputedStyle(second).width, oldWidth, "Should return the used value for width (after sibling removal)");
29+
}, "getComputedStyle() should return the correct used value for nodes that have had an IB-split sibling removed");
30+
</script>

0 commit comments

Comments
 (0)