<!DOCTYPE html>
<html>
<style>
.flexbox {
    position: relative;
    display: flex;
    background-color: grey;
    max-width: 100px;
    align-content: flex-start;
}
.flexbox > * {
    flex: none;
}
.title {
    margin-top: 1em;
}
.ltr {
    direction: ltr;
}
.rtl {
    direction: rtl;
}
.horizontal-tb {
    writing-mode: horizontal-tb;
}
.vertical-rl {
    writing-mode: vertical-rl;
}
.vertical-lr {
    writing-mode: vertical-lr;
}
.row {
    flex-flow: row;
}
.row-reverse {
    flex-flow: row-reverse;
}
.column {
    flex-flow: column;
}
.column-reverse {
    flex-flow: column-reverse;
}
.wrap {
    flex-wrap: wrap;
}
.wrap-reverse {
    flex-wrap: wrap-reverse;
}
.justify-content-flex-start {
    justify-content: flex-start;
}
.justify-content-flex-end {
    justify-content: flex-end;
}
.justify-content-center {
    justify-content: center;
}
.justify-content-space-between {
    justify-content: space-between;
}
.justify-content-space-around {
    justify-content: space-around;
}
.flexbox > :nth-child(1) {
    background-color: #0f0;
}
.flexbox > :nth-child(2) {
    background-color: #090;
}
.flexbox > :nth-child(3) {
    background-color: #00f;
}
.flexbox > :nth-child(4) {
    background-color: #009;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<body onload="checkLayout('.flexbox')">
<div id=log></div>

<script>
var expectations = {
    'horizontal-tb': {
        'row': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 40, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, 10],
                        'child4': [20, 10, 50, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, 10],
                        'child4': [20, 10, 55, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 10],
                        'child2': [20, 10, 40, 10],
                        'child3': [40, 10, 0, 0],
                        'child4': [20, 10, 40, 0],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 10],
                        'child2': [20, 10, 60, 10],
                        'child3': [40, 10, 20, 0],
                        'child4': [20, 10, 60, 0],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 10, 10],
                        'child2': [20, 10, 50, 10],
                        'child3': [40, 10, 10, 0],
                        'child4': [20, 10, 50, 0],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 10],
                        'child2': [20, 10, 60, 10],
                        'child3': [40, 10, 0, 0],
                        'child4': [20, 10, 60, 0],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 5, 10],
                        'child2': [20, 10, 55, 10],
                        'child3': [40, 10, 5, 0],
                        'child4': [20, 10, 55, 0],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 20, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, 10],
                        'child4': [20, 10, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, 10],
                        'child4': [20, 10, 5, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 10],
                        'child2': [20, 10, 20, 10],
                        'child3': [40, 10, 40, 0],
                        'child4': [20, 10, 20, 0],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 10],
                        'child2': [20, 10, 0, 10],
                        'child3': [40, 10, 20, 0],
                        'child4': [20, 10, 0, 0],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 30, 10],
                        'child2': [20, 10, 10, 10],
                        'child3': [40, 10, 30, 0],
                        'child4': [20, 10, 10, 0],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 10],
                        'child2': [20, 10, 0, 10],
                        'child3': [40, 10, 40, 0],
                        'child4': [20, 10, 0, 0],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 35, 10],
                        'child2': [20, 10, 5, 10],
                        'child3': [40, 10, 35, 0],
                        'child4': [20, 10, 5, 0],
                    },
                },
            },
        },
        'column': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 40],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 40],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 60],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 10],
                        'child2': [10, 20, 0, 50],
                        'child3': [10, 40, 10, 10],
                        'child4': [10, 20, 10, 50],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 60],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 5],
                        'child2': [10, 20, 0, 55],
                        'child3': [10, 40, 10, 5],
                        'child4': [10, 20, 10, 55],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 0],
                        'child2': [10, 20, 90, 40],
                        'child3': [10, 40, 80, 0],
                        'child4': [10, 20, 80, 40],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 20],
                        'child2': [10, 20, 90, 60],
                        'child3': [10, 40, 80, 20],
                        'child4': [10, 20, 80, 60],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 10],
                        'child2': [10, 20, 90, 50],
                        'child3': [10, 40, 80, 10],
                        'child4': [10, 20, 80, 50],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 0],
                        'child2': [10, 20, 90, 60],
                        'child3': [10, 40, 80, 0],
                        'child4': [10, 20, 80, 60],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 5],
                        'child2': [10, 20, 90, 55],
                        'child3': [10, 40, 80, 5],
                        'child4': [10, 20, 80, 55],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 0],
                        'child2': [10, 20, 90, 40],
                        'child3': [10, 40, 80, 0],
                        'child4': [10, 20, 80, 40],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 20],
                        'child2': [10, 20, 90, 60],
                        'child3': [10, 40, 80, 20],
                        'child4': [10, 20, 80, 60],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 10],
                        'child2': [10, 20, 90, 50],
                        'child3': [10, 40, 80, 10],
                        'child4': [10, 20, 80, 50],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 0],
                        'child2': [10, 20, 90, 60],
                        'child3': [10, 40, 80, 0],
                        'child4': [10, 20, 80, 60],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 5],
                        'child2': [10, 20, 90, 55],
                        'child3': [10, 40, 80, 5],
                        'child4': [10, 20, 80, 55],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 40],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 40],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 60],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 10],
                        'child2': [10, 20, 0, 50],
                        'child3': [10, 40, 10, 10],
                        'child4': [10, 20, 10, 50],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 60],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 5],
                        'child2': [10, 20, 0, 55],
                        'child3': [10, 40, 10, 5],
                        'child4': [10, 20, 10, 55],
                    },
                },
            },
        },
        'row-reverse': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 20, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, 10],
                        'child4': [20, 10, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, 10],
                        'child4': [20, 10, 5, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 10],
                        'child2': [20, 10, 20, 10],
                        'child3': [40, 10, 40, 0],
                        'child4': [20, 10, 20, 0],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 10],
                        'child2': [20, 10, 0, 10],
                        'child3': [40, 10, 20, 0],
                        'child4': [20, 10, 0, 0],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 30, 10],
                        'child2': [20, 10, 10, 10],
                        'child3': [40, 10, 30, 0],
                        'child4': [20, 10, 10, 0],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 40, 10],
                        'child2': [20, 10, 0, 10],
                        'child3': [40, 10, 40, 0],
                        'child4': [20, 10, 0, 0],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 35, 10],
                        'child2': [20, 10, 5, 10],
                        'child3': [40, 10, 35, 0],
                        'child4': [20, 10, 5, 0],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 40, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, 10],
                        'child4': [20, 10, 50, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, 10],
                        'child4': [20, 10, 55, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 10],
                        'child2': [20, 10, 40, 10],
                        'child3': [40, 10, 0, 0],
                        'child4': [20, 10, 40, 0],
                    },
                    'flex-end': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 20, 10],
                        'child2': [20, 10, 60, 10],
                        'child3': [40, 10, 20, 0],
                        'child4': [20, 10, 60, 0],
                    },
                    'center': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 10, 10],
                        'child2': [20, 10, 50, 10],
                        'child3': [40, 10, 10, 0],
                        'child4': [20, 10, 50, 0],
                    },
                    'space-between': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 0, 10],
                        'child2': [20, 10, 60, 10],
                        'child3': [40, 10, 0, 0],
                        'child4': [20, 10, 60, 0],
                    },
                    'space-around': {
                        'flexbox': [80, 20],
                        'child1': [40, 10, 5, 10],
                        'child2': [20, 10, 55, 10],
                        'child3': [40, 10, 5, 0],
                        'child4': [20, 10, 55, 0],
                    },
                },
            },
        },
        'column-reverse': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 20],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 20],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 0],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 30],
                        'child2': [10, 20, 0, 10],
                        'child3': [10, 40, 10, 30],
                        'child4': [10, 20, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 0],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 35],
                        'child2': [10, 20, 0, 5],
                        'child3': [10, 40, 10, 35],
                        'child4': [10, 20, 10, 5],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 40],
                        'child2': [10, 20, 90, 20],
                        'child3': [10, 40, 80, 40],
                        'child4': [10, 20, 80, 20],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 20],
                        'child2': [10, 20, 90, 0],
                        'child3': [10, 40, 80, 20],
                        'child4': [10, 20, 80, 0],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 30],
                        'child2': [10, 20, 90, 10],
                        'child3': [10, 40, 80, 30],
                        'child4': [10, 20, 80, 10],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 40],
                        'child2': [10, 20, 90, 0],
                        'child3': [10, 40, 80, 40],
                        'child4': [10, 20, 80, 0],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 35],
                        'child2': [10, 20, 90, 5],
                        'child3': [10, 40, 80, 35],
                        'child4': [10, 20, 80, 5],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 40],
                        'child2': [10, 20, 90, 20],
                        'child3': [10, 40, 80, 40],
                        'child4': [10, 20, 80, 20],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 20],
                        'child2': [10, 20, 90, 0],
                        'child3': [10, 40, 80, 20],
                        'child4': [10, 20, 80, 0],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 30],
                        'child2': [10, 20, 90, 10],
                        'child3': [10, 40, 80, 30],
                        'child4': [10, 20, 80, 10],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 40],
                        'child2': [10, 20, 90, 0],
                        'child3': [10, 40, 80, 40],
                        'child4': [10, 20, 80, 0],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 90, 35],
                        'child2': [10, 20, 90, 5],
                        'child3': [10, 40, 80, 35],
                        'child4': [10, 20, 80, 5],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 20],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 20],
                    },
                    'flex-end': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 0],
                    },
                    'center': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 30],
                        'child2': [10, 20, 0, 10],
                        'child3': [10, 40, 10, 30],
                        'child4': [10, 20, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 0],
                    },
                    'space-around': {
                        'flexbox': [100, 80],
                        'child1': [10, 40, 0, 35],
                        'child2': [10, 20, 0, 5],
                        'child3': [10, 40, 10, 35],
                        'child4': [10, 20, 10, 5],
                    },
                },
            },
        },
    },
    'vertical-rl': {
        'row': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 40],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 10],
                        'child2': [10, 20, 10, 50],
                        'child3': [10, 40, 0, 10],
                        'child4': [10, 20, 0, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 5],
                        'child2': [10, 20, 10, 55],
                        'child3': [10, 40, 0, 5],
                        'child4': [10, 20, 0, 55],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 40],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 10],
                        'child2': [10, 20, 0, 50],
                        'child3': [10, 40, 10, 10],
                        'child4': [10, 20, 10, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 5],
                        'child2': [10, 20, 0, 55],
                        'child3': [10, 40, 10, 5],
                        'child4': [10, 20, 10, 55],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 20],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 30],
                        'child2': [10, 20, 10, 10],
                        'child3': [10, 40, 0, 30],
                        'child4': [10, 20, 0, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 35],
                        'child2': [10, 20, 10, 5],
                        'child3': [10, 40, 0, 35],
                        'child4': [10, 20, 0, 5],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 20],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 30],
                        'child2': [10, 20, 0, 10],
                        'child3': [10, 40, 10, 30],
                        'child4': [10, 20, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 35],
                        'child2': [10, 20, 0, 5],
                        'child3': [10, 40, 10, 35],
                        'child4': [10, 20, 10, 5],
                    },
                },
            },
        },
        'column': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 20, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, 10],
                        'child4': [20, 10, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, 10],
                        'child4': [20, 10, 5, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 20, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, -10],
                        'child4': [20, 10, 10, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, -10],
                        'child4': [20, 10, 5, -10],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 20, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, -10],
                        'child4': [20, 10, 10, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, -10],
                        'child4': [20, 10, 5, -10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 20, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, 10],
                        'child4': [20, 10, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, 10],
                        'child4': [20, 10, 5, 10],
                    },
                },
            },
        },
        'row-reverse': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 20],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 30],
                        'child2': [10, 20, 10, 10],
                        'child3': [10, 40, 0, 30],
                        'child4': [10, 20, 0, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 35],
                        'child2': [10, 20, 10, 5],
                        'child3': [10, 40, 0, 35],
                        'child4': [10, 20, 0, 5],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 20],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 30],
                        'child2': [10, 20, 0, 10],
                        'child3': [10, 40, 10, 30],
                        'child4': [10, 20, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 35],
                        'child2': [10, 20, 0, 5],
                        'child3': [10, 40, 10, 35],
                        'child4': [10, 20, 10, 5],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 40],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 10],
                        'child2': [10, 20, 10, 50],
                        'child3': [10, 40, 0, 10],
                        'child4': [10, 20, 0, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 5],
                        'child2': [10, 20, 10, 55],
                        'child3': [10, 40, 0, 5],
                        'child4': [10, 20, 0, 55],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 40],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 10],
                        'child2': [10, 20, 0, 50],
                        'child3': [10, 40, 10, 10],
                        'child4': [10, 20, 10, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 5],
                        'child2': [10, 20, 0, 55],
                        'child3': [10, 40, 10, 5],
                        'child4': [10, 20, 10, 55],
                    },
                },
            },
        },
        'column-reverse': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 40, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, 10],
                        'child4': [20, 10, 50, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, 10],
                        'child4': [20, 10, 55, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 40, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, -10],
                        'child4': [20, 10, 50, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, -10],
                        'child4': [20, 10, 55, -10],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 40, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, -10],
                        'child4': [20, 10, 50, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, -10],
                        'child4': [20, 10, 55, -10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 40, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, 10],
                        'child4': [20, 10, 50, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, 10],
                        'child4': [20, 10, 55, 10],
                    },
                },
            },
        },
    },
    'vertical-lr': {
        'row': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 40],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 10],
                        'child2': [10, 20, 0, 50],
                        'child3': [10, 40, 10, 10],
                        'child4': [10, 20, 10, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 5],
                        'child2': [10, 20, 0, 55],
                        'child3': [10, 40, 10, 5],
                        'child4': [10, 20, 10, 55],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 40],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 10],
                        'child2': [10, 20, 10, 50],
                        'child3': [10, 40, 0, 10],
                        'child4': [10, 20, 0, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 5],
                        'child2': [10, 20, 10, 55],
                        'child3': [10, 40, 0, 5],
                        'child4': [10, 20, 0, 55],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 20],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 30],
                        'child2': [10, 20, 0, 10],
                        'child3': [10, 40, 10, 30],
                        'child4': [10, 20, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 35],
                        'child2': [10, 20, 0, 5],
                        'child3': [10, 40, 10, 35],
                        'child4': [10, 20, 10, 5],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 20],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 30],
                        'child2': [10, 20, 10, 10],
                        'child3': [10, 40, 0, 30],
                        'child4': [10, 20, 0, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 35],
                        'child2': [10, 20, 10, 5],
                        'child3': [10, 40, 0, 35],
                        'child4': [10, 20, 0, 5],
                    },
                },
            },
        },
        'column': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 40, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, 10],
                        'child4': [20, 10, 50, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, 10],
                        'child4': [20, 10, 55, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 40, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, -10],
                        'child4': [20, 10, 50, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, -10],
                        'child4': [20, 10, 55, -10],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 40, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, -10],
                        'child4': [20, 10, 50, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, -10],
                        'child4': [20, 10, 60, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, -10],
                        'child4': [20, 10, 55, -10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 40, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 40, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 10, 0],
                        'child2': [20, 10, 50, 0],
                        'child3': [40, 10, 10, 10],
                        'child4': [20, 10, 50, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 0, 0],
                        'child2': [20, 10, 60, 0],
                        'child3': [40, 10, 0, 10],
                        'child4': [20, 10, 60, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 5, 0],
                        'child2': [20, 10, 55, 0],
                        'child3': [40, 10, 5, 10],
                        'child4': [20, 10, 55, 10],
                    },
                },
            },
        },
        'row-reverse': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 20],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 30],
                        'child2': [10, 20, 0, 10],
                        'child3': [10, 40, 10, 30],
                        'child4': [10, 20, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 40],
                        'child2': [10, 20, 0, 0],
                        'child3': [10, 40, 10, 40],
                        'child4': [10, 20, 10, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 35],
                        'child2': [10, 20, 0, 5],
                        'child3': [10, 40, 10, 35],
                        'child4': [10, 20, 10, 5],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 20],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 20],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 0],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 30],
                        'child2': [10, 20, 10, 10],
                        'child3': [10, 40, 0, 30],
                        'child4': [10, 20, 0, 10],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 40],
                        'child2': [10, 20, 10, 0],
                        'child3': [10, 40, 0, 40],
                        'child4': [10, 20, 0, 0],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 35],
                        'child2': [10, 20, 10, 5],
                        'child3': [10, 40, 0, 35],
                        'child4': [10, 20, 0, 5],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 40],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 20],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 20],
                        'child4': [10, 20, 10, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 10],
                        'child2': [10, 20, 0, 50],
                        'child3': [10, 40, 10, 10],
                        'child4': [10, 20, 10, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 0],
                        'child2': [10, 20, 0, 60],
                        'child3': [10, 40, 10, 0],
                        'child4': [10, 20, 10, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 0, 5],
                        'child2': [10, 20, 0, 55],
                        'child3': [10, 40, 10, 5],
                        'child4': [10, 20, 10, 55],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 40],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 40],
                    },
                    'flex-end': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 20],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 20],
                        'child4': [10, 20, 0, 60],
                    },
                    'center': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 10],
                        'child2': [10, 20, 10, 50],
                        'child3': [10, 40, 0, 10],
                        'child4': [10, 20, 0, 50],
                    },
                    'space-between': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 0],
                        'child2': [10, 20, 10, 60],
                        'child3': [10, 40, 0, 0],
                        'child4': [10, 20, 0, 60],
                    },
                    'space-around': {
                        'flexbox': [20, 80],
                        'child1': [10, 40, 10, 5],
                        'child2': [10, 20, 10, 55],
                        'child3': [10, 40, 0, 5],
                        'child4': [10, 20, 0, 55],
                    },
                },
            },
        },
        'column-reverse': {
            'ltr': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 20, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, 10],
                        'child4': [20, 10, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, 10],
                        'child4': [20, 10, 5, 10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 20, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, -10],
                        'child4': [20, 10, 10, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, -10],
                        'child4': [20, 10, 5, -10],
                    },
                },
            },
            'rtl': {
                'wrap': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 20, -10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, -10],
                        'child4': [20, 10, 10, -10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, -10],
                        'child4': [20, 10, 0, -10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, -10],
                        'child4': [20, 10, 5, -10],
                    },
                },
                'wrap-reverse': {
                    'flex-start': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 20, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 20, 10],
                    },
                    'flex-end': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 20, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 20, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'center': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 30, 0],
                        'child2': [20, 10, 10, 0],
                        'child3': [40, 10, 30, 10],
                        'child4': [20, 10, 10, 10],
                    },
                    'space-between': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 40, 0],
                        'child2': [20, 10, 0, 0],
                        'child3': [40, 10, 40, 10],
                        'child4': [20, 10, 0, 10],
                    },
                    'space-around': {
                        'flexbox': [80, 10],
                        'child1': [40, 10, 35, 0],
                        'child2': [20, 10, 5, 0],
                        'child3': [40, 10, 35, 10],
                        'child4': [20, 10, 5, 10],
                    },
                },
            },
        },
    },
};

function mainAxisDirection(writingMode, flexDirection)
{
    if ((writingMode.indexOf('horizontal') != -1 && flexDirection.indexOf('row') != -1)
        || (writingMode.indexOf('vertical') != -1 && flexDirection.indexOf('column') != -1))
        return 'width';
    return 'height';
}

function addChild(flexbox, mainAxis, crossAxis, preferredSize, crossAxisLength, expectations)
{
    var child = document.createElement('div');
    child.setAttribute('style', mainAxis + ': ' + preferredSize + 'px;'
        + crossAxis + ': ' + crossAxisLength + 'px;');

    child.setAttribute("data-expected-width", expectations[0]);
    child.setAttribute("data-expected-height", expectations[1]);
    child.setAttribute("data-offset-x", expectations[2]);
    child.setAttribute("data-offset-y", expectations[3]);

    flexbox.appendChild(child);
}

var writingModes = ['horizontal-tb', 'vertical-rl', 'vertical-lr'];
var flexDirections = ['row', 'column', 'row-reverse', 'column-reverse'];
var directions = ['ltr', 'rtl'];
var wraps = ['wrap', 'wrap-reverse'];
var justifyContents = ['flex-start', 'flex-end', 'center', 'space-between', 'space-around'];

writingModes.forEach(function(writingMode) {
    flexDirections.forEach(function(flexDirection) {
        directions.forEach(function(direction) {
            wraps.forEach(function(wrap) {
                justifyContents.forEach(function(justifyContent) {
                    var flexboxClassName = writingMode + ' ' + direction + ' ' + flexDirection + ' ' + wrap + ' justify-content-' + justifyContent;
                    var title = document.createElement('div');
                    title.className = 'title';
                    title.innerHTML = flexboxClassName;
                    document.body.appendChild(title);

                    var mainAxis = mainAxisDirection(writingMode, flexDirection);
                    var crossAxis = (mainAxis == 'width') ? 'height' : 'width';

                    var flexbox = document.createElement('div');
                    flexbox.className = 'flexbox ' + flexboxClassName;
                    flexbox.setAttribute('style', mainAxis + ': 80px');

                    var baselineMargin = (flexDirection.indexOf('row') != -1) ? 'margin-block-start: 5px' : 'margin-inline-start: 5px';

                    var testExpectations = expectations[writingMode][flexDirection][direction][wrap][justifyContent];
                    addChild(flexbox, mainAxis, crossAxis, 40, '10', testExpectations['child1']);
                    addChild(flexbox, mainAxis, crossAxis, 20, '10', testExpectations['child2']);
                    addChild(flexbox, mainAxis, crossAxis, 40, '10', testExpectations['child3']);
                    addChild(flexbox, mainAxis, crossAxis, 20, '10', testExpectations['child4']);

                    flexbox.setAttribute("data-expected-width", testExpectations.flexbox[0]);
                    flexbox.setAttribute("data-expected-height", testExpectations.flexbox[1]);

                    document.body.appendChild(flexbox);
                })
            })
        })
    })
})
</script>
</body>
</html>
