flex overflow

This commit is contained in:
Christopher Chedeau
2014-04-22 09:56:48 -07:00
parent 4dd147e92a
commit f564effb5c
2 changed files with 19 additions and 0 deletions

View File

@@ -209,6 +209,9 @@ var computeLayout = (function() {
if (flexibleChildrenCount) {
var/*float*/ flexibleMainDim = remainingMainDim / flexibleChildrenCount;
if (flexibleMainDim < 0) {
flexibleMainDim = 0;
}
for (var/*int*/ i = 0; i < node.children.length; ++i) {
var/*css_node_t**/ child = node.children[i];
if (getFlex(child)) {

View File

@@ -645,6 +645,22 @@ describe('Layout', function() {
)
});
it('should layout node with flex and overflow', function() {
testLayout(
{style: {height: 300}, children: [
{style: {height: 600}},
{style: {flex: 1}}
]},
{width: 0, height: 300, top: 0, left: 0, children: [
{width: 0, height: 600, top: 0, left: 0},
{width: 0, height: 0, top: 600, left: 0}
]}
);
});
it('should layout randomly', function() {
function RNG(seed) {
this.state = seed;