Skip to content

Commit

Permalink
moveBefore: only call FlatParentChanged for the directly inserted node.
Browse files Browse the repository at this point in the history
To prevent from calling this on non-elements, ensure that the
StatePreservingAtomicMove flag is set only when the directly-moved
node is an element.

Bug: 352081025
Change-Id: I7f71c15509ad481d7d8c7e59fa60bc083d093a76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5791021
Reviewed-by: Rune Lillesveen <[email protected]>
Commit-Queue: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1343487}
  • Loading branch information
noamr authored and chromium-wpt-export-bot committed Aug 19, 2024
1 parent ff5b1bc commit d0b68d4
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions dom/nodes/moveBefore/tentative/moveBefore-shadow-inside.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<style>
section {
position: relative;
}
#item {
position: absolute;
inset: 0;
}
#section1 {
width: 200px;
height: 200px;
}

#section2 {
width: 300px;
height: 300px;
}
</style>
<section id="section1">
<div id="item">
<template shadowRootMode="open">
<style>
div {
position: absolute;
inset: 0;
background-color: var(--color, red);
}
</style>
<div></div>
</template>
</div>
</section>
<section id="section2">

</section>
<script>
promise_test(async () => {
const item = document.querySelector("#item");
document.querySelector("#section2").moveBefore(item, null);
await new Promise(resolve => requestAnimationFrame(() => resolve()));
assert_equals(item.shadowRoot.querySelector("div").getBoundingClientRect().width, 300);
});
</script>

0 comments on commit d0b68d4

Please sign in to comment.