diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-horiz-001v.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-horiz-001v.xhtml
new file mode 100644
index 0000000000..f1dfdfdb86
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-horiz-001v.xhtml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+ CSS Test: Testing flexbox layout algorithm property on block flex items in a horizontal flex container
+ (with various writing-modes on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-vert-001v.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-vert-001v.xhtml
new file mode 100644
index 0000000000..da943dfc56
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-vert-001v.xhtml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+ CSS Test: Testing flexbox layout algorithm property on block flex items in a vertical flex container
+ (with various writing-modes on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-001v.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-001v.xhtml
new file mode 100644
index 0000000000..ad623d77f7
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-001v.xhtml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ CSS Test: Testing flexbox layout algorithm property on canvas flex items in a horizontal flex container
+ (with a vertical writing-mode on the canvas flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ some words
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-001v.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-001v.xhtml
new file mode 100644
index 0000000000..057f63ae62
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-001v.xhtml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+ CSS Test: Testing flexbox layout algorithm property on canvas flex items in a vertical flex container
+ (with a vertical writing-mode on the canvas flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ a b
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-001v.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-001v.html
new file mode 100644
index 0000000000..4cc910b9e2
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-001v.html
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ CSS Test: Testing how explicit main-size & cross-size constraints
+ influence sizing on non-stretched flex item w/ intrinsic ratio
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-002v.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-002v.html
new file mode 100644
index 0000000000..0df92f9954
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-002v.html
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ CSS Test: Testing how explicit main-size & cross-size constraints
+ influence sizing on non-stretched flex item w/ intrinsic ratio
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-003v.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-003v.html
new file mode 100644
index 0000000000..cb9275fd8c
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-003v.html
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ CSS Test: Testing how explicit main-size & cross-size constraints
+ influence sizing on stretched flex item w/ intrinsic ratio
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-004v.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-004v.html
new file mode 100644
index 0000000000..01c5271c45
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-004v.html
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ CSS Test: Testing how explicit main-size & cross-size constraints
+ influence sizing on stretched flex item w/ intrinsic ratio
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-005v.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-005v.html
new file mode 100644
index 0000000000..ed1dcace0f
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-005v.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+ CSS Test: Testing how explicit main-size & cross-size constraints
+ influence sizing on non-stretched flexible flex item w/ intrinsic ratio
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-006v.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-006v.html
new file mode 100644
index 0000000000..8c12fad8c7
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-intrinsic-ratio-006v.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+ CSS Test: Testing how explicit main-size & cross-size constraints
+ influence sizing on non-stretched flexible flex item w/ intrinsic ratio
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-002v.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-002v.xhtml
new file mode 100644
index 0000000000..a02e3406c9
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-002v.xhtml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+ CSS Test: Testing margins, borders, and padding on flex items in a horizontal flex container
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-003v.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-003v.xhtml
new file mode 100644
index 0000000000..8baef30227
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-003v.xhtml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+ CSS Test: Testing borders and padding on a horizontal flex container and its flex items
+ (with a vertical writing-mode on the flex items).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-010-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-010-ref.html
new file mode 100644
index 0000000000..e488416412
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-010-ref.html
@@ -0,0 +1,94 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-010.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-010.html
new file mode 100644
index 0000000000..55c50e850f
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-010.html
@@ -0,0 +1,88 @@
+
+
+
+
+
+ CSS Test: Testing a mix of flex items with various values for
+ 'writing-mode' / 'direction' in a horizontal row-oriented flex container.
+
+
+
+
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-011-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-011-ref.html
new file mode 100644
index 0000000000..8b926490b6
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-011-ref.html
@@ -0,0 +1,97 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-011.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-011.html
new file mode 100644
index 0000000000..6114e19275
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-011.html
@@ -0,0 +1,89 @@
+
+
+
+
+
+ CSS Test: Testing a mix of flex items with various values for
+ 'writing-mode' / 'direction' in a vertical row-oriented flex container.
+
+
+
+
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-012-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-012-ref.html
new file mode 100644
index 0000000000..c03358be42
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-012-ref.html
@@ -0,0 +1,97 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-012.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-012.html
new file mode 100644
index 0000000000..a7b05f178d
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-012.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+ CSS Test: Testing a mix of flex items with various values for
+ 'writing-mode' / 'direction' in a vertical row-oriented flex container
+ with 'direction' flipped.
+
+
+
+
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-013-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-013-ref.html
new file mode 100644
index 0000000000..2a27003a5c
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-013-ref.html
@@ -0,0 +1,98 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-013.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-013.html
new file mode 100644
index 0000000000..a5d483c442
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-013.html
@@ -0,0 +1,89 @@
+
+
+
+
+
+ CSS Test: Testing a mix of flex items with various values for
+ 'writing-mode' / 'direction' in a horizontal column-oriented flex container.
+
+
+
+
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-014-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-014-ref.html
new file mode 100644
index 0000000000..4e4f5904a1
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-014-ref.html
@@ -0,0 +1,96 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-014.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-014.html
new file mode 100644
index 0000000000..1a5443279a
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-014.html
@@ -0,0 +1,88 @@
+
+
+
+
+
+ CSS Test: Testing a mix of flex items with various values for
+ 'writing-mode' / 'direction' in a vertical column-oriented flex container.
+
+
+
+
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-015-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-015-ref.html
new file mode 100644
index 0000000000..a236ca11d5
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-015-ref.html
@@ -0,0 +1,96 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-015.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-015.html
new file mode 100644
index 0000000000..af1f9b8456
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-015.html
@@ -0,0 +1,89 @@
+
+
+
+
+
+ CSS Test: Testing a mix of flex items with various values for
+ 'writing-mode' / 'direction' in a vertical column-oriented flex container
+ with 'direction' flipped.
+
+
+
+
+
+
+
+
+
+
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+ a b c
+ d e
+ a b c
+ d e
+ a b c
+ d e
+
+
+
+