<!DOCTYPE html>
<style>
div {
    overflow: hidden;
}
#root {
    width: 200px;
    height: 400px;
    background: red;
}
#content {
    background: green;
    width: 100%;
    height: 400px;
    display: block;
}
#container {
    width: 400px;
    height: 400px;
}
</style>
<script src="../../resources/check-layout.js"></script>
<div>
    crbug.com/497178: This test ensures we properly recompute preferred widths for
    nested subtree roots. If this test is ever flaky, it should be considered
    failing due the the non-deterministic way we iterate over subtree layout roots.
</div>
<div id="container">
    <div id="root">
        <div data-expected-width="400" id="content">OriginalText</div>
    </div>
</div>
<script>
document.body.offsetTop;
var rootElement = document.getElementById("root");
var content = document.getElementById("content");
content.innerText = "";
rootElement.style.width = "400px";
checkLayout("#content");
</script>
