<!DOCTYPE html>
<html>
<head>
<style>
#flexbox {
  display: -webkit-flex;
}

#left {
  -webkit-flex: 1;
  background-color: yellow;
}

#content {
  -webkit-flex: 1;
  background-color: grey;
}
</style>
<script>
// This test makes sure that we repaint the right region of a flexbox when
// changing the flex values. Only the middle of the test page should be
// repainted. If the top of the test page (above the flexbox) is repainted,
// this test fails.

function setFlex(id, animationPercentage, start, end) {
  var flexValue = start + ((end - start) * animationPercentage);
  document.getElementById(id).style.webkitFlex = flexValue + " 0 0px";
}

function step(count) {
    var animationPercentage = count ? 1 : .9;
    setFlex("content", animationPercentage, 1, 5);

    if (!count)
        setTimeout(step.bind(null, 1));
    else {
        if (window.testRunner)
            testRunner.notifyDone();
    }
}

window.onload = function() {
    if (window.testRunner) {
        testRunner.dumpAsText(true);
        document.body.offsetTop;
        testRunner.display();
        testRunner.waitUntilDone();
    }
    window.startTime = Date.now();

    setTimeout(step.bind(null, 0), 0);
};
</script>
</head>
<body>
<br><br><br><br><br><br>
<div id="flexbox">
<div id="left"></div>
<div id="content">
<p style="margin: 0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean laoreet dolor id urna eleifend aliquet. Nulla vel dolor ipsum. Aliquam ut turpis nisl, in vulputate sapien. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed congue magna vitae dolor feugiat vehicula. Sed volutpat, tellus vel varius vestibulum, purus quam mollis sapien, in condimentum leo neque sed nulla. Nunc quis porta elit. Pellentesque erat lectus, ultricies a lobortis id, faucibus id quam.</p>
</div>
</body>
</html>
