summaryrefslogtreecommitdiffstats
path: root/layout/reftests/writing-mode
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/reftests/writing-mode
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/reftests/writing-mode')
-rw-r--r--layout/reftests/writing-mode/1079154-1-vertical-rl-columns-ref.html49
-rw-r--r--layout/reftests/writing-mode/1079154-1-vertical-rl-columns.html41
-rw-r--r--layout/reftests/writing-mode/1082844-ref.html33
-rw-r--r--layout/reftests/writing-mode/1082844.html33
-rw-r--r--layout/reftests/writing-mode/1083748-ref.html52
-rw-r--r--layout/reftests/writing-mode/1083748.html48
-rw-r--r--layout/reftests/writing-mode/1083848-1-inline-border-ref.html55
-rw-r--r--layout/reftests/writing-mode/1083848-1-inline-border.html51
-rw-r--r--layout/reftests/writing-mode/1083848-2-inline-background-ref.html43
-rw-r--r--layout/reftests/writing-mode/1083848-2-inline-background.html43
-rw-r--r--layout/reftests/writing-mode/1083848-3-inline-background-repeat-ref.html49
-rw-r--r--layout/reftests/writing-mode/1083848-3-inline-background-repeat.html42
-rw-r--r--layout/reftests/writing-mode/1083892-1-ref.html27
-rw-r--r--layout/reftests/writing-mode/1083892-1.html27
-rw-r--r--layout/reftests/writing-mode/1086883-1-ref.html28
-rw-r--r--layout/reftests/writing-mode/1086883-1a.html29
-rw-r--r--layout/reftests/writing-mode/1086883-1b.html29
-rw-r--r--layout/reftests/writing-mode/1088025-1-ref.html24
-rw-r--r--layout/reftests/writing-mode/1088025-1.html27
-rw-r--r--layout/reftests/writing-mode/1089388-1-ref.html30
-rw-r--r--layout/reftests/writing-mode/1089388-1.html39
-rw-r--r--layout/reftests/writing-mode/1089388-2-ref.html30
-rw-r--r--layout/reftests/writing-mode/1089388-2.html39
-rw-r--r--layout/reftests/writing-mode/1090159-1-ref.html37
-rw-r--r--layout/reftests/writing-mode/1090159-1.html37
-rw-r--r--layout/reftests/writing-mode/1090168-1-notref.html41
-rw-r--r--layout/reftests/writing-mode/1090168-1-ref.html41
-rw-r--r--layout/reftests/writing-mode/1090168-1.html41
-rw-r--r--layout/reftests/writing-mode/1090168-2-ref.html41
-rw-r--r--layout/reftests/writing-mode/1090168-2.html41
-rw-r--r--layout/reftests/writing-mode/1090168-3-ref.html47
-rw-r--r--layout/reftests/writing-mode/1090168-3.html47
-rw-r--r--layout/reftests/writing-mode/1091058-1-ref.html35
-rw-r--r--layout/reftests/writing-mode/1091058-1.html35
-rw-r--r--layout/reftests/writing-mode/1094434-1-ref.html28
-rw-r--r--layout/reftests/writing-mode/1094434-1.html34
-rw-r--r--layout/reftests/writing-mode/1094434-2-ref.html29
-rw-r--r--layout/reftests/writing-mode/1094434-2.html35
-rw-r--r--layout/reftests/writing-mode/1094914-1-ref.html43
-rw-r--r--layout/reftests/writing-mode/1094914-1a.html43
-rw-r--r--layout/reftests/writing-mode/1094914-1b.html43
-rw-r--r--layout/reftests/writing-mode/1096224-1-ref.html43
-rw-r--r--layout/reftests/writing-mode/1096224-1a.html45
-rw-r--r--layout/reftests/writing-mode/1096224-1b.html45
-rw-r--r--layout/reftests/writing-mode/1102175-1-ref.html43
-rw-r--r--layout/reftests/writing-mode/1102175-1a.html39
-rw-r--r--layout/reftests/writing-mode/1102175-1b.html39
-rw-r--r--layout/reftests/writing-mode/1103613-1-ref.html28
-rw-r--r--layout/reftests/writing-mode/1103613-1.html27
-rw-r--r--layout/reftests/writing-mode/1105268-1-min-max-dimensions-ref.html60
-rw-r--r--layout/reftests/writing-mode/1105268-1-min-max-dimensions.html61
-rw-r--r--layout/reftests/writing-mode/1105268-2-min-max-dimensions-ref.html61
-rw-r--r--layout/reftests/writing-mode/1105268-2-min-max-dimensions.html71
-rw-r--r--layout/reftests/writing-mode/1106669-1-intrinsic-for-container-ref.html31
-rw-r--r--layout/reftests/writing-mode/1106669-1-intrinsic-for-container.html32
-rw-r--r--layout/reftests/writing-mode/1108923-1-percentage-margins-ref.html59
-rw-r--r--layout/reftests/writing-mode/1108923-1-percentage-margins.html52
-rw-r--r--layout/reftests/writing-mode/1111944-1-list-marker-ref.html107
-rw-r--r--layout/reftests/writing-mode/1111944-1-list-marker.html55
-rw-r--r--layout/reftests/writing-mode/1115916-1-vertical-metrics-ref.html25
-rw-r--r--layout/reftests/writing-mode/1115916-1-vertical-metrics.html28
-rw-r--r--layout/reftests/writing-mode/1117210-1-vertical-baseline-snap-ref.html47
-rw-r--r--layout/reftests/writing-mode/1117210-1-vertical-baseline-snap.html82
-rw-r--r--layout/reftests/writing-mode/1117227-1-text-overflow-ref.html56
-rw-r--r--layout/reftests/writing-mode/1117227-1-text-overflow.html60
-rw-r--r--layout/reftests/writing-mode/1122366-1-margin-collapse-ref.html25
-rw-r--r--layout/reftests/writing-mode/1122366-1-margin-collapse.html43
-rw-r--r--layout/reftests/writing-mode/1124636-1-fieldset-max-height-ref.html29
-rw-r--r--layout/reftests/writing-mode/1124636-1-fieldset-max-height.html29
-rw-r--r--layout/reftests/writing-mode/1124636-2-fieldset-min-height-ref.html25
-rw-r--r--layout/reftests/writing-mode/1124636-2-fieldset-min-height.html26
-rw-r--r--layout/reftests/writing-mode/1127488-align-bottom-left-ref.html20
-rw-r--r--layout/reftests/writing-mode/1127488-align-bottom-right-ref.html20
-rw-r--r--layout/reftests/writing-mode/1127488-align-default-horizontal-tb-ltr.html30
-rw-r--r--layout/reftests/writing-mode/1127488-align-default-horizontal-tb-rtl.html30
-rw-r--r--layout/reftests/writing-mode/1127488-align-default-vertical-lr-ltr.html30
-rw-r--r--layout/reftests/writing-mode/1127488-align-default-vertical-lr-rtl.html30
-rw-r--r--layout/reftests/writing-mode/1127488-align-default-vertical-rl-ltr.html30
-rw-r--r--layout/reftests/writing-mode/1127488-align-default-vertical-rl-rtl.html30
-rw-r--r--layout/reftests/writing-mode/1127488-align-end-horizontal-tb-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-end-horizontal-tb-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-end-vertical-lr-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-end-vertical-lr-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-end-vertical-rl-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-end-vertical-rl-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-left-horizontal-tb-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-left-horizontal-tb-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-left-vertical-lr-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-left-vertical-lr-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-left-vertical-rl-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-left-vertical-rl-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-right-horizontal-tb-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-right-horizontal-tb-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-right-vertical-lr-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-right-vertical-lr-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-right-vertical-rl-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-right-vertical-rl-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-start-horizontal-tb-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-start-horizontal-tb-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-start-vertical-lr-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-start-vertical-lr-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-start-vertical-rl-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-start-vertical-rl-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1127488-align-top-left-ref.html20
-rw-r--r--layout/reftests/writing-mode/1127488-align-top-right-ref.html20
-rw-r--r--layout/reftests/writing-mode/1130907-intrinsic-sizing-1-ref.html60
-rw-r--r--layout/reftests/writing-mode/1130907-intrinsic-sizing-1.html61
-rw-r--r--layout/reftests/writing-mode/1130907-intrinsic-sizing-2-ref.html73
-rw-r--r--layout/reftests/writing-mode/1130907-intrinsic-sizing-2.html74
-rw-r--r--layout/reftests/writing-mode/1131013-vertical-bidi-ref.html21
-rw-r--r--layout/reftests/writing-mode/1131013-vertical-bidi.html21
-rw-r--r--layout/reftests/writing-mode/1133945-1-vertical-align-ref.html17
-rw-r--r--layout/reftests/writing-mode/1133945-1-vertical-align.html20
-rw-r--r--layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1-ref.html25
-rw-r--r--layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1.html25
-rw-r--r--layout/reftests/writing-mode/1134849-orthogonal-inline-ref.html31
-rw-r--r--layout/reftests/writing-mode/1134849-orthogonal-inline.html33
-rw-r--r--layout/reftests/writing-mode/1135361-ruby-justify-1-ref.html45
-rw-r--r--layout/reftests/writing-mode/1135361-ruby-justify-1.html46
-rw-r--r--layout/reftests/writing-mode/1136557-1-nested-spans-ref.html37
-rw-r--r--layout/reftests/writing-mode/1136557-1-nested-spans.html37
-rw-r--r--layout/reftests/writing-mode/1136557-2-nested-spans-ref.html37
-rw-r--r--layout/reftests/writing-mode/1136557-2-nested-spans.html37
-rw-r--r--layout/reftests/writing-mode/1136557-3-nested-spans-ref.html37
-rw-r--r--layout/reftests/writing-mode/1136557-3-nested-spans.html37
-rw-r--r--layout/reftests/writing-mode/1138356-1-button-contents-alignment-ref.html31
-rw-r--r--layout/reftests/writing-mode/1138356-1-button-contents-alignment.html31
-rw-r--r--layout/reftests/writing-mode/1138356-2-button-contents-alignment-notref.html32
-rw-r--r--layout/reftests/writing-mode/1138356-2-button-contents-alignment.html32
-rw-r--r--layout/reftests/writing-mode/1144501-1-block-end-margin-orthogonal-size-ref.html55
-rw-r--r--layout/reftests/writing-mode/1144501-1a-block-end-margin-orthogonal-size.html56
-rw-r--r--layout/reftests/writing-mode/1144501-1b-block-end-margin-orthogonal-size.html56
-rw-r--r--layout/reftests/writing-mode/1147834-bottom-left-ref.html27
-rw-r--r--layout/reftests/writing-mode/1147834-bottom-right-ref.html27
-rw-r--r--layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-ltr.html31
-rw-r--r--layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-rtl.html31
-rw-r--r--layout/reftests/writing-mode/1147834-top-left-ref.html27
-rw-r--r--layout/reftests/writing-mode/1147834-top-right-ref.html27
-rw-r--r--layout/reftests/writing-mode/1151993-1-orthogonal-block-size-ref.html44
-rw-r--r--layout/reftests/writing-mode/1151993-1-orthogonal-block-size.html48
-rw-r--r--layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow-ref.html39
-rw-r--r--layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow.html53
-rw-r--r--layout/reftests/writing-mode/1156021-text-indent-percent-ref.html45
-rw-r--r--layout/reftests/writing-mode/1156021-text-indent-percent.html51
-rw-r--r--layout/reftests/writing-mode/1157752-upright-bidi-ref.html43
-rw-r--r--layout/reftests/writing-mode/1157752-upright-bidi.html43
-rw-r--r--layout/reftests/writing-mode/1157758-1-vertical-arabic-ref.html18
-rw-r--r--layout/reftests/writing-mode/1157758-1-vertical-arabic.html18
-rw-r--r--layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints-ref.html44
-rw-r--r--layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints.html44
-rw-r--r--layout/reftests/writing-mode/1163238-orthogonal-auto-margins-ref.html39
-rw-r--r--layout/reftests/writing-mode/1163238-orthogonal-auto-margins.html42
-rw-r--r--layout/reftests/writing-mode/1172774-percent-horizontal-ref.html10
-rw-r--r--layout/reftests/writing-mode/1172774-percent-margin-1.html59
-rw-r--r--layout/reftests/writing-mode/1172774-percent-margin-2.html59
-rw-r--r--layout/reftests/writing-mode/1172774-percent-margin-3.html63
-rw-r--r--layout/reftests/writing-mode/1172774-percent-margin-4.html63
-rw-r--r--layout/reftests/writing-mode/1172774-percent-padding-1.html57
-rw-r--r--layout/reftests/writing-mode/1172774-percent-padding-2.html58
-rw-r--r--layout/reftests/writing-mode/1172774-percent-padding-3.html62
-rw-r--r--layout/reftests/writing-mode/1172774-percent-padding-4.html62
-rw-r--r--layout/reftests/writing-mode/1172774-percent-vertical-ref.html10
-rw-r--r--layout/reftests/writing-mode/1174450-intrinsic-sizing-ref.html70
-rw-r--r--layout/reftests/writing-mode/1174450-intrinsic-sizing.html63
-rw-r--r--layout/reftests/writing-mode/1175789-underline-overline-1-ref.html91
-rw-r--r--layout/reftests/writing-mode/1175789-underline-overline-1.html91
-rw-r--r--layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics-ref.html17
-rw-r--r--layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics.html25
-rw-r--r--layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize-ref.html21
-rw-r--r--layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize.html34
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-1-ref.html24
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-1.html28
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-2-ref.html24
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-2.html28
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-3-ref.html21
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-3.html21
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-4-ref.html27
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-4.html27
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-decoration-1-ref.html10
-rw-r--r--layout/reftests/writing-mode/1193519-sideways-lr-decoration-1.html10
-rw-r--r--layout/reftests/writing-mode/1196887-1-computed-display-inline-block-ref.html3
-rw-r--r--layout/reftests/writing-mode/1196887-1-computed-display-inline-block.html5
-rw-r--r--layout/reftests/writing-mode/1205787-legacy-svg-values-1-ref.html25
-rw-r--r--layout/reftests/writing-mode/1205787-legacy-svg-values-1.html25
-rw-r--r--layout/reftests/writing-mode/1216747-1-notref.html3
-rw-r--r--layout/reftests/writing-mode/1216747-1-ref.html10
-rw-r--r--layout/reftests/writing-mode/1216747-1.html14
-rw-r--r--layout/reftests/writing-mode/1243125-1-floats-overflowing-ref.html31
-rw-r--r--layout/reftests/writing-mode/1243125-1-floats-overflowing.html40
-rw-r--r--layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun-ref.html21
-rw-r--r--layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun.html21
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-1-ref.html11
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-1a.html11
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-1b.html12
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-1c.html17
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-1d.html16
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-2-ref.html16
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-2a.html12
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-2b.html11
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-2c.html16
-rw-r--r--layout/reftests/writing-mode/1302389-scrolled-rect-2d.html17
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-1-ref.html11
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-1a.html12
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-1b.html12
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-2-ref.html11
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-2a.html12
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-2b.html12
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-2c.html12
-rw-r--r--layout/reftests/writing-mode/1302734-bidi-plaintext-2d.html12
-rw-r--r--layout/reftests/writing-mode/4colors.pngbin0 -> 3873 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1-ref.html16
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1a.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1b.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1c.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2-ref.html16
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2a.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2b.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2c.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3-ref.html13
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3a.html14
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3b.html14
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3c.html14
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4-ref.html17
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4a.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4b.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4c.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5-ref.html17
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5a.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5b.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5c.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6-ref.html13
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6a.html14
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6b.html14
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6c.html14
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7-ref.html19
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7a.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7b.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7c.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8-ref.html19
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8a.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8b.html15
-rw-r--r--layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8c.html15
-rw-r--r--layout/reftests/writing-mode/abspos/blue-32x32.pngbin0 -> 110 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/reftest-stylo.list130
-rw-r--r--layout/reftests/writing-mode/abspos/reftest.list128
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007-ref.xht57
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007.xht125
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019-ref.xht57
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031-ref.xht57
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031.xht101
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041.xht111
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061.xht101
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004-ref.xht49
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042.xht122
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044.xht118
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046.xht110
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048.xht123
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060.xht101
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080.xht96
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082.xht88
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084.xht100
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092.xht120
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094-ref.xht48
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094.xht112
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096-ref.xht56
-rw-r--r--layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096.xht124
-rw-r--r--layout/reftests/writing-mode/abspos/support/Ahem.ttfbin0 -> 12480 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/support/ahem.css4
-rw-r--r--layout/reftests/writing-mode/abspos/support/bg-red-2col-2row-320x320.pngbin0 -> 1731 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/support/bg-red-2col-3row-320x320.pngbin0 -> 1735 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/support/bg-red-3col-2row-320x320.pngbin0 -> 1732 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/support/bg-red-3col-3row-320x320.pngbin0 -> 1734 bytes
-rw-r--r--layout/reftests/writing-mode/abspos/support/pass-cdts-abs-pos-non-replaced.pngbin0 -> 3466 bytes
-rw-r--r--layout/reftests/writing-mode/blue-32x32.pngbin0 -> 110 bytes
-rw-r--r--layout/reftests/writing-mode/blue-yellow-165w-206h.pngbin0 -> 460 bytes
-rw-r--r--layout/reftests/writing-mode/blue-yellow-206w-165h.pngbin0 -> 463 bytes
-rw-r--r--layout/reftests/writing-mode/font-inflation-1-ref.html8
-rw-r--r--layout/reftests/writing-mode/font-inflation-1a.html8
-rw-r--r--layout/reftests/writing-mode/font-inflation-1b.html8
-rw-r--r--layout/reftests/writing-mode/font-inflation-1c-ref.html12
-rw-r--r--layout/reftests/writing-mode/font-inflation-1c.html8
-rw-r--r--layout/reftests/writing-mode/font-inflation-1d-ref.html12
-rw-r--r--layout/reftests/writing-mode/font-inflation-1d.html8
-rw-r--r--layout/reftests/writing-mode/green-100x100.pngbin0 -> 84 bytes
-rw-r--r--layout/reftests/writing-mode/left-bottom-300x300.pngbin0 -> 914 bytes
-rw-r--r--layout/reftests/writing-mode/left-top-300x300.pngbin0 -> 773 bytes
-rw-r--r--layout/reftests/writing-mode/reftest-stylo.list194
-rw-r--r--layout/reftests/writing-mode/reftest.list192
-rw-r--r--layout/reftests/writing-mode/right-bottom-300x300.pngbin0 -> 914 bytes
-rw-r--r--layout/reftests/writing-mode/right-top-300x300.pngbin0 -> 919 bytes
-rw-r--r--layout/reftests/writing-mode/swatch-yellow.pngbin0 -> 84 bytes
-rw-r--r--layout/reftests/writing-mode/tables/border-collapse-bevels-1-ref.html28
-rw-r--r--layout/reftests/writing-mode/tables/border-collapse-bevels-1a.html29
-rw-r--r--layout/reftests/writing-mode/tables/border-collapse-bevels-1b.html29
-rw-r--r--layout/reftests/writing-mode/tables/border-collapse-bevels-1c.html29
-rw-r--r--layout/reftests/writing-mode/tables/border-collapse-bevels-1d.html30
-rw-r--r--layout/reftests/writing-mode/tables/border-collapse-bevels-1e.html30
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-002-ref.html25
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-002-vlr.html53
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-002-vrl.html54
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-003-vlr.html49
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-003-vrl.html49
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-004-ref.html33
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-004-vlr.html61
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-004-vrl.html61
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-005-ref.html42
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-005-vlr.html55
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-005-vrl.html55
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-006-ref.html33
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-006-vlr.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-006-vrl.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-007-ref.html25
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-007-vlr.html47
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-007-vrl.html48
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-009-ref.html42
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-009-vlr.html46
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-009-vrl.html46
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-010-ref.html31
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-010-vlr.html70
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-010-vrl.html70
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-012-ref.html25
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-012-vlr.html54
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-012-vrl.html55
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-013-vlr.html59
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-013-vrl.html59
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-014-vlr.html62
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-014-vrl.html62
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-015-vlr.html60
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-015-vrl.html63
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-016-vlr.html52
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-016-vrl.html52
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-017-ref.html29
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-017-vlr.html90
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-017-vrl.html90
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-018-vlr.html93
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-018-vrl.html94
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-021-ref.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-021-vlr.html140
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-021-vrl.html140
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-022-ref.html49
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-022-vlr.html170
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-022-vrl.html170
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-023-ref.html49
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-023-vlr.html175
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-023-vrl.html175
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-025-ref.html23
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-025-vlr.html40
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-025-vrl.html40
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-026-vlr.html42
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-026-vrl.html42
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-027-vlr.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-027-vrl.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-028-vlr.html42
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-028-vrl.html42
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-029-vlr.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-029-vrl.html44
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-030-vlr.html41
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-030-vrl.html41
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-031-vlr.html41
-rw-r--r--layout/reftests/writing-mode/tables/fixed-table-layout-031-vrl.html41
-rw-r--r--layout/reftests/writing-mode/tables/multicol-count-002-ref.xht37
-rw-r--r--layout/reftests/writing-mode/tables/reftest-stylo.list95
-rw-r--r--layout/reftests/writing-mode/tables/reftest.list93
-rw-r--r--layout/reftests/writing-mode/tables/s72-border-spacing-002-ref.xht22
-rw-r--r--layout/reftests/writing-mode/tables/s72-border-spacing-002.xht144
-rw-r--r--layout/reftests/writing-mode/tables/s72-border-spacing-003.xht144
-rw-r--r--layout/reftests/writing-mode/tables/s72-border-spacing-004.xht124
-rw-r--r--layout/reftests/writing-mode/tables/s72-border-spacing-005.xht124
-rw-r--r--layout/reftests/writing-mode/tables/sideways-lr-row-progression-1-ref.html51
-rw-r--r--layout/reftests/writing-mode/tables/sideways-lr-row-progression-1a.html68
-rw-r--r--layout/reftests/writing-mode/tables/sideways-lr-row-progression-1b.html69
-rw-r--r--layout/reftests/writing-mode/tables/sideways-rl-row-progression-1-ref.html54
-rw-r--r--layout/reftests/writing-mode/tables/sideways-rl-row-progression-1a.html68
-rw-r--r--layout/reftests/writing-mode/tables/sideways-rl-row-progression-1b.html68
-rw-r--r--layout/reftests/writing-mode/tables/support/ahem.css4
-rw-r--r--layout/reftests/writing-mode/tables/support/swatch-green.pngbin0 -> 84 bytes
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-bottom-1-ref.html54
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-bottom-1.html61
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-left-1-ref.html65
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-left-1.html71
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-right-1-ref.html65
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-right-1.html71
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-top-1-ref.html54
-rw-r--r--layout/reftests/writing-mode/tables/table-caption-top-1.html61
-rw-r--r--layout/reftests/writing-mode/tables/vertical-border-collapse-1-ref.html49
-rw-r--r--layout/reftests/writing-mode/tables/vertical-border-collapse-1.html50
-rw-r--r--layout/reftests/writing-mode/tables/vertical-border-collapse-2-ref.html49
-rw-r--r--layout/reftests/writing-mode/tables/vertical-border-collapse-2.html50
-rw-r--r--layout/reftests/writing-mode/tables/vertical-rl-row-progression-1-ref.html50
-rw-r--r--layout/reftests/writing-mode/tables/vertical-rl-row-progression-1a.html57
-rw-r--r--layout/reftests/writing-mode/tables/vertical-rl-row-progression-1b.html57
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-1-ref.html44
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-1a.html41
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-1b.html41
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-2-ref.html42
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-2a.html39
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-2b.html39
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-colspan-1-ref.html37
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-colspan-1.html36
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-colspan-2-ref.html37
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-colspan-2.html36
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-rowspan-1-ref.html38
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-rowspan-1.html37
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-rowspan-2-ref.html38
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-rowspan-2.html37
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-specified-width-1-ref.html40
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-specified-width-1.html42
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-specified-width-2-ref.html40
-rw-r--r--layout/reftests/writing-mode/tables/vertical-table-specified-width-2.html42
-rw-r--r--layout/reftests/writing-mode/tables/wm-row-progression-002.xht73
-rw-r--r--layout/reftests/writing-mode/tables/wm-row-progression-003.xht73
-rw-r--r--layout/reftests/writing-mode/tables/wm-row-progression-004.xht73
-rw-r--r--layout/reftests/writing-mode/tables/wm-row-progression-005.xht73
-rw-r--r--layout/reftests/writing-mode/tables/wm-row-progression-006.xht73
-rw-r--r--layout/reftests/writing-mode/tables/wm-row-progression-007.xht73
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-1-ref.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-1.html16
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-2-ref.html29
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-2.html25
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-3-ref.html29
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-3.html25
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-4-ref.html32
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-4.html28
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-5-ref.html41
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-border-5.html37
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-button-1.html40
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-button-1a-ref.html52
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-button-1b-ref.html52
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1-ref.html54
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-fieldset-1-ref.html44
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-fieldset-1.html36
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html35
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-input-color-1.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-input-number-1-ref.html37
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-input-number-1.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-1-ref.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-1.html16
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-10-ref.html31
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-10.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-11-ref.html25
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-11.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-12-ref.html25
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-12.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-13-ref.html39
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-13.html35
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-14-ref.html20
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-14.html17
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-2-ref.html23
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-2.html16
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-3-ref.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-3.html16
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-4-ref.html32
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-4.html23
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-5-ref.html32
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-5.html23
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-6-ref.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-6.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-7-ref.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-7.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-8-ref.html31
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-8.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-9-ref.html31
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-margin-9.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-size-1-ref.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-size-1.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-size-2-ref.html22
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-size-2.html19
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-textarea-1.html18
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-textarea-1a-ref.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-textarea-1b-ref.html27
-rw-r--r--layout/reftests/writing-mode/ua-style-sheet-textarea-1c-ref.html30
647 files changed, 32471 insertions, 0 deletions
diff --git a/layout/reftests/writing-mode/1079154-1-vertical-rl-columns-ref.html b/layout/reftests/writing-mode/1079154-1-vertical-rl-columns-ref.html
new file mode 100644
index 000000000..bbf1705df
--- /dev/null
+++ b/layout/reftests/writing-mode/1079154-1-vertical-rl-columns-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family:test;
+ src:url(../fonts/sil/GenR102.ttf);
+}
+body { width: 500px; height: 300px; writing-mode: vertical-rl;
+ font:16px/24px test; margin: 0; border: 1px solid gray; }
+div { margin: 10px; background: #eee; }
+</style>
+</head>
+
+<body>
+
+<div>
+First single-column division.
+</div>
+
+<div>
+<div style="margin: 0; display: inline-block; height: 145px">
+Two columns<br>
+one<br>two<br>three
+</div><div style="margin: 0; display: inline-block; height: 135px; vertical-align: top">
+four<br>five<br>six
+</div>
+</div>
+
+<div>
+Another single-column division.
+</div>
+
+<div>
+<div style="margin: 0; display: inline-block; height: 95px">
+Three columns<br>
+one
+</div><div style="margin: 0; display: inline-block; height: 95px">two<br>three<br>four
+</div><div style="margin: 0; display: inline-block; height: 85px; vertical-align: top">five<br>six
+</div>
+</div>
+
+<div>
+Final single-column division.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1079154-1-vertical-rl-columns.html b/layout/reftests/writing-mode/1079154-1-vertical-rl-columns.html
new file mode 100644
index 000000000..e6880af43
--- /dev/null
+++ b/layout/reftests/writing-mode/1079154-1-vertical-rl-columns.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family:test;
+ src:url(../fonts/sil/GenR102.ttf);
+}
+body { width: 500px; height: 300px; writing-mode: vertical-rl;
+ font:16px/24px test; margin: 0; border: 1px solid gray; }
+div { margin: 10px; background: #eee; }
+</style>
+</head>
+
+<body>
+
+<div>
+First single-column division.
+</div>
+
+<div style="-moz-column-count:2; -moz-column-gap:10px">
+Two columns<br>
+one<br>two<br>three<br>four<br>five<br>six
+</div>
+
+<div>
+Another single-column division.
+</div>
+
+<div style="-moz-column-count:3; -moz-column-gap:5px">
+Three columns<br>
+one<br>two<br>three<br>four<br>five<br>six
+</div>
+
+<div>
+Final single-column division.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1082844-ref.html b/layout/reftests/writing-mode/1082844-ref.html
new file mode 100644
index 000000000..954b0ef23
--- /dev/null
+++ b/layout/reftests/writing-mode/1082844-ref.html
@@ -0,0 +1,33 @@
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body > div {
+ width:225px;
+ height:225px;
+}
+body > div > div {
+width:200px;
+ height:220px;
+ border:1px solid red;
+ line-height:20px;
+ text-transform: full-width;
+}
+.v-rl { writing-mode:vertical-rl; text-orientation:upright }
+</style>
+
+</head>
+
+<body>
+<div>
+<div id="test2" class="v-rl">
+ A B C D E
+ F G H I J
+ K L M N O
+ P Q R S T
+ U V W X Y
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1082844.html b/layout/reftests/writing-mode/1082844.html
new file mode 100644
index 000000000..b63c2167d
--- /dev/null
+++ b/layout/reftests/writing-mode/1082844.html
@@ -0,0 +1,33 @@
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body > div {
+ width:225px;
+ height:225px;
+}
+body > div > div {
+width:200px;
+ height:220px;
+ border:1px solid red;
+ line-height:20px;
+ text-transform: full-width;
+}
+.v-rl { writing-mode:vertical-rl; text-orientation:upright }
+</style>
+
+</head>
+
+<body>
+<div>
+<div id="test2" class="v-rl">
+ A B C D E
+ F G H I J
+ K <span>L <span>M N</span> O</span>
+ P Q R S T
+ U V W X Y
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083748-ref.html b/layout/reftests/writing-mode/1083748-ref.html
new file mode 100644
index 000000000..92a3f3273
--- /dev/null
+++ b/layout/reftests/writing-mode/1083748-ref.html
@@ -0,0 +1,52 @@
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/mplus/mplus-1p-regular.ttf);
+}
+body {
+ font-family: test;
+}
+body > div {
+ width:410px;
+ height:610px;
+ float:left;
+ border:1px solid green;
+ margin:5px;
+}
+body > div > div {
+ width:200px;
+ height:200px;
+ border:1px solid red;
+ line-height:20px;
+ text-transform:full-width;
+ float:left;
+}
+
+.v-lr { writing-mode:vertical-lr; text-orientation:upright }
+
+p {
+ margin: 0;
+}
+
+b {
+ background-color: rgb(224,255,224);
+}
+i {
+ background-color: rgb(255,224,224);
+}
+
+</style>
+
+</head>
+
+<body>
+<div>
+ <div class="v-lr">
+ <p>The <i>quick</i> brown fox jumps over the <b>lazy</b> dog.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083748.html b/layout/reftests/writing-mode/1083748.html
new file mode 100644
index 000000000..fff142eb8
--- /dev/null
+++ b/layout/reftests/writing-mode/1083748.html
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/mplus/mplus-1p-regular.ttf);
+}
+body {
+ font-family: test;
+}
+body > div {
+ width:410px;
+ height:610px;
+ float:left;
+ border:1px solid green;
+ margin:5px;
+}
+body > div > div {
+ width:200px;
+ height:200px;
+ border:1px solid red;
+ line-height:20px;
+ text-transform:full-width;
+ float:left;
+}
+
+.v-lr { writing-mode:vertical-lr; text-orientation:upright }
+
+b {
+ background-color: rgb(224,255,224);
+}
+i {
+ background-color: rgb(255,224,224);
+}
+
+</style>
+
+</head>
+
+<body>
+<div>
+ <div class="v-lr">
+ The <i>quick</i> brown fox jumps over the <b>lazy</b> dog.
+ </div>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083848-1-inline-border-ref.html b/layout/reftests/writing-mode/1083848-1-inline-border-ref.html
new file mode 100644
index 000000000..d252cc197
--- /dev/null
+++ b/layout/reftests/writing-mode/1083848-1-inline-border-ref.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+.test {
+ margin:10px;
+ border:1px solid blue;
+ font-family: dejavu;
+ font-size: 16px;
+ letter-spacing: 0.1em;
+ word-break:break-all;
+ text-orientation:upright;
+ width:7em;
+ height:7em;
+}
+
+.h { writing-mode:horizontal-tb; letter-spacing: 0.4em }
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+b {
+ background-color: yellow;
+}
+
+.bh1 {
+ border-left: 3px solid cyan;
+}
+.bh2 {
+ border-right: 3px solid magenta;
+}
+
+.bv1 {
+ border-top: 3px solid cyan;
+}
+.bv2 {
+ border-bottom: 3px solid magenta;
+}
+</style>
+</head>
+
+<body>
+
+<div class="test h">ABCDE<b class="bh1">F</b><b>GHIJKLMNOPQRS</b><b class="bh2">T</b>UVWXYZ</div>
+
+<div class="test v-lr">ABCDE<b class="bv1">F</b><b>GHIJKLMNOPQRS</b><b class="bv2">T</b>UVWXYZ</div>
+
+<div class="test v-rl">ABCDE<b class="bv1">F</b><b>GHIJKLMNOPQRS</b><b class="bv2">T</b>UVWXYZ</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083848-1-inline-border.html b/layout/reftests/writing-mode/1083848-1-inline-border.html
new file mode 100644
index 000000000..38795f139
--- /dev/null
+++ b/layout/reftests/writing-mode/1083848-1-inline-border.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+.test {
+ margin:10px;
+ border:1px solid blue;
+ font-family: dejavu;
+ font-size: 16px;
+ letter-spacing: 0.1em;
+ word-break:break-all;
+ text-orientation:upright;
+ width:7em;
+ height:7em;
+}
+
+.h { writing-mode:horizontal-tb; letter-spacing: 0.4em }
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+b {
+ background-color: yellow;
+}
+
+.bh {
+ border-left: 3px solid cyan;
+ border-right: 3px solid magenta;
+}
+
+.bv {
+ border-top: 3px solid cyan;
+ border-bottom: 3px solid magenta;
+}
+</style>
+</head>
+
+<body>
+
+<div class="test h">ABCDE<b class="bh">FGHIJKLMNOPQRST</b>UVWXYZ</div>
+
+<div class="test v-lr">ABCDE<b class="bv">FGHIJKLMNOPQRST</b>UVWXYZ</div>
+
+<div class="test v-rl">ABCDE<b class="bv">FGHIJKLMNOPQRST</b>UVWXYZ</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083848-2-inline-background-ref.html b/layout/reftests/writing-mode/1083848-2-inline-background-ref.html
new file mode 100644
index 000000000..b7d18e7fb
--- /dev/null
+++ b/layout/reftests/writing-mode/1083848-2-inline-background-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: mplus;
+ src: url(../fonts/mplus/mplus-1p-regular.ttf);
+}
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+.test {
+ margin:10px;
+ border:1px solid blue;
+ font-size: 16px;
+ word-break:break-all;
+ text-orientation:upright;
+ width:7.9em;
+ height:7.9em;
+}
+
+.h { writing-mode:horizontal-tb; font-family: mplus; text-transform:full-width; }
+.v-lr { writing-mode:vertical-lr; font-family: dejavu; }
+.v-rl { writing-mode:vertical-rl; font-family: dejavu; }
+
+.bgtest {
+ background: url(blue-32x32.png) no-repeat;
+}
+</style>
+</head>
+
+<body>
+
+<div class="test h">ABCDE<b class="bgtest">FG</b><b>HIJKLMNOPQRST</b>UVWXYZ</div>
+
+<div class="test v-lr">ABCDE<b class="bgtest">FG</b><b>HIJKLMNOPQRST</b>UVWXYZ</div>
+
+<div class="test v-rl">ABCDE<b class="bgtest">FG</b><b>HIJKLMNOPQRST</b>UVWXYZ</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083848-2-inline-background.html b/layout/reftests/writing-mode/1083848-2-inline-background.html
new file mode 100644
index 000000000..0591587b2
--- /dev/null
+++ b/layout/reftests/writing-mode/1083848-2-inline-background.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: mplus;
+ src: url(../fonts/mplus/mplus-1p-regular.ttf);
+}
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+.test {
+ margin:10px;
+ border:1px solid blue;
+ font-size: 16px;
+ word-break:break-all;
+ text-orientation:upright;
+ width:7.9em;
+ height:7.9em;
+}
+
+.h { writing-mode:horizontal-tb; font-family: mplus; text-transform:full-width; }
+.v-lr { writing-mode:vertical-lr; font-family: dejavu; }
+.v-rl { writing-mode:vertical-rl; font-family: dejavu; }
+
+.bgtest {
+ background: url(blue-32x32.png) no-repeat;
+}
+</style>
+</head>
+
+<body>
+
+<div class="test h">ABCDE<b class="bgtest">FGHIJKLMNOPQRST</b>UVWXYZ</div>
+
+<div class="test v-lr">ABCDE<b class="bgtest">FGHIJKLMNOPQRST</b>UVWXYZ</div>
+
+<div class="test v-rl">ABCDE<b class="bgtest">FGHIJKLMNOPQRST</b>UVWXYZ</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083848-3-inline-background-repeat-ref.html b/layout/reftests/writing-mode/1083848-3-inline-background-repeat-ref.html
new file mode 100644
index 000000000..cc93be8f5
--- /dev/null
+++ b/layout/reftests/writing-mode/1083848-3-inline-background-repeat-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+.test {
+ margin: 10px;
+ border: 1px solid gray;
+ font: 16px/24px dejavu;
+ word-break: break-all;
+ width: 10em;
+ height: 6.5em;
+ /* we use text-orientation:upright to improve the chances that our
+ glyphs will have an advance of exactly 1em, as the reference
+ rendering relies on this */
+ text-orientation: upright;
+ color: rgba(0,0,255,0.2);
+}
+
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+.c { background: cyan; }
+.b { background: blue; }
+</style>
+</head>
+
+<body>
+
+<div class="test v-lr">ABCD<span class="c">E</span><span class="b">F</span><span
+ class="c">G</span><span class="b">H</span><span class="c">I</span><span
+ class="b">J</span><span class="c">K</span><span class="b">L</span><span
+ class="c">M</span><span class="b">N</span><span class="c">O</span><span
+ class="b">P</span><span class="c">Q</span><span class="b">R</span><span
+ class="c">S</span><span class="b">T</span><span class="c">U</span>VWXYZ</div>
+
+<div class="test v-rl">ABCD<span class="c">E</span><span class="b">F</span><span
+ class="c">G</span><span class="b">H</span><span class="c">I</span><span
+ class="b">J</span><span class="c">K</span><span class="b">L</span><span
+ class="c">M</span><span class="b">N</span><span class="c">O</span><span
+ class="b">P</span><span class="c">Q</span><span class="b">R</span><span
+ class="c">S</span><span class="b">T</span><span class="c">U</span>VWXYZ</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083848-3-inline-background-repeat.html b/layout/reftests/writing-mode/1083848-3-inline-background-repeat.html
new file mode 100644
index 000000000..ac9dd02c5
--- /dev/null
+++ b/layout/reftests/writing-mode/1083848-3-inline-background-repeat.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+.test {
+ margin: 10px;
+ border: 1px solid gray;
+ font: 16px/24px dejavu;
+ word-break: break-all;
+ width: 10em;
+ height: 6.5em;
+ /* we use text-orientation:upright to improve the chances that our
+ glyphs will have an advance of exactly 1em, as the reference
+ rendering relies on this */
+ text-orientation: upright;
+ color: rgba(0,0,255,0.2);
+}
+
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+.bgtest {
+ background: url(4colors.png); /* A square divided into a 2x2 grid of 4 colors; */
+ /* only the two left squares (blue & cyan) should show */
+ background-size: 32px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="test v-lr">ABCD<span class="bgtest">EFGHIJKLMNOPQRSTU</span>VWXYZ</div>
+
+<div class="test v-rl">ABCD<span class="bgtest">EFGHIJKLMNOPQRSTU</span>VWXYZ</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1083892-1-ref.html b/layout/reftests/writing-mode/1083892-1-ref.html
new file mode 100644
index 000000000..66ff5b9a9
--- /dev/null
+++ b/layout/reftests/writing-mode/1083892-1-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1083892</title>
+<style>
+div {
+ width:400px;
+ height:400px;
+ padding:10px;
+ border:1px solid black;
+ writing-mode:vertical-lr;
+}
+p {
+ margin: 0;
+}
+</style>
+</head>
+
+<body>
+<div>
+ This is the first line.<br>
+ Line two.<br>
+ Third and final line.
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1083892-1.html b/layout/reftests/writing-mode/1083892-1.html
new file mode 100644
index 000000000..fa7c7a9aa
--- /dev/null
+++ b/layout/reftests/writing-mode/1083892-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1083892</title>
+<style>
+div {
+ width:400px;
+ height:400px;
+ padding:10px;
+ border:1px solid black;
+ writing-mode:vertical-lr;
+}
+p {
+ margin: 0;
+}
+</style>
+</head>
+
+<body>
+<div>
+ <p>This is the first line.
+ <p>Line two.
+ <p>Third and final line.
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1086883-1-ref.html b/layout/reftests/writing-mode/1086883-1-ref.html
new file mode 100644
index 000000000..ed15cdf9b
--- /dev/null
+++ b/layout/reftests/writing-mode/1086883-1-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1086883</title>
+<!-- writing mode of #inner div should not affect its position within #outer -->
+<style>
+#outer {
+ width:400px;
+ height:300px;
+ padding:50px;
+ border:1px solid black;
+}
+#inner {
+ width:200px;
+ height:100px;
+ background:red;
+}
+</style>
+</head>
+
+<body>
+<div id="outer">
+ <div id="inner">
+ </div>
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1086883-1a.html b/layout/reftests/writing-mode/1086883-1a.html
new file mode 100644
index 000000000..3e004439e
--- /dev/null
+++ b/layout/reftests/writing-mode/1086883-1a.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1086883</title>
+<!-- writing mode of #inner div should not affect its position within #outer -->
+<style>
+#outer {
+ width:400px;
+ height:300px;
+ padding:50px;
+ border:1px solid black;
+}
+#inner {
+ width:200px;
+ height:100px;
+ background:red;
+ writing-mode:vertical-lr;
+}
+</style>
+</head>
+
+<body>
+<div id="outer">
+ <div id="inner">
+ </div>
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1086883-1b.html b/layout/reftests/writing-mode/1086883-1b.html
new file mode 100644
index 000000000..24d6f9b56
--- /dev/null
+++ b/layout/reftests/writing-mode/1086883-1b.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1086883</title>
+<!-- writing mode of #inner div should not affect its position within #outer -->
+<style>
+#outer {
+ width:400px;
+ height:300px;
+ padding:50px;
+ border:1px solid black;
+}
+#inner {
+ width:200px;
+ height:100px;
+ background:red;
+ writing-mode:vertical-rl;
+}
+</style>
+</head>
+
+<body>
+<div id="outer">
+ <div id="inner">
+ </div>
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1088025-1-ref.html b/layout/reftests/writing-mode/1088025-1-ref.html
new file mode 100644
index 000000000..0ed0f34b1
--- /dev/null
+++ b/layout/reftests/writing-mode/1088025-1-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1083892</title>
+<style>
+div {
+ width:300px;
+ height:300px;
+ padding:10px;
+ border:1px solid black;
+ writing-mode:vertical-rl;
+}
+</style>
+</head>
+
+<body>
+<div>
+ This is the <b><i>first</i> paragraph</b>. It's long enough to wrap onto multiple lines.<br>
+ <b>Paragraph <i>two</i></b>.<br>
+ <b><i>Third and final</i> paragraph</b> of this simple testcase. That's all, folks!
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1088025-1.html b/layout/reftests/writing-mode/1088025-1.html
new file mode 100644
index 000000000..810095844
--- /dev/null
+++ b/layout/reftests/writing-mode/1088025-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1083892</title>
+<style>
+div {
+ width:300px;
+ height:300px;
+ padding:10px;
+ border:1px solid black;
+ writing-mode:vertical-rl;
+}
+p {
+ margin: 0;
+}
+</style>
+</head>
+
+<body>
+<div>
+ <p>This is the <b><i>first</i> paragraph</b>. It's long enough to wrap onto multiple lines.
+ <p><b>Paragraph <i>two</i></b>.
+ <p><b><i>Third and final</i> paragraph</b> of this simple testcase. That's all, folks!
+</div>
+</body>
+
+</html>
diff --git a/layout/reftests/writing-mode/1089388-1-ref.html b/layout/reftests/writing-mode/1089388-1-ref.html
new file mode 100644
index 000000000..ead9d0eda
--- /dev/null
+++ b/layout/reftests/writing-mode/1089388-1-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+div {
+ width: 300px;
+ height: 200px;
+ background: #ddd;
+ margin: 50px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="v-lr">
+First part of the block.
+<i id="test">New text inserted by script, to cause a reflow that slides the following lines.</i>
+We will insert enough new content that it wraps onto additional lines.
+<br><br>
+Here is some more text that follows a forced break.
+Observe what happens to it when text is added earlier.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1089388-1.html b/layout/reftests/writing-mode/1089388-1.html
new file mode 100644
index 000000000..e5277bae5
--- /dev/null
+++ b/layout/reftests/writing-mode/1089388-1.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8">
+<style>
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+div {
+ width: 300px;
+ height: 200px;
+ background: #ddd;
+ margin: 50px;
+}
+</style>
+
+<script>
+function doTest() {
+ document.getElementById("test").textContent =
+ "New text inserted by script, to cause a reflow that slides the following lines.";
+ document.documentElement.removeAttribute("class");
+}
+</script>
+
+</head>
+
+<body onload="doTest()">
+
+<div class="v-lr">
+First part of the block.
+<i id="test"></i>
+We will insert enough new content that it wraps onto additional lines.
+<br><br>
+Here is some more text that follows a forced break.
+Observe what happens to it when text is added earlier.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1089388-2-ref.html b/layout/reftests/writing-mode/1089388-2-ref.html
new file mode 100644
index 000000000..b5b247681
--- /dev/null
+++ b/layout/reftests/writing-mode/1089388-2-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+div {
+ width: 300px;
+ height: 200px;
+ background: #ddd;
+ margin: 50px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="v-rl">
+First part of the block.
+<i id="test">New text inserted by script, to cause a reflow that slides the following lines.</i>
+We will insert enough new content that it wraps onto additional lines.
+<br><br>
+Here is some more text that follows a forced break.
+Observe what happens to it when text is added earlier.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1089388-2.html b/layout/reftests/writing-mode/1089388-2.html
new file mode 100644
index 000000000..69e3ae9fc
--- /dev/null
+++ b/layout/reftests/writing-mode/1089388-2.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8">
+<style>
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+div {
+ width: 300px;
+ height: 200px;
+ background: #ddd;
+ margin: 50px;
+}
+</style>
+
+<script>
+function doTest() {
+ document.getElementById("test").textContent =
+ "New text inserted by script, to cause a reflow that slides the following lines.";
+ document.documentElement.removeAttribute("class");
+}
+</script>
+
+</head>
+
+<body onload="doTest()">
+
+<div class="v-rl">
+First part of the block.
+<i id="test"></i>
+We will insert enough new content that it wraps onto additional lines.
+<br><br>
+Here is some more text that follows a forced break.
+Observe what happens to it when text is added earlier.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1090159-1-ref.html b/layout/reftests/writing-mode/1090159-1-ref.html
new file mode 100644
index 000000000..4678efe9e
--- /dev/null
+++ b/layout/reftests/writing-mode/1090159-1-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.h { writing-mode:horizontal-tb; }
+.v-lr { writing-mode:vertical-lr; text-orientation:sideways-right; }
+.v-rl { writing-mode:vertical-rl; text-orientation:sideways-right; }
+
+div {
+ width: 250px;
+ height: 250px;
+ border: 1px solid red;
+ margin: 10px;
+ display: inline-block;
+ font: 16px monospace;
+ line-height: 32px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="h">
+你好吗? hello
+</div>
+
+<div class="v-lr">
+你好吗? hello
+</div>
+
+<div class="v-rl">
+你好吗? hello
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1090159-1.html b/layout/reftests/writing-mode/1090159-1.html
new file mode 100644
index 000000000..eabded9b1
--- /dev/null
+++ b/layout/reftests/writing-mode/1090159-1.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.h { writing-mode:horizontal-tb; }
+.v-lr { writing-mode:vertical-lr; text-orientation:sideways-right; }
+.v-rl { writing-mode:vertical-rl; text-orientation:sideways-right; }
+
+div {
+ width: 250px;
+ height: 250px;
+ border: 1px solid red;
+ margin: 10px;
+ display: inline-block;
+ font: 16px monospace;
+ line-height: 32px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="h">
+你好吗? <span>hello</span>
+</div>
+
+<div class="v-lr">
+你好吗? <span>hello</span>
+</div>
+
+<div class="v-rl">
+你好吗? <span>hello</span>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1090168-1-notref.html b/layout/reftests/writing-mode/1090168-1-notref.html
new file mode 100644
index 000000000..9480faf73
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-1-notref.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with orientation:sideways-right
+// test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:sideways-right', 0);
+
+// Reference: horizontal text with 90° rotation
+// test(100, 50, 'Hello', 'writing-mode:horizontal-tb', Math.PI/2);
+
+// Non-reference: vertical text with orientation:mixed
+test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:mixed', 0);
+
+</script>
diff --git a/layout/reftests/writing-mode/1090168-1-ref.html b/layout/reftests/writing-mode/1090168-1-ref.html
new file mode 100644
index 000000000..8f9520cc1
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-1-ref.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with orientation:sideways-right
+// test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:sideways-right', 0);
+
+// Reference: horizontal text with 90° rotation
+test(100, 50, 'Hello', 'writing-mode:horizontal-tb', Math.PI/2);
+
+// Non-reference: vertical text with orientation:mixed
+// test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:mixed', 0);
+
+</script>
diff --git a/layout/reftests/writing-mode/1090168-1.html b/layout/reftests/writing-mode/1090168-1.html
new file mode 100644
index 000000000..443678678
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-1.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with orientation:sideways-right
+test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:sideways-right', 0);
+
+// Reference: horizontal text with 90° rotation
+// test(100, 50, 'Hello', 'writing-mode:horizontal-tb', Math.PI/2);
+
+// Non-reference: vertical text with orientation:mixed
+// test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:mixed', 0);
+
+</script>
diff --git a/layout/reftests/writing-mode/1090168-2-ref.html b/layout/reftests/writing-mode/1090168-2-ref.html
new file mode 100644
index 000000000..f12a5156c
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-2-ref.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation, baseline) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ if (baseline != '') {
+ ctx.textBaseline = baseline;
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with orientation:mixed
+// test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:mixed', 0, '');
+
+// Reference: horizontal text with 90° rotation and textBaseline=middle
+test(100, 50, 'Hello', 'writing-mode:horizontal-tb', Math.PI/2, 'middle');
+
+</script>
diff --git a/layout/reftests/writing-mode/1090168-2.html b/layout/reftests/writing-mode/1090168-2.html
new file mode 100644
index 000000000..631b7a909
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-2.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation, baseline) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ if (baseline != '') {
+ ctx.textBaseline = baseline;
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with orientation:mixed
+test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:mixed', 0, '');
+
+// Reference: horizontal text with 90° rotation and textBaseline=middle
+// test(100, 50, 'Hello', 'writing-mode:horizontal-tb', Math.PI/2, 'middle');
+
+</script>
diff --git a/layout/reftests/writing-mode/1090168-3-ref.html b/layout/reftests/writing-mode/1090168-3-ref.html
new file mode 100644
index 000000000..212c67589
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-3-ref.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation, baseline) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ if (baseline != '') {
+ ctx.textBaseline = baseline;
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with various textBaselines
+// test(100, 50, 'Top', 'writing-mode:vertical-lr', 0, 'top');
+// test(150, 50, 'Middle', 'writing-mode:vertical-lr', 0, 'middle');
+// test(200, 50, 'Alphabetic', 'writing-mode:vertical-lr', 0, 'alphabetic');
+// test(250, 50, 'Bottom', 'writing-mode:vertical-lr', 0, 'bottom');
+
+// Reference: horizontal text with 90° rotation and the same baselines
+test(100, 50, 'Top', 'writing-mode:horizontal-tb', Math.PI/2, 'top');
+test(150, 50, 'Middle', 'writing-mode:horizontal-tb', Math.PI/2, 'middle');
+test(200, 50, 'Alphabetic', 'writing-mode:horizontal-tb', Math.PI/2, 'alphabetic');
+test(250, 50, 'Bottom', 'writing-mode:horizontal-tb', Math.PI/2, 'bottom');
+
+</script>
diff --git a/layout/reftests/writing-mode/1090168-3.html b/layout/reftests/writing-mode/1090168-3.html
new file mode 100644
index 000000000..f22a22acd
--- /dev/null
+++ b/layout/reftests/writing-mode/1090168-3.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<script type="text/javascript">
+var testFont = '40px sans-serif';
+
+function test(x, y, text, style, rotation, baseline) {
+ var canvas = document.createElement("canvas");
+ canvas.width = 400;
+ canvas.height = 400;
+ canvas.style.cssText = 'position:absolute;' + style;
+ document.getElementsByTagName('body')[0].appendChild(canvas);
+ var ctx = canvas.getContext('2d');
+ ctx.globalAlpha = 0.5;
+ ctx.beginPath();
+ ctx.moveTo(x - 20, y); ctx.lineTo(x + 20, y);
+ ctx.moveTo(x, y - 20); ctx.lineTo(x, y + 20);
+ ctx.stroke();
+ ctx.globalAlpha = 1.0;
+ ctx.font = testFont;
+ if (rotation != 0) {
+ ctx.translate(x,y);
+ ctx.rotate(rotation);
+ ctx.translate(-x,-y);
+ }
+ if (baseline != '') {
+ ctx.textBaseline = baseline;
+ }
+ ctx.fillText(text, x, y);
+}
+
+// Testcase: vertical text with various textBaselines
+test(100, 50, 'Top', 'writing-mode:vertical-lr', 0, 'top');
+test(150, 50, 'Middle', 'writing-mode:vertical-lr', 0, 'middle');
+test(200, 50, 'Alphabetic', 'writing-mode:vertical-lr', 0, 'alphabetic');
+test(250, 50, 'Bottom', 'writing-mode:vertical-lr', 0, 'bottom');
+
+// Reference: horizontal text with 90° rotation and the same baselines
+// test(100, 50, 'Top', 'writing-mode:horizontal-tb', Math.PI/2, 'top');
+// test(150, 50, 'Middle', 'writing-mode:horizontal-tb', Math.PI/2, 'middle');
+// test(200, 50, 'Alphabetic', 'writing-mode:horizontal-tb', Math.PI/2, 'alphabetic');
+// test(250, 50, 'Bottom', 'writing-mode:horizontal-tb', Math.PI/2, 'bottom');
+
+</script>
diff --git a/layout/reftests/writing-mode/1091058-1-ref.html b/layout/reftests/writing-mode/1091058-1-ref.html
new file mode 100644
index 000000000..acce74148
--- /dev/null
+++ b/layout/reftests/writing-mode/1091058-1-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.h { writing-mode:horizontal-tb; }
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+div {
+ width: 250px;
+ height: 250px;
+ border: 1px solid red;
+ margin: 10px;
+ display: inline-block;
+}
+</style>
+</head>
+
+<body>
+
+<div class="h">
+<u>方ABC方方</u><i><u>abc</u></i><u>方方方</u><i><u>xyz</u></i><u>方</u>
+</div>
+
+<div class="v-lr">
+<u>方ABC方方</u><i><u>abc</u></i><u>方方方</u><i><u>xyz</u></i><u>方</u>
+</div>
+
+<div class="v-rl">
+<u>方ABC方方</u><i><u>abc</u></i><u>方方方</u><i><u>xyz</u></i><u>方</u>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1091058-1.html b/layout/reftests/writing-mode/1091058-1.html
new file mode 100644
index 000000000..69d5f0979
--- /dev/null
+++ b/layout/reftests/writing-mode/1091058-1.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.h { writing-mode:horizontal-tb; }
+.v-lr { writing-mode:vertical-lr; }
+.v-rl { writing-mode:vertical-rl; }
+
+div {
+ width: 250px;
+ height: 250px;
+ border: 1px solid red;
+ margin: 10px;
+ display: inline-block;
+}
+</style>
+</head>
+
+<body>
+
+<div class="h">
+<u>方ABC方方<i>abc</i>方方方<i>xyz</i>方</u>
+</div>
+
+<div class="v-lr">
+<u>方ABC方方<i>abc</i>方方方<i>xyz</i>方</u>
+</div>
+
+<div class="v-rl">
+<u>方ABC方方<i>abc</i>方方方<i>xyz</i>方</u>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094434-1-ref.html b/layout/reftests/writing-mode/1094434-1-ref.html
new file mode 100644
index 000000000..df8564d2b
--- /dev/null
+++ b/layout/reftests/writing-mode/1094434-1-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.test {
+ margin: 20px;
+ height: 200px;
+ width: 200px;
+ padding: 0;
+}
+</style>
+</head>
+
+<body>
+
+<textarea class="test" dir="ltr"> </textarea>
+
+<textarea class="test" dir="ltr"> </textarea>
+
+<br>
+
+<textarea class="test" dir="rtl"> </textarea>
+
+<textarea class="test" dir="rtl"> </textarea>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094434-1.html b/layout/reftests/writing-mode/1094434-1.html
new file mode 100644
index 000000000..9639377c7
--- /dev/null
+++ b/layout/reftests/writing-mode/1094434-1.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.test {
+ margin: 20px;
+ height: 200px;
+ width: 200px;
+ padding: 0;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+</style>
+</head>
+
+<body>
+
+<textarea class="test vlr" dir="ltr"> </textarea>
+
+<textarea class="test vlr" dir="rtl"> </textarea>
+
+<br>
+
+<textarea class="test vrl" dir="ltr"> </textarea>
+
+<textarea class="test vrl" dir="rtl"> </textarea>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094434-2-ref.html b/layout/reftests/writing-mode/1094434-2-ref.html
new file mode 100644
index 000000000..3182e7cfd
--- /dev/null
+++ b/layout/reftests/writing-mode/1094434-2-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.test {
+ margin: 20px;
+ height: 200px;
+ width: 200px;
+ overflow: scroll;
+ padding: 0;
+}
+</style>
+</head>
+
+<body>
+
+<textarea class="test" dir="ltr"> </textarea>
+
+<textarea class="test" dir="ltr"> </textarea>
+
+<br>
+
+<textarea class="test" dir="rtl"> </textarea>
+
+<textarea class="test" dir="rtl"> </textarea>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094434-2.html b/layout/reftests/writing-mode/1094434-2.html
new file mode 100644
index 000000000..2c6873fbb
--- /dev/null
+++ b/layout/reftests/writing-mode/1094434-2.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.test {
+ margin: 20px;
+ height: 200px;
+ width: 200px;
+ overflow: scroll;
+ padding: 0;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+</style>
+</head>
+
+<body>
+
+<textarea class="test vlr" dir="ltr"> </textarea>
+
+<textarea class="test vlr" dir="rtl"> </textarea>
+
+<br>
+
+<textarea class="test vrl" dir="ltr"> </textarea>
+
+<textarea class="test vrl" dir="rtl"> </textarea>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094914-1-ref.html b/layout/reftests/writing-mode/1094914-1-ref.html
new file mode 100644
index 000000000..28e1efe43
--- /dev/null
+++ b/layout/reftests/writing-mode/1094914-1-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+ margin: 0px;
+ background: #ddd;
+ font-size: 0;
+ width: 300px;
+}
+
+#test1 {
+ writing-mode: horizontal-tb;
+
+ height: 50px;
+ width: 100px;
+
+ margin-top: 10px;
+ margin-bottom: 0px;
+ margin-left: 50px;
+ margin-right: 0px;
+
+ border-top: 10px solid blue;
+ border-left: 20px solid red;
+ border-right: 30px solid green;
+ border-bottom: 40px solid gray;
+
+ display: inline-block;
+ background: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<div id="outer">
+ <div id="test1">
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094914-1a.html b/layout/reftests/writing-mode/1094914-1a.html
new file mode 100644
index 000000000..2234aa1a4
--- /dev/null
+++ b/layout/reftests/writing-mode/1094914-1a.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+ margin: 0px;
+ background: #ddd;
+ font-size: 0;
+ width: 300px;
+}
+
+#test1 {
+ writing-mode: vertical-lr;
+
+ height: 50px;
+ width: 100px;
+
+ margin-top: 10px;
+ margin-bottom: 0px;
+ margin-left: 50px;
+ margin-right: 0px;
+
+ border-top: 10px solid blue;
+ border-left: 20px solid red;
+ border-right: 30px solid green;
+ border-bottom: 40px solid gray;
+
+ display: inline-block;
+ background: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<div id="outer">
+ <div id="test1">
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1094914-1b.html b/layout/reftests/writing-mode/1094914-1b.html
new file mode 100644
index 000000000..e815348ad
--- /dev/null
+++ b/layout/reftests/writing-mode/1094914-1b.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+ margin: 0px;
+ background: #ddd;
+ font-size: 0;
+ width: 300px;
+}
+
+#test1 {
+ writing-mode: vertical-rl;
+
+ height: 50px;
+ width: 100px;
+
+ margin-top: 10px;
+ margin-bottom: 0px;
+ margin-left: 50px;
+ margin-right: 0px;
+
+ border-top: 10px solid blue;
+ border-left: 20px solid red;
+ border-right: 30px solid green;
+ border-bottom: 40px solid gray;
+
+ display: inline-block;
+ background: yellow;
+}
+</style>
+</head>
+
+<body>
+
+<div id="outer">
+ <div id="test1">
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1096224-1-ref.html b/layout/reftests/writing-mode/1096224-1-ref.html
new file mode 100644
index 000000000..196258ef8
--- /dev/null
+++ b/layout/reftests/writing-mode/1096224-1-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.outer {
+ padding: 2px;
+ border: 1px solid black;
+ background: #ddd;
+ width: 200px;
+}
+.inner {
+ width: 50px;
+ height: 50px;
+ background: yellow;
+}
+.foo {
+ margin-left: 100px;
+ margin-right: 50px;
+ margin-top: 20px;
+ margin-bottom: 5px;
+}
+.bar {
+ margin-left: 50px;
+ margin-right: 100px;
+ margin-top: 5px;
+ margin-bottom: 20px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="outer">
+ <div class="inner foo">
+ </div>
+<hr>
+ <div class="inner bar">
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1096224-1a.html b/layout/reftests/writing-mode/1096224-1a.html
new file mode 100644
index 000000000..53ea4ab59
--- /dev/null
+++ b/layout/reftests/writing-mode/1096224-1a.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.outer {
+ padding: 2px;
+ border: 1px solid black;
+ background: #ddd;
+ width: 200px;
+}
+.inner {
+ width: 50px;
+ height: 50px;
+ background: yellow;
+}
+.foo {
+ writing-mode: vertical-lr;
+ margin-left: 100px;
+ margin-right: 50px;
+ margin-top: 20px;
+ margin-bottom: 5px;
+}
+.bar {
+ writing-mode: vertical-lr;
+ margin-left: 50px;
+ margin-right: 100px;
+ margin-top: 5px;
+ margin-bottom: 20px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="outer">
+ <div class="inner foo">
+ </div>
+<hr>
+ <div class="inner bar">
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1096224-1b.html b/layout/reftests/writing-mode/1096224-1b.html
new file mode 100644
index 000000000..fe617b2fc
--- /dev/null
+++ b/layout/reftests/writing-mode/1096224-1b.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.outer {
+ padding: 2px;
+ border: 1px solid black;
+ background: #ddd;
+ width: 200px;
+}
+.inner {
+ width: 50px;
+ height: 50px;
+ background: yellow;
+}
+.foo {
+ writing-mode: vertical-rl;
+ margin-left: 100px;
+ margin-right: 50px;
+ margin-top: 20px;
+ margin-bottom: 5px;
+}
+.bar {
+ writing-mode: vertical-rl;
+ margin-left: 50px;
+ margin-right: 100px;
+ margin-top: 5px;
+ margin-bottom: 20px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="outer">
+ <div class="inner foo">
+ </div>
+<hr>
+ <div class="inner bar">
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1102175-1-ref.html b/layout/reftests/writing-mode/1102175-1-ref.html
new file mode 100644
index 000000000..64804f6e2
--- /dev/null
+++ b/layout/reftests/writing-mode/1102175-1-ref.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body > div {
+ width:100%;
+ height:100%;
+ display:inline-block;
+}
+body > div > div {
+ width:400px;
+ height:400px;
+ border:1px solid red;
+ float:left;
+}
+
+.v-rl {
+ -ms-writing-mode: tb-rl; /* old syntax. IE */
+ -ms-writing-mode: vertical-rl; /* new syntax */
+ -webkit-writing-mode: vertical-rl;
+ -moz-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+}
+
+#test1 {
+ font-size: 24px;
+}
+</style>
+
+</head>
+
+<body>
+<div id="wrapper" class="v-rl">
+<div id="test1">
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
+ eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
+ ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+ aliquip ex ea commodo consequat.
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1102175-1a.html b/layout/reftests/writing-mode/1102175-1a.html
new file mode 100644
index 000000000..8b3c7df58
--- /dev/null
+++ b/layout/reftests/writing-mode/1102175-1a.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body > div {
+ width:402px;
+ height:402px;
+ display:inline-block;
+}
+body > div > div {
+ width:400px;
+ height:400px;
+ border:1px solid red;
+ float:left;
+}
+
+.v-rl {
+ -ms-writing-mode: tb-rl; /* old syntax. IE */
+ -ms-writing-mode: vertical-rl; /* new syntax */
+ -webkit-writing-mode: vertical-rl;
+ -moz-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+}
+
+#test1 {
+ font-size: 24px;
+}
+</style>
+
+</head>
+
+<body class="v-rl">
+<div>
+ <div id="test1">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1102175-1b.html b/layout/reftests/writing-mode/1102175-1b.html
new file mode 100644
index 000000000..63a920286
--- /dev/null
+++ b/layout/reftests/writing-mode/1102175-1b.html
@@ -0,0 +1,39 @@
+<html class="v-rl">
+<head>
+<meta charset="utf-8">
+<style>
+body > div {
+ width:402px;
+ height:402px;
+ display:inline-block;
+}
+body > div > div {
+ width:400px;
+ height:400px;
+ border:1px solid red;
+ float:left;
+}
+
+.v-rl {
+ -ms-writing-mode: tb-rl; /* old syntax. IE */
+ -ms-writing-mode: vertical-rl; /* new syntax */
+ -webkit-writing-mode: vertical-rl;
+ -moz-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+}
+
+#test1 {
+ font-size: 24px;
+}
+</style>
+
+</head>
+
+<body>
+<div>
+ <div id="test1">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1103613-1-ref.html b/layout/reftests/writing-mode/1103613-1-ref.html
new file mode 100644
index 000000000..4054b2d84
--- /dev/null
+++ b/layout/reftests/writing-mode/1103613-1-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+ height: 200px;
+ width: 300px;
+ margin: 10px;
+ border: 50px solid #ddd;
+}
+#test {
+ writing-mode: vertical-lr;
+ margin: 10px;
+ height: 180px;
+}
+</style>
+</head>
+
+<body>
+<div id="outer">
+<div id="test">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1103613-1.html b/layout/reftests/writing-mode/1103613-1.html
new file mode 100644
index 000000000..b7b40ba23
--- /dev/null
+++ b/layout/reftests/writing-mode/1103613-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+ height: 200px;
+ width: 300px;
+ margin: 10px;
+ border: 50px solid #ddd;
+}
+#test {
+ writing-mode: vertical-lr;
+ margin: 10px;
+}
+</style>
+</head>
+
+<body>
+<div id="outer">
+<div id="test">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1105268-1-min-max-dimensions-ref.html b/layout/reftests/writing-mode/1105268-1-min-max-dimensions-ref.html
new file mode 100644
index 000000000..90347bc05
--- /dev/null
+++ b/layout/reftests/writing-mode/1105268-1-min-max-dimensions-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.wrapper {
+ display: inline-block;
+ vertical-align: top;
+ margin: 20px;
+}
+.outer {
+ height: 250px;
+ width: 200px;
+ border: 10px solid #ddd;
+}
+.inner {
+ font: 12px monospace;
+ background: yellow;
+ overflow: hidden;
+}
+.test1 {
+ width: 180px;
+ height: 150px;
+}
+.test2 {
+ width: 150px;
+ height: 200px;
+}
+.lr {
+ writing-mode: vertical-lr;
+}
+.rl {
+ writing-mode: vertical-rl;
+}
+</style>
+
+</head>
+
+<body>
+
+<div class="wrapper">
+<div class="outer">
+<div class="inner test1 lr">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</div>
+</div>
+</div>
+
+<br>
+
+<div class="wrapper">
+<div class="outer">
+<div class="inner test2 lr">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</div>
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1105268-1-min-max-dimensions.html b/layout/reftests/writing-mode/1105268-1-min-max-dimensions.html
new file mode 100644
index 000000000..1d4764187
--- /dev/null
+++ b/layout/reftests/writing-mode/1105268-1-min-max-dimensions.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.wrapper {
+ display: inline-block;
+ vertical-align: top;
+ margin: 20px;
+}
+.outer {
+ height: 250px;
+ width: 200px;
+ border: 10px solid #ddd;
+}
+.inner {
+ font: 12px monospace;
+ background: yellow;
+ overflow: hidden;
+}
+.test1 {
+ min-width: 180px;
+ max-width: 180px;
+ min-height: 150px;
+ max-height: 150px;
+}
+.test2 {
+ min-width: 150px;
+ max-width: 150px;
+ min-height: 200px;
+ max-height: 200px;
+}
+.lr {
+ writing-mode: vertical-lr;
+}
+</style>
+
+</head>
+
+<body>
+
+<div class="wrapper">
+<div class="outer">
+<div class="inner test1 lr">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</div>
+</div>
+</div>
+
+<br>
+
+<div class="wrapper">
+<div class="outer">
+<div class="inner test2 lr">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</div>
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1105268-2-min-max-dimensions-ref.html b/layout/reftests/writing-mode/1105268-2-min-max-dimensions-ref.html
new file mode 100644
index 000000000..6ca2ba2e9
--- /dev/null
+++ b/layout/reftests/writing-mode/1105268-2-min-max-dimensions-ref.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.wrapper {
+ display: inline-block;
+ vertical-align: top;
+ margin: 20px;
+}
+.outer {
+ height: 250px;
+ width: 200px;
+ border: 10px solid #ddd;
+}
+.inner {
+ overflow: hidden;
+ background: yellow;
+}
+.test1 {
+ width: 100px;
+ height: 150px;
+}
+.test2 {
+ width: 150px;
+ height: 100px;
+}
+</style>
+
+</head>
+
+<body>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test1" src="foo">
+</div>
+</div>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test1" src="foo" dir="rtl">
+</div>
+</div>
+
+<br>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test2" src="foo">
+</div>
+</div>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test2" src="foo" dir="rtl">
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1105268-2-min-max-dimensions.html b/layout/reftests/writing-mode/1105268-2-min-max-dimensions.html
new file mode 100644
index 000000000..3df6d3b62
--- /dev/null
+++ b/layout/reftests/writing-mode/1105268-2-min-max-dimensions.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.wrapper {
+ display: inline-block;
+ vertical-align: top;
+ margin: 20px;
+}
+.outer {
+ height: 250px;
+ width: 200px;
+ border: 10px solid #ddd;
+}
+.inner {
+ overflow: hidden;
+ background: yellow;
+}
+.test1 {
+ min-width: 100px;
+ max-width: 100px;
+ min-height: 150px;
+ max-height: 150px;
+}
+.test2 {
+ min-width: 150px;
+ max-width: 150px;
+ min-height: 100px;
+ max-height: 100px;
+}
+.lr {
+ writing-mode: vertical-lr;
+}
+.rl {
+ writing-mode: vertical-rl;
+}
+</style>
+
+</head>
+
+<body>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test1 lr" src="foo">
+</div>
+</div>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test1 rl" src="foo">
+</div>
+</div>
+
+<br>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test2 lr" src="foo">
+</div>
+</div>
+
+<div class="wrapper">
+<div class="outer">
+<img class="inner test2 rl" src="foo">
+</div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1106669-1-intrinsic-for-container-ref.html b/layout/reftests/writing-mode/1106669-1-intrinsic-for-container-ref.html
new file mode 100644
index 000000000..0f0d09eb5
--- /dev/null
+++ b/layout/reftests/writing-mode/1106669-1-intrinsic-for-container-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+button {
+ position: absolute;
+ border: 1px solid blue;
+ margin: 1px;
+ padding: 0;
+}
+div {
+ position: absolute;
+ background: yellow;
+}
+</style>
+</head>
+<body>
+
+<button style="top:0px"><img src="" width="20" height="80"></button>
+
+<button style="top:100px"><img src="" width="80" height="20"></button>
+
+<!-- solid-color <div>s that should completely cover the buttons above,
+ provided they size themselves properly for their <img> content -->
+<div style="top:0px; width:40px; height:90px;"></div>
+
+<div style="top:100px; width:100px; height:40px;"></div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1106669-1-intrinsic-for-container.html b/layout/reftests/writing-mode/1106669-1-intrinsic-for-container.html
new file mode 100644
index 000000000..214c346d3
--- /dev/null
+++ b/layout/reftests/writing-mode/1106669-1-intrinsic-for-container.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+button {
+ position: absolute;
+ border: 1px solid blue;
+ margin: 1px;
+ padding: 0;
+ writing-mode: vertical-rl;
+}
+div {
+ position: absolute;
+ background: yellow;
+}
+</style>
+</head>
+<body>
+
+<button style="top:0px"><img src="" width="20" height="80"></button>
+
+<button style="top:100px"><img src="" width="80" height="20"></button>
+
+<!-- solid-color <div>s that should completely cover the buttons above,
+ provided they size themselves properly for their <img> content -->
+<div style="top:0px; width:40px; height:90px;"></div>
+
+<div style="top:100px; width:100px; height:40px;"></div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1108923-1-percentage-margins-ref.html b/layout/reftests/writing-mode/1108923-1-percentage-margins-ref.html
new file mode 100644
index 000000000..ecd5c175d
--- /dev/null
+++ b/layout/reftests/writing-mode/1108923-1-percentage-margins-ref.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.outer {
+ width:600px;
+ height:200px;
+ border:1px solid gray;
+ background:#eee;
+ font-size:0px;
+}
+.test1 {
+ display:inline-block;
+ position:relative;
+ top:100px;
+ left:300px;
+ border:10px solid green;
+ width:80px;
+ height:30px;
+}
+.test2 {
+ display:inline-block;
+ position:relative;
+ top:0px;
+ left:250px;
+ border:10px solid blue;
+ width:80px;
+ height:30px;
+}
+.test3 {
+ display:inline-block;
+ position:relative;
+ top:20px;
+ left:230px;
+ border:10px solid yellow;
+ width:80px;
+ height:30px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="outer">
+
+<div class="test3">
+</div>
+
+<div class="test2">
+</div>
+
+<div class="test1">
+</div>
+
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1108923-1-percentage-margins.html b/layout/reftests/writing-mode/1108923-1-percentage-margins.html
new file mode 100644
index 000000000..71a6d7f66
--- /dev/null
+++ b/layout/reftests/writing-mode/1108923-1-percentage-margins.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.outer {
+ writing-mode:vertical-rl;
+ -webkit-writing-mode:vertical-rl;
+ width:600px;
+ height:200px;
+ border:1px solid gray;
+ background:#eee;
+}
+.test1 {
+ border:10px solid green;
+ margin-top:50%; /* should be 50% of 200px, i.e. 100px */
+ width:80px;
+ height:30px;
+}
+.test2 {
+ border:10px solid blue;
+ margin-right:25%; /* should be 25% of 200px, i.e. 50px */
+ margin-left:10%; /* should be 10% of 200px, i.e. 20px */
+ width:80px;
+ height:30px;
+}
+.test3 {
+ border:10px solid yellow;
+ margin-top:10%; /* should be 10% of 200px, i.e. 20px */
+ width:80px;
+ height:30px;
+}
+</style>
+</head>
+
+<body>
+
+<div class="outer">
+
+<div class="test1">
+</div>
+
+<div class="test2">
+</div>
+
+<div class="test3">
+</div>
+
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1111944-1-list-marker-ref.html b/layout/reftests/writing-mode/1111944-1-list-marker-ref.html
new file mode 100644
index 000000000..f0676fbd4
--- /dev/null
+++ b/layout/reftests/writing-mode/1111944-1-list-marker-ref.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ font-family: Arial, sans-serif;
+ font-size: 16px;
+ line-height: 24px;
+}
+.outer {
+ display: inline-block;
+ vertical-align: top;
+ width: 380px;
+ height: 180px;
+ border: 1px solid blue;
+ margin: 5px;
+}
+.ol {
+ margin: 0 12px;
+}
+.m1 {
+ display: inline-block;
+ height: 40px;
+ text-align: right;
+}
+.m2 {
+ display: inline-block;
+ height: 5em;
+ text-align: right;
+}
+</style>
+</head>
+<body>
+ Test for list item markers in vertical mode:
+ <br>
+ <div class="outer" style="writing-mode:vertical-lr;text-orientation:sideways-right">
+ Mode vertical-lr, style lower-roman:
+ <div class="ol">
+ <span class="m1">i.&nbsp;</span>one<br>
+ <span class="m1">ii.&nbsp;</span>two<br>
+ <span class="m1">iii.&nbsp;</span>three<br>
+ <span class="m1">iv.&nbsp;</span>four<br>
+ <span class="m1">v.&nbsp;</span>five<br>
+ <span class="m1">vi.&nbsp;</span>six<br>
+ <span class="m1">vii.&nbsp;</span>seven<br>
+ <span class="m1">viii.&nbsp;</span>eight<br>
+ <span class="m1">ix.&nbsp;</span>nine<br>
+ <span class="m1">x.&nbsp;</span>ten<br>
+ <span class="m1">xi.&nbsp;</span>eleven<br>
+ <span class="m1">xii.&nbsp;</span>twelve<br>
+ </div>
+ </div>
+ <div class="outer" style="writing-mode:vertical-rl;text-orientation:sideways-right">
+ Mode vertical-rl, style hebrew:
+ <div class="ol">
+ <span class="m1">א.&nbsp;</span>one<br>
+ <span class="m1">ב.&nbsp;</span>two<br>
+ <span class="m1">ג.&nbsp;</span>three<br>
+ <span class="m1">ד.&nbsp;</span>four<br>
+ <span class="m1">ה.&nbsp;</span>five<br>
+ <span class="m1">ו.&nbsp;</span>six<br>
+ <span class="m1">ז.&nbsp;</span>seven<br>
+ <span class="m1">ח.&nbsp;</span>eight<br>
+ <span class="m1">ט.&nbsp;</span>nine<br>
+ <span class="m1">י.&nbsp;</span>ten<br>
+ <span class="m1">יא.&nbsp;</span>eleven<br>
+ <span class="m1">יב.&nbsp;</span>twelve<br>
+ </div>
+ </div>
+ <br>
+ <div class="outer" style="writing-mode:vertical-lr">
+ Mode vertical-lr, style trad-chinese-formal:
+ <div class="ol">
+ <span class="m2">壹、</span>one<br>
+ <span class="m2">貳、</span>two<br>
+ <span class="m2">參、</span>three<br>
+ <span class="m2">肆、</span>four<br>
+ <span class="m2">伍、</span>five<br>
+ <span class="m2">陸、</span>six<br>
+ <span class="m2">柒、</span>seven<br>
+ <span class="m2">捌、</span>eight<br>
+ <span class="m2">玖、</span>nine<br>
+ <span class="m2">壹拾、</span>ten<br>
+ <span class="m2">壹拾壹、</span>eleven<br>
+ <span class="m2">壹拾貳、</span>twelve<br>
+ </div>
+ </div>
+ <div class="outer" style="writing-mode:vertical-rl">
+ Mode vertical-rl, style japanese-informal:
+ <div class="ol">
+ <span class="m2">一、</span>one<br>
+ <span class="m2">二、</span>two<br>
+ <span class="m2">三、</span>three<br>
+ <span class="m2">四、</span>four<br>
+ <span class="m2">五、</span>five<br>
+ <span class="m2">六、</span>six<br>
+ <span class="m2">七、</span>seven<br>
+ <span class="m2">八、</span>eight<br>
+ <span class="m2">九、</span>nine<br>
+ <span class="m2">十、</span>ten<br>
+ <span class="m2">十一、</span>eleven<br>
+ <span class="m2">十二、</span>twelve<br>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1111944-1-list-marker.html b/layout/reftests/writing-mode/1111944-1-list-marker.html
new file mode 100644
index 000000000..cd7f2eda2
--- /dev/null
+++ b/layout/reftests/writing-mode/1111944-1-list-marker.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ font-family: Arial, sans-serif;
+ font-size: 16px;
+ line-height: 24px;
+}
+div {
+ display: inline-block;
+ vertical-align: top;
+ width: 380px;
+ height: 180px;
+ border: 1px solid blue;
+ margin: 5px;
+}
+ol {
+ margin: 0 12px;
+ padding: 40px 0 0 0;
+}
+li { margin:0; padding:0 }
+</style>
+</head>
+<body>
+ Test for list item markers in vertical mode:
+ <br>
+ <div style="writing-mode:vertical-lr;text-orientation:sideways-right">
+ Mode vertical-lr, style lower-roman:
+ <ol style="list-style-type:lower-roman">
+ <li>one<li>two<li>three<li>four<li>five<li>six<li>seven<li>eight<li>nine<li>ten<li>eleven<li>twelve
+ </ol>
+ </div>
+ <div style="writing-mode:vertical-rl;text-orientation:sideways-right">
+ Mode vertical-rl, style hebrew:
+ <ol style="list-style-type:hebrew">
+ <li>one<li>two<li>three<li>four<li>five<li>six<li>seven<li>eight<li>nine<li>ten<li>eleven<li>twelve
+ </ol>
+ </div>
+ <br>
+ <div style="writing-mode:vertical-lr">
+ Mode vertical-lr, style trad-chinese-formal:
+ <ol style="list-style-type:trad-chinese-formal;padding-top:5em">
+ <li>one<li>two<li>three<li>four<li>five<li>six<li>seven<li>eight<li>nine<li>ten<li>eleven<li>twelve
+ </ol>
+ </div>
+ <div style="writing-mode:vertical-rl">
+ Mode vertical-rl, style japanese-informal:
+ <ol style="list-style-type:japanese-informal;padding-top:5em">
+ <li>one<li>two<li>three<li>four<li>five<li>six<li>seven<li>eight<li>nine<li>ten<li>eleven<li>twelve
+ </ol>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1115916-1-vertical-metrics-ref.html b/layout/reftests/writing-mode/1115916-1-vertical-metrics-ref.html
new file mode 100644
index 000000000..f900e37a5
--- /dev/null
+++ b/layout/reftests/writing-mode/1115916-1-vertical-metrics-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: ahem;
+ src: url(../fonts/Ahem.ttf);
+}
+div {
+ height: 100px;
+ font: 16px/24px ahem;
+}
+#test1 {
+ writing-mode: vertical-lr;
+ text-orientation: upright;
+}
+</style>
+</head>
+<body>
+<div id="test1">
+<span>ab<br>cd</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1115916-1-vertical-metrics.html b/layout/reftests/writing-mode/1115916-1-vertical-metrics.html
new file mode 100644
index 000000000..9916b4a54
--- /dev/null
+++ b/layout/reftests/writing-mode/1115916-1-vertical-metrics.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: ahem;
+ src: url(../fonts/Ahem.ttf);
+}
+div {
+ height: 100px;
+ font: 16px/24px ahem;
+}
+#test1 {
+ writing-mode: vertical-lr;
+ text-orientation: upright;
+}
+span {
+ background: red; /* should not be visible */
+}
+</style>
+</head>
+<body>
+<div id="test1">
+<span>ab<br>cd</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1117210-1-vertical-baseline-snap-ref.html b/layout/reftests/writing-mode/1117210-1-vertical-baseline-snap-ref.html
new file mode 100644
index 000000000..2ebaf81dc
--- /dev/null
+++ b/layout/reftests/writing-mode/1117210-1-vertical-baseline-snap-ref.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: ahem;
+ src: url(../fonts/Ahem.ttf);
+}
+
+div {
+ font-family: ahem;
+ font-size: 10px;
+}
+
+.lr {
+ writing-mode: vertical-lr;
+ text-orientation: sideways-right;
+ height: 40px;
+}
+.rl {
+ writing-mode: vertical-lr;
+ text-orientation: sideways-right;
+ height: 40px;
+}
+
+.c { position: relative; top: 10px; left: 10px; }
+</style>
+</head>
+
+<body>
+<div class="lr c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+
+<br>
+
+<div class="rl c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1117210-1-vertical-baseline-snap.html b/layout/reftests/writing-mode/1117210-1-vertical-baseline-snap.html
new file mode 100644
index 000000000..88eca655e
--- /dev/null
+++ b/layout/reftests/writing-mode/1117210-1-vertical-baseline-snap.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: ahem;
+ src: url(../fonts/Ahem.ttf);
+}
+
+div {
+ font-family: ahem;
+ font-size: 10px;
+}
+
+.lr {
+ writing-mode: vertical-lr;
+ text-orientation: sideways-right;
+ height: 40px;
+}
+.rl {
+ writing-mode: vertical-rl;
+ text-orientation: sideways-right;
+ height: 40px;
+}
+
+.a { position: relative; top: 10px; left: 10px; }
+.b { position: relative; top: 10px; left: 10px; }
+.c { position: relative; top: 10px; left: 10px; }
+.d { position: relative; top: 10px; left: 10px; }
+.e { position: relative; top: 10px; left: 10px; }
+
+/* resolution-dependent offsets: we want CSS px values that will correspond
+ to less that 0.5 device pixels either side of where 10px falls, so they
+ all snap to the same device-pixel value */
+
+/* XXX For higher-than-retina density, we punt; the test becomes a no-op */
+
+@media (max-resolution: 2dppx) {
+ .a { left: 9.8px; }
+ .b { left: 9.9px; }
+ .c { left: 10px; }
+ .d { left: 10.1px; }
+ .e { left: 10.2px; }
+}
+
+@media (max-resolution: 1.5dppx) {
+ .a { left: 9.7px; }
+ .b { left: 9.85px; }
+ .c { left: 10px; }
+ .d { left: 10.15px; }
+ .e { left: 10.3px; }
+}
+
+@media (max-resolution: 1dppx) {
+ .a { left: 9.6px; }
+ .b { left: 9.8px; }
+ .c { left: 10px; }
+ .d { left: 10.2px; }
+ .e { left: 10.4px; }
+}
+
+</style>
+</head>
+
+<body>
+<div class="lr a">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr b">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr d">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="lr e">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+
+<br>
+
+<div class="rl a">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl b">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl c">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl d">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+<div class="rl e">abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc<br>abc</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1117227-1-text-overflow-ref.html b/layout/reftests/writing-mode/1117227-1-text-overflow-ref.html
new file mode 100644
index 000000000..41b3d42e3
--- /dev/null
+++ b/layout/reftests/writing-mode/1117227-1-text-overflow-ref.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 1117227 - text-overflow on vertical text</title>
+ <style>
+ @font-face {
+ font-family: DejaVuSansMono;
+ src: url(../fonts/DejaVuSansMono.woff);
+ }
+ body {
+ font: 16px DejaVuSansMono;
+ text-orientation: sideways-right;
+ white-space: nowrap;
+ }
+ .c {
+ block-size: 3em; inline-size: 4em;
+ overflow: hidden;
+ }
+ .vlr { writing-mode: vertical-lr; }
+ .vrl { writing-mode: vertical-rl; }
+ .t { margin-inline-start: -1em; }
+ m { display: inline-block; }
+
+ #tests { position: relative; }
+ #tests > div { position: absolute; }
+ .r1 { top: 0em; }
+ .r2 { top: 4.5em; }
+ .c1 { left: 0em; }
+ .c2 { left: 4em; }
+ .c3 { left: 8em; }
+ .c4 { left: 12em; }
+ .c5 { left: 16em; }
+ .c6 { left: 20em; }
+ </style>
+</head>
+<body>
+ <p style="font-family: sans-serif">Test for text-overflow in vertical mode:</p>
+
+ <div id="tests">
+ <div class="r1 c1"><div class="c vrl"><span class="t">&nbsp;123456<m>&hellip;</m></span></div></div>
+ <div class="r1 c2"><div class="c vlr"><span class="t">&nbsp;123456<m>&hellip;</m></span></div></div>
+ <div class="r1 c3"><div class="c vrl"><span class="t">&nbsp;&nbsp;<m>&hellip;</m>3456<m>&hellip;</m></span></div></div>
+ <div class="r1 c4"><div class="c vlr"><span class="t">&nbsp;&nbsp;<m>&hellip;</m>3456<m>&hellip;</m></span></div></div>
+ <div class="r1 c5"><div class="c vrl"><span class="t">&nbsp;&nbsp;<m>&hellip;</m>345678&nbsp;</span></div></div>
+ <div class="r1 c6"><div class="c vlr"><span class="t">&nbsp;&nbsp;<m>&hellip;</m>345678&nbsp;</span></div></div>
+
+ <div class="r2 c1"><div class="c vrl"><span class="t">&nbsp;123456<m>$</m></span></div></div>
+ <div class="r2 c2"><div class="c vlr"><span class="t">&nbsp;123456<m>$</m></span></div></div>
+ <div class="r2 c3"><div class="c vrl"><span class="t">&nbsp;&nbsp;<m>^</m>3456<m>$</m></span></div></div>
+ <div class="r2 c4"><div class="c vlr"><span class="t">&nbsp;&nbsp;<m>^</m>3456<m>$</m></span></div></div>
+ <div class="r2 c5"><div class="c vrl"><span class="t">&nbsp;&nbsp;<m>^</m>3456<m>&hellip;</m></span></div></div>
+ <div class="r2 c6"><div class="c vlr"><span class="t">&nbsp;&nbsp;<m>^</m>3456<m>&hellip;</m></span></div></div>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1117227-1-text-overflow.html b/layout/reftests/writing-mode/1117227-1-text-overflow.html
new file mode 100644
index 000000000..a09e3449c
--- /dev/null
+++ b/layout/reftests/writing-mode/1117227-1-text-overflow.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 1117227 - text-overflow on vertical text</title>
+ <style>
+ @font-face {
+ font-family: DejaVuSansMono;
+ src: url(../fonts/DejaVuSansMono.woff);
+ }
+ body {
+ font: 16px DejaVuSansMono;
+ text-orientation: sideways-right;
+ }
+ .c {
+ block-size: 3em; inline-size: 4em;
+ overflow: hidden;
+ }
+ .e { text-overflow: ellipsis; }
+ .ee { text-overflow: ellipsis ellipsis; }
+ .ec { text-overflow: ellipsis clip; }
+ .s { text-overflow: '$'; }
+ .ss { text-overflow: '^' '$'; }
+ .se { text-overflow: '^' ellipsis; }
+ .vlr { writing-mode: vertical-lr; }
+ .vrl { writing-mode: vertical-rl; }
+ .t { margin-inline-start: -1em; }
+
+ #tests { position: relative; }
+ #tests > div { position: absolute; }
+ .r1 { top: 0em; }
+ .r2 { top: 4.5em; }
+ .c1 { left: 0em; }
+ .c2 { left: 4em; }
+ .c3 { left: 8em; }
+ .c4 { left: 12em; }
+ .c5 { left: 16em; }
+ .c6 { left: 20em; }
+ </style>
+</head>
+<body>
+ <p style="font-family: sans-serif">Test for text-overflow in vertical mode:</p>
+
+ <div id="tests">
+ <div class="r1 c1"><div class="c e vrl"><span class="t">0123456789</span></div></div>
+ <div class="r1 c2"><div class="c e vlr"><span class="t">0123456789</span></div></div>
+ <div class="r1 c3"><div class="c ee vrl"><span class="t">0123456789</span></div></div>
+ <div class="r1 c4"><div class="c ee vlr"><span class="t">0123456789</span></div></div>
+ <div class="r1 c5"><div class="c ec vrl"><span class="t">0123456789</span></div></div>
+ <div class="r1 c6"><div class="c ec vlr"><span class="t">0123456789</span></div></div>
+
+ <div class="r2 c1"><div class="c s vrl"><span class="t">0123456789</span></div></div>
+ <div class="r2 c2"><div class="c s vlr"><span class="t">0123456789</span></div></div>
+ <div class="r2 c3"><div class="c ss vrl"><span class="t">0123456789</span></div></div>
+ <div class="r2 c4"><div class="c ss vlr"><span class="t">0123456789</span></div></div>
+ <div class="r2 c5"><div class="c se vrl"><span class="t">0123456789</span></div></div>
+ <div class="r2 c6"><div class="c se vlr"><span class="t">0123456789</span></div></div>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1122366-1-margin-collapse-ref.html b/layout/reftests/writing-mode/1122366-1-margin-collapse-ref.html
new file mode 100644
index 000000000..315ea6c45
--- /dev/null
+++ b/layout/reftests/writing-mode/1122366-1-margin-collapse-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bug 1122366 - margin collapsing</title>
+ <style type="text/css">
+ div {
+ font: 40px/1em serif;
+ height: 4em;
+ }
+ div.wrapper {
+ margin: 10px;
+ background: blue;
+ border-left: green solid .5em;
+ border-right: green solid 1.5em;
+ width: 2em;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="wrapper">
+ </div>
+ <div class="wrapper">
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1122366-1-margin-collapse.html b/layout/reftests/writing-mode/1122366-1-margin-collapse.html
new file mode 100644
index 000000000..80e0fad18
--- /dev/null
+++ b/layout/reftests/writing-mode/1122366-1-margin-collapse.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bug 1122366 - margin collapsing</title>
+ <style type="text/css">
+ div {
+ font: 40px/1em serif;
+ height: 4em;
+ }
+ div.wrapper {
+ margin: 10px;
+ background: blue;
+ border-left: green solid .5em;
+ border-right: green solid 1.5em;
+ }
+ div.lr {
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+ div.rl {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+ div.widthless
+ {
+ margin-right: 2em;
+ width: 0;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="wrapper lr">
+ <div class="widthless"></div>
+ <div class="widthless"></div>
+ </div>
+ <div class="wrapper rl">
+ <div class="widthless"></div>
+ <div class="widthless"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1124636-1-fieldset-max-height-ref.html b/layout/reftests/writing-mode/1124636-1-fieldset-max-height-ref.html
new file mode 100644
index 000000000..7de3adf56
--- /dev/null
+++ b/layout/reftests/writing-mode/1124636-1-fieldset-max-height-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Maximum height on fieldset</title>
+ <style>
+ div {
+ writing-mode: vertical-lr;
+ }
+ fieldset {
+ background:rgba(0,0,0,0.1);
+ border-color:teal;
+ border-width:2px;
+ height:100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div>
+ <fieldset>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Duis odio est, cursus non adipiscing at, fringilla
+ quis eros. Sed volutpat nibh sit amet ante molestie a
+ vehicula nulla gravida. Mauris elementum cursus urna id
+ vestibulum.</p>
+ </fieldset>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1124636-1-fieldset-max-height.html b/layout/reftests/writing-mode/1124636-1-fieldset-max-height.html
new file mode 100644
index 000000000..8cd5c9e27
--- /dev/null
+++ b/layout/reftests/writing-mode/1124636-1-fieldset-max-height.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Maximum height on fieldset</title>
+ <style>
+ div {
+ writing-mode: vertical-lr;
+ }
+ fieldset {
+ background:rgba(0,0,0,0.1);
+ border-color:teal;
+ border-width:2px;
+ max-height:100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div>
+ <fieldset>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Duis odio est, cursus non adipiscing at, fringilla
+ quis eros. Sed volutpat nibh sit amet ante molestie a
+ vehicula nulla gravida. Mauris elementum cursus urna id
+ vestibulum.</p>
+ </fieldset>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1124636-2-fieldset-min-height-ref.html b/layout/reftests/writing-mode/1124636-2-fieldset-min-height-ref.html
new file mode 100644
index 000000000..e01d1dabc
--- /dev/null
+++ b/layout/reftests/writing-mode/1124636-2-fieldset-min-height-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Minimum height on fieldset</title>
+ <style>
+ div {
+ writing-mode: vertical-lr;
+ }
+ fieldset {
+ background:rgba(0,0,0,0.1);
+ border-color:teal;
+ border-width:2px;
+ height:200px;
+ }
+ </style>
+ </head>
+ <body>
+ <div>
+ <fieldset>
+ <p>Lorem ipsum.</p>
+ </fieldset>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1124636-2-fieldset-min-height.html b/layout/reftests/writing-mode/1124636-2-fieldset-min-height.html
new file mode 100644
index 000000000..72f139bb4
--- /dev/null
+++ b/layout/reftests/writing-mode/1124636-2-fieldset-min-height.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Minimum height on fieldset</title>
+ <style>
+ div {
+ writing-mode: vertical-lr;
+ }
+ fieldset {
+ background:rgba(0,0,0,0.1);
+ border-color:teal;
+ border-width:2px;
+ min-height:200px;
+ max-height:400px;
+ }
+ </style>
+ </head>
+ <body>
+ <div>
+ <fieldset>
+ <p>Lorem ipsum.</p>
+ </fieldset>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-bottom-left-ref.html b/layout/reftests/writing-mode/1127488-align-bottom-left-ref.html
new file mode 100644
index 000000000..af2d3d942
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-bottom-left-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div {
+ position: absolute;
+ left: 0px;
+ top: 200px;
+ }
+ </style>
+ </head>
+ <body>
+ <div><img src="green-100x100.png" width="100" height="100" alt="Image download support must be enabled"></img></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-bottom-right-ref.html b/layout/reftests/writing-mode/1127488-align-bottom-right-ref.html
new file mode 100644
index 000000000..9e9d79229
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-bottom-right-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div {
+ position: absolute;
+ left: 200px;
+ top: 200px;
+ }
+ </style>
+ </head>
+ <body>
+ <div><img src="green-100x100.png" width="100" height="100" alt="Image download support must be enabled"></img></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-default-horizontal-tb-ltr.html b/layout/reftests/writing-mode/1127488-align-default-horizontal-tb-ltr.html
new file mode 100644
index 000000000..9dcbb305f
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-default-horizontal-tb-ltr.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ writing-mode: horizontal-tb;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-default-horizontal-tb-rtl.html b/layout/reftests/writing-mode/1127488-align-default-horizontal-tb-rtl.html
new file mode 100644
index 000000000..d4fcd0ea3
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-default-horizontal-tb-rtl.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ writing-mode: horizontal-tb;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-default-vertical-lr-ltr.html b/layout/reftests/writing-mode/1127488-align-default-vertical-lr-ltr.html
new file mode 100644
index 000000000..ae0a69bde
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-default-vertical-lr-ltr.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ writing-mode: vertical-lr;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-default-vertical-lr-rtl.html b/layout/reftests/writing-mode/1127488-align-default-vertical-lr-rtl.html
new file mode 100644
index 000000000..d83b2370f
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-default-vertical-lr-rtl.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-default-vertical-rl-ltr.html b/layout/reftests/writing-mode/1127488-align-default-vertical-rl-ltr.html
new file mode 100644
index 000000000..a70ed3e9c
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-default-vertical-rl-ltr.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ writing-mode: vertical-rl;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-default-vertical-rl-rtl.html b/layout/reftests/writing-mode/1127488-align-default-vertical-rl-rtl.html
new file mode 100644
index 000000000..c57877551
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-default-vertical-rl-rtl.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ writing-mode: vertical-rl;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-end-horizontal-tb-ltr.html b/layout/reftests/writing-mode/1127488-align-end-horizontal-tb-ltr.html
new file mode 100644
index 000000000..782784fb4
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-end-horizontal-tb-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: end;
+ writing-mode: horizontal-tb;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-end-horizontal-tb-rtl.html b/layout/reftests/writing-mode/1127488-align-end-horizontal-tb-rtl.html
new file mode 100644
index 000000000..cda08e24f
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-end-horizontal-tb-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: end;
+ writing-mode: horizontal-tb;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-end-vertical-lr-ltr.html b/layout/reftests/writing-mode/1127488-align-end-vertical-lr-ltr.html
new file mode 100644
index 000000000..a01ed838d
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-end-vertical-lr-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: end;
+ writing-mode: vertical-lr;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-end-vertical-lr-rtl.html b/layout/reftests/writing-mode/1127488-align-end-vertical-lr-rtl.html
new file mode 100644
index 000000000..d7d697707
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-end-vertical-lr-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: end;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-end-vertical-rl-ltr.html b/layout/reftests/writing-mode/1127488-align-end-vertical-rl-ltr.html
new file mode 100644
index 000000000..d9bd2cdf5
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-end-vertical-rl-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: end;
+ writing-mode: vertical-rl;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-end-vertical-rl-rtl.html b/layout/reftests/writing-mode/1127488-align-end-vertical-rl-rtl.html
new file mode 100644
index 000000000..4c5c8e609
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-end-vertical-rl-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: end;
+ writing-mode: vertical-rl;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-left-horizontal-tb-ltr.html b/layout/reftests/writing-mode/1127488-align-left-horizontal-tb-ltr.html
new file mode 100644
index 000000000..5c27f2631
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-left-horizontal-tb-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: left;
+ writing-mode: horizontal-tb;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-left-horizontal-tb-rtl.html b/layout/reftests/writing-mode/1127488-align-left-horizontal-tb-rtl.html
new file mode 100644
index 000000000..4a358149e
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-left-horizontal-tb-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: left;
+ writing-mode: horizontal-tb;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-left-vertical-lr-ltr.html b/layout/reftests/writing-mode/1127488-align-left-vertical-lr-ltr.html
new file mode 100644
index 000000000..c39eb5226
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-left-vertical-lr-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: left;
+ writing-mode: vertical-lr;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-left-vertical-lr-rtl.html b/layout/reftests/writing-mode/1127488-align-left-vertical-lr-rtl.html
new file mode 100644
index 000000000..d7709b433
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-left-vertical-lr-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: left;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-left-vertical-rl-ltr.html b/layout/reftests/writing-mode/1127488-align-left-vertical-rl-ltr.html
new file mode 100644
index 000000000..b2a77b32e
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-left-vertical-rl-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: left;
+ writing-mode: vertical-rl;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-left-vertical-rl-rtl.html b/layout/reftests/writing-mode/1127488-align-left-vertical-rl-rtl.html
new file mode 100644
index 000000000..1ad09717c
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-left-vertical-rl-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: left;
+ writing-mode: vertical-rl;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-right-horizontal-tb-ltr.html b/layout/reftests/writing-mode/1127488-align-right-horizontal-tb-ltr.html
new file mode 100644
index 000000000..52e76192a
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-right-horizontal-tb-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: right;
+ writing-mode: horizontal-tb;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-right-horizontal-tb-rtl.html b/layout/reftests/writing-mode/1127488-align-right-horizontal-tb-rtl.html
new file mode 100644
index 000000000..ceaf162b2
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-right-horizontal-tb-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: right;
+ writing-mode: horizontal-tb;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-right-vertical-lr-ltr.html b/layout/reftests/writing-mode/1127488-align-right-vertical-lr-ltr.html
new file mode 100644
index 000000000..74aecd953
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-right-vertical-lr-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: right;
+ writing-mode: vertical-lr;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-right-vertical-lr-rtl.html b/layout/reftests/writing-mode/1127488-align-right-vertical-lr-rtl.html
new file mode 100644
index 000000000..bbc9ee514
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-right-vertical-lr-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: right;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-right-vertical-rl-ltr.html b/layout/reftests/writing-mode/1127488-align-right-vertical-rl-ltr.html
new file mode 100644
index 000000000..071ed4957
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-right-vertical-rl-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: right;
+ writing-mode: vertical-rl;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-right-vertical-rl-rtl.html b/layout/reftests/writing-mode/1127488-align-right-vertical-rl-rtl.html
new file mode 100644
index 000000000..2b09236af
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-right-vertical-rl-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: right;
+ writing-mode: vertical-rl;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-start-horizontal-tb-ltr.html b/layout/reftests/writing-mode/1127488-align-start-horizontal-tb-ltr.html
new file mode 100644
index 000000000..2a199d4b1
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-start-horizontal-tb-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: start;
+ writing-mode: horizontal-tb;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-start-horizontal-tb-rtl.html b/layout/reftests/writing-mode/1127488-align-start-horizontal-tb-rtl.html
new file mode 100644
index 000000000..8ce6cb3a7
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-start-horizontal-tb-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: start;
+ writing-mode: horizontal-tb;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-start-vertical-lr-ltr.html b/layout/reftests/writing-mode/1127488-align-start-vertical-lr-ltr.html
new file mode 100644
index 000000000..6926e007e
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-start-vertical-lr-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: start;
+ writing-mode: vertical-lr;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-start-vertical-lr-rtl.html b/layout/reftests/writing-mode/1127488-align-start-vertical-lr-rtl.html
new file mode 100644
index 000000000..bc386949c
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-start-vertical-lr-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("left-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: start;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-start-vertical-rl-ltr.html b/layout/reftests/writing-mode/1127488-align-start-vertical-rl-ltr.html
new file mode 100644
index 000000000..f57b8f5f6
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-start-vertical-rl-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-top-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: start;
+ writing-mode: vertical-rl;
+ direction: ltr;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-start-vertical-rl-rtl.html b/layout/reftests/writing-mode/1127488-align-start-vertical-rl-rtl.html
new file mode 100644
index 000000000..ded86fc02
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-start-vertical-rl-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>CSS Writing Modes</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes">
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div.outer {
+ background: red url("right-bottom-300x300.png");
+ height: 300px;
+ width: 300px;
+ text-align: start;
+ writing-mode: vertical-rl;
+ direction: rtl;
+ }
+ div.inner {
+ display: inline-block;
+ background-color: green;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer"><div class="inner"></div></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-top-left-ref.html b/layout/reftests/writing-mode/1127488-align-top-left-ref.html
new file mode 100644
index 000000000..b253a7fa9
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-top-left-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ }
+ </style>
+ </head>
+ <body>
+ <div><img src="green-100x100.png" width="100" height="100" alt="Image download support must be enabled"></img></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1127488-align-top-right-ref.html b/layout/reftests/writing-mode/1127488-align-top-right-ref.html
new file mode 100644
index 000000000..448ac8fb1
--- /dev/null
+++ b/layout/reftests/writing-mode/1127488-align-top-right-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <style type="text/css">
+ body {
+ margin: 0;
+ }
+ div {
+ position: absolute;
+ left: 200px;
+ top: 0px;
+ }
+ </style>
+ </head>
+ <body>
+ <div><img src="green-100x100.png" width="100" height="100" alt="Image download support must be enabled"></img></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1130907-intrinsic-sizing-1-ref.html b/layout/reftests/writing-mode/1130907-intrinsic-sizing-1-ref.html
new file mode 100644
index 000000000..1817d739e
--- /dev/null
+++ b/layout/reftests/writing-mode/1130907-intrinsic-sizing-1-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for intrinsic sizing of float around contents with border</title>
+ <style>
+ body { font-family: sans-serif; line-height: 1.4em; }
+ div { float: left; border: 2px solid blue; margin: 5px; padding: 1px; }
+ span { display: inline-block; }
+ br { clear: both; }
+ .h { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ .y { background: yellow; color: transparent; }
+ .i { inline-size: 2em; }
+ .b { block-size: 2em; inline-size: 100%; }
+ </style>
+ </head>
+ <body>
+ <p>In each case, the blue border should neatly enclose the text and its yellow border-block.</p>
+ <div class="h">
+ <span><span class="y i" style="inline-size:2em;">x</span>123321</span>
+ </div>
+ <div class="h">
+ <span>123321<span class="y i" style="inline-size:2em;">x</span></span>
+ </div>
+ <div class="h">
+ <span><span class="y b">x</span><br>123321</span>
+ </div>
+ <div class="h">
+ <span>123321<br><span class="y b">x</span></span>
+ </div>
+ <br>
+ <div class="v-lr">
+ <span><span class="y i" style="inline-size:2em;">x</span>123321</span>
+ </div>
+ <div class="v-lr">
+ <span>123321<span class="y i" style="inline-size:2em;">x</span></span>
+ </div>
+ <div class="v-lr">
+ <span><span class="y b">x</span><br>123321</span>
+ </div>
+ <div class="v-lr">
+ <span>123321<br><span class="y b">x</span></span>
+ </div>
+ <br>
+ <div class="v-rl">
+ <span><span class="y i" style="inline-size:2em;">x</span>123321</span>
+ </div>
+ <div class="v-rl">
+ <span>123321<span class="y i" style="inline-size:2em;">x</span></span>
+ </div>
+ <div class="v-rl">
+ <span><span class="y b">x</span><br>123321</span>
+ </div>
+ <div class="v-rl">
+ <span>123321<br><span class="y b">x</span></span>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1130907-intrinsic-sizing-1.html b/layout/reftests/writing-mode/1130907-intrinsic-sizing-1.html
new file mode 100644
index 000000000..dd8126d00
--- /dev/null
+++ b/layout/reftests/writing-mode/1130907-intrinsic-sizing-1.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for intrinsic sizing of float around contents with border</title>
+ <style>
+ body { font-family: sans-serif; line-height: 1.4em; }
+ div { float: left; border: 2px solid blue; margin: 5px; padding: 1px; }
+ span { display: inline-block; }
+ br { clear: both; }
+ .h { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ .a { border-inline-start: 2em solid #ff0; }
+ .b { border-inline-end: 2em solid #ff0; }
+ .c { border-block-start: 2em solid #ff0; }
+ .d { border-block-end: 2em solid #ff0; }
+ </style>
+ </head>
+ <body>
+ <p>In each case, the blue border should neatly enclose the text and its yellow border-block.</p>
+ <div class="h">
+ <span class="a">123321</span>
+ </div>
+ <div class="h">
+ <span class="b">123321</span>
+ </div>
+ <div class="h">
+ <span class="c">123321</span>
+ </div>
+ <div class="h">
+ <span class="d">123321</span>
+ </div>
+ <br>
+ <div class="v-lr">
+ <span class="a">123321</span>
+ </div>
+ <div class="v-lr">
+ <span class="b">123321</span>
+ </div>
+ <div class="v-lr">
+ <span class="c">123321</span>
+ </div>
+ <div class="v-lr">
+ <span class="d">123321</span>
+ </div>
+ <br>
+ <div class="v-rl">
+ <span class="a">123321</span>
+ </div>
+ <div class="v-rl">
+ <span class="b">123321</span>
+ </div>
+ <div class="v-rl">
+ <span class="c">123321</span>
+ </div>
+ <div class="v-rl">
+ <span class="d">123321</span>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1130907-intrinsic-sizing-2-ref.html b/layout/reftests/writing-mode/1130907-intrinsic-sizing-2-ref.html
new file mode 100644
index 000000000..44aca7acf
--- /dev/null
+++ b/layout/reftests/writing-mode/1130907-intrinsic-sizing-2-ref.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for intrinsic sizing of float around contents with border</title>
+ <style>
+ body { font-family: sans-serif; line-height: 1.4em; }
+ .h, .v-lr, .v-rl { float: left; border: 2px solid blue; margin: 1.5em; padding: 1px; }
+ .sw { text-orientation: sideways-right; }
+ span { display: inline-block; }
+ br { clear: both; }
+ .h { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ .i { inline-size: 1.5em; }
+ .u { vertical-align: 0.75em; }
+ .d { vertical-align: -0.75em; }
+ </style>
+ </head>
+ <body>
+ <p>In each case, the blue border should neatly enclose the text.</p>
+ <div class="h">
+ <span>12<span class="i"></span><b>33</b>21</span>
+ </div>
+ <div class="h">
+ <span>12<b>33</b><span class="i"></span>21</span>
+ </div>
+ <div class="h">
+ <span>12<b>33</b>21</span>
+ </div>
+ <div class="h">
+ <span>12<b>33</b>21</span>
+ </div>
+ <br>
+ <div class="v-lr">
+ <span>12<span class="i"></span><b>33</b>21</span>
+ </div>
+ <div class="v-lr">
+ <span>12<b>33</b><span class="i"></span>21</span>
+ </div>
+ <div class="v-lr">
+ <span>12<b class="u">33</b>21</span>
+ </div>
+ <div class="v-lr">
+ <span>12<b class="d">33</b>21</span>
+ </div>
+ <div class="v-lr sw">
+ <span>12<b>33</b>21</span>
+ </div>
+ <div class="v-lr sw">
+ <span>12<b>33</b>21</span>
+ </div>
+ <br>
+ <div class="v-rl">
+ <span>12<span class="i"></span><b>33</b>21</span>
+ </div>
+ <div class="v-rl">
+ <span>12<b>33</b><span class="i"></span>21</span>
+ </div>
+ <div class="v-rl">
+ <span>12<b class="d">33</b>21</span>
+ </div>
+ <div class="v-rl">
+ <span>12<b class="u">33</b>21</span>
+ </div>
+ <div class="v-rl sw">
+ <span>12<b>33</b>21</span>
+ </div>
+ <div class="v-rl sw">
+ <span>12<b>33</b>21</span>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1130907-intrinsic-sizing-2.html b/layout/reftests/writing-mode/1130907-intrinsic-sizing-2.html
new file mode 100644
index 000000000..cef3f3d37
--- /dev/null
+++ b/layout/reftests/writing-mode/1130907-intrinsic-sizing-2.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for intrinsic sizing of float around contents with border</title>
+ <style>
+ body { font-family: sans-serif; line-height: 1.4em; }
+ .h, .v-lr, .v-rl { float: left; border: 2px solid blue; margin: 1.5em; padding: 1px; }
+ .sw { text-orientation: sideways-right; }
+ span { display: inline-block; }
+ br { clear: both; }
+ .h { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ .a { border-inline-start: 1.5em solid transparent; }
+ .b { border-inline-end: 1.5em solid transparent; }
+ .c { border-block-start: 1.5em solid transparent; }
+ .d { border-block-end: 1.5em solid transparent; }
+ </style>
+ </head>
+ <body>
+ <p>In each case, the blue border should neatly enclose the text.</p>
+ <div class="h">
+ <span>12<b class="a">33</b>21</span>
+ </div>
+ <div class="h">
+ <span>12<b class="b">33</b>21</span>
+ </div>
+ <div class="h">
+ <span>12<b class="c">33</b>21</span>
+ </div>
+ <div class="h">
+ <span>12<b class="d">33</b>21</span>
+ </div>
+ <br>
+ <div class="v-lr">
+ <div>12<b class="a">33</b>21</div>
+ </div>
+ <div class="v-lr">
+ <div>12<b class="b">33</b>21</div>
+ </div>
+ <div class="v-lr">
+ <div>12<b class="c">33</b>21</div>
+ </div>
+ <div class="v-lr">
+ <div>12<b class="d">33</b>21</div>
+ </div>
+ <div class="v-lr sw">
+ <div>12<b class="c">33</b>21</div>
+ </div>
+ <div class="v-lr sw">
+ <div>12<b class="d">33</b>21</div>
+ </div>
+ <br>
+ <div class="v-rl">
+ <div>12<b class="a">33</b>21</div>
+ </div>
+ <div class="v-rl">
+ <div>12<b class="b">33</b>21</div>
+ </div>
+ <div class="v-rl">
+ <div>12<b class="c">33</b>21</div>
+ </div>
+ <div class="v-rl">
+ <div>12<b class="d">33</b>21</div>
+ </div>
+ <div class="v-rl sw">
+ <div>12<b class="c">33</b>21</div>
+ </div>
+ <div class="v-rl sw">
+ <div>12<b class="d">33</b>21</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1131013-vertical-bidi-ref.html b/layout/reftests/writing-mode/1131013-vertical-bidi-ref.html
new file mode 100644
index 000000000..dbd67da9b
--- /dev/null
+++ b/layout/reftests/writing-mode/1131013-vertical-bidi-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>vertical bidi</title>
+ <style type="text/css">
+div {
+ writing-mode: vertical-rl;
+ text-orientation: sideways-right;
+ height: 200px;
+ width: 100px;
+ text-align: end;
+ background: yellow;
+ line-height: 1.5em;
+}
+ </style>
+ </head>
+ <body>
+ <div>xyz <b>ג bar</b> ב foo א abc</div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1131013-vertical-bidi.html b/layout/reftests/writing-mode/1131013-vertical-bidi.html
new file mode 100644
index 000000000..c2f90920f
--- /dev/null
+++ b/layout/reftests/writing-mode/1131013-vertical-bidi.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>vertical bidi</title>
+ <style type="text/css">
+div {
+ writing-mode: vertical-rl;
+ text-orientation: sideways-right;
+ height: 200px;
+ width: 100px;
+ text-align: start;
+ background: yellow;
+ line-height: 1.5em;
+}
+ </style>
+ </head>
+ <body>
+ <div dir="rtl">abc א foo ב <b>bar ג</b> xyz</div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1133945-1-vertical-align-ref.html b/layout/reftests/writing-mode/1133945-1-vertical-align-ref.html
new file mode 100644
index 000000000..d561a0cf1
--- /dev/null
+++ b/layout/reftests/writing-mode/1133945-1-vertical-align-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for bug 1133945</title>
+ <style>
+ body { writing-mode: vertical-rl; line-height: 60px; }
+ div { display: inline-block; width: 20px; height: 10px; background: blue; }
+ .d { position: relative; left: -20px; }
+ .e { position: relative; left: 20px; }
+ </style>
+ </head>
+ <body>
+ a <div class="a"></div> b <div class="b"></div> c <div class="c"></div>
+ d <div class="d"></div> e <div class="e"></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1133945-1-vertical-align.html b/layout/reftests/writing-mode/1133945-1-vertical-align.html
new file mode 100644
index 000000000..7f4859799
--- /dev/null
+++ b/layout/reftests/writing-mode/1133945-1-vertical-align.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for bug 1133945</title>
+ <style>
+ body { writing-mode: vertical-rl; line-height: 60px; }
+ div { display: inline-block; width: 20px; height: 10px; background: blue; }
+ .a { vertical-align: initial; }
+ .b { vertical-align: middle; }
+ .c { vertical-align: 0; }
+ .d { vertical-align: -20px; }
+ .e { vertical-align: 20px; }
+ </style>
+ </head>
+ <body>
+ a <div class="a"></div> b <div class="b"></div> c <div class="c"></div>
+ d <div class="d"></div> e <div class="e"></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1-ref.html b/layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1-ref.html
new file mode 100644
index 000000000..3ecf58686
--- /dev/null
+++ b/layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1134744 testcase</title>
+<meta charset="utf-8">
+<style>
+div {
+ height: 200px;
+ margin: 1px;
+ padding: 1px;
+}
+</style>
+</head>
+<body>
+<!-- these two blocks should look the same -->
+<div style="writing-mode: vertical-lr; text-orientation: sideways-right">
+ <label><input type="checkbox">Checkbox</label></br>
+ <label><input type="radio">Radio</label></br>
+</div>
+<div style="writing-mode: vertical-rl; text-orientation: sideways-right">
+ <label><input type="radio">Radio</label></br>
+ <label><input type="checkbox">Checkbox</label></br>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1.html b/layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1.html
new file mode 100644
index 000000000..d1c3bdbbb
--- /dev/null
+++ b/layout/reftests/writing-mode/1134744-radio-checkbox-baseline-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1134744 testcase</title>
+<meta charset="utf-8">
+<style>
+div {
+ height: 200px;
+ margin: 1px;
+ padding: 1px;
+}
+</style>
+</head>
+<body>
+<!-- these two blocks should look the same -->
+<div style="writing-mode: vertical-rl; text-orientation: sideways-right">
+ <label><input type="radio">Radio</label></br>
+ <label><input type="checkbox">Checkbox</label></br>
+</div>
+<div style="writing-mode: vertical-lr; text-orientation: sideways-right">
+ <label><input type="checkbox">Checkbox</label></br>
+ <label><input type="radio">Radio</label></br>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1134849-orthogonal-inline-ref.html b/layout/reftests/writing-mode/1134849-orthogonal-inline-ref.html
new file mode 100644
index 000000000..c059c7f40
--- /dev/null
+++ b/layout/reftests/writing-mode/1134849-orthogonal-inline-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for bug 1134849</title>
+ <style>
+ div { display: inline-block; vertical-align: top;
+ inline-size: 12em; block-size: 15em;
+ border: solid silver; margin: 10px; }
+ p { margin: 5px; }
+ .h { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ p > span, p > b { display: inline-block; }
+ p > span > b { display: inline; }
+ </style>
+ </head>
+ <body>
+ <div class="h">
+ <p>The <span class="v-lr">quick <b>brown</b> fox</span> jumps over<br>the <b class="v-rl">lazy</b> dog.</p>
+ </div>
+ <div class="v-lr">
+ <p>The <span class="h">quick <b>brown</b> fox</span> jumps over<br>the <b class="h">lazy</b> dog.</p>
+ </div>
+ <div class="v-rl">
+ <p>The <span class="h">quick <b>brown</b> fox</span> jumps over<br>the <b class="h">lazy</b> dog.</p>
+ </div>
+ <br>
+ inline-block
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1134849-orthogonal-inline.html b/layout/reftests/writing-mode/1134849-orthogonal-inline.html
new file mode 100644
index 000000000..26dfc17cd
--- /dev/null
+++ b/layout/reftests/writing-mode/1134849-orthogonal-inline.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for bug 1134849</title>
+ <style>
+ div { display: inline-block; vertical-align: top;
+ inline-size: 12em; block-size: 15em;
+ border: solid silver; margin: 10px; }
+ p { margin: 5px; }
+ .h { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ span, b { display: inline; } /* but because they're orthogonal, this will compute to inline-block */
+ </style>
+ </head>
+ <body>
+ <div class="h">
+ <p>The <span class="v-lr" id="test">quick <b>brown</b> fox</span> jumps over<br>the <b class="v-rl">lazy</b> dog.</p>
+ </div>
+ <div class="v-lr">
+ <p>The <span class="h">quick <b>brown</b> fox</span> jumps over<br>the <b class="h">lazy</b> dog.</p>
+ </div>
+ <div class="v-rl">
+ <p>The <span class="h">quick <b>brown</b> fox</span> jumps over<br>the <b class="h">lazy</b> dog.</p>
+ </div>
+ <br>
+ <script>
+ /* this should append "inline-block" to the document, not "inline" */
+ document.write(window.getComputedStyle(document.querySelector("#test")).display);
+ </script>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1135361-ruby-justify-1-ref.html b/layout/reftests/writing-mode/1135361-ruby-justify-1-ref.html
new file mode 100644
index 000000000..d7d64b3fa
--- /dev/null
+++ b/layout/reftests/writing-mode/1135361-ruby-justify-1-ref.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for bug 1135361</title>
+ <style>
+ body {
+ font: 48px sans-serif;
+ }
+ div {
+ display: inline-block;
+ width: 3em;
+ border: 1px solid silver;
+ padding: .5em;
+ }
+ p {
+ writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ -ms-writing-mode: tb-rl; /* old syntax. IE */
+ text-orientation: upright;
+ -webkit-text-orientation: upright;
+ height: 4ch;
+ }
+ rt {
+ font-size: 20%; /* ensure ruby is small enough that it won't affect inline spacing */
+ }
+ span {
+ display: inline-block;
+ height: .5ch; /* shim for fake justification */
+ }
+ </style>
+ </head>
+ <body>
+ <div>
+ <p>
+ <span></span><ruby>東<rt>to</rt></ruby>
+ </p>
+ </div>
+ <div>
+ <p style="text-align:right;">
+ <ruby>京<rt>kyo</rt></ruby><span></span>
+ </p>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1135361-ruby-justify-1.html b/layout/reftests/writing-mode/1135361-ruby-justify-1.html
new file mode 100644
index 000000000..880837161
--- /dev/null
+++ b/layout/reftests/writing-mode/1135361-ruby-justify-1.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Test for bug 1135361</title>
+ <style>
+ body {
+ font: 48px sans-serif;
+ }
+ div {
+ display: inline-block;
+ width: 3em;
+ border: 1px solid silver;
+ padding: .5em;
+ }
+ p {
+ writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ -ms-writing-mode: tb-rl; /* old syntax. IE */
+ text-orientation: upright;
+ -webkit-text-orientation: upright;
+ height: 4ch;
+ text-align: justify;
+ text-align-last: justify;
+ }
+ rt {
+ font-size: 20%; /* ensure ruby is small enough that it won't affect inline spacing */
+ }
+ .t {
+ color: transparent;
+ }
+ </style>
+ </head>
+ <body>
+ <div>
+ <p>
+ <ruby>東<rt>to</rt></ruby><ruby class="t">京<rt>kyo</rt></ruby>
+ </p>
+ </div>
+ <div>
+ <p>
+ <ruby class="t">東<rt>to</rt></ruby><ruby>京<rt>kyo</rt></ruby>
+ </p>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1136557-1-nested-spans-ref.html b/layout/reftests/writing-mode/1136557-1-nested-spans-ref.html
new file mode 100644
index 000000000..929cce15a
--- /dev/null
+++ b/layout/reftests/writing-mode/1136557-1-nested-spans-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>Testcase, bug 1136557</title>
+<style>
+.a { font: 12px serif }
+.b { font: 12.25px serif }
+.c { font: 12.5px serif }
+.d { font: 12.75px serif }
+.e { font: 12px sans-serif }
+.f { font: 12.25px sans-serif }
+.g { font: 12.5px sans-serif }
+.h { font: 12.75px sans-serif }
+.i { font: 12px monospace }
+.j { font: 12.25px monospace }
+.k { font: 12.5px monospace }
+.l { font: 12.75px monospace }
+</style>
+</head>
+<body>
+<div style="writing-mode:vertical-lr">
+<p class="a">xyzzy</p>
+<p class="b">xyzzy</p>
+<p class="c">xyzzy</p>
+<p class="d">xyzzy</p>
+<p class="e">xyzzy</p>
+<p class="f">xyzzy</p>
+<p class="g">xyzzy</p>
+<p class="h">xyzzy</p>
+<p class="i">xyzzy</p>
+<p class="j">xyzzy</p>
+<p class="k">xyzzy</p>
+<p class="l">xyzzy</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1136557-1-nested-spans.html b/layout/reftests/writing-mode/1136557-1-nested-spans.html
new file mode 100644
index 000000000..125852373
--- /dev/null
+++ b/layout/reftests/writing-mode/1136557-1-nested-spans.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>Testcase, bug 1136557</title>
+<style>
+.a { font: 12px serif }
+.b { font: 12.25px serif }
+.c { font: 12.5px serif }
+.d { font: 12.75px serif }
+.e { font: 12px sans-serif }
+.f { font: 12.25px sans-serif }
+.g { font: 12.5px sans-serif }
+.h { font: 12.75px sans-serif }
+.i { font: 12px monospace }
+.j { font: 12.25px monospace }
+.k { font: 12.5px monospace }
+.l { font: 12.75px monospace }
+</style>
+</head>
+<body>
+<div style="writing-mode:vertical-lr">
+<p class="a">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="b">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="c">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="d">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="e">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="f">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="g">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="h">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="i">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="j">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="k">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="l">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1136557-2-nested-spans-ref.html b/layout/reftests/writing-mode/1136557-2-nested-spans-ref.html
new file mode 100644
index 000000000..753c658de
--- /dev/null
+++ b/layout/reftests/writing-mode/1136557-2-nested-spans-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="zh-cn">
+<head>
+<meta charset="utf-8">
+<title>Testcase, bug 1136557</title>
+<style>
+.a { font: 12px serif }
+.b { font: 12.25px serif }
+.c { font: 12.5px serif }
+.d { font: 12.75px serif }
+.e { font: 12px sans-serif }
+.f { font: 12.25px sans-serif }
+.g { font: 12.5px sans-serif }
+.h { font: 12.75px sans-serif }
+.i { font: 12px monospace }
+.j { font: 12.25px monospace }
+.k { font: 12.5px monospace }
+.l { font: 12.75px monospace }
+</style>
+</head>
+<body>
+<div style="writing-mode:vertical-lr">
+<p class="a">xyzzy</p>
+<p class="b">xyzzy</p>
+<p class="c">xyzzy</p>
+<p class="d">xyzzy</p>
+<p class="e">xyzzy</p>
+<p class="f">xyzzy</p>
+<p class="g">xyzzy</p>
+<p class="h">xyzzy</p>
+<p class="i">xyzzy</p>
+<p class="j">xyzzy</p>
+<p class="k">xyzzy</p>
+<p class="l">xyzzy</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1136557-2-nested-spans.html b/layout/reftests/writing-mode/1136557-2-nested-spans.html
new file mode 100644
index 000000000..26a6cca72
--- /dev/null
+++ b/layout/reftests/writing-mode/1136557-2-nested-spans.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="zh-cn">
+<head>
+<meta charset="utf-8">
+<title>Testcase, bug 1136557</title>
+<style>
+.a { font: 12px serif }
+.b { font: 12.25px serif }
+.c { font: 12.5px serif }
+.d { font: 12.75px serif }
+.e { font: 12px sans-serif }
+.f { font: 12.25px sans-serif }
+.g { font: 12.5px sans-serif }
+.h { font: 12.75px sans-serif }
+.i { font: 12px monospace }
+.j { font: 12.25px monospace }
+.k { font: 12.5px monospace }
+.l { font: 12.75px monospace }
+</style>
+</head>
+<body>
+<div style="writing-mode:vertical-lr">
+<p class="a">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="b">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="c">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="d">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="e">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="f">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="g">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="h">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="i">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="j">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="k">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="l">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1136557-3-nested-spans-ref.html b/layout/reftests/writing-mode/1136557-3-nested-spans-ref.html
new file mode 100644
index 000000000..9cbec254f
--- /dev/null
+++ b/layout/reftests/writing-mode/1136557-3-nested-spans-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="ja">
+<head>
+<meta charset="utf-8">
+<title>Testcase, bug 1136557</title>
+<style>
+.a { font: 12px serif }
+.b { font: 12.25px serif }
+.c { font: 12.5px serif }
+.d { font: 12.75px serif }
+.e { font: 12px sans-serif }
+.f { font: 12.25px sans-serif }
+.g { font: 12.5px sans-serif }
+.h { font: 12.75px sans-serif }
+.i { font: 12px monospace }
+.j { font: 12.25px monospace }
+.k { font: 12.5px monospace }
+.l { font: 12.75px monospace }
+</style>
+</head>
+<body>
+<div style="writing-mode:vertical-lr">
+<p class="a">xyzzy</p>
+<p class="b">xyzzy</p>
+<p class="c">xyzzy</p>
+<p class="d">xyzzy</p>
+<p class="e">xyzzy</p>
+<p class="f">xyzzy</p>
+<p class="g">xyzzy</p>
+<p class="h">xyzzy</p>
+<p class="i">xyzzy</p>
+<p class="j">xyzzy</p>
+<p class="k">xyzzy</p>
+<p class="l">xyzzy</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1136557-3-nested-spans.html b/layout/reftests/writing-mode/1136557-3-nested-spans.html
new file mode 100644
index 000000000..3d7297153
--- /dev/null
+++ b/layout/reftests/writing-mode/1136557-3-nested-spans.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="ja">
+<head>
+<meta charset="utf-8">
+<title>Testcase, bug 1136557</title>
+<style>
+.a { font: 12px serif }
+.b { font: 12.25px serif }
+.c { font: 12.5px serif }
+.d { font: 12.75px serif }
+.e { font: 12px sans-serif }
+.f { font: 12.25px sans-serif }
+.g { font: 12.5px sans-serif }
+.h { font: 12.75px sans-serif }
+.i { font: 12px monospace }
+.j { font: 12.25px monospace }
+.k { font: 12.5px monospace }
+.l { font: 12.75px monospace }
+</style>
+</head>
+<body>
+<div style="writing-mode:vertical-lr">
+<p class="a">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="b">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="c">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="d">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="e">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="f">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="g">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="h">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="i">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="j">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="k">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+<p class="l">xy<span><span><span><span><span><span><span><span><span><span>zzy</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1138356-1-button-contents-alignment-ref.html b/layout/reftests/writing-mode/1138356-1-button-contents-alignment-ref.html
new file mode 100644
index 000000000..dde5a0c77
--- /dev/null
+++ b/layout/reftests/writing-mode/1138356-1-button-contents-alignment-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<style type="text/css">
+button {
+ writing-mode: vertical-lr;
+ -moz-appearance: none;
+}
+#a { }
+#b { width: 50px; }
+#c { padding: 20px; }
+#d { padding-left: 20px; }
+#e { padding-right: 20px; }
+#f { width: 50px; padding: 20px; visibility: hidden; } /* expected to mismatch */
+#g { width: 50px; padding-left: 20px; }
+#h { width: 50px; padding-right: 20px; }
+#i { padding-top: 20px; }
+#j { padding-bottom: 20px; }
+</style>
+
+<!-- except for button #f, these should all render the same in both
+ vertical-rl and vertical-lr writing modes -->
+<button id="a">Button</button>
+<button id="b">Button</button>
+<button id="c">Button</button>
+<button id="d">Button</button>
+<button id="e">Button</button>
+<button id="f">Button</button>
+<button id="g">Button</button>
+<button id="h">Button</button>
+<button id="i">Button</button>
+<button id="j">Button</button>
diff --git a/layout/reftests/writing-mode/1138356-1-button-contents-alignment.html b/layout/reftests/writing-mode/1138356-1-button-contents-alignment.html
new file mode 100644
index 000000000..545f3adc2
--- /dev/null
+++ b/layout/reftests/writing-mode/1138356-1-button-contents-alignment.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<style type="text/css">
+button {
+ writing-mode: vertical-rl;
+ -moz-appearance: none;
+}
+#a { }
+#b { width: 50px; }
+#c { padding: 20px; }
+#d { padding-left: 20px; }
+#e { padding-right: 20px; }
+#f { width: 50px; padding: 20px; visibility: hidden; } /* expected to mismatch */
+#g { width: 50px; padding-left: 20px; }
+#h { width: 50px; padding-right: 20px; }
+#i { padding-top: 20px; }
+#j { padding-bottom: 20px; }
+</style>
+
+<!-- except for button #f, these should all render the same in both
+ vertical-rl and vertical-lr writing modes -->
+<button id="a">Button</button>
+<button id="b">Button</button>
+<button id="c">Button</button>
+<button id="d">Button</button>
+<button id="e">Button</button>
+<button id="f">Button</button>
+<button id="g">Button</button>
+<button id="h">Button</button>
+<button id="i">Button</button>
+<button id="j">Button</button>
diff --git a/layout/reftests/writing-mode/1138356-2-button-contents-alignment-notref.html b/layout/reftests/writing-mode/1138356-2-button-contents-alignment-notref.html
new file mode 100644
index 000000000..03a4a053c
--- /dev/null
+++ b/layout/reftests/writing-mode/1138356-2-button-contents-alignment-notref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<style type="text/css">
+button {
+ writing-mode: vertical-lr;
+ -moz-appearance: none;
+ visibility: hidden;
+}
+#a { }
+#b { width: 50px; }
+#c { padding: 20px; }
+#d { padding-left: 20px; }
+#e { padding-right: 20px; }
+#f { width: 50px; padding: 20px; visibility: visible; } /* expected to mismatch */
+#g { width: 50px; padding-left: 20px; }
+#h { width: 50px; padding-right: 20px; }
+#i { padding-top: 20px; }
+#j { padding-bottom: 20px; }
+</style>
+
+<!-- except for button #f, these should all render the same in both
+ vertical-rl and vertical-lr writing modes -->
+<button id="a">Button</button>
+<button id="b">Button</button>
+<button id="c">Button</button>
+<button id="d">Button</button>
+<button id="e">Button</button>
+<button id="f">Button</button>
+<button id="g">Button</button>
+<button id="h">Button</button>
+<button id="i">Button</button>
+<button id="j">Button</button>
diff --git a/layout/reftests/writing-mode/1138356-2-button-contents-alignment.html b/layout/reftests/writing-mode/1138356-2-button-contents-alignment.html
new file mode 100644
index 000000000..2010b6209
--- /dev/null
+++ b/layout/reftests/writing-mode/1138356-2-button-contents-alignment.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<style type="text/css">
+button {
+ writing-mode: vertical-rl;
+ -moz-appearance: none;
+ visibility: hidden;
+}
+#a { }
+#b { width: 50px; }
+#c { padding: 20px; }
+#d { padding-left: 20px; }
+#e { padding-right: 20px; }
+#f { width: 50px; padding: 20px; visibility: visible; } /* expected to mismatch */
+#g { width: 50px; padding-left: 20px; }
+#h { width: 50px; padding-right: 20px; }
+#i { padding-top: 20px; }
+#j { padding-bottom: 20px; }
+</style>
+
+<!-- except for button #f, these should all render the same in both
+ vertical-rl and vertical-lr writing modes -->
+<button id="a">Button</button>
+<button id="b">Button</button>
+<button id="c">Button</button>
+<button id="d">Button</button>
+<button id="e">Button</button>
+<button id="f">Button</button>
+<button id="g">Button</button>
+<button id="h">Button</button>
+<button id="i">Button</button>
+<button id="j">Button</button>
diff --git a/layout/reftests/writing-mode/1144501-1-block-end-margin-orthogonal-size-ref.html b/layout/reftests/writing-mode/1144501-1-block-end-margin-orthogonal-size-ref.html
new file mode 100644
index 000000000..bdf34ff76
--- /dev/null
+++ b/layout/reftests/writing-mode/1144501-1-block-end-margin-orthogonal-size-ref.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 1144501 testcase</title>
+ <meta charset="utf-8">
+ <style type="text/css">
+ .outer {
+ width: 300px;
+ height: 100px;
+ border: 1px solid silver;
+ margin: 8px 0;
+ display: inline-block;
+ vertical-align: top;
+ }
+ p {
+ margin: 0;
+ background: #eee;
+ }
+ .hr {
+ background-color: green;
+ border: transparent none 0px;
+ height: 10px;
+ margin: 0px;
+ width: 100%;
+ }
+ </style>
+</head>
+<body>
+ <div class="outer">
+ <p style="margin-top:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <div class="outer">
+ <p style="margin-right:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <br>
+ <div class="outer">
+ <p style="margin-bottom:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <div class="outer">
+ <p style="margin-left:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1144501-1a-block-end-margin-orthogonal-size.html b/layout/reftests/writing-mode/1144501-1a-block-end-margin-orthogonal-size.html
new file mode 100644
index 000000000..5c819ac45
--- /dev/null
+++ b/layout/reftests/writing-mode/1144501-1a-block-end-margin-orthogonal-size.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 1144501 testcase</title>
+ <meta charset="utf-8">
+ <style type="text/css">
+ .outer {
+ width: 300px;
+ height: 100px;
+ border: 1px solid silver;
+ margin: 8px 0;
+ display: inline-block;
+ vertical-align: top;
+ }
+ p {
+ margin: 0;
+ background: #eee;
+ }
+ .hr {
+ background-color: green;
+ border: transparent none 0px;
+ height: 10px;
+ margin: 0px;
+ width: 100%;
+ writing-mode: vertical-lr;
+ }
+ </style>
+</head>
+<body>
+ <div class="outer">
+ <p style="margin-top:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <div class="outer">
+ <p style="margin-right:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <br>
+ <div class="outer">
+ <p style="margin-bottom:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <div class="outer">
+ <p style="margin-left:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1144501-1b-block-end-margin-orthogonal-size.html b/layout/reftests/writing-mode/1144501-1b-block-end-margin-orthogonal-size.html
new file mode 100644
index 000000000..d15952c77
--- /dev/null
+++ b/layout/reftests/writing-mode/1144501-1b-block-end-margin-orthogonal-size.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 1144501 testcase</title>
+ <meta charset="utf-8">
+ <style type="text/css">
+ .outer {
+ width: 300px;
+ height: 100px;
+ border: 1px solid silver;
+ margin: 8px 0;
+ display: inline-block;
+ vertical-align: top;
+ }
+ p {
+ margin: 0;
+ background: #eee;
+ }
+ .hr {
+ background-color: green;
+ border: transparent none 0px;
+ height: 10px;
+ margin: 0px;
+ width: 100%;
+ writing-mode: vertical-rl;
+ }
+ </style>
+</head>
+<body>
+ <div class="outer">
+ <p style="margin-top:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <div class="outer">
+ <p style="margin-right:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <br>
+ <div class="outer">
+ <p style="margin-bottom:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+ <div class="outer">
+ <p style="margin-left:20px">
+ There should be a horizontal green bar the full width of the div.
+ </p>
+ <div class="hr"></div>
+ </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-bottom-left-ref.html b/layout/reftests/writing-mode/1147834-bottom-left-ref.html
new file mode 100644
index 000000000..22a7807fe
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-bottom-left-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ }
+ #inner1 {
+ position: relative;
+ left: 0px;
+ top: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-bottom-right-ref.html b/layout/reftests/writing-mode/1147834-bottom-right-ref.html
new file mode 100644
index 000000000..7b04cf659
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-bottom-right-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ top: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-ltr.html b/layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-ltr.html
new file mode 100644
index 000000000..4ce2980af
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ writing-mode: horizontal-tb;
+ direction: ltr;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ right: 40px;
+ top: 20px;
+ bottom: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-rtl.html b/layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-rtl.html
new file mode 100644
index 000000000..1c35de714
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-relative-overconstrained-horizontal-tb-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ writing-mode: horizontal-tb;
+ direction: rtl;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ right: 40px;
+ top: 20px;
+ bottom: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-ltr.html b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-ltr.html
new file mode 100644
index 000000000..397c7f06e
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ writing-mode: vertical-lr;
+ direction: ltr;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ right: 40px;
+ top: 20px;
+ bottom: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-rtl.html b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-rtl.html
new file mode 100644
index 000000000..9221df101
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-lr-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ right: 40px;
+ top: 20px;
+ bottom: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-ltr.html b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-ltr.html
new file mode 100644
index 000000000..cbed4d39d
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-ltr.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ writing-mode: vertical-rl;
+ direction: ltr;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ right: 40px;
+ top: 20px;
+ bottom: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-rtl.html b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-rtl.html
new file mode 100644
index 000000000..c6645d489
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-relative-overconstrained-vertical-rl-rtl.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ writing-mode: vertical-rl;
+ direction: rtl;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ right: 40px;
+ top: 20px;
+ bottom: 20px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-top-left-ref.html b/layout/reftests/writing-mode/1147834-top-left-ref.html
new file mode 100644
index 000000000..2b0914c6f
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-top-left-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ }
+ #inner1 {
+ position: relative;
+ left: 0px;
+ top: 0px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1147834-top-right-ref.html b/layout/reftests/writing-mode/1147834-top-right-ref.html
new file mode 100644
index 000000000..8fa07ec08
--- /dev/null
+++ b/layout/reftests/writing-mode/1147834-top-right-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Overconstrained relative positioning</title>
+ <style>
+ .test {
+ border: 1px solid black;
+ height: 200px;
+ width: 400px;
+ }
+ #inner1 {
+ position: relative;
+ left: 40px;
+ top: 0px;
+ height: 180px;
+ width: 360px;
+ background-color: teal;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="inner1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1151993-1-orthogonal-block-size-ref.html b/layout/reftests/writing-mode/1151993-1-orthogonal-block-size-ref.html
new file mode 100644
index 000000000..fe11c1704
--- /dev/null
+++ b/layout/reftests/writing-mode/1151993-1-orthogonal-block-size-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Bug 1151993 - sizing of orthogonal block</title>
+ <style>
+ .outer {
+ width: 400px;
+ height: 300px;
+ border: 1px solid silver;
+ overflow: visible;
+ display: inline-block;
+ margin: 10px;
+ vertical-align: top;
+ }
+ .test1 {
+ background: yellow;
+ width: 100px;
+ height: 40px;
+ }
+ .test2 {
+ background: yellow;
+ width: 100px;
+ height: 300px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer">
+ <p>Lorem ipsum dolor sit amet, illum harum sed cu, ex mea delectus recteque.
+ Sit aperiri incorrupte cu. Et eam ullum minim disputando, no usu stet postea.</p>
+ <div class="test1"></div>
+ <p>Cu ornatus accusam nam, minim impedit omittantur vel ne.
+ Qui detraxit temporibus contentiones te.</p>
+ </div>
+ <div class="outer">
+ <p>Lorem ipsum dolor sit amet, illum harum sed cu, ex mea delectus recteque.
+ Sit aperiri incorrupte cu. Et eam ullum minim disputando, no usu stet postea.</p>
+ <div class="test2"></div>
+ <p>Cu ornatus accusam nam, minim impedit omittantur vel ne.
+ Qui detraxit temporibus contentiones te.</p>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1151993-1-orthogonal-block-size.html b/layout/reftests/writing-mode/1151993-1-orthogonal-block-size.html
new file mode 100644
index 000000000..7920de711
--- /dev/null
+++ b/layout/reftests/writing-mode/1151993-1-orthogonal-block-size.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Bug 1151993 - sizing of orthogonal block</title>
+ <style>
+ .outer {
+ width: 400px;
+ height: 300px;
+ border: 1px solid silver;
+ overflow: visible;
+ display: inline-block;
+ margin: 10px;
+ vertical-align: top;
+ }
+ .v-lr {
+ writing-mode: vertical-lr;
+ background: yellow;
+ font-weight: bold;
+ width: 100px;
+ }
+ span {
+ display: inline-block;
+ height: 40px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer">
+ <p>Lorem ipsum dolor sit amet, illum harum sed cu, ex mea delectus recteque.
+ Sit aperiri incorrupte cu. Et eam ullum minim disputando, no usu stet postea.</p>
+ <div class="v-lr"><span class="test"></span></div> <!-- single line: shrink-wrapped -->
+ <p>Cu ornatus accusam nam, minim impedit omittantur vel ne.
+ Qui detraxit temporibus contentiones te.</p>
+ </div>
+ <div class="outer">
+ <p>Lorem ipsum dolor sit amet, illum harum sed cu, ex mea delectus recteque.
+ Sit aperiri incorrupte cu. Et eam ullum minim disputando, no usu stet postea.</p>
+ <div class="v-lr">
+ <span></span> <span></span> <span></span> <span></span> <span></span>
+ <span></span> <span></span> <span></span> <span></span> <span></span>
+ <span></span> <span></span> <span></span> <span></span> <span></span>
+ </div> <!-- multi-line: use containing block's height as inline size -->
+ <p>Cu ornatus accusam nam, minim impedit omittantur vel ne.
+ Qui detraxit temporibus contentiones te.</p>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow-ref.html b/layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow-ref.html
new file mode 100644
index 000000000..d7748e024
--- /dev/null
+++ b/layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow-ref.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+html {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ font: 16px/24px monospace;
+ padding: 20px;
+}
+body {
+ width: 40em;
+ height: 25em;
+}
+blockquote {
+ -webkit-writing-mode: horizontal-tb;
+ writing-mode: horizontal-tb;
+ width: 20em;
+ color: transparent;
+}
+</style>
+</head>
+
+<body>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac fringilla quam,
+ eu ultricies augue.</p>
+
+ <blockquote>
+ <!-- Short enough text that it won't overflow. -->
+ <p>Ut accumsan dui eu elit dapibus rutrum. Nunc tristique urna eget ex dictum
+ placerat. Nunc venenatis enim sed odio iaculis, consequat consectetur sem
+ elementum.</p>
+ </blockquote>
+
+ <p>Maecenas nec ornare ligula. Phasellus eleifend
+ elit leo, nec vestibulum sapien consectetur quis.</p>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow.html b/layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow.html
new file mode 100644
index 000000000..5ce03d152
--- /dev/null
+++ b/layout/reftests/writing-mode/1152941-1-orthogonal-blocksize-overflow.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+html {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ font: 16px/24px monospace;
+ padding: 20px;
+}
+body {
+ width: 40em;
+ height: 25em;
+}
+blockquote {
+ -webkit-writing-mode: horizontal-tb;
+ writing-mode: horizontal-tb;
+ width: 20em;
+ color: transparent;
+}
+</style>
+</head>
+
+<body>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac fringilla quam,
+ eu ultricies augue.</p>
+
+ <blockquote>
+ <!-- The (invisible) text in the orthogonal block should NOT make following
+ content vanish if it overflows the <body>'s height! -->
+ <p>Ut accumsan dui eu elit dapibus rutrum. Nunc tristique urna eget ex dictum
+ placerat. Nunc venenatis enim sed odio iaculis, consequat consectetur sem
+ elementum.</p>
+
+ <p>Fusce eros eros, eleifend eget eros at, convallis tempor tortor. Cras
+ at gravida leo. Proin ultricies ipsum vitae felis suscipit, a tincidunt orci
+ mattis. Cras in suscipit mauris.</p>
+
+ <p>Etiam eu pellentesque nisi. Quisque
+ ullamcorper dui odio, eu feugiat nunc interdum vitae. Morbi egestas dolor a
+ nulla pellentesque, faucibus tincidunt diam facilisis. Suspendisse at urna
+ varius, pellentesque nibh non, venenatis ante.</p>
+
+ <p>Nullam aliquet orci vel dui
+ dapibus, nec facilisis enim interdum. Morbi condimentum venenatis commodo. Sed
+ viverra diam nec lacinia congue. Etiam ultrices luctus volutpat.</p>
+ </blockquote>
+
+ <p>Maecenas nec ornare ligula. Phasellus eleifend
+ elit leo, nec vestibulum sapien consectetur quis.</p>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1156021-text-indent-percent-ref.html b/layout/reftests/writing-mode/1156021-text-indent-percent-ref.html
new file mode 100644
index 000000000..0bb7fcba8
--- /dev/null
+++ b/layout/reftests/writing-mode/1156021-text-indent-percent-ref.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ font-size: 10px;
+}
+div {
+ width: 100px;
+ height: 200px;
+ margin: 5px;
+ border: 1px solid silver;
+ display: inline-block;
+ vertical-align: top;
+}
+p {
+ inline-size: 100%;
+ margin: 0;
+}
+span {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ background: green;
+ position: relative;
+}
+</style>
+</head>
+<body>
+<div> <p><span style="left: 20px;"></span></p> </div>
+<div> <p><span style="left: 60px;"></span></p> </div>
+<div> <p><span style="top: 40px;"></span></p> </div>
+<div> <p><span style="top: 140px;"></span></p> </div>
+<div> <p><span style="top: 40px; left: 80px;"></span></p> </div>
+<div> <p><span style="top: 140px; left: 80px;"></span></p> </div>
+<br>
+<div> <p><span style="left: 20px;"></span></p> </div>
+<div> <p><span style="left: 60px;"></span></p> </div>
+<div> <p><span style="top: 40px;"></span></p> </div>
+<div> <p><span style="top: 140px;"></span></p> </div>
+<div> <p><span style="top: 40px;"></span></p> </div>
+<div> <p><span style="top: 140px;"></span></p> </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1156021-text-indent-percent.html b/layout/reftests/writing-mode/1156021-text-indent-percent.html
new file mode 100644
index 000000000..b37a202e2
--- /dev/null
+++ b/layout/reftests/writing-mode/1156021-text-indent-percent.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ font-size: 10px;
+}
+div {
+ width: 100px;
+ height: 200px;
+ margin: 5px;
+ border: 1px solid silver;
+ display: inline-block;
+ vertical-align: top;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+p {
+ inline-size: 100%;
+ text-indent: 20%;
+ margin: 0;
+}
+span {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ background: green;
+}
+</style>
+</head>
+<body>
+<div> <p><span></span></p> </div>
+<div dir="rtl"> <p><span></span></p> </div>
+<div class="vlr"> <p><span></span></p> </div>
+<div class="vlr" dir="rtl"> <p><span></span></p> </div>
+<div class="vrl"> <p><span></span></p> </div>
+<div class="vrl" dir="rtl"> <p><span></span></p> </div>
+<br>
+<div> <p><span></span></p> </div>
+<div> <p dir="rtl"><span></span></p> </div>
+<div> <p class="vlr"><span></span></p> </div>
+<div> <p class="vlr" dir="rtl"><span></span></p> </div>
+<div> <p class="vrl"><span></span></p> </div>
+<div> <p class="vrl" dir="rtl"><span></span></p> </div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1157752-upright-bidi-ref.html b/layout/reftests/writing-mode/1157752-upright-bidi-ref.html
new file mode 100644
index 000000000..6be780e66
--- /dev/null
+++ b/layout/reftests/writing-mode/1157752-upright-bidi-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ font: 16px/24px sans-serif;
+ padding: 20px;
+ width: 300px;
+ height: 400px;
+}
+.sideways {
+ -webkit-text-orientation: sideways-right;
+ text-orientation: sideways-right;
+}
+.upright {
+ -webkit-text-orientation: upright;
+ text-orientation: upright;
+}
+</style>
+</head>
+
+<body>
+<div class=sideways>
+Bidi עברית text
+</div>
+
+<div dir=rtl class=sideways>
+Bidi עברית text
+</div>
+
+<div class=upright>
+<bdo dir=ltr>Bidi עברית text</bdo>
+</div>
+
+<div dir=rtl class=upright>
+<bdo dir=ltr>Bidi עברית text</bdo>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1157752-upright-bidi.html b/layout/reftests/writing-mode/1157752-upright-bidi.html
new file mode 100644
index 000000000..551e75b12
--- /dev/null
+++ b/layout/reftests/writing-mode/1157752-upright-bidi.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ font: 16px/24px sans-serif;
+ padding: 20px;
+ width: 300px;
+ height: 400px;
+}
+.sideways {
+ -webkit-text-orientation: sideways-right;
+ text-orientation: sideways-right;
+}
+.upright {
+ -webkit-text-orientation: upright;
+ text-orientation: upright;
+}
+</style>
+</head>
+
+<body>
+<div class=sideways>
+Bidi עברית text
+</div>
+
+<div dir=rtl class=sideways>
+Bidi עברית text
+</div>
+
+<div class=upright>
+Bidi עברית text
+</div>
+
+<div dir=rtl class=upright>
+Bidi עברית text
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1157758-1-vertical-arabic-ref.html b/layout/reftests/writing-mode/1157758-1-vertical-arabic-ref.html
new file mode 100644
index 000000000..e3ec37a5a
--- /dev/null
+++ b/layout/reftests/writing-mode/1157758-1-vertical-arabic-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+html {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ -webkit-text-orientation: upright;
+ text-orientation: upright;
+}
+</style>
+</head>
+
+<body>
+ &#x4F60; <bdo dir=ltr>&#x0627;&#x200c;&#x0644;&#x200c;&#x0639;&#x200c;&#x0631;&#x200c;&#x0628;&#x200c;&#x064A;</bdo> &#x597D;&#xFF01;
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1157758-1-vertical-arabic.html b/layout/reftests/writing-mode/1157758-1-vertical-arabic.html
new file mode 100644
index 000000000..ddd084379
--- /dev/null
+++ b/layout/reftests/writing-mode/1157758-1-vertical-arabic.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+html {
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ -webkit-text-orientation: upright;
+ text-orientation: upright;
+}
+</style>
+</head>
+
+<body>
+ &#x4F60; &#x0627;&#x0644;&#x0639;&#x0631;&#x0628;&#x064A; &#x597D;&#xFF01;
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints-ref.html b/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints-ref.html
new file mode 100644
index 000000000..15520d034
--- /dev/null
+++ b/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ font: 16px/20px sans-serif;
+ width: 600px;
+ height: 500px;
+ padding: 5px;
+ border: 1px solid gray;
+}
+blockquote {
+ background: #eee;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ width: 600px;
+ height: 200px;
+ margin: 0;
+ padding: 10px 0;
+}
+</style>
+</head>
+
+<body>
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac fringilla quam,
+eu ultricies augue. Aliquam ante orci, egestas eu pulvinar eget, ullamcorper eu
+elit. Phasellus tristique vulputate odio, quis ultricies justo rutrum in. Mauris
+auctor est in sagittis eleifend.</p>
+
+<blockquote>
+<p>Ut accumsan dui eu elit dapibus rutrum. Nunc tristique urna eget ex dictum
+placerat. Nunc venenatis enim sed odio iaculis, consequat consectetur sem
+elementum. Fusce eros eros, eleifend eget eros at, convallis tempor tortor. Cras
+at gravida leo. Proin ultricies ipsum vitae felis suscipit, a tincidunt orci
+mattis. Cras in suscipit mauris.</p>
+</blockquote>
+
+<p>Vivamus lobortis hendrerit vehicula. Nullam dapibus ante et commodo lacinia.
+Sed tincidunt pretium ligula, eget porta metus pharetra eget. Mauris pharetra
+tortor convallis nisi varius facilisis.</p>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints.html b/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints.html
new file mode 100644
index 000000000..2ef3d1cda
--- /dev/null
+++ b/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+ font: 16px/20px sans-serif;
+ width: 600px;
+ height: 500px;
+ padding: 5px;
+ border: 1px solid gray;
+}
+blockquote {
+ background: #eee;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: vertical-rl;
+ min-width: 100%;
+ max-height: 40%;
+ margin: 0;
+ padding: 10px 0;
+}
+</style>
+</head>
+
+<body>
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac fringilla quam,
+eu ultricies augue. Aliquam ante orci, egestas eu pulvinar eget, ullamcorper eu
+elit. Phasellus tristique vulputate odio, quis ultricies justo rutrum in. Mauris
+auctor est in sagittis eleifend.</p>
+
+<blockquote>
+<p>Ut accumsan dui eu elit dapibus rutrum. Nunc tristique urna eget ex dictum
+placerat. Nunc venenatis enim sed odio iaculis, consequat consectetur sem
+elementum. Fusce eros eros, eleifend eget eros at, convallis tempor tortor. Cras
+at gravida leo. Proin ultricies ipsum vitae felis suscipit, a tincidunt orci
+mattis. Cras in suscipit mauris.</p>
+</blockquote>
+
+<p>Vivamus lobortis hendrerit vehicula. Nullam dapibus ante et commodo lacinia.
+Sed tincidunt pretium ligula, eget porta metus pharetra eget. Mauris pharetra
+tortor convallis nisi varius facilisis.</p>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1163238-orthogonal-auto-margins-ref.html b/layout/reftests/writing-mode/1163238-orthogonal-auto-margins-ref.html
new file mode 100644
index 000000000..2842969d0
--- /dev/null
+++ b/layout/reftests/writing-mode/1163238-orthogonal-auto-margins-ref.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ border: 1px solid blue;
+ }
+ .vlr {
+ border: 5px solid green;
+ width: 200px;
+ height: 400px;
+ margin: 0px auto;
+ }
+ .h1 {
+ border: 10px solid red;
+ width: 100px;
+ height: 200px;
+ margin-top: 90px;
+ }
+ .vrl {
+ background: yellow;
+ width: 50px;
+ height: 75px;
+ padding-top: 25px;
+ margin-left: 25px;
+ }
+ .h2 {
+ background: black;
+ width: 20px;
+ height: 50px;
+ margin-left: 30px;
+ }
+ </style>
+</head>
+<body>
+ <div class="vlr">
+ <div class="h1">
+ <div class="vrl">
+ <div class="h2">
diff --git a/layout/reftests/writing-mode/1163238-orthogonal-auto-margins.html b/layout/reftests/writing-mode/1163238-orthogonal-auto-margins.html
new file mode 100644
index 000000000..e4758ec6f
--- /dev/null
+++ b/layout/reftests/writing-mode/1163238-orthogonal-auto-margins.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ border: 1px solid blue;
+ }
+ .vlr {
+ border: 5px solid green;
+ width: 200px;
+ height: 400px;
+ writing-mode: vertical-lr;
+ margin: auto;
+ }
+ .h1 {
+ border: 10px solid red;
+ width: 100px;
+ height: 200px;
+ writing-mode: horizontal-tb;
+ margin: auto;
+ }
+ .vrl {
+ background: yellow;
+ width: 50px;
+ height: 100px;
+ writing-mode: vertical-rl;
+ margin: auto;
+ }
+ .h2 {
+ background: black;
+ width: 20px;
+ height: 50px;
+ writing-mode: horizontal-tb;
+ margin: auto;
+ }
+ </style>
+</head>
+<body>
+ <div class="vlr">
+ <div class="h1">
+ <div class="vrl">
+ <div class="h2">
diff --git a/layout/reftests/writing-mode/1172774-percent-horizontal-ref.html b/layout/reftests/writing-mode/1172774-percent-horizontal-ref.html
new file mode 100644
index 000000000..53b1bef4b
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-horizontal-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: margin percentage and 'vertical-rl'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ </head>
+ <body>
+ <div id="reference"><img src="blue-yellow-206w-165h.png" width="206" height="165" alt="Image download support must be enabled"></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/1172774-percent-margin-1.html b/layout/reftests/writing-mode/1172774-percent-margin-1.html
new file mode 100644
index 000000000..4017ea9f1
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-margin-1.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: margin percentage and 'vertical-rl'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the margin are calculated with respect to the inline-size (width) of the containing block if 'writing-mode' of such containing block is 'horizontal-tb'. In this test, div.outer's computed 'writing-mode' value is 'horizontal-tb' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ width: 200px;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ height: 3px;
+ margin: 0.5em auto;
+ }
+
+ div.inner
+ {
+ background-color: yellow;
+ height: 50px;
+ width: 50px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div.foo
+ {
+ margin-bottom: 2.5%; /* 5px */
+ margin-left: 50%; /* 100px */
+ margin-right: 25%; /* 50px */
+ margin-top: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ margin-bottom: 10%;
+ margin-left: 25%;
+ margin-right: 50%;
+ margin-top: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner foo"></div>
+ <hr>
+ <div class="inner bar"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-margin-2.html b/layout/reftests/writing-mode/1172774-percent-margin-2.html
new file mode 100644
index 000000000..55ce27f50
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-margin-2.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: margin percentage and 'vertical-lr'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the margin are calculated with respect to the inline-size (width) of the containing block if 'writing-mode' of such containing block is 'horizontal-tb'. In this test, div.outer's computed 'writing-mode' value is 'horizontal-tb' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ width: 200px;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ height: 3px;
+ margin: 0.5em auto;
+ }
+
+ div.inner
+ {
+ background-color: yellow;
+ height: 50px;
+ width: 50px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div.foo
+ {
+ margin-bottom: 2.5%; /* 5px */
+ margin-left: 50%; /* 100px */
+ margin-right: 25%; /* 50px */
+ margin-top: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ margin-bottom: 10%;
+ margin-left: 25%;
+ margin-right: 50%;
+ margin-top: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner foo"></div>
+ <hr>
+ <div class="inner bar"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-margin-3.html b/layout/reftests/writing-mode/1172774-percent-margin-3.html
new file mode 100644
index 000000000..03f5edde4
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-margin-3.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: margin percentage and 'vertical-rl'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the margin are calculated with respect to the inline size (height!) of the containing block if 'writing-mode' of such containing block is 'vertical-rl'. In this test, div.outer's computed 'writing-mode' value is 'vertical-rl' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ height: 200px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ width: 3px;
+ margin: auto 0.5em;
+ }
+
+ div.inner
+ {
+ background-color: yellow;
+ height: 50px;
+ width: 50px;
+ -ah-writing-mode: horizontal-tb;
+ -webkit-writing-mode: horizontal-tb;
+ writing-mode: lr-tb; /* IE11 */
+ writing-mode: horizontal-tb;
+ }
+
+ div.foo
+ {
+ margin-left: 2.5%; /* 5px */
+ margin-top: 50%; /* 100px */
+ margin-bottom: 25%; /* 50px */
+ margin-right: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ margin-left: 10%;
+ margin-top: 25%;
+ margin-bottom: 50%;
+ margin-right: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner foo"></div>
+ <hr>
+ <div class="inner bar"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-margin-4.html b/layout/reftests/writing-mode/1172774-percent-margin-4.html
new file mode 100644
index 000000000..adac543be
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-margin-4.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: margin percentage and 'vertical-lr'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the margin are calculated with respect to the inline size (height!) of the containing block if 'writing-mode' of such containing block is 'vertical-lr'. In this test, div.outer's computed 'writing-mode' value is 'vertical-lr' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ height: 200px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ width: 3px;
+ margin: auto 0.5em;
+ }
+
+ div.inner
+ {
+ background-color: yellow;
+ height: 50px;
+ width: 50px;
+ -ah-writing-mode: horizontal-tb;
+ -webkit-writing-mode: horizontal-tb;
+ writing-mode: lr-tb; /* IE11 */
+ writing-mode: horizontal-tb;
+ }
+
+ div.foo
+ {
+ margin-left: 2.5%; /* 5px */
+ margin-top: 50%; /* 100px */
+ margin-bottom: 25%; /* 50px */
+ margin-right: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ margin-left: 10%;
+ margin-top: 25%;
+ margin-bottom: 50%;
+ margin-right: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner bar"></div>
+ <hr>
+ <div class="inner foo"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-padding-1.html b/layout/reftests/writing-mode/1172774-percent-padding-1.html
new file mode 100644
index 000000000..d665db725
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-padding-1.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: padding percentage and 'vertical-rl'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the padding are calculated with respect to the inline-size (width) of the containing block if 'writing-mode' of such containing block is 'horizontal-tb'. In this test, div.outer's computed 'writing-mode' value is 'horizontal-tb' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ width: 200px;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ height: 3px;
+ margin: 3px auto;
+ }
+
+ div.inner
+ {
+ background-color: transparent;
+ height: 50px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div.foo
+ {
+ padding-bottom: 2.5%; /* 5px */
+ padding-left: 50%; /* 100px */
+ padding-right: 25%; /* 50px */
+ padding-top: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ padding-bottom: 10%;
+ padding-left: 25%;
+ padding-right: 50%;
+ padding-top: 2.5%;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer">
+ <div class="inner foo"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ <hr>
+ <div class="inner bar"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-padding-2.html b/layout/reftests/writing-mode/1172774-percent-padding-2.html
new file mode 100644
index 000000000..2a9cb52f7
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-padding-2.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: padding percentage and 'vertical-lr'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the padding are calculated with respect to the inline-size (width) of the containing block if 'writing-mode' of such containing block is 'horizontal-tb'. In this test, div.outer's computed 'writing-mode' value is 'horizontal-tb' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ width: 200px;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ height: 3px;
+ margin: 3px auto;
+ }
+
+ div.inner
+ {
+ background-color: transparent;
+ height: 50px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div.foo
+ {
+ padding-bottom: 2.5%; /* 5px */
+ padding-left: 50%; /* 100px */
+ padding-right: 25%; /* 50px */
+ padding-top: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ padding-bottom: 10%;
+ padding-left: 25%;
+ padding-right: 50%;
+ padding-top: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner foo"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ <hr>
+ <div class="inner bar"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-padding-3.html b/layout/reftests/writing-mode/1172774-percent-padding-3.html
new file mode 100644
index 000000000..fb897735a
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-padding-3.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: padding percentage and 'vertical-rl'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the padding are calculated with respect to the inline size (height!) of the containing block if 'writing-mode' of such containing block is 'vertical-rl'. In this test, div.outer's computed 'writing-mode' value is 'vertical-rl' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ height: 200px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ width: 3px;
+ margin: auto 3px;
+ }
+
+ div.inner
+ {
+ background-color: transparent;
+ width: 50px;
+ -ah-writing-mode: horizontal-tb;
+ -webkit-writing-mode: horizontal-tb;
+ writing-mode: lr-tb; /* IE11 */
+ writing-mode: horizontal-tb;
+ }
+
+ div.foo
+ {
+ padding-left: 2.5%; /* 5px */
+ padding-top: 50%; /* 100px */
+ padding-bottom: 25%; /* 50px */
+ padding-right: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ padding-left: 10%;
+ padding-top: 25%;
+ padding-bottom: 50%;
+ padding-right: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner foo"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ <hr>
+ <div class="inner bar"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-padding-4.html b/layout/reftests/writing-mode/1172774-percent-padding-4.html
new file mode 100644
index 000000000..a3d8859a5
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-padding-4.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: padding percentage and 'vertical-lr'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <meta content="This test checks that percentages on the padding are calculated with respect to the inline size (height!) of the containing block if 'writing-mode' of such containing block is 'vertical-lr'. In this test, div.outer's computed 'writing-mode' value is 'vertical-lr' and it is the div.inner's containing block." name="assert">
+ <style type="text/css">
+ div.outer
+ {
+ background-color: blue;
+ border: blue solid 3px;
+ height: 200px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ hr
+ {
+ background-color: transparent;
+ border: transparent none 0px;
+ width: 3px;
+ margin: auto 3px;
+ }
+
+ div.inner
+ {
+ background-color: transparent;
+ width: 50px;
+ -ah-writing-mode: horizontal-tb;
+ -webkit-writing-mode: horizontal-tb;
+ writing-mode: lr-tb; /* IE11 */
+ writing-mode: horizontal-tb;
+ }
+
+ div.foo
+ {
+ padding-left: 2.5%; /* 5px */
+ padding-top: 50%; /* 100px */
+ padding-bottom: 25%; /* 50px */
+ padding-right: 10%; /* 20px */
+ }
+
+ div.bar
+ {
+ padding-left: 10%;
+ padding-top: 25%;
+ padding-bottom: 50%;
+ padding-right: 2.5%;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="outer">
+ <div class="inner bar"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ <hr>
+ <div class="inner foo"><img src="swatch-yellow.png" width="50" height="50" alt="Image download support must be enabled"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1172774-percent-vertical-ref.html b/layout/reftests/writing-mode/1172774-percent-vertical-ref.html
new file mode 100644
index 000000000..2fd2a2f08
--- /dev/null
+++ b/layout/reftests/writing-mode/1172774-percent-vertical-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Writing Modes Test: margin percentage and 'vertical-rl'</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ </head>
+ <body>
+ <div id="reference"><img src="blue-yellow-165w-206h.png" width="165" height="206" alt="Image download support must be enabled"></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/1174450-intrinsic-sizing-ref.html b/layout/reftests/writing-mode/1174450-intrinsic-sizing-ref.html
new file mode 100644
index 000000000..629c0a917
--- /dev/null
+++ b/layout/reftests/writing-mode/1174450-intrinsic-sizing-ref.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+ <meta charset="utf-8">
+ <title>Testcase for bug 1174450</title>
+ <style type="text/css">
+body,html { color:black; background:white; font-size:12px; line-height:16px; padding:0; margin:0; }
+
+div.v, div.h {
+ display: block;
+ position: relative;
+ border: 1px dashed silver;
+ width:92px;
+ height:60px;
+}
+div.h {
+ width:124px;
+ height:98px;
+}
+.h span {
+ margin: 7px 13px 62px 25px;
+ padding: 1px 3px 12px 37px;
+}
+.v span {
+ margin: 7px 13px 30px 12px;
+ padding: 1px 3px 6px 18px;
+}
+
+span {
+ display: block;
+ position: absolute;
+ width: 30px;
+ height: 10px;
+ background: lime;
+ border-width: 5px 9px 1px 7px;
+ border-style: solid;
+}
+
+.a { position:absolute; }
+.t2 {top:100px;}
+.t3 {top:200px;}
+.t4 {top:300px;}
+
+ </style>
+</head>
+<body>
+
+
+<div class="a t1">
+<pre>vertical container, horizontal child</pre>
+<div class="v"><span class="h"></span></div>
+</div>
+<div class="a t2">
+<pre>vertical container, vertical child</pre>
+<div class="v"><span class="v"></span></div>
+</div>
+<div class="a t3">
+<pre>horizontal container, horizontal child</pre>
+<div class="h"><span class="h"></span></div>
+</div>
+<div class="a t4">
+<pre>horizontal container, vertical child</pre>
+<div class="h"><span class="v"></span></div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1174450-intrinsic-sizing.html b/layout/reftests/writing-mode/1174450-intrinsic-sizing.html
new file mode 100644
index 000000000..e7cd5585c
--- /dev/null
+++ b/layout/reftests/writing-mode/1174450-intrinsic-sizing.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+ <meta charset="utf-8">
+ <title>Testcase for bug 1174450</title>
+ <style type="text/css">
+body,html { color:black; background:white; font-size:12px; line-height:16px; padding:0; margin:0; }
+
+div.h, div.v {
+ display: block;
+ border: 1px dashed silver;
+ float: left;
+}
+.v {
+ writing-mode: vertical-lr;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+
+span {
+ display: block;
+ width: 30px;
+ height: 10px;
+ background: lime;
+ margin: 7px 13px 50% 20%;
+ padding: 1px 3px 10% 30%;
+ border-width: 5px 9px 1px 7px;
+ border-style: solid;
+}
+
+.a { position:absolute; }
+.t2 {top:100px;}
+.t3 {top:200px;}
+.t4 {top:300px;}
+
+ </style>
+</head>
+<body>
+
+
+<div class="a t1">
+<pre>vertical container, horizontal child</pre>
+<div class="v"><span class="h"></span></div>
+</div>
+<div class="a t2">
+<pre>vertical container, vertical child</pre>
+<div class="v"><span class="v"></span></div>
+</div>
+<div class="a t3">
+<pre>horizontal container, horizontal child</pre>
+<div class="h"><span class="h"></span></div>
+</div>
+<div class="a t4">
+<pre>horizontal container, vertical child</pre>
+<div class="h"><span class="v"></span></div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1175789-underline-overline-1-ref.html b/layout/reftests/writing-mode/1175789-underline-overline-1-ref.html
new file mode 100644
index 000000000..b788d6bae
--- /dev/null
+++ b/layout/reftests/writing-mode/1175789-underline-overline-1-ref.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bug 1175789 - underline and overline in various language</title>
+ <style type="text/css">
+ body {
+ font-family: "Arial", "Helvetica", "sans-serif";
+ }
+ div {
+ padding: .5em 1em;
+ line-height: 2em;
+ }
+ .underline {
+ text-decoration: underline;
+ }
+ .overline {
+ text-decoration: overline;
+ }
+ </style>
+ </head>
+ <body>
+ <dl>
+ <dt>lang="en-US"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ja"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ko"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ja-JP"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ko-KR"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="overline">underline</span><br>
+ <span class="underline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="zh"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ </dl>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1175789-underline-overline-1.html b/layout/reftests/writing-mode/1175789-underline-overline-1.html
new file mode 100644
index 000000000..1044a9dca
--- /dev/null
+++ b/layout/reftests/writing-mode/1175789-underline-overline-1.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bug 1175789 - underline and overline in various language</title>
+ <style type="text/css">
+ body {
+ font-family: "Arial", "Helvetica", "sans-serif";
+ }
+ div {
+ padding: .5em 1em;
+ line-height: 2em;
+ }
+ .underline {
+ text-decoration: underline;
+ }
+ .overline {
+ text-decoration: overline;
+ }
+ </style>
+ </head>
+ <body>
+ <dl>
+ <dt>lang="en-US"</dt>
+ <dd lang="en-US">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ja"</dt>
+ <dd lang="ja">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ko"</dt>
+ <dd lang="ko">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ja-JP"</dt>
+ <dd lang="ja-JP">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="ko-KR"</dt>
+ <dd lang="ko-KR">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ <dt>lang="zh"</dt>
+ <dd lang="zh">
+ <div style="writing-mode: vertical-rl;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ <div style="writing-mode: vertical-lr;">
+ <span class="underline">underline</span><br>
+ <span class="overline">overline</span>
+ </div>
+ </dd>
+ </dl>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics-ref.html b/layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics-ref.html
new file mode 100644
index 000000000..90e80637b
--- /dev/null
+++ b/layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<style>
+
+html { writing-mode: vertical-rl; }
+
+</style>
+<body>
+
+<p>The following blue box should have uniform padding around all sides.</p>
+
+<div style="float: left; background: olive; padding: 5px;">
+ <div id="c" style="background: blue; height: 100px; width: 100px">
+ </div>
+</div>
+
+<p style="clear:left">Note that if you zoom the page after it loads
+it fixes the problem by causing a reflow.</p>
diff --git a/layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics.html b/layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics.html
new file mode 100644
index 000000000..44f90e85e
--- /dev/null
+++ b/layout/reftests/writing-mode/1188061-1-nsChangeHint_ClearAncestorIntrinsics.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<style>
+
+html { writing-mode: vertical-rl; }
+
+</style>
+<body>
+
+<p>The following blue box should have uniform padding around all sides.</p>
+
+<div style="float: left; background: olive; padding: 5px;">
+ <div id="c" style="background: blue; height: 200px; width: 100px">
+ </div>
+</div>
+
+<p style="clear:left">Note that if you zoom the page after it loads
+it fixes the problem by causing a reflow.</p>
+
+<script>
+
+var div = document.getElementById("c")
+var flush_and_ignore = div.offsetTop;
+div.style.height = "100px";
+
+</script>
diff --git a/layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize-ref.html b/layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize-ref.html
new file mode 100644
index 000000000..716e11c60
--- /dev/null
+++ b/layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<style>
+
+html { writing-mode: vertical-rl; }
+
+</style>
+<body>
+
+<p>The following image should have uniform padding around all sides.</p>
+
+
+<div style="width: 150px; float: left; background: yellow; padding: 5px;">
+ <div style="width: 100%">
+ <!-- 32x32 blue image -->
+ <img style="width: 100%" src="data:image/png; charset=binary;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAChJREFUSMftzUEBAAAEBLCjf2dK8NsKrJLJp84zgUAgEAgEAoFAcGUBocYBP+pqhN4AAAAASUVORK5CYII=">
+ </div>
+</div>
+
+<p style="clear:left">Note that if you zoom the page after it loads
+it fixes the problem by causing a reflow.</p>
diff --git a/layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize.html b/layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize.html
new file mode 100644
index 000000000..22c32aefd
--- /dev/null
+++ b/layout/reftests/writing-mode/1188061-2-nsChangeHint_UpdateComputedBSize.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<style>
+
+html { writing-mode: vertical-rl; }
+
+</style>
+<body onload="run()">
+
+<p>The following image should have uniform padding around all sides.</p>
+
+
+<div style="width: 200px; float: left; background: yellow; padding: 5px;">
+ <div style="width: 100%">
+ <!-- 32x32 blue image -->
+ <img style="width: 100%" src="data:image/png; charset=binary;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAChJREFUSMftzUEBAAAEBLCjf2dK8NsKrJLJp84zgUAgEAgEAoFAcGUBocYBP+pqhN4AAAAASUVORK5CYII=">
+ </div>
+</div>
+
+<p style="clear:left">Note that if you zoom the page after it loads
+it fixes the problem by causing a reflow.</p>
+
+<script>
+
+function run() {
+ /* needs to happen after the image loads */
+ var img = document.getElementsByTagName("img")[0];
+ var flush_and_ignore = img.offsetTop;
+ img.parentNode.parentNode.style.width = "150px";
+
+ document.documentElement.removeAttribute("class");
+}
+
+</script>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-1-ref.html b/layout/reftests/writing-mode/1193519-sideways-lr-1-ref.html
new file mode 100644
index 000000000..e3c96714c
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-1-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { padding: 5px; display: inline-block; }
+span { display: block; width: 2em; }
+span:nth-child(1) { background: red; height: 1em; }
+span:nth-child(2) { background: orange; height: 1.1em; }
+span:nth-child(3) { background: yellow; height: 1.3em; }
+span:nth-child(4) { background: green; height: 1.5em; }
+span:nth-child(5) { background: blue; height: 1.7em; }
+span:nth-child(6) { background: indigo; height: 1.9em; }
+span:nth-child(7) { background: violet; height: 2em; }
+</style>
+</head>
+
+<body>
+
+<p>All four columns should look the same:
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-1.html b/layout/reftests/writing-mode/1193519-sideways-lr-1.html
new file mode 100644
index 000000000..66df9d85f
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { padding: 5px; display: inline-block; }
+.vlr { writing-mode: vertical-lr; text-orientation: sideways; }
+.vrl { writing-mode: vertical-rl; text-orientation: sideways; }
+.slr { writing-mode: sideways-lr; }
+.srl { writing-mode: sideways-rl; }
+span { display: inline-block; block-size: 2em; vertical-align: middle; }
+span:nth-child(1) { background: red; inline-size: 1em; }
+span:nth-child(2) { background: orange; inline-size: 1.1em; }
+span:nth-child(3) { background: yellow; inline-size: 1.3em; }
+span:nth-child(4) { background: green; inline-size: 1.5em; }
+span:nth-child(5) { background: blue; inline-size: 1.7em; }
+span:nth-child(6) { background: indigo; inline-size: 1.9em; }
+span:nth-child(7) { background: violet; inline-size: 2em; }
+</style>
+</head>
+
+<body>
+
+<p>All four columns should look the same:
+<div dir=ltr class="vrl"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div dir=ltr class="vlr"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div dir=ltr class="srl"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div dir=rtl class="slr"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-2-ref.html b/layout/reftests/writing-mode/1193519-sideways-lr-2-ref.html
new file mode 100644
index 000000000..681cb2890
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-2-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { padding: 5px; display: inline-block; }
+span { display: block; width: 2em; }
+span:nth-child(7) { background: red; height: 1em; }
+span:nth-child(6) { background: orange; height: 1.1em; }
+span:nth-child(5) { background: yellow; height: 1.3em; }
+span:nth-child(4) { background: green; height: 1.5em; }
+span:nth-child(3) { background: blue; height: 1.7em; }
+span:nth-child(2) { background: indigo; height: 1.9em; }
+span:nth-child(1) { background: violet; height: 2em; }
+</style>
+</head>
+
+<body>
+
+<p>All four columns should look the same:
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-2.html b/layout/reftests/writing-mode/1193519-sideways-lr-2.html
new file mode 100644
index 000000000..5a6e7ea0e
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-2.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { padding: 5px; display: inline-block; }
+.vlr { writing-mode: vertical-lr; text-orientation: sideways; }
+.vrl { writing-mode: vertical-rl; text-orientation: sideways; }
+.slr { writing-mode: sideways-lr; }
+.srl { writing-mode: sideways-rl; }
+span { display: inline-block; block-size: 2em; vertical-align: middle; }
+span:nth-child(1) { background: red; inline-size: 1em; }
+span:nth-child(2) { background: orange; inline-size: 1.1em; }
+span:nth-child(3) { background: yellow; inline-size: 1.3em; }
+span:nth-child(4) { background: green; inline-size: 1.5em; }
+span:nth-child(5) { background: blue; inline-size: 1.7em; }
+span:nth-child(6) { background: indigo; inline-size: 1.9em; }
+span:nth-child(7) { background: violet; inline-size: 2em; }
+</style>
+</head>
+
+<body>
+
+<p>All four columns should look the same:
+<div dir=rtl class="vrl"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div dir=rtl class="vlr"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div dir=rtl class="srl"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
+<div dir=ltr class="slr"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-3-ref.html b/layout/reftests/writing-mode/1193519-sideways-lr-3-ref.html
new file mode 100644
index 000000000..e9ac42e25
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-3-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { border: 1px solid silver; padding: 5px; writing-mode: sideways-rl; transform: rotate(180deg); }
+span { padding: 5px; color: transparent; }
+span:nth-child(1) { background: red; }
+span:nth-child(2) { background: orange; }
+span:nth-child(3) { background: yellow; }
+span:nth-child(4) { background: green; }
+span:nth-child(5) { background: blue; }
+span:nth-child(6) { background: indigo; }
+span:nth-child(7) { background: violet; }
+</style>
+</head>
+
+<body>
+
+<div><span>one</span> <span>two</span> <span>three</span> <span>four</span>
+ <span>five</span> <span>six</span> <span>seven</span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-3.html b/layout/reftests/writing-mode/1193519-sideways-lr-3.html
new file mode 100644
index 000000000..09287844e
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-3.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { border: 1px solid silver; padding: 5px; writing-mode: sideways-lr; }
+span { padding: 5px; color: transparent; }
+span:nth-child(1) { background: red; }
+span:nth-child(2) { background: orange; }
+span:nth-child(3) { background: yellow; }
+span:nth-child(4) { background: green; }
+span:nth-child(5) { background: blue; }
+span:nth-child(6) { background: indigo; }
+span:nth-child(7) { background: violet; }
+</style>
+</head>
+
+<body>
+
+<div><span>one</span> <span>two</span> <span>three</span> <span>four</span>
+ <span>five</span> <span>six</span> <span>seven</span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-4-ref.html b/layout/reftests/writing-mode/1193519-sideways-lr-4-ref.html
new file mode 100644
index 000000000..368d38834
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-4-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { display: inline-block; border: 1px solid silver; padding: 5px;
+ line-height: 2em; writing-mode: sideways-rl; transform: rotate(180deg); }
+span { padding: 5px; color: transparent; }
+span:nth-child(1) { background: red; }
+span:nth-child(2) { background: orange; }
+span:nth-child(3) { background: yellow; }
+span:nth-child(4) { background: green; }
+span:nth-child(5) { background: blue; }
+span:nth-child(6) { background: indigo; }
+span:nth-child(7) { background: violet; }
+</style>
+</head>
+
+<body>
+
+<div><span>"One</span> <span>two</span>
+ <span>three</span> <span>four</span> <span>five</span>
+ <span>six</span> <span>seven."</span></div>
+
+<div dir=rtl><span>"One</span> <span>two</span>
+ <span>three</span> <span>four</span> <span>five</span>
+ <span>six</span> <span>seven."</span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-4.html b/layout/reftests/writing-mode/1193519-sideways-lr-4.html
new file mode 100644
index 000000000..f01956e3f
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-4.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+div { display: inline-block; border: 1px solid silver; padding: 5px;
+ line-height: 2em; writing-mode: sideways-lr; }
+span { padding: 5px; color: transparent; }
+span:nth-child(1) { background: red; }
+span:nth-child(2) { background: orange; }
+span:nth-child(3) { background: yellow; }
+span:nth-child(4) { background: green; }
+span:nth-child(5) { background: blue; }
+span:nth-child(6) { background: indigo; }
+span:nth-child(7) { background: violet; }
+</style>
+</head>
+
+<body>
+
+<div><span>"One</span> <span>two</span>
+ <span>three</span> <span>four</span> <span>five</span>
+ <span>six</span> <span>seven."</span></div>
+
+<div dir=rtl><span>"One</span> <span>two</span>
+ <span>three</span> <span>four</span> <span>five</span>
+ <span>six</span> <span>seven."</span></div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-decoration-1-ref.html b/layout/reftests/writing-mode/1193519-sideways-lr-decoration-1-ref.html
new file mode 100644
index 000000000..24cac4884
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-decoration-1-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<div style="width:300px;
+ height:300px;
+ text-align:center;
+ line-height:150px;
+ transform:rotate(-90deg);">
+ <span style="text-decoration:underline;">under</span>
+ <span style="text-decoration:overline;">over</span>
+ <span style="text-decoration:line-through;">through</span>
+</div>
diff --git a/layout/reftests/writing-mode/1193519-sideways-lr-decoration-1.html b/layout/reftests/writing-mode/1193519-sideways-lr-decoration-1.html
new file mode 100644
index 000000000..a9cc3dd73
--- /dev/null
+++ b/layout/reftests/writing-mode/1193519-sideways-lr-decoration-1.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<div style="width:300px;
+ height:300px;
+ text-align:center;
+ line-height:150px;
+ writing-mode:sideways-lr;">
+ <span style="text-decoration:underline;">under</span>
+ <span style="text-decoration:overline;">over</span>
+ <span style="text-decoration:line-through;">through</span>
+</div>
diff --git a/layout/reftests/writing-mode/1196887-1-computed-display-inline-block-ref.html b/layout/reftests/writing-mode/1196887-1-computed-display-inline-block-ref.html
new file mode 100644
index 000000000..502e5a964
--- /dev/null
+++ b/layout/reftests/writing-mode/1196887-1-computed-display-inline-block-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<p>There should be no red:</p>
+<div style="background: green; width: 100px; height: 100px;"></div>
diff --git a/layout/reftests/writing-mode/1196887-1-computed-display-inline-block.html b/layout/reftests/writing-mode/1196887-1-computed-display-inline-block.html
new file mode 100644
index 000000000..676cd3d22
--- /dev/null
+++ b/layout/reftests/writing-mode/1196887-1-computed-display-inline-block.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<p>There should be no red:</p>
+<div style="background: red; width: 100px; height: 100px; position: absolute; z-index: -1;"></div>
+<div style="background: green; writing-mode: vertical-rl; width: 100px;">
+ <span style="writing-mode: vertical-lr; height: 100px;">
diff --git a/layout/reftests/writing-mode/1205787-legacy-svg-values-1-ref.html b/layout/reftests/writing-mode/1205787-legacy-svg-values-1-ref.html
new file mode 100644
index 000000000..251f57415
--- /dev/null
+++ b/layout/reftests/writing-mode/1205787-legacy-svg-values-1-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<style>
+/* These are the CSS values that the testcase rules should compute to: */
+.tb { writing-mode: vertical-rl; inline-size: 10em; }
+.tbrl { writing-mode: vertical-rl; }
+.lr { writing-mode: horizontal-tb; }
+</style>
+<div class=tb>
+Hello
+<span class=lr>horizontal</span>
+world
+</div>
+
+<div>One <span class=tbrl>two</span> three</div>
+
+<!-- replace the <span> contents with their computed writing-mode -->
+<script>
+var s = document.querySelectorAll("span");
+for (i = 0; i < s.length; i++) {
+ s[i].textContent = window.getComputedStyle(s[i]).writingMode;
+}
+
+document.documentElement.removeAttribute("class");
+</script>
diff --git a/layout/reftests/writing-mode/1205787-legacy-svg-values-1.html b/layout/reftests/writing-mode/1205787-legacy-svg-values-1.html
new file mode 100644
index 000000000..2e73e68c4
--- /dev/null
+++ b/layout/reftests/writing-mode/1205787-legacy-svg-values-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<style>
+/* SVG1.1 writing-mode values that should compute to standard CSS values: */
+.tb { writing-mode: tb; inline-size: 10em; }
+.tbrl { writing-mode: tb-rl; }
+.lr { writing-mode: lr; }
+</style>
+<div class=tb>
+Hello
+<span class=lr>horizontal</span>
+world
+</div>
+
+<div>One <span class=tbrl>two</span> three</div>
+
+<!-- replace the <span> contents with their computed writing-mode -->
+<script>
+var s = document.querySelectorAll("span");
+for (i = 0; i < s.length; i++) {
+ s[i].textContent = window.getComputedStyle(s[i]).writingMode;
+}
+
+document.documentElement.removeAttribute("class");
+</script>
diff --git a/layout/reftests/writing-mode/1216747-1-notref.html b/layout/reftests/writing-mode/1216747-1-notref.html
new file mode 100644
index 000000000..373fd99b7
--- /dev/null
+++ b/layout/reftests/writing-mode/1216747-1-notref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE HTML>
+
+<div>This should have min-content width (i.e., many line breaks).</div>
diff --git a/layout/reftests/writing-mode/1216747-1-ref.html b/layout/reftests/writing-mode/1216747-1-ref.html
new file mode 100644
index 000000000..440456ef1
--- /dev/null
+++ b/layout/reftests/writing-mode/1216747-1-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<style>
+
+div {
+ width: -moz-min-content;
+}
+
+</style>
+
+<div>This should have min-content width (i.e., many line breaks).</div>
diff --git a/layout/reftests/writing-mode/1216747-1.html b/layout/reftests/writing-mode/1216747-1.html
new file mode 100644
index 000000000..e982646ad
--- /dev/null
+++ b/layout/reftests/writing-mode/1216747-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<style>
+
+div {
+ width: -moz-min-content;
+}
+
+</style>
+
+<!-- If you delete this div, the bug goes away, because we don't cache
+ vertical-specific data in the rule tree. -->
+<div style="writing-mode: vertical-rl"></div>
+
+<div>This should have min-content width (i.e., many line breaks).</div>
diff --git a/layout/reftests/writing-mode/1243125-1-floats-overflowing-ref.html b/layout/reftests/writing-mode/1243125-1-floats-overflowing-ref.html
new file mode 100644
index 000000000..35b2d8239
--- /dev/null
+++ b/layout/reftests/writing-mode/1243125-1-floats-overflowing-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 1243125 testcase</title>
+ <meta charset="utf-8">
+ <style type="text/css">
+ div {
+ overflow: hidden;
+ height: 20px;
+ width: 300px;
+ background: green;
+ margin: 8px 0;
+ }
+ </style>
+</head>
+<body>
+ <p>There should be 9 green bars</p>
+
+ <div></div>
+ <div></div>
+ <div></div>
+
+ <div></div>
+ <div></div>
+ <div></div>
+
+ <div></div>
+ <div></div>
+ <div></div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1243125-1-floats-overflowing.html b/layout/reftests/writing-mode/1243125-1-floats-overflowing.html
new file mode 100644
index 000000000..463396fbf
--- /dev/null
+++ b/layout/reftests/writing-mode/1243125-1-floats-overflowing.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bug 1243125 testcase</title>
+ <meta charset="utf-8">
+ <style type="text/css">
+ div {
+ overflow: hidden;
+ height: 20px;
+ width: 300px;
+ background: red;
+ margin: 8px 0;
+ }
+ .h-tb { writing-mode: horizontal-tb; }
+ .v-lr { writing-mode: vertical-lr; }
+ .v-rl { writing-mode: vertical-rl; }
+ span {
+ float: left;
+ height: 21px;
+ width: 301px;
+ background: green;
+ }
+ </style>
+</head>
+<body>
+ <p>There should be 9 green bars</p>
+
+ <div class="h-tb"><span class="h-tb"></span></div>
+ <div class="h-tb"><span class="v-lr"></span></div>
+ <div class="h-tb"><span class="v-rl"></span></div>
+
+ <div class="v-lr"><span class="h-tb"></span></div>
+ <div class="v-lr"><span class="v-lr"></span></div>
+ <div class="v-lr"><span class="v-rl"></span></div>
+
+ <div class="v-rl"><span class="h-tb"></span></div>
+ <div class="v-rl"><span class="v-lr"></span></div>
+ <div class="v-rl"><span class="v-rl"></span></div>
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun-ref.html b/layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun-ref.html
new file mode 100644
index 000000000..60b02f4c3
--- /dev/null
+++ b/layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url('../fonts/gw1270797.ttf') format("truetype");
+}
+html {
+ font-size: 72pt;
+ font-family: test, sans-serif;
+ writing-mode: vertical-rl;
+ text-orientation: mixed;
+}
+</style>
+</head>
+<body>
+&#xFA19;&#xFA19;&#xFA19;&#xFA19;
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun.html b/layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun.html
new file mode 100644
index 000000000..793c57046
--- /dev/null
+++ b/layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url('../fonts/gw1270797.ttf') format("truetype");
+}
+html {
+ font-size: 72pt;
+ font-family: test, sans-serif;
+ writing-mode: vertical-rl;
+ text-orientation: mixed;
+}
+</style>
+</head>
+<body>
+&#xFA19;&#x795E;&#xE0100;&#x795E;&#xE0103;&#x795E;&#xFE00;
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-1-ref.html b/layout/reftests/writing-mode/1302389-scrolled-rect-1-ref.html
new file mode 100644
index 000000000..01fc3cc51
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<div style="height: 300px;
+ width: -moz-min-content;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-1a.html b/layout/reftests/writing-mode/1302389-scrolled-rect-1a.html
new file mode 100644
index 000000000..48b156321
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-1a.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<div style="writing-mode: vertical-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-1b.html b/layout/reftests/writing-mode/1302389-scrolled-rect-1b.html
new file mode 100644
index 000000000..a71e0d00c
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-1b.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<body>
+<div style="writing-mode: sideways-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;
+ direction: rtl;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-1c.html b/layout/reftests/writing-mode/1302389-scrolled-rect-1c.html
new file mode 100644
index 000000000..6e71cf61a
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-1c.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script>
+function scroll() {
+ document.getElementsByTagName("div")[0].scrollTop = -200;
+}
+</script>
+<body onload="scroll()">
+<div style="writing-mode: vertical-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;
+ direction: rtl;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-1d.html b/layout/reftests/writing-mode/1302389-scrolled-rect-1d.html
new file mode 100644
index 000000000..094cf9012
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-1d.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script>
+function scroll() {
+ document.getElementsByTagName("div")[0].scrollTop = -200;
+}
+</script>
+<body onload="scroll()">
+<div style="writing-mode: sideways-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-2-ref.html b/layout/reftests/writing-mode/1302389-scrolled-rect-2-ref.html
new file mode 100644
index 000000000..6912f6fe6
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-2-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script>
+function scroll() {
+ document.getElementsByTagName("div")[0].scrollTop = 200;
+}
+</script>
+<body onload="scroll()">
+<div style="height: 300px;
+ width: -moz-min-content;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-2a.html b/layout/reftests/writing-mode/1302389-scrolled-rect-2a.html
new file mode 100644
index 000000000..ecf00333b
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-2a.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<body>
+<div style="writing-mode: vertical-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;
+ direction: rtl;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-2b.html b/layout/reftests/writing-mode/1302389-scrolled-rect-2b.html
new file mode 100644
index 000000000..5611e0e2c
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-2b.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<div style="writing-mode: sideways-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-2c.html b/layout/reftests/writing-mode/1302389-scrolled-rect-2c.html
new file mode 100644
index 000000000..687d02165
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-2c.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script>
+function scroll() {
+ document.getElementsByTagName("div")[0].scrollTop = 200;
+}
+</script>
+<body onload="scroll()">
+<div style="writing-mode: vertical-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302389-scrolled-rect-2d.html b/layout/reftests/writing-mode/1302389-scrolled-rect-2d.html
new file mode 100644
index 000000000..941729cdd
--- /dev/null
+++ b/layout/reftests/writing-mode/1302389-scrolled-rect-2d.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script>
+function scroll() {
+ document.getElementsByTagName("div")[0].scrollTop = 200;
+}
+</script>
+<body onload="scroll()">
+<div style="writing-mode: sideways-lr;
+ height: 300px;
+ font-size: 0;
+ line-height: 0;
+ border: 1px solid gray;
+ overflow: scroll;
+ direction: rtl;">
+ <div style="height: 100%;
+ width: 100px;
+ border: 50px solid blue;">
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-1-ref.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-1-ref.html
new file mode 100644
index 000000000..c84053be8
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<div>x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-1a.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-1a.html
new file mode 100644
index 000000000..45234bd6c
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-1a.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<!-- unicode-bidi:plaintext should resolve to LTR, ignoring the dir attribute -->
+<div dir="rtl" style="unicode-bidi:plaintext;">x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-1b.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-1b.html
new file mode 100644
index 000000000..cd1dc7b00
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-1b.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<!-- unicode-bidi:plaintext should resolve to LTR, ignoring the direction property -->
+<div style="direction:rtl; unicode-bidi:plaintext;">x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-2-ref.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-2-ref.html
new file mode 100644
index 000000000..47cdba9ed
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-2-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<div style="text-align:end">x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-2a.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-2a.html
new file mode 100644
index 000000000..0d7019f73
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-2a.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<!-- dir="rtl" should make the text bottom-aligned (i.e. line-right) -->
+<div dir="rtl">x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-2b.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-2b.html
new file mode 100644
index 000000000..8045069b7
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-2b.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<!-- direction:rtl should make the text bottom-aligned (i.e. line-right) -->
+<div style="direction:rtl;">x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-2c.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-2c.html
new file mode 100644
index 000000000..678013361
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-2c.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<!-- unicode-bidi:plaintext should resolve to RTL, ignoring the dir attribute -->
+<div dir="ltr" style="unicode-bidi:plaintext;">&rlm;x</div>
diff --git a/layout/reftests/writing-mode/1302734-bidi-plaintext-2d.html b/layout/reftests/writing-mode/1302734-bidi-plaintext-2d.html
new file mode 100644
index 000000000..989415e3e
--- /dev/null
+++ b/layout/reftests/writing-mode/1302734-bidi-plaintext-2d.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+ width: 50px;
+ height: 100px;
+ border: 1px solid gray;
+ display: inline-block;
+ writing-mode: vertical-rl;
+}
+</style>
+<!-- unicode-bidi:plaintext should resolve to RTL, ignoring the direction property -->
+<div style="direction:ltr; unicode-bidi:plaintext;">&rlm;x</div>
diff --git a/layout/reftests/writing-mode/4colors.png b/layout/reftests/writing-mode/4colors.png
new file mode 100644
index 000000000..250273aae
--- /dev/null
+++ b/layout/reftests/writing-mode/4colors.png
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1-ref.html
new file mode 100644
index 000000000..fc6e6b5af
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px;
+ writing-mode: vertical-lr; position: absolute; left: 0; top: 0; }
+.test { background: #aaa; position: absolute; left: 0; top: 0; width: 2em; height: 100%; }
+.rel { position: relative; }
+img { position: absolute; left: 0; top: 34px;
+ width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="rel">
+ <div class="test"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1a.html
new file mode 100644
index 000000000..e3a9f414d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1a.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+img { position: absolute; width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vlr">
+ <div class="test"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1b.html
new file mode 100644
index 000000000..12e79285d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+img { position: absolute; width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vlr rel">
+ <div class="test"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1c.html
new file mode 100644
index 000000000..234d9b86f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-1c.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+img { position: absolute; width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vlr">
+ <div class="test rel"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2-ref.html
new file mode 100644
index 000000000..69f635771
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px;
+ writing-mode: vertical-lr; position: absolute; left: 0; top: 0; }
+.test { background: #aaa; position: absolute; left: 0; top: 0; width: 2em; height: 100%; }
+.rel { position: relative; }
+img { position: absolute; left: 0; top: 34px;
+ background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="rel">
+ <div class="test"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2a.html
new file mode 100644
index 000000000..26a039659
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2a.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+img { position: absolute; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vlr">
+ <div class="test"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2b.html
new file mode 100644
index 000000000..d5960f00f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+img { position: absolute; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vlr rel">
+ <div class="test"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2c.html
new file mode 100644
index 000000000..37798c920
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-2c.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+img { position: absolute; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vlr">
+ <div class="test rel"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3-ref.html
new file mode 100644
index 000000000..87e0c4e8f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vlr { writing-mode: vertical-lr; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { margin: 0; padding: 2px; border: 2px solid green; inline-size: -moz-fit-content; }
+</style>
+<body>
+<div>
+ <div class="vlr"><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3a.html
new file mode 100644
index 000000000..2231ad7bd
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3a.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { position: absolute; margin: 0; padding: 2px; border: 2px solid green; }
+</style>
+<body>
+<div class="vlr">
+ <div><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3b.html
new file mode 100644
index 000000000..f75b01b1a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3b.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { position: absolute; margin: 0; padding: 2px; border: 2px solid green; }
+</style>
+<body>
+<div class="vlr rel">
+ <div><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3c.html
new file mode 100644
index 000000000..d2a1511d6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-3c.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { position: absolute; margin: 0; padding: 2px; border: 2px solid green; }
+</style>
+<body>
+<div class="vlr">
+ <div class="rel"><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4-ref.html
new file mode 100644
index 000000000..4a6eda999
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px;
+ position: absolute; right: 0; top: 0; }
+.test { writing-mode: vertical-rl; background: #aaa;
+ position: absolute; right: 0; top: 0; width: 2em; height: 100%; }
+.rel { position: relative; }
+img { position: absolute; right: 0; top: 34px;
+ width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="rel">
+ <div class="test"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4a.html
new file mode 100644
index 000000000..5c7ecab70
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4a.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+img { position: absolute; width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vrl">
+ <div class="test"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4b.html
new file mode 100644
index 000000000..1e51065b7
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+img { position: absolute; width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vrl rel">
+ <div class="test"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4c.html
new file mode 100644
index 000000000..edc8b870e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-4c.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+img { position: absolute; width: 30px; height: 40px; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vrl">
+ <div class="test rel"><span class="abc">abc</span><img src=""></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5-ref.html
new file mode 100644
index 000000000..cf0b18aca
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px;
+ position: absolute; right: 0; top: 0; }
+.test { writing-mode: vertical-rl; background: #aaa;
+ position: absolute; right: 0; top: 0; width: 2em; height: 100%; }
+.rel { position: relative; }
+img { position: absolute; right: 0; top: 34px;
+ background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="rel">
+ <div class="test"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5a.html
new file mode 100644
index 000000000..fd7e3cead
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5a.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+img { position: absolute; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vrl">
+ <div class="test"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5b.html
new file mode 100644
index 000000000..2b48fcaa8
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+img { position: absolute; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vrl rel">
+ <div class="test"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5c.html
new file mode 100644
index 000000000..3923017a4
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-5c.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 100px; height: 150px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+img { position: absolute; background: green; border: 5px solid yellow; }
+</style>
+<body>
+<div class="vrl">
+ <div class="test rel"><span class="abc">abc</span><img src="blue-32x32.png"></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6-ref.html
new file mode 100644
index 000000000..c68151004
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vrl { writing-mode: vertical-rl; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { margin: 0; padding: 2px; border: 2px solid green; inline-size: -moz-fit-content; }
+</style>
+<body>
+<div class="vrl">
+ <div><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6a.html
new file mode 100644
index 000000000..41f6681c9
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6a.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { position: absolute; margin: 0; padding: 2px; border: 2px solid green; }
+</style>
+<body>
+<div class="vrl">
+ <div><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6b.html
new file mode 100644
index 000000000..d768e575c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6b.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { position: absolute; margin: 0; padding: 2px; border: 2px solid green; }
+</style>
+<body>
+<div class="vrl rel">
+ <div><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6c.html
new file mode 100644
index 000000000..111443acf
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-6c.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 120px; height: 150px; border: 5px solid blue; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+span { display: inline-block; padding: 5px; block-size: 1.5em; border: 2px solid red; }
+p { position: absolute; margin: 0; padding: 2px; border: 2px solid green; }
+</style>
+<body>
+<div class="vrl">
+ <div class="rel"><span>abc def</span><p>xyzzy</p></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7-ref.html
new file mode 100644
index 000000000..77ad9c15b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px;
+ writing-mode: vertical-lr; position: absolute; left: 0; top: 0; }
+.test { background: #aaa; position: absolute; left: 0; top: 0; width: 2em; height: 100%; }
+.rel { position: relative; }
+iframe {
+ position: absolute; left: 0; top: 34px;
+ background: yellow; border: 5px solid green;
+ width: 300px; height: 150px;
+}
+</style>
+<body>
+<div class="rel">
+ <div class="test"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7a.html
new file mode 100644
index 000000000..906757ae9
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7a.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+iframe { position: absolute; background: yellow; border: 5px solid green; }
+</style>
+<body>
+<div class="vlr">
+ <div class="test"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7b.html
new file mode 100644
index 000000000..9056e75cb
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+iframe { position: absolute; background: yellow; border: 5px solid green; }
+</style>
+<body>
+<div class="vlr rel">
+ <div class="test"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7c.html
new file mode 100644
index 000000000..d21dbaa1e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-7c.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vlr { writing-mode: vertical-lr; }
+.rel { position: relative; }
+iframe { position: absolute; background: yellow; border: 5px solid green; }
+</style>
+<body>
+<div class="vlr">
+ <div class="test rel"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8-ref.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8-ref.html
new file mode 100644
index 000000000..33e90d3f8
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px;
+ writing-mode: vertical-rl; position: absolute; right: 0; top: 0; }
+.test { background: #aaa; position: absolute; right: 0; top: 0; width: 2em; height: 100%; }
+.rel { position: relative; }
+iframe {
+ position: absolute; right: 0; top: 34px;
+ background: yellow; border: 5px solid green;
+ width: 300px; height: 150px;
+}
+</style>
+<body>
+<div class="rel">
+ <div class="test"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8a.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8a.html
new file mode 100644
index 000000000..ccca0406c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8a.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+iframe { position: absolute; background: yellow; border: 5px solid green; }
+</style>
+<body>
+<div class="vrl">
+ <div class="test"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8b.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8b.html
new file mode 100644
index 000000000..948c0ee09
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+iframe { position: absolute; background: yellow; border: 5px solid green; }
+</style>
+<body>
+<div class="vrl rel">
+ <div class="test"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8c.html b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8c.html
new file mode 100644
index 000000000..c8b95701b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/1183431-orthogonal-modes-8c.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+body>div { margin: 50px 20px; width: 400px; height: 500px; border: 5px solid blue; }
+.abc { display: inline-block; border: 2px solid red; inline-size: 30px; }
+.test { background: #aaa; width: 2em; }
+.vrl { writing-mode: vertical-rl; }
+.rel { position: relative; }
+iframe { position: absolute; background: yellow; border: 5px solid green; }
+</style>
+<body>
+<div class="vrl">
+ <div class="test rel"><span class="abc">abc</span><iframe src="data:text/html,hello"></iframe></div>
+</div>
diff --git a/layout/reftests/writing-mode/abspos/blue-32x32.png b/layout/reftests/writing-mode/abspos/blue-32x32.png
new file mode 100644
index 000000000..deefd19b2
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/blue-32x32.png
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/reftest-stylo.list b/layout/reftests/writing-mode/abspos/reftest-stylo.list
new file mode 100644
index 000000000..8874e96ef
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/reftest-stylo.list
@@ -0,0 +1,130 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+# This directory contains tests for position:absolute and vertical writing modes.
+# They require the vertical-text pref to be true, otherwise lots of them will fail.
+# (See bug 1079151 for the origin of these testcases by Gérard Talbot.)
+
+
+# All of these are fuzzy-if on skia content on OS X due to subpixel text positioning.
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-003.xht s71-abs-pos-non-replaced-vlr-003.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-005.xht s71-abs-pos-non-replaced-vlr-005.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-007.xht s71-abs-pos-non-replaced-vlr-007.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-009.xht s71-abs-pos-non-replaced-vlr-009.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-011.xht s71-abs-pos-non-replaced-vlr-011.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-013.xht s71-abs-pos-non-replaced-vlr-013.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-015.xht s71-abs-pos-non-replaced-vlr-015.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-017.xht s71-abs-pos-non-replaced-vlr-017.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-019.xht s71-abs-pos-non-replaced-vlr-019.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-021.xht s71-abs-pos-non-replaced-vlr-021.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-023.xht s71-abs-pos-non-replaced-vlr-023.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-025.xht s71-abs-pos-non-replaced-vlr-025.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-027.xht s71-abs-pos-non-replaced-vlr-027.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-029.xht s71-abs-pos-non-replaced-vlr-029.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-031.xht s71-abs-pos-non-replaced-vlr-031.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-033.xht s71-abs-pos-non-replaced-vlr-033.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-035.xht s71-abs-pos-non-replaced-vlr-035.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-037.xht s71-abs-pos-non-replaced-vlr-037.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-039.xht s71-abs-pos-non-replaced-vlr-039.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-041.xht s71-abs-pos-non-replaced-vlr-041.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-043.xht s71-abs-pos-non-replaced-vlr-043.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-045.xht s71-abs-pos-non-replaced-vlr-045.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-047.xht s71-abs-pos-non-replaced-vlr-047.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-049.xht s71-abs-pos-non-replaced-vlr-049.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-051.xht s71-abs-pos-non-replaced-vlr-051.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-053.xht s71-abs-pos-non-replaced-vlr-053.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-055.xht s71-abs-pos-non-replaced-vlr-055.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-057.xht s71-abs-pos-non-replaced-vlr-057.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-059.xht s71-abs-pos-non-replaced-vlr-059.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-061.xht s71-abs-pos-non-replaced-vlr-061.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vlr-063.xht s71-abs-pos-non-replaced-vlr-063.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vlr-065.xht s71-abs-pos-non-replaced-vlr-065.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vlr-067.xht s71-abs-pos-non-replaced-vlr-067.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vlr-069.xht s71-abs-pos-non-replaced-vlr-069.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vlr-071.xht s71-abs-pos-non-replaced-vlr-071.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vlr-073.xht s71-abs-pos-non-replaced-vlr-073.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-075.xht s71-abs-pos-non-replaced-vlr-075.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-077.xht s71-abs-pos-non-replaced-vlr-077.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-079.xht s71-abs-pos-non-replaced-vlr-079.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-081.xht s71-abs-pos-non-replaced-vlr-081.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-083.xht s71-abs-pos-non-replaced-vlr-083.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-085.xht s71-abs-pos-non-replaced-vlr-085.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-087.xht s71-abs-pos-non-replaced-vlr-087.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-089.xht s71-abs-pos-non-replaced-vlr-089.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-091.xht s71-abs-pos-non-replaced-vlr-091.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-093.xht s71-abs-pos-non-replaced-vlr-093.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-095.xht s71-abs-pos-non-replaced-vlr-095.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vlr-097.xht s71-abs-pos-non-replaced-vlr-097.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-002.xht s71-abs-pos-non-replaced-vrl-002.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-004.xht s71-abs-pos-non-replaced-vrl-004.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-006.xht s71-abs-pos-non-replaced-vrl-006.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-008.xht s71-abs-pos-non-replaced-vrl-008.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-010.xht s71-abs-pos-non-replaced-vrl-010.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-012.xht s71-abs-pos-non-replaced-vrl-012.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-014.xht s71-abs-pos-non-replaced-vrl-014.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-016.xht s71-abs-pos-non-replaced-vrl-016.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-018.xht s71-abs-pos-non-replaced-vrl-018.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-020.xht s71-abs-pos-non-replaced-vrl-020.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-022.xht s71-abs-pos-non-replaced-vrl-022.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-024.xht s71-abs-pos-non-replaced-vrl-024.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-026.xht s71-abs-pos-non-replaced-vrl-026.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-028.xht s71-abs-pos-non-replaced-vrl-028.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-030.xht s71-abs-pos-non-replaced-vrl-030.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-032.xht s71-abs-pos-non-replaced-vrl-032.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-034.xht s71-abs-pos-non-replaced-vrl-034.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-036.xht s71-abs-pos-non-replaced-vrl-036.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-038.xht s71-abs-pos-non-replaced-vrl-038.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-040.xht s71-abs-pos-non-replaced-vrl-040.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-042.xht s71-abs-pos-non-replaced-vrl-042.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-044.xht s71-abs-pos-non-replaced-vrl-044.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-046.xht s71-abs-pos-non-replaced-vrl-046.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-048.xht s71-abs-pos-non-replaced-vrl-048.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-050.xht s71-abs-pos-non-replaced-vrl-050.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-052.xht s71-abs-pos-non-replaced-vrl-052.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-054.xht s71-abs-pos-non-replaced-vrl-054.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-056.xht s71-abs-pos-non-replaced-vrl-056.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-058.xht s71-abs-pos-non-replaced-vrl-058.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-060.xht s71-abs-pos-non-replaced-vrl-060.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vrl-062.xht s71-abs-pos-non-replaced-vrl-062.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vrl-064.xht s71-abs-pos-non-replaced-vrl-064.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vrl-066.xht s71-abs-pos-non-replaced-vrl-066.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vrl-068.xht s71-abs-pos-non-replaced-vrl-068.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vrl-070.xht s71-abs-pos-non-replaced-vrl-070.xht
+fails fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) == s71-abs-pos-non-replaced-vrl-072.xht s71-abs-pos-non-replaced-vrl-072.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-074.xht s71-abs-pos-non-replaced-vrl-074.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-076.xht s71-abs-pos-non-replaced-vrl-076.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-078.xht s71-abs-pos-non-replaced-vrl-078.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-080.xht s71-abs-pos-non-replaced-vrl-080.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-082.xht s71-abs-pos-non-replaced-vrl-082.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-084.xht s71-abs-pos-non-replaced-vrl-084.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-086.xht s71-abs-pos-non-replaced-vrl-086.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-088.xht s71-abs-pos-non-replaced-vrl-088.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-090.xht s71-abs-pos-non-replaced-vrl-090.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-092.xht s71-abs-pos-non-replaced-vrl-092.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-094.xht s71-abs-pos-non-replaced-vrl-094.xht
+fails fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) == s71-abs-pos-non-replaced-vrl-096.xht s71-abs-pos-non-replaced-vrl-096.xht
+
+== 1183431-orthogonal-modes-1a.html 1183431-orthogonal-modes-1a.html
+== 1183431-orthogonal-modes-1b.html 1183431-orthogonal-modes-1b.html
+== 1183431-orthogonal-modes-1c.html 1183431-orthogonal-modes-1c.html
+== 1183431-orthogonal-modes-2a.html 1183431-orthogonal-modes-2a.html
+== 1183431-orthogonal-modes-2b.html 1183431-orthogonal-modes-2b.html
+== 1183431-orthogonal-modes-2c.html 1183431-orthogonal-modes-2c.html
+== 1183431-orthogonal-modes-3a.html 1183431-orthogonal-modes-3a.html
+== 1183431-orthogonal-modes-3b.html 1183431-orthogonal-modes-3b.html
+== 1183431-orthogonal-modes-3c.html 1183431-orthogonal-modes-3c.html
+== 1183431-orthogonal-modes-4a.html 1183431-orthogonal-modes-4a.html
+== 1183431-orthogonal-modes-4b.html 1183431-orthogonal-modes-4b.html
+== 1183431-orthogonal-modes-4c.html 1183431-orthogonal-modes-4c.html
+== 1183431-orthogonal-modes-5a.html 1183431-orthogonal-modes-5a.html
+== 1183431-orthogonal-modes-5b.html 1183431-orthogonal-modes-5b.html
+== 1183431-orthogonal-modes-5c.html 1183431-orthogonal-modes-5c.html
+== 1183431-orthogonal-modes-6a.html 1183431-orthogonal-modes-6a.html
+# bug 1191801
+== 1183431-orthogonal-modes-6b.html 1183431-orthogonal-modes-6b.html
+== 1183431-orthogonal-modes-6c.html 1183431-orthogonal-modes-6c.html
+== 1183431-orthogonal-modes-7a.html 1183431-orthogonal-modes-7a.html
+== 1183431-orthogonal-modes-7b.html 1183431-orthogonal-modes-7b.html
+== 1183431-orthogonal-modes-7c.html 1183431-orthogonal-modes-7c.html
+== 1183431-orthogonal-modes-8a.html 1183431-orthogonal-modes-8a.html
+# bug 1191801
+== 1183431-orthogonal-modes-8b.html 1183431-orthogonal-modes-8b.html
+== 1183431-orthogonal-modes-8c.html 1183431-orthogonal-modes-8c.html
diff --git a/layout/reftests/writing-mode/abspos/reftest.list b/layout/reftests/writing-mode/abspos/reftest.list
new file mode 100644
index 000000000..204ab825a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/reftest.list
@@ -0,0 +1,128 @@
+# This directory contains tests for position:absolute and vertical writing modes.
+# (See bug 1079151 for the origin of these testcases by Gérard Talbot.)
+
+# All of these are fuzzy-if on skia content on OS X due to subpixel text positioning.
+# Frequent Windows 7 load failed: timed out waiting for test to complete (waiting for onload scripts to complete), bug 1167155 and friends
+# Even though the whole reftest.list here is skipped, it doesn't actually work because reftests match the last
+# **-if, which means even though we tried to skip this list,the fuzzy-if still matched forcing us to run the test.
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-003.xht s71-abs-pos-non-replaced-vlr-003-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-005.xht s71-abs-pos-non-replaced-vlr-005-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-007.xht s71-abs-pos-non-replaced-vlr-007-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-009.xht s71-abs-pos-non-replaced-vlr-009-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-011.xht s71-abs-pos-non-replaced-vlr-011-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-013.xht s71-abs-pos-non-replaced-vlr-013-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-015.xht s71-abs-pos-non-replaced-vlr-015-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-017.xht s71-abs-pos-non-replaced-vlr-017-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-019.xht s71-abs-pos-non-replaced-vlr-019-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-021.xht s71-abs-pos-non-replaced-vlr-021-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-023.xht s71-abs-pos-non-replaced-vlr-023-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-025.xht s71-abs-pos-non-replaced-vlr-025-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-027.xht s71-abs-pos-non-replaced-vlr-027-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-029.xht s71-abs-pos-non-replaced-vlr-029-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-031.xht s71-abs-pos-non-replaced-vlr-031-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-033.xht s71-abs-pos-non-replaced-vlr-033-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-035.xht s71-abs-pos-non-replaced-vlr-035-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-037.xht s71-abs-pos-non-replaced-vlr-037-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-039.xht s71-abs-pos-non-replaced-vlr-039-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-041.xht s71-abs-pos-non-replaced-vlr-041-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-043.xht s71-abs-pos-non-replaced-vlr-043-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-045.xht s71-abs-pos-non-replaced-vlr-045-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-047.xht s71-abs-pos-non-replaced-vlr-047-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-049.xht s71-abs-pos-non-replaced-vlr-049-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-051.xht s71-abs-pos-non-replaced-vlr-051-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-053.xht s71-abs-pos-non-replaced-vlr-053-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-055.xht s71-abs-pos-non-replaced-vlr-055-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-057.xht s71-abs-pos-non-replaced-vlr-057-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-059.xht s71-abs-pos-non-replaced-vlr-059-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-061.xht s71-abs-pos-non-replaced-vlr-061-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-063.xht s71-abs-pos-non-replaced-vlr-063-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-065.xht s71-abs-pos-non-replaced-vlr-065-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-067.xht s71-abs-pos-non-replaced-vlr-067-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-069.xht s71-abs-pos-non-replaced-vlr-069-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-071.xht s71-abs-pos-non-replaced-vlr-071-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-073.xht s71-abs-pos-non-replaced-vlr-073-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-075.xht s71-abs-pos-non-replaced-vlr-075-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-077.xht s71-abs-pos-non-replaced-vlr-077-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-079.xht s71-abs-pos-non-replaced-vlr-079-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-081.xht s71-abs-pos-non-replaced-vlr-081-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-083.xht s71-abs-pos-non-replaced-vlr-083-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-085.xht s71-abs-pos-non-replaced-vlr-085-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-087.xht s71-abs-pos-non-replaced-vlr-087-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-089.xht s71-abs-pos-non-replaced-vlr-089-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-091.xht s71-abs-pos-non-replaced-vlr-091-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-093.xht s71-abs-pos-non-replaced-vlr-093-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-095.xht s71-abs-pos-non-replaced-vlr-095-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vlr-097.xht s71-abs-pos-non-replaced-vlr-097-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-002.xht s71-abs-pos-non-replaced-vrl-002-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-004.xht s71-abs-pos-non-replaced-vrl-004-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-006.xht s71-abs-pos-non-replaced-vrl-006-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-008.xht s71-abs-pos-non-replaced-vrl-008-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-010.xht s71-abs-pos-non-replaced-vrl-010-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-012.xht s71-abs-pos-non-replaced-vrl-012-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-014.xht s71-abs-pos-non-replaced-vrl-014-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-016.xht s71-abs-pos-non-replaced-vrl-016-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-018.xht s71-abs-pos-non-replaced-vrl-018-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-020.xht s71-abs-pos-non-replaced-vrl-020-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-022.xht s71-abs-pos-non-replaced-vrl-022-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-024.xht s71-abs-pos-non-replaced-vrl-024-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-026.xht s71-abs-pos-non-replaced-vrl-026-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-028.xht s71-abs-pos-non-replaced-vrl-028-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-030.xht s71-abs-pos-non-replaced-vrl-030-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-032.xht s71-abs-pos-non-replaced-vrl-032-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-034.xht s71-abs-pos-non-replaced-vrl-034-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-036.xht s71-abs-pos-non-replaced-vrl-036-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-038.xht s71-abs-pos-non-replaced-vrl-038-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-040.xht s71-abs-pos-non-replaced-vrl-040-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-042.xht s71-abs-pos-non-replaced-vrl-042-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-044.xht s71-abs-pos-non-replaced-vrl-044-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-046.xht s71-abs-pos-non-replaced-vrl-046-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-048.xht s71-abs-pos-non-replaced-vrl-048-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-050.xht s71-abs-pos-non-replaced-vrl-050-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-052.xht s71-abs-pos-non-replaced-vrl-052-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-054.xht s71-abs-pos-non-replaced-vrl-054-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-056.xht s71-abs-pos-non-replaced-vrl-056-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-058.xht s71-abs-pos-non-replaced-vrl-058-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-060.xht s71-abs-pos-non-replaced-vrl-060-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-062.xht s71-abs-pos-non-replaced-vrl-062-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-064.xht s71-abs-pos-non-replaced-vrl-064-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-066.xht s71-abs-pos-non-replaced-vrl-066-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-068.xht s71-abs-pos-non-replaced-vrl-068-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-070.xht s71-abs-pos-non-replaced-vrl-070-ref.xht
+fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) fuzzy-if(skiaContent,154,320) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-072.xht s71-abs-pos-non-replaced-vrl-072-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-074.xht s71-abs-pos-non-replaced-vrl-074-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-076.xht s71-abs-pos-non-replaced-vrl-076-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-078.xht s71-abs-pos-non-replaced-vrl-078-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-080.xht s71-abs-pos-non-replaced-vrl-080-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-082.xht s71-abs-pos-non-replaced-vrl-082-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-084.xht s71-abs-pos-non-replaced-vrl-084-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-086.xht s71-abs-pos-non-replaced-vrl-086-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-088.xht s71-abs-pos-non-replaced-vrl-088-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-090.xht s71-abs-pos-non-replaced-vrl-090-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-092.xht s71-abs-pos-non-replaced-vrl-092-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-094.xht s71-abs-pos-non-replaced-vrl-094-ref.xht
+fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) fuzzy-if(skiaContent,255,248) skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == s71-abs-pos-non-replaced-vrl-096.xht s71-abs-pos-non-replaced-vrl-096-ref.xht
+
+== 1183431-orthogonal-modes-1a.html 1183431-orthogonal-modes-1-ref.html
+== 1183431-orthogonal-modes-1b.html 1183431-orthogonal-modes-1-ref.html
+== 1183431-orthogonal-modes-1c.html 1183431-orthogonal-modes-1-ref.html
+== 1183431-orthogonal-modes-2a.html 1183431-orthogonal-modes-2-ref.html
+== 1183431-orthogonal-modes-2b.html 1183431-orthogonal-modes-2-ref.html
+== 1183431-orthogonal-modes-2c.html 1183431-orthogonal-modes-2-ref.html
+== 1183431-orthogonal-modes-3a.html 1183431-orthogonal-modes-3-ref.html
+== 1183431-orthogonal-modes-3b.html 1183431-orthogonal-modes-3-ref.html
+== 1183431-orthogonal-modes-3c.html 1183431-orthogonal-modes-3-ref.html
+== 1183431-orthogonal-modes-4a.html 1183431-orthogonal-modes-4-ref.html
+== 1183431-orthogonal-modes-4b.html 1183431-orthogonal-modes-4-ref.html
+== 1183431-orthogonal-modes-4c.html 1183431-orthogonal-modes-4-ref.html
+== 1183431-orthogonal-modes-5a.html 1183431-orthogonal-modes-5-ref.html
+== 1183431-orthogonal-modes-5b.html 1183431-orthogonal-modes-5-ref.html
+== 1183431-orthogonal-modes-5c.html 1183431-orthogonal-modes-5-ref.html
+fails == 1183431-orthogonal-modes-6a.html 1183431-orthogonal-modes-6-ref.html # bug 1191801
+== 1183431-orthogonal-modes-6b.html 1183431-orthogonal-modes-6-ref.html
+== 1183431-orthogonal-modes-6c.html 1183431-orthogonal-modes-6-ref.html
+== 1183431-orthogonal-modes-7a.html 1183431-orthogonal-modes-7-ref.html
+== 1183431-orthogonal-modes-7b.html 1183431-orthogonal-modes-7-ref.html
+== 1183431-orthogonal-modes-7c.html 1183431-orthogonal-modes-7-ref.html
+fails == 1183431-orthogonal-modes-8a.html 1183431-orthogonal-modes-8-ref.html # bug 1191801
+== 1183431-orthogonal-modes-8b.html 1183431-orthogonal-modes-8-ref.html
+== 1183431-orthogonal-modes-8c.html 1183431-orthogonal-modes-8-ref.html
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003-ref.xht
new file mode 100644
index 000000000..c301c0c10
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003.xht
new file mode 100644
index 000000000..8d310eeb0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-003.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are 'auto', then set 'top' to the static position, then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005-ref.xht
new file mode 100644
index 000000000..8b7840656
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005.xht
new file mode 100644
index 000000000..492f8b863
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-005.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left', 'width' and 'right' are 'auto', then set 'left' to the static position, the width becomes shrink-to-fit and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007-ref.xht
new file mode 100644
index 000000000..ed3c87a81
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007-ref.xht
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007.xht
new file mode 100644
index 000000000..ab3234854
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-007.xht
@@ -0,0 +1,125 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are 'auto', then set 'top' to the static position, then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009-ref.xht
new file mode 100644
index 000000000..ec7fafe59
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009.xht
new file mode 100644
index 000000000..0787fb621
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-009.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are 'auto', then set 'bottom' to the static position, the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011-ref.xht
new file mode 100644
index 000000000..6299224f3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011.xht
new file mode 100644
index 000000000..7a5bf63c4
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-011.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left', 'width' and 'right' are 'auto', then set 'right' to the static position, the width becomes shrink-to-fit and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right: auto: set to static position
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right: auto: set to static position
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013-ref.xht
new file mode 100644
index 000000000..a05914e70
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013.xht
new file mode 100644
index 000000000..7d098c917
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-013.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are 'auto', then set 'bottom' to the static position, the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015-ref.xht
new file mode 100644
index 000000000..f1e1acad9
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' are 'auto' and bottom is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015.xht
new file mode 100644
index 000000000..d69a507aa
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-015.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' are 'auto' and bottom is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' are 'auto' and bottom is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017-ref.xht
new file mode 100644
index 000000000..733b9a04b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017.xht
new file mode 100644
index 000000000..b2408a91f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-017.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width becomes shrink-to-fit and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 2em;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019-ref.xht
new file mode 100644
index 000000000..f90551d4c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019-ref.xht
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'height' are 'auto and 'bottom' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019.xht
new file mode 100644
index 000000000..49a8929d8
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-019.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021-ref.xht
new file mode 100644
index 000000000..d29d7f4d0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto and 'bottom' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021.xht
new file mode 100644
index 000000000..1a0d096d2
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-021.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto and 'bottom' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023-ref.xht
new file mode 100644
index 000000000..3d3d2af3f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023.xht
new file mode 100644
index 000000000..b3e430fb0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-023.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width becomes shrink-to-fit and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 2em;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025-ref.xht
new file mode 100644
index 000000000..86f4555e8
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025.xht
new file mode 100644
index 000000000..9b1288566
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-025.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' are 'auto' and bottom is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027-ref.xht
new file mode 100644
index 000000000..0c725e83a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom are 'auto' and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ color: transparent;
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027.xht
new file mode 100644
index 000000000..df3640a6f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-027.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height" title="10.6.4 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029-ref.xht
new file mode 100644
index 000000000..dd7458329
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029.xht
new file mode 100644
index 000000000..63ab36c27
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-029.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left' and 'right' are 'auto' and 'width' is not 'auto', then set 'left' to the static position and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031-ref.xht
new file mode 100644
index 000000000..c9b7f5ed5
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031-ref.xht
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom are 'auto' and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031.xht
new file mode 100644
index 000000000..209aec746
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-031.xht
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033-ref.xht
new file mode 100644
index 000000000..5342e9c3d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033.xht
new file mode 100644
index 000000000..5e4be1bf0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-033.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035-ref.xht
new file mode 100644
index 000000000..91a8a0263
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035.xht
new file mode 100644
index 000000000..5ae49beb3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-035.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left' and 'right' are 'auto' and 'width' is not 'auto', then set 'right' to the static position and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037-ref.xht
new file mode 100644
index 000000000..81debc1f3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037.xht
new file mode 100644
index 000000000..da548931e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-037.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039-ref.xht
new file mode 100644
index 000000000..82ea1a041
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039.xht
new file mode 100644
index 000000000..15570b21a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-039.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041-ref.xht
new file mode 100644
index 000000000..13c6d126f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041.xht
new file mode 100644
index 000000000..fcc17fe5d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-041.xht
@@ -0,0 +1,111 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width becomes shrink-to-fit and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043-ref.xht
new file mode 100644
index 000000000..44d3b928e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043.xht
new file mode 100644
index 000000000..11c90eaa3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-043.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045-ref.xht
new file mode 100644
index 000000000..b3a420fc3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045.xht
new file mode 100644
index 000000000..090e26a86
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-045.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047-ref.xht
new file mode 100644
index 000000000..8434ecf3a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047.xht
new file mode 100644
index 000000000..9cafed71d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-047.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width becomes shrink-to-fit and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049-ref.xht
new file mode 100644
index 000000000..be5d151be
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049.xht
new file mode 100644
index 000000000..044c563c2
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-049.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051-ref.xht
new file mode 100644
index 000000000..0bde1b19e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051.xht
new file mode 100644
index 000000000..a038a9003
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-051.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053-ref.xht
new file mode 100644
index 000000000..53a92cddc
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' is 'auto', 'width' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053.xht
new file mode 100644
index 000000000..973798a09
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-053.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' is 'auto', 'width' and 'right' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 1em;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055-ref.xht
new file mode 100644
index 000000000..8ad2c61a4
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055.xht
new file mode 100644
index 000000000..d0da9d3c2
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-055.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057-ref.xht
new file mode 100644
index 000000000..367d88847
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057.xht
new file mode 100644
index 000000000..e951bafb0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-057.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059-ref.xht
new file mode 100644
index 000000000..ddb9b1f9b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059.xht
new file mode 100644
index 000000000..d2ea5fc06
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-059.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left', then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 1em;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+4.'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061-ref.xht
new file mode 100644
index 000000000..2a4e3e845
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061.xht
new file mode 100644
index 000000000..45c8e0dc6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-061.xht
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063-ref.xht
new file mode 100644
index 000000000..d19612ac3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063.xht
new file mode 100644
index 000000000..600a84523
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-063.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065-ref.xht
new file mode 100644
index 000000000..3a7b02a8e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065.xht
new file mode 100644
index 000000000..ecfd274cb
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-065.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left', 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ height: 1em;
+ left: 2em;
+ position: absolute;
+ right: 1em;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (solve) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed width value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067-ref.xht
new file mode 100644
index 000000000..d40647476
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067.xht
new file mode 100644
index 000000000..f84cb9075
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-067.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069-ref.xht
new file mode 100644
index 000000000..0b0d583d1
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069.xht
new file mode 100644
index 000000000..150f7dbf6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-069.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071-ref.xht
new file mode 100644
index 000000000..d088c8ee0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071.xht
new file mode 100644
index 000000000..b92e70f1e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-071.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ height: 1em;
+ left: 2em;
+ position: absolute;
+ right: 1em;
+ width: auto;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (solve) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed width value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073-ref.xht
new file mode 100644
index 000000000..f82d8e3ef
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073.xht
new file mode 100644
index 000000000..844d3dfde
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-073.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075-ref.xht
new file mode 100644
index 000000000..a058a2c79
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075.xht
new file mode 100644
index 000000000..34afe6930
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-075.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077-ref.xht
new file mode 100644
index 000000000..0ebbc59ee
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077.xht
new file mode 100644
index 000000000..7680949ae
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-077.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079-ref.xht
new file mode 100644
index 000000000..808cdb1a6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079.xht
new file mode 100644
index 000000000..689863c43
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-079.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081-ref.xht
new file mode 100644
index 000000000..9af8baad5
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081.xht
new file mode 100644
index 000000000..4605260c7
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-081.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083-ref.xht
new file mode 100644
index 000000000..646241b50
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083.xht
new file mode 100644
index 000000000..f98e85320
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-083.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085-ref.xht
new file mode 100644
index 000000000..1f1afd43d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085.xht
new file mode 100644
index 000000000..774e54dbc
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-085.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087-ref.xht
new file mode 100644
index 000000000..e9cdcfce1
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087.xht
new file mode 100644
index 000000000..c12bda239
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-087.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-003-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'bottom' and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089-ref.xht
new file mode 100644
index 000000000..9ba99e984
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089.xht
new file mode 100644
index 000000000..c5367dbbe
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-089.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left', 'width' and 'right' are not 'auto' (overconstrained), then ignore 'right' and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 2em;
+ margin-left: 0em;
+ margin-right: 0em;
+ position: absolute;
+ right: 2em;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091-ref.xht
new file mode 100644
index 000000000..61be51411
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091.xht
new file mode 100644
index 000000000..0217c3d48
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-091.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-007-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'bottom' and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093-ref.xht
new file mode 100644
index 000000000..9248a251e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093.xht
new file mode 100644
index 000000000..97d9ea47e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-093.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'top' and solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095-ref.xht
new file mode 100644
index 000000000..f89ea7b47
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095.xht
new file mode 100644
index 000000000..d8f913f9d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-095.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left', 'width' and 'right' are not 'auto' and if the values are overconstrained, then ignore 'left' and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 2em;
+ margin-left: 0em;
+ margin-right: 0em;
+ position: absolute;
+ right: 2em;
+ width: 1em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+/*
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097-ref.xht
new file mode 100644
index 000000000..54c01741a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097.xht
new file mode 100644
index 000000000..1c6055fbb
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vlr-097.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-013-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'top' and solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002-ref.xht
new file mode 100644
index 000000000..fd594c18e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002.xht
new file mode 100644
index 000000000..b8f23b411
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-002.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are 'auto', then set 'top' to the static position, the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004-ref.xht
new file mode 100644
index 000000000..3c242a069
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004-ref.xht
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are 'auto'</title>
+
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004.xht
new file mode 100644
index 000000000..a261ae81a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-004.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left', 'width' and 'right' are 'auto', then set 'left' to the static position, the width becomes shrink-to-fit and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006-ref.xht
new file mode 100644
index 000000000..0db069725
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006.xht
new file mode 100644
index 000000000..80e097a70
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-006.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are 'auto', then set 'top' to the static position, the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008-ref.xht
new file mode 100644
index 000000000..01f86da91
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008.xht
new file mode 100644
index 000000000..b24e2703b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-008.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are 'auto', then set 'bottom' to the static position, the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010-ref.xht
new file mode 100644
index 000000000..6299224f3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010.xht
new file mode 100644
index 000000000..e9afe99c0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-010.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left', 'width' and 'right' are 'auto', then set 'right' to the static position, the width becomes shrink-to-fit and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right: auto: set to static position
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right: auto: set to static position
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012-ref.xht
new file mode 100644
index 000000000..f2a3e2453
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012.xht
new file mode 100644
index 000000000..0deb42565
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-012.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are 'auto', then set 'bottom' to the static position, the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.
+
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014-ref.xht
new file mode 100644
index 000000000..0891c22a0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' are 'auto' and bottom is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014.xht
new file mode 100644
index 000000000..b8ae0f1c7
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-014.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' are 'auto' and bottom is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' are 'auto' and 'bottom' is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016-ref.xht
new file mode 100644
index 000000000..733b9a04b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016.xht
new file mode 100644
index 000000000..fa57900a5
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-016.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width becomes shrink-to-fit and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 2em;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018-ref.xht
new file mode 100644
index 000000000..bb5775c58
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'height' are 'auto and 'bottom' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018.xht
new file mode 100644
index 000000000..da299956d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-018.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020-ref.xht
new file mode 100644
index 000000000..a0efd3188
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto and 'bottom' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020.xht
new file mode 100644
index 000000000..a49d25445
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-020.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto and 'bottom' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022-ref.xht
new file mode 100644
index 000000000..3d3d2af3f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022.xht
new file mode 100644
index 000000000..29fbe27c5
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-022.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'width' are 'auto' and 'right' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width becomes shrink-to-fit and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 2em;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024-ref.xht
new file mode 100644
index 000000000..686407dc3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024.xht
new file mode 100644
index 000000000..d55f12573
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-024.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then the height is based on the content and then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the width is shrink-to-fit. Then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026-ref.xht
new file mode 100644
index 000000000..2133c6f33
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom are 'auto' and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026.xht
new file mode 100644
index 000000000..df66a1e66
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-026.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028-ref.xht
new file mode 100644
index 000000000..dd7458329
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028.xht
new file mode 100644
index 000000000..0a2cea204
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-028.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left' and 'right' are 'auto' and 'width' is not 'auto', then set 'left' to the static position and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 160px : left: auto: set to static position
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030-ref.xht
new file mode 100644
index 000000000..87e733bb7
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom are 'auto' and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030.xht
new file mode 100644
index 000000000..df20ebeee
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-030.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top: auto: set to static position
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032-ref.xht
new file mode 100644
index 000000000..74a173cae
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032.xht
new file mode 100644
index 000000000..c721a93be
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-032.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034-ref.xht
new file mode 100644
index 000000000..91a8a0263
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034.xht
new file mode 100644
index 000000000..f0fb04539
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-034.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' and 'right' are 'auto' and 'width' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left' and 'right' are 'auto' and 'width' is not 'auto', then set 'right' to the static position and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right: auto: set to static position
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036-ref.xht
new file mode 100644
index 000000000..25bbb01fe
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036.xht
new file mode 100644
index 000000000..c4569c581
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-036.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then set 'top' to static position and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+2. 'left' and 'right' are 'auto' and 'width' is not 'auto', then if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position, otherwise set 'right' to the static position. Then solve for 'left' (if 'direction is 'rtl') or 'right' (if 'direction' is 'ltr').
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom: auto: set to static position
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038-ref.xht
new file mode 100644
index 000000000..cc9fbebec
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038.xht
new file mode 100644
index 000000000..62e9059a6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-038.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040-ref.xht
new file mode 100644
index 000000000..13c6d126f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040.xht
new file mode 100644
index 000000000..13ffffc5b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-040.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width becomes shrink-to-fit and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042-ref.xht
new file mode 100644
index 000000000..203611921
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042.xht
new file mode 100644
index 000000000..a20a1c8b6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-042.xht
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044-ref.xht
new file mode 100644
index 000000000..daaaab6bb
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044.xht
new file mode 100644
index 000000000..9dc62d894
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-044.xht
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046-ref.xht
new file mode 100644
index 000000000..8434ecf3a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046.xht
new file mode 100644
index 000000000..27d388d8e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-046.xht
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' and 'right' are 'auto' and 'left' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width becomes shrink-to-fit and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : (shrink-to-fit) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048-ref.xht
new file mode 100644
index 000000000..259199912
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048.xht
new file mode 100644
index 000000000..3bf09d48e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-048.xht
@@ -0,0 +1,123 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then the height is based on the content and then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: auto;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+3. 'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : (based on the content) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050-ref.xht
new file mode 100644
index 000000000..8d8a4f938
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050.xht
new file mode 100644
index 000000000..44a10f668
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-050.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052-ref.xht
new file mode 100644
index 000000000..53a92cddc
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' is 'auto', 'width' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052.xht
new file mode 100644
index 000000000..2ef2c95cf
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-052.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left' is 'auto', 'width' and 'right' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 1em;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054-ref.xht
new file mode 100644
index 000000000..8abe49109
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054.xht
new file mode 100644
index 000000000..e2baabfd3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-054.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056-ref.xht
new file mode 100644
index 000000000..15ecf8331
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056.xht
new file mode 100644
index 000000000..00d2d7223
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-056.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058-ref.xht
new file mode 100644
index 000000000..ddb9b1f9b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058.xht
new file mode 100644
index 000000000..81392b524
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-058.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left', then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: auto;
+ position: absolute;
+ right: 1em;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+4.'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ (solve) : left: auto
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060-ref.xht
new file mode 100644
index 000000000..35d6b307a
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060.xht
new file mode 100644
index 000000000..ff2f8bc7e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-060.xht
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top' is 'auto' and 'height' and 'bottom' are not 'auto', then solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 1em;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: auto;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ (solve) : top: auto
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 160px .
+*/
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062-ref.xht
new file mode 100644
index 000000000..ce2cf8b47
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062.xht
new file mode 100644
index 000000000..2fbfbfa53
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-062.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064-ref.xht
new file mode 100644
index 000000000..3a7b02a8e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064.xht
new file mode 100644
index 000000000..6b747031b
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-064.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ height: 1em;
+ left: 2em;
+ position: absolute;
+ right: 1em;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (solve) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed width value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066-ref.xht
new file mode 100644
index 000000000..dbb96bd05
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066.xht
new file mode 100644
index 000000000..1c5a37ceb
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-066.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068-ref.xht
new file mode 100644
index 000000000..f40e41b05
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068.xht
new file mode 100644
index 000000000..071ce34d7
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-068.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070-ref.xht
new file mode 100644
index 000000000..d088c8ee0
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070.xht
new file mode 100644
index 000000000..469b3c4f8
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-070.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'width' is 'auto', 'left' and 'right' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ height: 1em;
+ left: 2em;
+ position: absolute;
+ right: 1em;
+ width: auto;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ (solve) : width: auto
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 80px : right
+ =====================
+ 320px : width of containing block
+
+And so computed width value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072-ref.xht
new file mode 100644
index 000000000..d164df55f
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072.xht
new file mode 100644
index 000000000..1092601e4
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-072.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'height' is 'auto' and 'top' and 'bottom' are not 'auto', then solve for 'height'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: green;
+ bottom: 1em;
+ height: auto;
+ position: absolute;
+ top: 2em;
+ width: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+5. 'width' is 'auto', 'left' and 'right' are not 'auto', then solve for 'width'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ (solve) : height: auto
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 80px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed height value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span></span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074-ref.xht
new file mode 100644
index 000000000..ffffeddf8
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074.xht
new file mode 100644
index 000000000..5e9d9588d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-074.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076-ref.xht
new file mode 100644
index 000000000..0ebbc59ee
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076.xht
new file mode 100644
index 000000000..b64c33c91
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-076.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078-ref.xht
new file mode 100644
index 000000000..85972a314
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078.xht
new file mode 100644
index 000000000..824f438dc
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-078.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080-ref.xht
new file mode 100644
index 000000000..ab013a575
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080.xht
new file mode 100644
index 000000000..ed644247c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-080.xht
@@ -0,0 +1,96 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082-ref.xht
new file mode 100644
index 000000000..646241b50
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082.xht
new file mode 100644
index 000000000..22e8ddfe6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-082.xht
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'right' is 'auto', 'left' and 'width' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 1em;
+ position: absolute;
+ right: auto;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 80px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right: auto
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084-ref.xht
new file mode 100644
index 000000000..a733a84e3
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084.xht
new file mode 100644
index 000000000..9a4129279
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-084.xht
@@ -0,0 +1,100 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'bottom' is 'auto' and 'top' and 'height' are not 'auto', then solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: auto;
+ color: green;
+ height: 1em;
+ position: absolute;
+ top: 1em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 80px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom: auto
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 160px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086-ref.xht
new file mode 100644
index 000000000..92ac87b32
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086.xht
new file mode 100644
index 000000000..6b45920bd
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-086.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-002-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'bottom' and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088-ref.xht
new file mode 100644
index 000000000..9ba99e984
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088.xht
new file mode 100644
index 000000000..2c959917d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-088.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'left', 'width' and 'right' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'left', 'width' and 'right' are not 'auto' (overconstrained), then ignore 'right' and then solve for 'right'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 2em;
+ margin-left: 0em;
+ margin-right: 0em;
+ position: absolute;
+ right: 2em;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-left-width
+ +
+ 0px : padding-left
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ (solve) : right
+ =====================
+ 320px : width of containing block
+
+And so computed right value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090-ref.xht
new file mode 100644
index 000000000..6fa438f0c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 2em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090.xht
new file mode 100644
index 000000000..e3671d95c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-090.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: ltr' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-006-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'ltr' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'bottom' and solve for 'bottom'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-3row-320x320.png");
+ color: transparent;
+ direction: ltr;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ (solve) : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed bottom value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092-ref.xht
new file mode 100644
index 000000000..328354de5
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092.xht
new file mode 100644
index 000000000..ff547dc1c
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-092.xht
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-004-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'top' and solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094-ref.xht
new file mode 100644
index 000000000..f89ea7b47
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094-ref.xht
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 1em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094.xht
new file mode 100644
index 000000000..581b2962d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-094.xht
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'left', 'width' and 'right' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vlr-009-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'left', 'width' and 'right' are not 'auto' and if the values are overconstrained, then ignore 'left' and then solve for 'left'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ div#containing-block
+ {
+ background: red url("support/bg-red-2col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ left: 2em;
+ margin-left: 0em;
+ margin-right: 0em;
+ position: absolute;
+ right: 2em;
+ width: 1em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+/*
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' = width of containing block
+
+So:
+
+ 160px : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+gives us:
+
+ (solve) : left
+ +
+ 0px : margin-left
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : width
+ +
+ 0px : padding-right
+ +
+ 0px : border-right-width
+ +
+ 0px : margin-right
+ +
+ 160px : right
+ =====================
+ 320px : width of containing block
+
+And so computed left value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096-ref.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096-ref.xht
new file mode 100644
index 000000000..165a00e35
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096-ref.xht
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto'</title>
+
+
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ -ah-writing-mode: initial;
+ -webkit-writing-mode: initial;
+ writing-mode: initial;
+ direction: ltr;
+ color: transparent;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ color: green;
+ position: absolute;
+ left: 2em; top: 1em;
+ }
+
+
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096.xht b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096.xht
new file mode 100644
index 000000000..9d426e20d
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/s71-abs-pos-non-replaced-vrl-096.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: absolutely positioned non-replaced element - 'direction: rtl' and 'top', 'height' and 'bottom' are not 'auto' (overconstrained)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" title="10.3.7 Absolutely positioned, non-replaced elements" />
+ <link rel="match" href="s71-abs-pos-non-replaced-vrl-012-ref.xht" />
+
+ <meta name="flags" content="ahem image" />
+ <meta name="assert" content="When 'direction' is 'rtl' and 'top', 'height' and 'bottom' are not 'auto' and if the values are overconstrained, then ignore 'top' and solve for 'top'." />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ html
+ {
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ div#containing-block
+ {
+ background: red url("support/bg-red-3col-2row-320x320.png");
+ color: transparent;
+ direction: rtl;
+ font: 80px/1 Ahem;
+ height: 320px;
+ position: relative;
+ width: 320px;
+ }
+
+ div#containing-block > span
+ {
+ background-color: red;
+ bottom: 2em;
+ color: green;
+ height: 1em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ position: absolute;
+ top: 2em;
+ }
+
+/*
+"
+Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
+"
+7.1 Principles of Layout in Vertical Writing Modes
+http://www.w3.org/TR/css-writing-modes-3/#vertical-layout
+
+So here, *-top and *-bottom properties are input into the §10.3.7 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
+
+"
+If none of the three is 'auto': If both 'margin-left' and 'margin-right' are 'auto', solve the equation under the extra constraint that the two margins get equal values, unless this would make them negative, in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
+"
+
+'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block
+
+So:
+
+ 160px : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+gives us:
+
+ (solve) : top
+ +
+ 0px : margin-top
+ +
+ 0px : border-top-width
+ +
+ 0px : padding-top
+ +
+ 80px : height
+ +
+ 0px : padding-bottom
+ +
+ 0px : border-bottom-width
+ +
+ 0px : margin-bottom
+ +
+ 160px : bottom
+ =====================
+ 320px : height of containing block
+
+And so computed top value must be 80px .
+*/
+
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
+
+ <div id="containing-block">1 2 34<span>X</span></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/abspos/support/Ahem.ttf b/layout/reftests/writing-mode/abspos/support/Ahem.ttf
new file mode 100644
index 000000000..ac81cb031
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/Ahem.ttf
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/support/ahem.css b/layout/reftests/writing-mode/abspos/support/ahem.css
new file mode 100644
index 000000000..2d07a1d56
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/ahem.css
@@ -0,0 +1,4 @@
+@font-face {
+ font-family: Ahem;
+ src: url("Ahem.ttf");
+}
diff --git a/layout/reftests/writing-mode/abspos/support/bg-red-2col-2row-320x320.png b/layout/reftests/writing-mode/abspos/support/bg-red-2col-2row-320x320.png
new file mode 100644
index 000000000..4f354e935
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/bg-red-2col-2row-320x320.png
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/support/bg-red-2col-3row-320x320.png b/layout/reftests/writing-mode/abspos/support/bg-red-2col-3row-320x320.png
new file mode 100644
index 000000000..6eded69a4
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/bg-red-2col-3row-320x320.png
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/support/bg-red-3col-2row-320x320.png b/layout/reftests/writing-mode/abspos/support/bg-red-3col-2row-320x320.png
new file mode 100644
index 000000000..5f4b53c46
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/bg-red-3col-2row-320x320.png
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/support/bg-red-3col-3row-320x320.png b/layout/reftests/writing-mode/abspos/support/bg-red-3col-3row-320x320.png
new file mode 100644
index 000000000..4c2f6c8e6
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/bg-red-3col-3row-320x320.png
Binary files differ
diff --git a/layout/reftests/writing-mode/abspos/support/pass-cdts-abs-pos-non-replaced.png b/layout/reftests/writing-mode/abspos/support/pass-cdts-abs-pos-non-replaced.png
new file mode 100644
index 000000000..15fd6065e
--- /dev/null
+++ b/layout/reftests/writing-mode/abspos/support/pass-cdts-abs-pos-non-replaced.png
Binary files differ
diff --git a/layout/reftests/writing-mode/blue-32x32.png b/layout/reftests/writing-mode/blue-32x32.png
new file mode 100644
index 000000000..deefd19b2
--- /dev/null
+++ b/layout/reftests/writing-mode/blue-32x32.png
Binary files differ
diff --git a/layout/reftests/writing-mode/blue-yellow-165w-206h.png b/layout/reftests/writing-mode/blue-yellow-165w-206h.png
new file mode 100644
index 000000000..3d70889ee
--- /dev/null
+++ b/layout/reftests/writing-mode/blue-yellow-165w-206h.png
Binary files differ
diff --git a/layout/reftests/writing-mode/blue-yellow-206w-165h.png b/layout/reftests/writing-mode/blue-yellow-206w-165h.png
new file mode 100644
index 000000000..47ceb84d3
--- /dev/null
+++ b/layout/reftests/writing-mode/blue-yellow-206w-165h.png
Binary files differ
diff --git a/layout/reftests/writing-mode/font-inflation-1-ref.html b/layout/reftests/writing-mode/font-inflation-1-ref.html
new file mode 100644
index 000000000..fc99dfda8
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { width: 0; height: 0; }
+#inner { font-size: 12px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/font-inflation-1a.html b/layout/reftests/writing-mode/font-inflation-1a.html
new file mode 100644
index 000000000..39eb4ef94
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1a.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { width: 450px; }
+#inner { font-size: 12px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/font-inflation-1b.html b/layout/reftests/writing-mode/font-inflation-1b.html
new file mode 100644
index 000000000..554f53287
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1b.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { width: 600px; }
+#inner { font-size: 12px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/font-inflation-1c-ref.html b/layout/reftests/writing-mode/font-inflation-1c-ref.html
new file mode 100644
index 000000000..a15d0488b
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1c-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { width: 0; height: 0; }
+/*
+In a 450px container, the minimum font size at 15em per line is 30px.
+This means we map 0px-45px into 30px-45px, so 12px gets mapped to 34px.
+*/
+#inner { font-size: 34px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/font-inflation-1c.html b/layout/reftests/writing-mode/font-inflation-1c.html
new file mode 100644
index 000000000..32d963d04
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1c.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { height: 450px; }
+#inner { font-size: 12px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/font-inflation-1d-ref.html b/layout/reftests/writing-mode/font-inflation-1d-ref.html
new file mode 100644
index 000000000..9e36cb6d2
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1d-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { width: 0; height: 0; }
+/*
+In a 600px container, the minimum font size at 15em per line is 40px.
+This means we map 0px-60px into 40px-60px, so 12px gets mapped to 44px.
+*/
+#inner { font-size: 44px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/font-inflation-1d.html b/layout/reftests/writing-mode/font-inflation-1d.html
new file mode 100644
index 000000000..e00a0efb0
--- /dev/null
+++ b/layout/reftests/writing-mode/font-inflation-1d.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<style>
+body { writing-mode: vertical-lr; text-orientation: sideways-right; }
+#outer { height: 600px; }
+#inner { font-size: 12px; width: 100%; height: 100%; }
+</style>
+<div id="outer">
+<div id="inner">Inflated?
diff --git a/layout/reftests/writing-mode/green-100x100.png b/layout/reftests/writing-mode/green-100x100.png
new file mode 100644
index 000000000..0aa79b0c8
--- /dev/null
+++ b/layout/reftests/writing-mode/green-100x100.png
Binary files differ
diff --git a/layout/reftests/writing-mode/left-bottom-300x300.png b/layout/reftests/writing-mode/left-bottom-300x300.png
new file mode 100644
index 000000000..cd565a8b8
--- /dev/null
+++ b/layout/reftests/writing-mode/left-bottom-300x300.png
Binary files differ
diff --git a/layout/reftests/writing-mode/left-top-300x300.png b/layout/reftests/writing-mode/left-top-300x300.png
new file mode 100644
index 000000000..68961d9d0
--- /dev/null
+++ b/layout/reftests/writing-mode/left-top-300x300.png
Binary files differ
diff --git a/layout/reftests/writing-mode/reftest-stylo.list b/layout/reftests/writing-mode/reftest-stylo.list
new file mode 100644
index 000000000..5574d9b5b
--- /dev/null
+++ b/layout/reftests/writing-mode/reftest-stylo.list
@@ -0,0 +1,194 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+# This directory contains tests for vertical text and logical layout coordinates.
+# They require the vertical-text pref to be true, otherwise lots of them will fail.
+
+
+HTTP(..) == 1079154-1-vertical-rl-columns.html 1079154-1-vertical-rl-columns.html
+== 1082844.html 1082844.html
+HTTP(..) == 1083748.html 1083748.html
+HTTP(..) == 1083848-1-inline-border.html 1083848-1-inline-border.html
+HTTP(..) == 1083848-2-inline-background.html 1083848-2-inline-background.html
+fails fuzzy-if(gtkWidget,255,2) fuzzy-if(winWidget||Android||B2G,4,8704) HTTP(..) == 1083848-3-inline-background-repeat.html 1083848-3-inline-background-repeat.html
+== 1083892-1.html 1083892-1.html
+== 1086883-1a.html 1086883-1a.html
+== 1086883-1b.html 1086883-1b.html
+== 1088025-1.html 1088025-1.html
+== 1089388-1.html 1089388-1.html
+== 1089388-2.html 1089388-2.html
+== 1090159-1.html 1090159-1.html
+# bug 1230357 fuzz on b2g for subpixel text positioning on skia.
+fuzzy-if(B2G&&azureSkia,130,200) == 1090168-1.html 1090168-1.html
+== 1090168-1.html 1090168-1.html
+fuzzy-if(B2G&&azureSkia,130,200) == 1090168-2.html 1090168-2.html
+fuzzy-if(B2G,244,173) fuzzy-if(Mulet,255,165) fuzzy-if(azureSkia,255,2700) == 1090168-3.html 1090168-3.html
+# bug 1142928: mark fuzzy on Mulet as on B2G, bug 1230357 for skia.
+== 1091058-1.html 1091058-1.html
+random-if(gtkWidget) == 1094434-1.html 1094434-1.html
+# bug 1094845
+random-if(gtkWidget) == 1094434-2.html 1094434-2.html
+# bug 1094845
+== 1094914-1a.html 1094914-1a.html
+== 1094914-1b.html 1094914-1b.html
+== 1096224-1a.html 1096224-1a.html
+== 1096224-1b.html 1096224-1b.html
+== 1102175-1a.html 1102175-1a.html
+== 1102175-1b.html 1102175-1b.html
+== 1103613-1.html 1103613-1.html
+== 1105268-1-min-max-dimensions.html 1105268-1-min-max-dimensions.html
+== 1105268-2-min-max-dimensions.html 1105268-2-min-max-dimensions.html
+== 1106669-1-intrinsic-for-container.html 1106669-1-intrinsic-for-container.html
+== 1108923-1-percentage-margins.html 1108923-1-percentage-margins.html
+== 1111944-1-list-marker.html 1111944-1-list-marker.html
+HTTP(..) == 1115916-1-vertical-metrics.html 1115916-1-vertical-metrics.html
+== 1117210-1-vertical-baseline-snap.html 1117210-1-vertical-baseline-snap.html
+== 1117227-1-text-overflow.html 1117227-1-text-overflow.html
+== 1122366-1-margin-collapse.html 1122366-1-margin-collapse.html
+== 1124636-1-fieldset-max-height.html 1124636-1-fieldset-max-height.html
+== 1124636-2-fieldset-min-height.html 1124636-2-fieldset-min-height.html
+
+== ua-style-sheet-margin-1.html ua-style-sheet-margin-1.html
+== ua-style-sheet-margin-2.html ua-style-sheet-margin-2.html
+== ua-style-sheet-margin-3.html ua-style-sheet-margin-3.html
+== ua-style-sheet-margin-4.html ua-style-sheet-margin-4.html
+== ua-style-sheet-margin-5.html ua-style-sheet-margin-5.html
+== ua-style-sheet-margin-6.html ua-style-sheet-margin-6.html
+== ua-style-sheet-margin-7.html ua-style-sheet-margin-7.html
+== ua-style-sheet-margin-8.html ua-style-sheet-margin-8.html
+== ua-style-sheet-margin-9.html ua-style-sheet-margin-9.html
+== ua-style-sheet-margin-10.html ua-style-sheet-margin-10.html
+== ua-style-sheet-margin-11.html ua-style-sheet-margin-11.html
+== ua-style-sheet-margin-12.html ua-style-sheet-margin-12.html
+== ua-style-sheet-margin-13.html ua-style-sheet-margin-13.html
+== ua-style-sheet-margin-14.html ua-style-sheet-margin-14.html
+== ua-style-sheet-border-1.html ua-style-sheet-border-1.html
+== ua-style-sheet-border-2.html ua-style-sheet-border-2.html
+== ua-style-sheet-border-3.html ua-style-sheet-border-3.html
+== ua-style-sheet-border-4.html ua-style-sheet-border-4.html
+== ua-style-sheet-border-5.html ua-style-sheet-border-5.html
+== ua-style-sheet-size-1.html ua-style-sheet-size-1.html
+== ua-style-sheet-size-2.html ua-style-sheet-size-2.html
+
+== ua-style-sheet-fieldset-1.html ua-style-sheet-fieldset-1.html
+skip-if(Android||B2G||Mulet||(winWidget&&!/^Windows\x20NT\x205\.1/.test(http.oscpu))) == ua-style-sheet-textarea-1.html ua-style-sheet-textarea-1.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if(!(Android||B2G||Mulet)) == ua-style-sheet-textarea-1.html ua-style-sheet-textarea-1.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if(!winWidget||/^Windows\x20NT\x205\.1/.test(http.oscpu)) == ua-style-sheet-textarea-1.html ua-style-sheet-textarea-1.html
+== ua-style-sheet-checkbox-radio-1.html ua-style-sheet-checkbox-radio-1.html
+skip-if(Android||B2G||Mulet) fuzzy-if(skiaContent,2,6) == ua-style-sheet-button-1.html ua-style-sheet-button-1.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if(!(Android||B2G||Mulet)) == ua-style-sheet-button-1.html ua-style-sheet-button-1.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+== ua-style-sheet-input-color-1.html ua-style-sheet-input-color-1.html
+# skip fuzzy-if(gtkWidget,1,15) == ua-style-sheet-input-number-1.html ua-style-sheet-input-number-1.html
+
+HTTP(..) == 1127488-align-default-horizontal-tb-ltr.html 1127488-align-default-horizontal-tb-ltr.html
+HTTP(..) == 1127488-align-start-horizontal-tb-ltr.html 1127488-align-start-horizontal-tb-ltr.html
+HTTP(..) == 1127488-align-end-horizontal-tb-ltr.html 1127488-align-end-horizontal-tb-ltr.html
+HTTP(..) == 1127488-align-left-horizontal-tb-ltr.html 1127488-align-left-horizontal-tb-ltr.html
+HTTP(..) == 1127488-align-right-horizontal-tb-ltr.html 1127488-align-right-horizontal-tb-ltr.html
+HTTP(..) == 1127488-align-default-horizontal-tb-rtl.html 1127488-align-default-horizontal-tb-rtl.html
+HTTP(..) == 1127488-align-start-horizontal-tb-rtl.html 1127488-align-start-horizontal-tb-rtl.html
+HTTP(..) == 1127488-align-end-horizontal-tb-rtl.html 1127488-align-end-horizontal-tb-rtl.html
+HTTP(..) == 1127488-align-left-horizontal-tb-rtl.html 1127488-align-left-horizontal-tb-rtl.html
+HTTP(..) == 1127488-align-right-horizontal-tb-rtl.html 1127488-align-right-horizontal-tb-rtl.html
+HTTP(..) == 1127488-align-default-vertical-rl-rtl.html 1127488-align-default-vertical-rl-rtl.html
+HTTP(..) == 1127488-align-start-vertical-rl-rtl.html 1127488-align-start-vertical-rl-rtl.html
+HTTP(..) == 1127488-align-end-vertical-rl-rtl.html 1127488-align-end-vertical-rl-rtl.html
+HTTP(..) == 1127488-align-left-vertical-rl-rtl.html 1127488-align-left-vertical-rl-rtl.html
+HTTP(..) == 1127488-align-right-vertical-rl-rtl.html 1127488-align-right-vertical-rl-rtl.html
+HTTP(..) == 1127488-align-default-vertical-rl-ltr.html 1127488-align-default-vertical-rl-ltr.html
+HTTP(..) == 1127488-align-start-vertical-rl-ltr.html 1127488-align-start-vertical-rl-ltr.html
+HTTP(..) == 1127488-align-end-vertical-rl-ltr.html 1127488-align-end-vertical-rl-ltr.html
+HTTP(..) == 1127488-align-left-vertical-rl-ltr.html 1127488-align-left-vertical-rl-ltr.html
+HTTP(..) == 1127488-align-right-vertical-rl-ltr.html 1127488-align-right-vertical-rl-ltr.html
+HTTP(..) == 1127488-align-default-vertical-lr-rtl.html 1127488-align-default-vertical-lr-rtl.html
+HTTP(..) == 1127488-align-start-vertical-lr-rtl.html 1127488-align-start-vertical-lr-rtl.html
+HTTP(..) == 1127488-align-end-vertical-lr-rtl.html 1127488-align-end-vertical-lr-rtl.html
+HTTP(..) == 1127488-align-left-vertical-lr-rtl.html 1127488-align-left-vertical-lr-rtl.html
+HTTP(..) == 1127488-align-right-vertical-lr-rtl.html 1127488-align-right-vertical-lr-rtl.html
+HTTP(..) == 1127488-align-default-vertical-lr-ltr.html 1127488-align-default-vertical-lr-ltr.html
+HTTP(..) == 1127488-align-start-vertical-lr-ltr.html 1127488-align-start-vertical-lr-ltr.html
+HTTP(..) == 1127488-align-end-vertical-lr-ltr.html 1127488-align-end-vertical-lr-ltr.html
+HTTP(..) == 1127488-align-left-vertical-lr-ltr.html 1127488-align-left-vertical-lr-ltr.html
+HTTP(..) == 1127488-align-right-vertical-lr-ltr.html 1127488-align-right-vertical-lr-ltr.html
+== 1130907-intrinsic-sizing-1.html 1130907-intrinsic-sizing-1.html
+== 1130907-intrinsic-sizing-2.html 1130907-intrinsic-sizing-2.html
+== 1131013-vertical-bidi.html 1131013-vertical-bidi.html
+== 1133945-1-vertical-align.html 1133945-1-vertical-align.html
+== 1134744-radio-checkbox-baseline-1.html 1134744-radio-checkbox-baseline-1.html
+== 1134849-orthogonal-inline.html 1134849-orthogonal-inline.html
+random == 1135361-ruby-justify-1.html 1135361-ruby-justify-1.html
+# bug 1136067
+# Initial mulet triage: parity with B2G/B2G Desktop
+fails skip-if(Mulet) fuzzy-if(winWidget,255,163) fuzzy-if(skiaContent,159,111) == 1136557-1-nested-spans.html 1136557-1-nested-spans.html
+# MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
+fails skip-if(Mulet) fuzzy-if(winWidget,255,221) fuzzy-if(skiaContent,159,111) == 1136557-2-nested-spans.html 1136557-2-nested-spans.html
+# MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
+skip-if(Mulet) fuzzy-if(winWidget,255,236) == 1136557-3-nested-spans.html 1136557-3-nested-spans.html
+# MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
+== 1138356-1-button-contents-alignment.html 1138356-1-button-contents-alignment.html
+== 1138356-2-button-contents-alignment.html 1138356-2-button-contents-alignment.html
+
+# Font inflation behaves wrong in vertical writing mode: bug 1138495
+fails test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1a.html font-inflation-1a.html
+fails test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1b.html font-inflation-1b.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1c.html font-inflation-1c.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1d.html font-inflation-1d.html
+pref(dom.meta-viewport.enabled,true) pref(font.size.inflation.emPerLine,15) pref(font.size.inflation.forceEnabled,true) pref(font.size.inflation.lineThreshold,0) == font-inflation-1c.html font-inflation-1c.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1c.html font-inflation-1c.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1d.html font-inflation-1d.html
+
+== 1144501-1a-block-end-margin-orthogonal-size.html 1144501-1a-block-end-margin-orthogonal-size.html
+== 1144501-1b-block-end-margin-orthogonal-size.html 1144501-1b-block-end-margin-orthogonal-size.html
+== 1147834-relative-overconstrained-horizontal-tb-ltr.html 1147834-relative-overconstrained-horizontal-tb-ltr.html
+== 1147834-relative-overconstrained-horizontal-tb-rtl.html 1147834-relative-overconstrained-horizontal-tb-rtl.html
+== 1147834-relative-overconstrained-vertical-lr-ltr.html 1147834-relative-overconstrained-vertical-lr-ltr.html
+== 1147834-relative-overconstrained-vertical-lr-rtl.html 1147834-relative-overconstrained-vertical-lr-rtl.html
+== 1147834-relative-overconstrained-vertical-rl-ltr.html 1147834-relative-overconstrained-vertical-rl-ltr.html
+== 1147834-relative-overconstrained-vertical-rl-rtl.html 1147834-relative-overconstrained-vertical-rl-rtl.html
+== 1151993-1-orthogonal-block-size.html 1151993-1-orthogonal-block-size.html
+== 1152941-1-orthogonal-blocksize-overflow.html 1152941-1-orthogonal-blocksize-overflow.html
+== 1156021-text-indent-percent.html 1156021-text-indent-percent.html
+== 1157752-upright-bidi.html 1157752-upright-bidi.html
+== 1157758-1-vertical-arabic.html 1157758-1-vertical-arabic.html
+== 1158549-1-vertical-block-size-constraints.html 1158549-1-vertical-block-size-constraints.html
+== 1163238-orthogonal-auto-margins.html 1163238-orthogonal-auto-margins.html
+== 1172774-percent-margin-1.html 1172774-percent-margin-1.html
+== 1172774-percent-margin-2.html 1172774-percent-margin-2.html
+== 1172774-percent-margin-3.html 1172774-percent-margin-3.html
+== 1172774-percent-margin-4.html 1172774-percent-margin-4.html
+random == 1172774-percent-padding-1.html 1172774-percent-padding-1.html
+== 1172774-percent-padding-2.html 1172774-percent-padding-2.html
+random == 1172774-percent-padding-3.html 1172774-percent-padding-3.html
+== 1172774-percent-padding-4.html 1172774-percent-padding-4.html
+== 1174450-intrinsic-sizing.html 1174450-intrinsic-sizing.html
+== 1175789-underline-overline-1.html 1175789-underline-overline-1.html
+== 1188061-1-nsChangeHint_ClearAncestorIntrinsics.html 1188061-1-nsChangeHint_ClearAncestorIntrinsics.html
+== 1188061-2-nsChangeHint_UpdateComputedBSize.html 1188061-2-nsChangeHint_UpdateComputedBSize.html
+
+# tests involving sideways-lr mode
+== 1193519-sideways-lr-1.html 1193519-sideways-lr-1.html
+== 1193519-sideways-lr-2.html 1193519-sideways-lr-2.html
+fuzzy-if(winWidget,3,84) == 1193519-sideways-lr-3.html 1193519-sideways-lr-3.html
+fuzzy-if(winWidget,3,112) == 1193519-sideways-lr-4.html 1193519-sideways-lr-4.html
+fails fuzzy-if(gtkWidget||B2G,255,6) fuzzy-if(cocoaWidget,65,69) == 1193519-sideways-lr-decoration-1.html 1193519-sideways-lr-decoration-1.html
+
+== 1196887-1-computed-display-inline-block.html 1196887-1-computed-display-inline-block.html
+== 1205787-legacy-svg-values-1.html 1205787-legacy-svg-values-1.html
+
+== 1216747-1.html 1216747-1.html
+== 1216747-1.html 1216747-1.html
+
+== 1243125-1-floats-overflowing.html 1243125-1-floats-overflowing.html
+
+skip-if(Android) HTTP(..) == 1248248-1-orientation-break-glyphrun.html 1248248-1-orientation-break-glyphrun.html
+# Android bug 1250229
+
+# Suite of tests from Gérard Talbot in bug 1079151
+# Frequent Windows 7 load failed: timed out waiting for test to complete (waiting for onload scripts to complete), bug 1167155 and friends
+# All tests are intermittent/fuzzy on stylo
+# include abspos/reftest-stylo.list
+
+# Tests for tables with vertical writing modes
+include tables/reftest-stylo.list
diff --git a/layout/reftests/writing-mode/reftest.list b/layout/reftests/writing-mode/reftest.list
new file mode 100644
index 000000000..b670dbd13
--- /dev/null
+++ b/layout/reftests/writing-mode/reftest.list
@@ -0,0 +1,192 @@
+# This directory contains tests for vertical text and logical layout coordinates.
+
+HTTP(..) == 1079154-1-vertical-rl-columns.html 1079154-1-vertical-rl-columns-ref.html
+== 1082844.html 1082844-ref.html
+HTTP(..) == 1083748.html 1083748-ref.html
+HTTP(..) == 1083848-1-inline-border.html 1083848-1-inline-border-ref.html
+HTTP(..) == 1083848-2-inline-background.html 1083848-2-inline-background-ref.html
+fuzzy-if(gtkWidget,255,2) fuzzy-if(winWidget||Android,4,8704) HTTP(..) == 1083848-3-inline-background-repeat.html 1083848-3-inline-background-repeat-ref.html
+== 1083892-1.html 1083892-1-ref.html
+== 1086883-1a.html 1086883-1-ref.html
+== 1086883-1b.html 1086883-1-ref.html
+== 1088025-1.html 1088025-1-ref.html
+== 1089388-1.html 1089388-1-ref.html
+== 1089388-2.html 1089388-2-ref.html
+== 1090159-1.html 1090159-1-ref.html
+== 1090168-1.html 1090168-1-ref.html
+!= 1090168-1.html 1090168-1-notref.html
+== 1090168-2.html 1090168-2-ref.html
+fuzzy-if(azureSkia,255,2700) == 1090168-3.html 1090168-3-ref.html # bug 1230357 mark fuzzy for skia.
+== 1091058-1.html 1091058-1-ref.html
+== 1094434-1.html 1094434-1-ref.html
+== 1094434-2.html 1094434-2-ref.html
+== 1094914-1a.html 1094914-1-ref.html
+== 1094914-1b.html 1094914-1-ref.html
+== 1096224-1a.html 1096224-1-ref.html
+== 1096224-1b.html 1096224-1-ref.html
+fails == 1102175-1a.html 1102175-1-ref.html
+== 1102175-1b.html 1102175-1-ref.html
+== 1103613-1.html 1103613-1-ref.html
+== 1105268-1-min-max-dimensions.html 1105268-1-min-max-dimensions-ref.html
+== 1105268-2-min-max-dimensions.html 1105268-2-min-max-dimensions-ref.html
+== 1106669-1-intrinsic-for-container.html 1106669-1-intrinsic-for-container-ref.html
+== 1108923-1-percentage-margins.html 1108923-1-percentage-margins-ref.html
+== 1111944-1-list-marker.html 1111944-1-list-marker-ref.html
+fuzzy(116,94) fuzzy-if(winWidget,135,124) HTTP(..) == 1115916-1-vertical-metrics.html 1115916-1-vertical-metrics-ref.html
+== 1117210-1-vertical-baseline-snap.html 1117210-1-vertical-baseline-snap-ref.html
+== 1117227-1-text-overflow.html 1117227-1-text-overflow-ref.html
+== 1122366-1-margin-collapse.html 1122366-1-margin-collapse-ref.html
+== 1124636-1-fieldset-max-height.html 1124636-1-fieldset-max-height-ref.html
+== 1124636-2-fieldset-min-height.html 1124636-2-fieldset-min-height-ref.html
+
+== ua-style-sheet-margin-1.html ua-style-sheet-margin-1-ref.html
+== ua-style-sheet-margin-2.html ua-style-sheet-margin-2-ref.html
+== ua-style-sheet-margin-3.html ua-style-sheet-margin-3-ref.html
+== ua-style-sheet-margin-4.html ua-style-sheet-margin-4-ref.html
+== ua-style-sheet-margin-5.html ua-style-sheet-margin-5-ref.html
+== ua-style-sheet-margin-6.html ua-style-sheet-margin-6-ref.html
+== ua-style-sheet-margin-7.html ua-style-sheet-margin-7-ref.html
+== ua-style-sheet-margin-8.html ua-style-sheet-margin-8-ref.html
+== ua-style-sheet-margin-9.html ua-style-sheet-margin-9-ref.html
+== ua-style-sheet-margin-10.html ua-style-sheet-margin-10-ref.html
+== ua-style-sheet-margin-11.html ua-style-sheet-margin-11-ref.html
+== ua-style-sheet-margin-12.html ua-style-sheet-margin-12-ref.html
+== ua-style-sheet-margin-13.html ua-style-sheet-margin-13-ref.html
+== ua-style-sheet-margin-14.html ua-style-sheet-margin-14-ref.html
+== ua-style-sheet-border-1.html ua-style-sheet-border-1-ref.html
+== ua-style-sheet-border-2.html ua-style-sheet-border-2-ref.html
+== ua-style-sheet-border-3.html ua-style-sheet-border-3-ref.html
+== ua-style-sheet-border-4.html ua-style-sheet-border-4-ref.html
+== ua-style-sheet-border-5.html ua-style-sheet-border-5-ref.html
+== ua-style-sheet-size-1.html ua-style-sheet-size-1-ref.html
+== ua-style-sheet-size-2.html ua-style-sheet-size-2-ref.html
+
+== ua-style-sheet-fieldset-1.html ua-style-sheet-fieldset-1-ref.html
+skip-if(Android||(winWidget&&!/^Windows\x20NT\x205\.1/.test(http.oscpu))) == ua-style-sheet-textarea-1.html ua-style-sheet-textarea-1a-ref.html
+skip-if(!(Android)) == ua-style-sheet-textarea-1.html ua-style-sheet-textarea-1b-ref.html
+skip-if(!winWidget||/^Windows\x20NT\x205\.1/.test(http.oscpu)) == ua-style-sheet-textarea-1.html ua-style-sheet-textarea-1c-ref.html
+== ua-style-sheet-checkbox-radio-1.html ua-style-sheet-checkbox-radio-1-ref.html
+skip-if(Android) fuzzy-if(skiaContent&&!Android,2,6) == ua-style-sheet-button-1.html ua-style-sheet-button-1a-ref.html
+skip-if(!(Android)) == ua-style-sheet-button-1.html ua-style-sheet-button-1b-ref.html
+== ua-style-sheet-input-color-1.html ua-style-sheet-input-color-1-ref.html
+fuzzy-if(gtkWidget,1,15) == ua-style-sheet-input-number-1.html ua-style-sheet-input-number-1-ref.html
+
+HTTP(..) == 1127488-align-default-horizontal-tb-ltr.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-start-horizontal-tb-ltr.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-end-horizontal-tb-ltr.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-left-horizontal-tb-ltr.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-right-horizontal-tb-ltr.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-default-horizontal-tb-rtl.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-start-horizontal-tb-rtl.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-end-horizontal-tb-rtl.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-left-horizontal-tb-rtl.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-right-horizontal-tb-rtl.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-default-vertical-rl-rtl.html 1127488-align-bottom-right-ref.html
+HTTP(..) == 1127488-align-start-vertical-rl-rtl.html 1127488-align-bottom-right-ref.html
+HTTP(..) == 1127488-align-end-vertical-rl-rtl.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-left-vertical-rl-rtl.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-right-vertical-rl-rtl.html 1127488-align-bottom-right-ref.html
+HTTP(..) == 1127488-align-default-vertical-rl-ltr.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-start-vertical-rl-ltr.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-end-vertical-rl-ltr.html 1127488-align-bottom-right-ref.html
+HTTP(..) == 1127488-align-left-vertical-rl-ltr.html 1127488-align-top-right-ref.html
+HTTP(..) == 1127488-align-right-vertical-rl-ltr.html 1127488-align-bottom-right-ref.html
+HTTP(..) == 1127488-align-default-vertical-lr-rtl.html 1127488-align-bottom-left-ref.html
+HTTP(..) == 1127488-align-start-vertical-lr-rtl.html 1127488-align-bottom-left-ref.html
+HTTP(..) == 1127488-align-end-vertical-lr-rtl.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-left-vertical-lr-rtl.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-right-vertical-lr-rtl.html 1127488-align-bottom-left-ref.html
+HTTP(..) == 1127488-align-default-vertical-lr-ltr.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-start-vertical-lr-ltr.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-end-vertical-lr-ltr.html 1127488-align-bottom-left-ref.html
+HTTP(..) == 1127488-align-left-vertical-lr-ltr.html 1127488-align-top-left-ref.html
+HTTP(..) == 1127488-align-right-vertical-lr-ltr.html 1127488-align-bottom-left-ref.html
+== 1130907-intrinsic-sizing-1.html 1130907-intrinsic-sizing-1-ref.html
+== 1130907-intrinsic-sizing-2.html 1130907-intrinsic-sizing-2-ref.html
+== 1131013-vertical-bidi.html 1131013-vertical-bidi-ref.html
+== 1133945-1-vertical-align.html 1133945-1-vertical-align-ref.html
+== 1134744-radio-checkbox-baseline-1.html 1134744-radio-checkbox-baseline-1-ref.html
+== 1134849-orthogonal-inline.html 1134849-orthogonal-inline-ref.html
+== 1135361-ruby-justify-1.html 1135361-ruby-justify-1-ref.html # bug 1136067
+fuzzy-if(winWidget,255,163) fuzzy-if(skiaContent,159,111) == 1136557-1-nested-spans.html 1136557-1-nested-spans-ref.html
+fuzzy-if(winWidget,255,221) fuzzy-if(skiaContent,159,111) == 1136557-2-nested-spans.html 1136557-2-nested-spans-ref.html
+fuzzy-if(winWidget,255,236) == 1136557-3-nested-spans.html 1136557-3-nested-spans-ref.html
+== 1138356-1-button-contents-alignment.html 1138356-1-button-contents-alignment-ref.html
+!= 1138356-2-button-contents-alignment.html 1138356-2-button-contents-alignment-notref.html
+
+# Font inflation behaves wrong in vertical writing mode: bug 1138495
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1a.html font-inflation-1-ref.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1b.html font-inflation-1-ref.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) != font-inflation-1c.html font-inflation-1-ref.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) != font-inflation-1d.html font-inflation-1-ref.html
+pref(dom.meta-viewport.enabled,true) pref(font.size.inflation.emPerLine,15) pref(font.size.inflation.forceEnabled,true) pref(font.size.inflation.lineThreshold,0) != font-inflation-1c.html font-inflation-1d.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1c.html font-inflation-1c-ref.html
+test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1d.html font-inflation-1d-ref.html
+
+== 1144501-1a-block-end-margin-orthogonal-size.html 1144501-1-block-end-margin-orthogonal-size-ref.html
+== 1144501-1b-block-end-margin-orthogonal-size.html 1144501-1-block-end-margin-orthogonal-size-ref.html
+== 1147834-relative-overconstrained-horizontal-tb-ltr.html 1147834-bottom-right-ref.html
+== 1147834-relative-overconstrained-horizontal-tb-rtl.html 1147834-bottom-left-ref.html
+== 1147834-relative-overconstrained-vertical-lr-ltr.html 1147834-bottom-right-ref.html
+== 1147834-relative-overconstrained-vertical-lr-rtl.html 1147834-top-right-ref.html
+== 1147834-relative-overconstrained-vertical-rl-ltr.html 1147834-bottom-left-ref.html
+== 1147834-relative-overconstrained-vertical-rl-rtl.html 1147834-top-left-ref.html
+== 1151993-1-orthogonal-block-size.html 1151993-1-orthogonal-block-size-ref.html
+== 1152941-1-orthogonal-blocksize-overflow.html 1152941-1-orthogonal-blocksize-overflow-ref.html
+== 1156021-text-indent-percent.html 1156021-text-indent-percent-ref.html
+== 1157752-upright-bidi.html 1157752-upright-bidi-ref.html
+== 1157758-1-vertical-arabic.html 1157758-1-vertical-arabic-ref.html
+== 1158549-1-vertical-block-size-constraints.html 1158549-1-vertical-block-size-constraints-ref.html
+== 1163238-orthogonal-auto-margins.html 1163238-orthogonal-auto-margins-ref.html
+== 1172774-percent-margin-1.html 1172774-percent-horizontal-ref.html
+== 1172774-percent-margin-2.html 1172774-percent-horizontal-ref.html
+== 1172774-percent-margin-3.html 1172774-percent-vertical-ref.html
+== 1172774-percent-margin-4.html 1172774-percent-vertical-ref.html
+== 1172774-percent-padding-1.html 1172774-percent-horizontal-ref.html
+== 1172774-percent-padding-2.html 1172774-percent-horizontal-ref.html
+== 1172774-percent-padding-3.html 1172774-percent-vertical-ref.html
+== 1172774-percent-padding-4.html 1172774-percent-vertical-ref.html
+== 1174450-intrinsic-sizing.html 1174450-intrinsic-sizing-ref.html
+== 1175789-underline-overline-1.html 1175789-underline-overline-1-ref.html
+== 1188061-1-nsChangeHint_ClearAncestorIntrinsics.html 1188061-1-nsChangeHint_ClearAncestorIntrinsics-ref.html
+== 1188061-2-nsChangeHint_UpdateComputedBSize.html 1188061-2-nsChangeHint_UpdateComputedBSize-ref.html
+
+# tests involving sideways-lr mode
+== 1193519-sideways-lr-1.html 1193519-sideways-lr-1-ref.html
+== 1193519-sideways-lr-2.html 1193519-sideways-lr-2-ref.html
+fuzzy-if(winWidget,3,84) == 1193519-sideways-lr-3.html 1193519-sideways-lr-3-ref.html
+fuzzy-if(winWidget,3,112) == 1193519-sideways-lr-4.html 1193519-sideways-lr-4-ref.html
+fuzzy-if(gtkWidget,255,6) fuzzy-if(cocoaWidget,65,69) == 1193519-sideways-lr-decoration-1.html 1193519-sideways-lr-decoration-1-ref.html
+
+== 1196887-1-computed-display-inline-block.html 1196887-1-computed-display-inline-block-ref.html
+== 1205787-legacy-svg-values-1.html 1205787-legacy-svg-values-1-ref.html
+
+== 1216747-1.html 1216747-1-ref.html
+!= 1216747-1.html 1216747-1-notref.html
+
+== 1243125-1-floats-overflowing.html 1243125-1-floats-overflowing-ref.html
+
+skip-if(Android) HTTP(..) == 1248248-1-orientation-break-glyphrun.html 1248248-1-orientation-break-glyphrun-ref.html # Android bug 1250229
+
+== 1302734-bidi-plaintext-1a.html 1302734-bidi-plaintext-1-ref.html
+== 1302734-bidi-plaintext-1b.html 1302734-bidi-plaintext-1-ref.html
+== 1302734-bidi-plaintext-2a.html 1302734-bidi-plaintext-2-ref.html
+== 1302734-bidi-plaintext-2b.html 1302734-bidi-plaintext-2-ref.html
+== 1302734-bidi-plaintext-2c.html 1302734-bidi-plaintext-2-ref.html
+== 1302734-bidi-plaintext-2d.html 1302734-bidi-plaintext-2-ref.html
+
+== 1302389-scrolled-rect-1a.html 1302389-scrolled-rect-1-ref.html
+fuzzy-if(Android,54,852) == 1302389-scrolled-rect-1b.html 1302389-scrolled-rect-1-ref.html
+fuzzy-if(Android,54,852) fuzzy-if(gtkWidget,1,25) fuzzy-if(cocoaWidget,1,2) == 1302389-scrolled-rect-1c.html 1302389-scrolled-rect-1-ref.html
+fuzzy-if(gtkWidget,1,25) fuzzy-if(cocoaWidget,1,2) == 1302389-scrolled-rect-1d.html 1302389-scrolled-rect-1-ref.html
+fuzzy-if(Android,54,852) fuzzy-if(gtkWidget,1,25) fuzzy-if(cocoaWidget,1,2) == 1302389-scrolled-rect-2a.html 1302389-scrolled-rect-2-ref.html
+fuzzy-if(gtkWidget,1,25) fuzzy-if(cocoaWidget,1,2) == 1302389-scrolled-rect-2b.html 1302389-scrolled-rect-2-ref.html
+== 1302389-scrolled-rect-2c.html 1302389-scrolled-rect-2-ref.html
+fuzzy-if(Android,54,852) == 1302389-scrolled-rect-2d.html 1302389-scrolled-rect-2-ref.html
+
+# Suite of tests from Gérard Talbot in bug 1079151
+# Frequent Windows 7 load failed: timed out waiting for test to complete (waiting for onload scripts to complete), bug 1167155 and friends
+skip-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) include abspos/reftest.list
+
+# Tests for tables with vertical writing modes
+include tables/reftest.list
diff --git a/layout/reftests/writing-mode/right-bottom-300x300.png b/layout/reftests/writing-mode/right-bottom-300x300.png
new file mode 100644
index 000000000..1182ceefc
--- /dev/null
+++ b/layout/reftests/writing-mode/right-bottom-300x300.png
Binary files differ
diff --git a/layout/reftests/writing-mode/right-top-300x300.png b/layout/reftests/writing-mode/right-top-300x300.png
new file mode 100644
index 000000000..0387861a2
--- /dev/null
+++ b/layout/reftests/writing-mode/right-top-300x300.png
Binary files differ
diff --git a/layout/reftests/writing-mode/swatch-yellow.png b/layout/reftests/writing-mode/swatch-yellow.png
new file mode 100644
index 000000000..1591aa0e2
--- /dev/null
+++ b/layout/reftests/writing-mode/swatch-yellow.png
Binary files differ
diff --git a/layout/reftests/writing-mode/tables/border-collapse-bevels-1-ref.html b/layout/reftests/writing-mode/tables/border-collapse-bevels-1-ref.html
new file mode 100644
index 000000000..5d5a43058
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/border-collapse-bevels-1-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border-spacing: 0;
+ border-collapse: collapse;
+}
+td {
+ border-top: 10px solid rgba(0,0,255,0.3);
+ border-right: 20px solid rgba(255,0,0,0.3);
+ border-bottom: 30px solid rgba(0,255,0,0.3);
+ border-left: 40px solid rgba(255,0,255,0.3);
+ width: 50px;
+ height: 50px;
+ padding: 0;
+}
+</style>
+</head>
+<body>
+
+<div>
+<table>
+<tr><td> </td></tr>
+</table>
+</div>
diff --git a/layout/reftests/writing-mode/tables/border-collapse-bevels-1a.html b/layout/reftests/writing-mode/tables/border-collapse-bevels-1a.html
new file mode 100644
index 000000000..4bfcc0077
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/border-collapse-bevels-1a.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ direction: rtl;
+}
+td {
+ border-top: 10px solid rgba(0,0,255,0.3);
+ border-right: 20px solid rgba(255,0,0,0.3);
+ border-bottom: 30px solid rgba(0,255,0,0.3);
+ border-left: 40px solid rgba(255,0,255,0.3);
+ width: 50px;
+ height: 50px;
+ padding: 0;
+}
+</style>
+</head>
+<body>
+
+<div>
+<table>
+<tr><td> </td></tr>
+</table>
+</div>
diff --git a/layout/reftests/writing-mode/tables/border-collapse-bevels-1b.html b/layout/reftests/writing-mode/tables/border-collapse-bevels-1b.html
new file mode 100644
index 000000000..d1535ce44
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/border-collapse-bevels-1b.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ writing-mode: vertical-lr;
+}
+td {
+ border-top: 10px solid rgba(0,0,255,0.3);
+ border-right: 20px solid rgba(255,0,0,0.3);
+ border-bottom: 30px solid rgba(0,255,0,0.3);
+ border-left: 40px solid rgba(255,0,255,0.3);
+ width: 50px;
+ height: 50px;
+ padding: 0;
+}
+</style>
+</head>
+<body>
+
+<div>
+<table>
+<tr><td> </td></tr>
+</table>
+</div>
diff --git a/layout/reftests/writing-mode/tables/border-collapse-bevels-1c.html b/layout/reftests/writing-mode/tables/border-collapse-bevels-1c.html
new file mode 100644
index 000000000..30e8bdb8b
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/border-collapse-bevels-1c.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ writing-mode: vertical-rl;
+}
+td {
+ border-top: 10px solid rgba(0,0,255,0.3);
+ border-right: 20px solid rgba(255,0,0,0.3);
+ border-bottom: 30px solid rgba(0,255,0,0.3);
+ border-left: 40px solid rgba(255,0,255,0.3);
+ width: 50px;
+ height: 50px;
+ padding: 0;
+}
+</style>
+</head>
+<body>
+
+<div>
+<table>
+<tr><td> </td></tr>
+</table>
+</div>
diff --git a/layout/reftests/writing-mode/tables/border-collapse-bevels-1d.html b/layout/reftests/writing-mode/tables/border-collapse-bevels-1d.html
new file mode 100644
index 000000000..b621cde1a
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/border-collapse-bevels-1d.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ writing-mode: vertical-lr;
+ direction: rtl;
+}
+td {
+ border-top: 10px solid rgba(0,0,255,0.3);
+ border-right: 20px solid rgba(255,0,0,0.3);
+ border-bottom: 30px solid rgba(0,255,0,0.3);
+ border-left: 40px solid rgba(255,0,255,0.3);
+ width: 50px;
+ height: 50px;
+ padding: 0;
+}
+</style>
+</head>
+<body>
+
+<div>
+<table>
+<tr><td> </td></tr>
+</table>
+</div>
diff --git a/layout/reftests/writing-mode/tables/border-collapse-bevels-1e.html b/layout/reftests/writing-mode/tables/border-collapse-bevels-1e.html
new file mode 100644
index 000000000..82ea6e152
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/border-collapse-bevels-1e.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ writing-mode: vertical-rl;
+ direction: rtl;
+}
+td {
+ border-top: 10px solid rgba(0,0,255,0.3);
+ border-right: 20px solid rgba(255,0,0,0.3);
+ border-bottom: 30px solid rgba(0,255,0,0.3);
+ border-left: 40px solid rgba(255,0,255,0.3);
+ width: 50px;
+ height: 50px;
+ padding: 0;
+}
+</style>
+</head>
+<body>
+
+<div>
+<table>
+<tr><td> </td></tr>
+</table>
+</div>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-002-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-002-ref.html
new file mode 100644
index 000000000..3ce178442
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-002-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; }
+ div.stripe
+ {
+ width: 24px;
+ height: 100px;
+ }
+ div.blue {background-color: blue;}
+ div.black {background-color: black;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <div class="black stripe"></div>
+ <div class="blue stripe"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-002-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-002-vlr.html
new file mode 100644
index 000000000..99aeab786
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-002-vlr.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Value other than 'auto' for column height sets height of cells in the column</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column element with a value other than 'auto' for the 'height' property sets the height for the column of cells it contains.">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ #col
+ {
+ height: 100px;
+ }
+ td
+ {
+ padding: 0;
+ width: 24px;
+ }
+ #cell
+ {
+ background: black;
+ }
+ #div1
+ {
+ background: blue;
+ width: 24px;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <col id="col">
+ <col>
+ <tr>
+ <td id="cell">X</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-002-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-002-vrl.html
new file mode 100644
index 000000000..adbbff925
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-002-vrl.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Value other than 'auto' for column height sets height of cells in the column</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column element with a value other than 'auto' for the 'height' property sets the height for the column of cells it contains.">
+ <style type="text/css">
+ .test { writing-mode: vertical-rl; }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ #col
+ {
+ height: 100px;
+ }
+ td
+ {
+ padding: 0;
+ width: 24px;
+ }
+ #cell
+ {
+ background: blue;
+ color: blue;
+ }
+ #div1
+ {
+ background: black;
+ width: 24px;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <col id="col">
+ <col>
+ <tr>
+ <td id="cell">X</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-003-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-003-vlr.html
new file mode 100644
index 000000000..30913cbf7
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-003-vlr.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Cell in the first row with specified height sets the height for the column</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with specified non-auto 'height' sets the height for its column in the absence of a column element with specified non-auto height.">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td
+ {
+ padding: 0;
+ }
+ #cell
+ {
+ background: black;
+ height: 100px;
+ width: 24px;
+
+ }
+ #div1
+ {
+ background: blue;
+ width: 24px;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td id="cell">X</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-003-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-003-vrl.html
new file mode 100644
index 000000000..0dd80b978
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-003-vrl.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Cell in the first row with specified height sets the height for the column</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with specified non-auto 'height' sets the height for its column in the absence of a column element with specified non-auto height.">
+ <style type="text/css">
+ .test { writing-mode: vertical-rl; }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td
+ {
+ padding: 0;
+ }
+ #cell
+ {
+ background: blue;
+ height: 100px;
+ width: 24px;
+ color: blue;
+ }
+ #div1
+ {
+ background: black;
+ width: 24px;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td id="cell">X</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-004-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-004-ref.html
new file mode 100644
index 000000000..f1575a900
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-004-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; }
+ div.stripe
+ {
+ width: 20px;
+ height: 100px;
+ }
+ div#blue-stripe {background-color: blue;}
+ div#reference {background-color: black;}
+ div.middle { width: 20px; height: 50px; }
+ div.bottom { background-color: orange; float: right; }
+ div.top { background-color: silver; float: left; }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the blue and black bars are the same height
+and the gray and orange boxes are half of that height.</p>
+ <div class="test">
+ <div class="stripe" id="reference"></div>
+ <div class="stripe">
+ <div class="middle top"></div>
+ <div class="middle bottom"></div>
+ </div>
+ <div class="stripe" id="blue-stripe"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-004-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-004-vlr.html
new file mode 100644
index 000000000..a8a6a8f9f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-004-vlr.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="The height of a column-spanning cell (which determines column heights in fixed table layout) is divided over the columns it spans.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border-collapse: collapse;
+ margin: 0;
+ table-layout: fixed;
+ height: 100px;
+ }
+ #cell1
+ {
+ background: black;
+ height: 98px;
+ }
+ td
+ {
+ width: 20px;
+ padding: 0;
+ }
+ #cell2
+ {
+ background: silver;
+ }
+ #cell3
+ {
+ background: orange;
+ }
+ #div1
+ {
+ background: blue;
+ width: 20px;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the blue and black bars are the same height
+and the gray and orange boxes are half of that height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td id="cell1" colspan="2"></td>
+ </tr>
+ <tr>
+ <td id="cell2"></td>
+ <td id="cell3"></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </test>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-004-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-004-vrl.html
new file mode 100644
index 000000000..efa93023b
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-004-vrl.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="The height of a column-spanning cell (which determines column heights in fixed table layout) is divided over the columns it spans.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border-collapse: collapse;
+ margin: 0;
+ table-layout: fixed;
+ height: 100px;
+ }
+ #cell1
+ {
+ background: blue;
+ height: 98px;
+ }
+ td
+ {
+ width: 20px;
+ padding: 0;
+ }
+ #cell2
+ {
+ background: silver;
+ }
+ #cell3
+ {
+ background: orange;
+ }
+ #div1
+ {
+ background: black;
+ width: 20px;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the blue and black bars are the same height
+and the gray and orange boxes are half of that height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td id="cell1" colspan="2"></td>
+ </tr>
+ <tr>
+ <td id="cell2"></td>
+ <td id="cell3"></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </test>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-005-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-005-ref.html
new file mode 100644
index 000000000..8f1efad6d
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-005-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Leftover table height is divided evenly among auto-sized columns</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Any remaining vertical table space is divided evenly among columns which do not have specified heights.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ #div1
+ {
+ width: 100px;
+ height: 300px;
+ }
+ #div1 > div
+ {
+ float: left;
+ }
+ .px50
+ {
+ height: 50px;
+ }
+ #px100
+ {
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div id="div1">
+ <div class="px50">1</div>
+ <div class="px50">2</div>
+ <div id="px100">3</div>
+ <div class="px50">4</div>
+ <div class="px50">5</div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-005-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-005-vlr.html
new file mode 100644
index 000000000..1b2288946
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-005-vlr.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Leftover table height is divided evenly among auto-sized columns</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Any remaining vertical table space is divided evenly among columns which do not have specified heights.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ height: 300px;
+ }
+ #col1
+ {
+ height: 50px;
+ }
+ td
+ {
+ padding: 0;
+ }
+ #cell1
+ {
+ height: 50px;
+ }
+ #cell2
+ {
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <table>
+ <col id="col1">
+ <col>
+ <col>
+ <col>
+ <col>
+ <col>
+ <tr>
+ <td>1</td>
+ <td id="cell1">2</td>
+ <td id="cell2" colspan="2">3</td>
+ <td>4</td>
+ <td>5</td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-005-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-005-vrl.html
new file mode 100644
index 000000000..bc22d3db6
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-005-vrl.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Leftover table height is divided evenly among auto-sized columns</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Any remaining vertical table space is divided evenly among columns which do not have specified heights.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ height: 300px;
+ }
+ #col1
+ {
+ height: 50px;
+ }
+ td
+ {
+ padding: 0;
+ }
+ #cell1
+ {
+ height: 50px;
+ }
+ #cell2
+ {
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <table>
+ <col id="col1">
+ <col>
+ <col>
+ <col>
+ <col>
+ <col>
+ <tr>
+ <td>1</td>
+ <td id="cell1">2</td>
+ <td id="cell2" colspan="2">3</td>
+ <td>4</td>
+ <td>5</td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-006-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-006-ref.html
new file mode 100644
index 000000000..42e28b5e3
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-006-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ div.stripe
+ {
+ height: 10px;
+ width: 100px;
+ }
+ div.blue {background-color: blue;}
+ div.orange {background-color: orange;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if all of the blue lines below appear to have the same height.</p>
+ <div class="blue stripe"></div>
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-006-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-006-vlr.html
new file mode 100644
index 000000000..3ccbff1ed
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-006-vlr.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Remaining table height is divided evenly among non auto-sized columns (minus borders and cell spacing)</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Any remaining horizontal table space is divided evenly among columns which do not have specified heights (minus borders and cell spacing).">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ background: blue;
+ border-collapse: separate;
+ border-spacing: 10px 0;
+ table-layout: fixed;
+ height: 130px;
+ }
+ td
+ {
+ background: blue;
+ border-top: 10px solid orange;
+ border-bottom: 10px solid orange;
+ width: 100px;
+ padding: 0;
+ }
+ #specified
+ {
+ height: 10px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if all of the blue lines below appear to have the same height.</p>
+ <table>
+ <tr>
+ <td id="specified"></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-006-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-006-vrl.html
new file mode 100644
index 000000000..821e4c682
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-006-vrl.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Remaining table height is divided evenly among non auto-sized columns (minus borders and cell spacing)</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Any remaining horizontal table space is divided evenly among columns which do not have specified heights (minus borders and cell spacing).">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ background: blue;
+ border-collapse: separate;
+ border-spacing: 10px 0;
+ table-layout: fixed;
+ height: 130px;
+ }
+ td
+ {
+ background: blue;
+ border-top: 10px solid orange;
+ border-bottom: 10px solid orange;
+ width: 100px;
+ padding: 0;
+ }
+ #specified
+ {
+ height: 10px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if all of the blue lines below appear to have the same height.</p>
+ <table>
+ <tr>
+ <td id="specified"></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-007-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-007-ref.html
new file mode 100644
index 000000000..431309088
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-007-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; }
+ div.stripe
+ {
+ width: 24px;
+ height: 200px;
+ }
+ div.blue {background-color: blue;}
+ div.black {background-color: black;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <div class="black stripe"></div>
+ <div class="blue stripe"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-007-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-007-vlr.html
new file mode 100644
index 000000000..9cd003f81
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-007-vlr.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table height is maximum between table and sum of column 'height' (table height wins)</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A fixed layout table's height will be its specified height if that height is greater than the sum of its columns' heights.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ }
+ td
+ {
+ background: black;
+ padding: 0;
+ height: 50px;
+ width: 24px;
+ }
+ #div1
+ {
+ background: blue;
+ width: 24px;
+ }
+ #div1, table
+ {
+ height: 200px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td>X</td>
+ <td>X</td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-007-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-007-vrl.html
new file mode 100644
index 000000000..b5b3e3002
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-007-vrl.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table height is maximum between table and sum of column 'height' (table height wins)</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A fixed layout table's height will be its specified height if that height is greater than the sum of its columns' heights.">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ }
+ td
+ {
+ background: blue;
+ padding: 0;
+ height: 50px;
+ width: 24px;
+ color: blue;
+ }
+ #div1
+ {
+ background: black;
+ width: 24px;
+ }
+ #div1, table
+ {
+ height: 200px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td>X</td>
+ <td>X</td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-009-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-009-ref.html
new file mode 100644
index 000000000..89ca8ffaf
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-009-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Cell that overflows a fixed-height table</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell that overflows the fixed table height uses its 'overflow' property to determine whether to clip the overflow content.">
+ <style type="text/css">
+ div.test {
+ writing-mode: vertical-lr;
+ }
+ div.prose {
+ writing-mode: horizontal-tb;
+ width: 180px;
+ padding: 1em;
+ }
+ div.textContainer
+ {
+ height: 100px;
+ border: 1px solid blue;
+ margin: 2px;
+ }
+ #hidden
+ {
+ overflow: hidden;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <div class="textContainer">FillerTextFillerTextFillerTextFiller</div>
+ <div class="prose">Test passes if the text in the blue rectangle to the left
+ of this line spills outside of its bottom border and the text
+ in the blue rectangle to the right of this line is contained
+ within the rectangle's border (and appears to be cut off on
+ its bottom edge).</div>
+ <div class="textContainer" id="hidden">FillerTextFillerTextFillerTextFiller</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-009-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-009-vlr.html
new file mode 100644
index 000000000..5d26b9728
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-009-vlr.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Cell that overflows a fixed-height table</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell that overflows the fixed table height uses its 'overflow' property to determine whether to clip the overflow content.">
+ <style type="text/css">
+ div.test {
+ writing-mode: vertical-lr;
+ }
+ div.prose {
+ writing-mode: horizontal-tb;
+ width: 180px;
+ margin: 1em;
+ }
+ table
+ {
+ table-layout: fixed;
+ height: 100px;
+ }
+ td
+ {
+ border: 1px solid blue;
+ height: 100px;
+ padding: 0px;
+ }
+ #hidden
+ {
+ overflow: hidden;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <table><tr><td>FillerTextFillerTextFillerTextFiller</td></tr></table>
+ <div class="prose">Test passes if the text in the blue rectangle to the left
+ of this line spills outside of its bottom border and the text
+ in the blue rectangle to the right of this line is contained
+ within the rectangle's border (and appears to be cut off on
+ its bottom edge).</div>
+ <table><tr><td id="hidden">FillerTextFillerTextFillerTextFiller</td></tr></table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-009-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-009-vrl.html
new file mode 100644
index 000000000..639103d15
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-009-vrl.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Cell that overflows a fixed-height table</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell that overflows the fixed table height uses its 'overflow' property to determine whether to clip the overflow content.">
+ <style type="text/css">
+ div.test {
+ writing-mode: vertical-rl;
+ }
+ div.prose {
+ writing-mode: horizontal-tb;
+ width: 180px;
+ margin: 1em;
+ }
+ table
+ {
+ table-layout: fixed;
+ height: 100px;
+ }
+ td
+ {
+ border: 1px solid blue;
+ height: 100px;
+ padding: 0px;
+ }
+ #hidden
+ {
+ overflow: hidden;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="test">
+ <table><tr><td id="hidden">FillerTextFillerTextFillerTextFiller</td></tr></table>
+ <div class="prose">Test passes if the text in the blue rectangle to the left
+ of this line spills outside of its bottom border and the text
+ in the blue rectangle to the right of this line is contained
+ within the rectangle's border (and appears to be cut off on
+ its bottom edge).</div>
+ <table><tr><td>FillerTextFillerTextFillerTextFiller</td></tr></table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-010-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-010-ref.html
new file mode 100644
index 000000000..f53e1160b
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-010-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; text-orientation: sideways-right; }
+ div.stripe
+ {
+ width: 20px;
+ line-height: 20px;
+ height: 200px;
+ }
+ div.blue {background-color: blue; }
+ div.black {background-color: black;}
+ span.text { position: relative; top: 100px; white-space: pre;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height and the
+blue box has the words "Filler Text" in the middle,
+overflowing below the box.</p>
+ <div class="test">
+ <div class="blue stripe"></div>
+ <div class="blue stripe"><span class="text">Filler Text Filler Text Filler Text</span></div>
+ <div class="blue stripe"></div>
+ <div class="black stripe"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-010-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-010-vlr.html
new file mode 100644
index 000000000..1ef6d7d6a
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-010-vlr.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Subsequent rows in fixed table layout</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Cells in subsequent rows after the first do not affect column heights in fixed table layout.">
+ <style type="text/css">
+ div.test {
+ writing-mode: vertical-lr;
+ text-orientation: sideways-right;
+ }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ }
+ td
+ {
+ background: blue;
+ color: blue;
+ padding: 0;
+ width: 20px;
+ }
+ #overflow
+ {
+ color: black;
+ overflow: visible;
+ white-space: pre;
+ }
+ #div1
+ {
+ background: black;
+ width: 20px;
+ }
+ table, .row1
+ {
+ height: 100px;
+ }
+ .row2, #div1
+ {
+ height: 200px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height and the
+blue box has the words "Filler Text" in the middle,
+overflowing below the box.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td class="row1"></td>
+ <td class="row1"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td id="overflow">Filler Text Filler Text Filler Text</td>
+ </tr>
+ <tr>
+ <td class="row2"></td>
+ <td class="row2"></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-010-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-010-vrl.html
new file mode 100644
index 000000000..f062e8617
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-010-vrl.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Subsequent rows in fixed table layout</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Cells in subsequent rows after the first do not affect column heights in fixed table layout.">
+ <style type="text/css">
+ div.test {
+ writing-mode: vertical-rl;
+ text-orientation: sideways-right;
+ }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ }
+ td
+ {
+ background: blue;
+ color: blue;
+ padding: 0;
+ width: 20px;
+ }
+ #overflow
+ {
+ color: black;
+ overflow: visible;
+ white-space: pre;
+ }
+ #div1
+ {
+ background: black;
+ width: 20px;
+ }
+ table, .row1
+ {
+ height: 100px;
+ }
+ .row2, #div1
+ {
+ height: 200px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height and the
+blue box has the words "Filler Text" in the middle,
+overflowing below the box.</p>
+ <div class="test">
+ <div id="div1"></div>
+ <table>
+ <tr>
+ <td class="row1"></td>
+ <td class="row1"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td id="overflow">Filler Text Filler Text Filler Text</td>
+ </tr>
+ <tr>
+ <td class="row2"></td>
+ <td class="row2"></td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-012-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-012-ref.html
new file mode 100644
index 000000000..52e387c9f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-012-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ .test { writing-mode: vertical-lr; }
+ div.stripe
+ {
+ width: 24px;
+ height: 50px;
+ }
+ div.blue {background-color: blue;}
+ div.black {background-color: black;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <div class="black stripe"></div>
+ <div class="blue stripe"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-012-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-012-vlr.html
new file mode 100644
index 000000000..ef25ceedc
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-012-vlr.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified column height overrides first-cell specified height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column element with specified height sets the height of the column, even if the first-row cell has a specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-lr;
+ }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td { padding: 0px; }
+ #col
+ {
+ height: 50px;
+ }
+ #cell
+ {
+ background: black;
+ height: 175px;
+ width: 24px;
+ }
+ #div1
+ {
+ background: blue;
+ width: 24px;
+ height: 50px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <col id="col">
+ <col>
+ <tr>
+ <td id="cell">X</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-012-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-012-vrl.html
new file mode 100644
index 000000000..e44349497
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-012-vrl.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified column height overrides first-cell specified height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column element with specified height sets the height of the column, even if the first-row cell has a specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-rl;
+ }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td { padding: 0px; }
+ #col
+ {
+ height: 50px;
+ }
+ #cell
+ {
+ background: blue;
+ color: blue;
+ height: 175px;
+ width: 24px;
+ }
+ #div1
+ {
+ background: black;
+ width: 24px;
+ height: 50px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <col id="col">
+ <col>
+ <tr>
+ <td id="cell">X</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-013-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-013-vlr.html
new file mode 100644
index 000000000..4d8f76386
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-013-vlr.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified column-group height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Specified column-group height is ignored in fixed table layout.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-lr;
+ }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td { padding: 0px; }
+ #colgroup
+ {
+ height: 50px;
+ }
+ #cell
+ {
+ background: black;
+ }
+ #div1
+ {
+ background: blue;
+ height: 100px;
+ }
+ #div1, #cell
+ {
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <colgroup id="colgroup">
+ <col>
+ </colgroup>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td id="cell"></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-013-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-013-vrl.html
new file mode 100644
index 000000000..147c3db0f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-013-vrl.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified column-group height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="Specified column-group height is ignored in fixed table layout.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-rl;
+ }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td { padding: 0px; }
+ #colgroup
+ {
+ height: 50px;
+ }
+ #cell
+ {
+ background: blue;
+ }
+ #div1
+ {
+ background: black;
+ height: 100px;
+ }
+ #div1, #cell
+ {
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <colgroup id="colgroup">
+ <col>
+ </colgroup>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td id="cell"></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-014-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-014-vlr.html
new file mode 100644
index 000000000..0f9a51ac8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-014-vlr.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified column height overrides specified column-group height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column that has both a column height and column-group height specified will use its column specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-lr;
+ }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td { padding: 0px; }
+ #colgroup
+ {
+ height: 300px;
+ }
+ #cell
+ {
+ background: black;
+ }
+ #div1
+ {
+ background: blue;
+ }
+ #div1, #cell
+ {
+ width: 24px;
+ }
+ #div1, #col
+ {
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <colgroup id="colgroup">
+ <col id="col">
+ </colgroup>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td id="cell"></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-014-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-014-vrl.html
new file mode 100644
index 000000000..aac53493c
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-014-vrl.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified column height overrides specified column-group height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column that has both a column height and column-group height specified will use its column specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-rl;
+ }
+ table
+ {
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td { padding: 0px; }
+ #colgroup
+ {
+ height: 300px;
+ }
+ #cell
+ {
+ background: blue;
+ }
+ #div1
+ {
+ background: black;
+ }
+ #div1, #cell
+ {
+ width: 24px;
+ }
+ #div1, #col
+ {
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <colgroup id="colgroup">
+ <col id="col">
+ </colgroup>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td id="cell"></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-015-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-015-vlr.html
new file mode 100644
index 000000000..cbb026d34
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-015-vlr.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified cell height overrides specified column-group height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column that has both a cell height and column-group height specified will use its cell specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-lr;
+ }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ height: 200px;
+ }
+ td { padding: 0px; }
+ #colgroup
+ {
+ height: 75px;
+ }
+ #cell
+ {
+ background: black;
+ height: 100px;
+ }
+ #div1
+ {
+ background: blue;
+ height: 100px;
+ }
+ #div1, td
+ {
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <colgroup id="colgroup">
+ <col>
+ </colgroup>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td id="cell"></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-015-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-015-vrl.html
new file mode 100644
index 000000000..50f378d86
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-015-vrl.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table layout - specified cell height overrides specified column-group height</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A column that has both a cell height and column-group height specified will use its cell specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-rl;
+ }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ height: 200px;
+ }
+ #colgroup
+ {
+ height: 75px;
+ }
+ #cell
+ {
+ background: blue;
+ height: 100px;
+ }
+ td
+ {
+ padding: 0;
+ }
+ #div1
+ {
+ background: black;
+ height: 100px;
+ }
+ #div1, td
+ {
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <colgroup id="colgroup">
+ <col>
+ </colgroup>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td id="cell"></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-016-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-016-vlr.html
new file mode 100644
index 000000000..ad4b6944e
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-016-vlr.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table height is maximum between table and sum of column 'height' (sum of columns' heights wins)</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A fixed layout table's height will be the sum of its columns' heights if that number is greater than the table's specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-lr;
+ }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ height: 75px;
+ }
+ td
+ {
+ background: black;
+ padding: 0;
+ height: 25px;
+ }
+ #div1
+ {
+ background: blue;
+ height: 100px;
+ }
+ #div1, td
+ {
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-016-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-016-vrl.html
new file mode 100644
index 000000000..604dacbe4
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-016-vrl.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: Fixed table height is maximum between table and sum of column 'height' (sum of columns' heights wins)</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">
+ <meta name="flags" content="">
+ <meta name="assert" content="A fixed layout table's height will be the sum of its columns' heights if that number is greater than the table's specified height.">
+ <style type="text/css">
+ div.test
+ {
+ writing-mode: vertical-rl;
+ }
+ table
+ {
+ border-spacing: 0;
+ table-layout: fixed;
+ height: 75px;
+ }
+ td
+ {
+ background: blue;
+ padding: 0;
+ height: 25px;
+ }
+ #div1
+ {
+ background: black;
+ height: 100px;
+ }
+ #div1, td
+ {
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the boxes below are the same height.</p>
+ <div class="test">
+ <table>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="div1"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-017-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-017-ref.html
new file mode 100644
index 000000000..237db1a83
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-017-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ div.test {
+ writing-mode: vertical-lr;
+ padding-left: 4px; }
+ div.stripe
+ {
+ width: 24px;
+ margin-right: 4px;
+ margin-top: 172px;
+ height: 160px;
+ }
+ div.blue {background-color: blue;}
+ div.orange {background-color: orange; margin-left: 0px}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the orange stripe is exactly as high as the blue stripe and is vertically positioned the same.</p>
+ <div class="test">
+ <div class="orange stripe"></div>
+ <div class="blue stripe"></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-017-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-017-vlr.html
new file mode 100644
index 000000000..d3d0e4d02
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-017-vlr.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-017-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated and predicted when in 'border-collapse: separate' model." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border-collapse: separate;
+ border-spacing: 4px;
+ table-layout: fixed;
+ height: 420px;
+ }
+ col#test
+ {
+ background-color: orange;
+ height: 40%;
+ }
+ td#third-cell {color: orange;}
+ td { padding: 0px; width: 24px;}
+ div#reference
+ {
+ background-color: blue;
+ color: blue;
+ top: 172px;
+ width: 24px;
+ /*
+ 3 vertical border-spacing separate the start
+ of table box and the start of 3rd column.
+ The first 2 columns should each be 80px exactly
+ since "Any remaining columns equally divide the
+ remaining vertical table space (minus [table] borders or
+ cell spacing)." So:
+ 0px : table border-top
+ +
+ 4px : 1st border-spacing
+ +
+ 80px : 1st column : (420 - 20) mult by (60% divided by 3)
+ +
+ 4px : 2nd border-spacing
+ +
+ 80px : 2nd column : (420 - 20) mult by (60% divided by 3)
+ +
+ 4px: 3rd border-spacing
+ ========
+ 172px
+ */
+ position: relative;
+ height: 160px;
+ /*
+ 420px : total height of table
+ -
+ 20px : 5 times vertical border-spacing
+ -
+ 0px : total of vertical table borders
+ ========
+ 400px
+ mult by
+ 40%
+ ========
+ 160px
+ */
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the orange stripe is exactly as high as the blue stripe and is vertically positioned the same.</p>
+ <div class="test">
+ <table>
+ <col>
+ <col>
+ <col id="test">
+ <col>
+ <tr>
+ <td></td>
+ <td></td>
+ <td id="third-cell">col</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="reference">ref</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-017-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-017-vrl.html
new file mode 100644
index 000000000..b4d90e3a1
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-017-vrl.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-017-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated and predicted when in 'border-collapse: separate' model." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border-collapse: separate;
+ border-spacing: 4px;
+ table-layout: fixed;
+ height: 420px;
+ }
+ col#test
+ {
+ background-color: orange;
+ height: 40%;
+ }
+ td#third-cell {color: orange;}
+ td { padding: 0px; width: 24px;}
+ div#reference
+ {
+ background-color: blue;
+ color: blue;
+ top: 172px;
+ width: 24px;
+ /*
+ 3 vertical border-spacing separate the start
+ of table box and the start of 3rd column.
+ The first 2 columns should each be 80px exactly
+ since "Any remaining columns equally divide the
+ remaining vertical table space (minus [table] borders or
+ cell spacing)." So:
+ 0px : table border-top
+ +
+ 4px : 1st border-spacing
+ +
+ 80px : 1st column : (420 - 20) mult by (60% divided by 3)
+ +
+ 4px : 2nd border-spacing
+ +
+ 80px : 2nd column : (420 - 20) mult by (60% divided by 3)
+ +
+ 4px: 3rd border-spacing
+ ========
+ 172px
+ */
+ position: relative;
+ height: 160px;
+ /*
+ 420px : total height of table
+ -
+ 20px : 5 times vertical border-spacing
+ -
+ 0px : total of vertical table borders
+ ========
+ 400px
+ mult by
+ 40%
+ ========
+ 160px
+ */
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the orange stripe is exactly as high as the blue stripe and is vertically positioned the same.</p>
+ <div class="test">
+ <div id="reference">ref</div>
+ <table>
+ <col>
+ <col>
+ <col id="test">
+ <col>
+ <tr>
+ <td></td>
+ <td></td>
+ <td id="third-cell">col</td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-018-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-018-vlr.html
new file mode 100644
index 000000000..266caae5e
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-018-vlr.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-017-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated and predicted when in 'border-collapse: separate' model." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border: solid white;
+ border-width: 6px 0px;
+ border-collapse: separate;
+ border-spacing: 2px 4px;
+ table-layout: fixed;
+ height: 422px;
+ }
+ col#test
+ {
+ background-color: orange;
+ height: 40%;
+ }
+ td#third-cell {color: orange;}
+ td {padding: 0px; width: 24px;}
+ div#reference
+ {
+ background-color: blue;
+ color: blue;
+ top: 172px;
+ width: 24px;
+ /*
+ 3 vertical border-spacing and the table
+ border-left separate the start
+ of table box and the start of 3rd column.
+ The first 2 columns should each be 80px exactly
+ since "Any remaining columns equally divide the
+ remaining vertical table space (minus [table] borders or
+ cell spacing)." So:
+ 6px : table border-left
+ +
+ 2px : 1st border-spacing
+ +
+ 80px : 1st column : (422 - 10 - 12) mult by (60% divided by 3)
+ +
+ 2px : 2nd border-spacing
+ +
+ 80px : 2nd column : (422 - 10 - 12) mult by (60% divided by 3)
+ +
+ 2px : 3rd border-spacing
+ =========
+ 172px
+ */
+ position: relative;
+ height: 160px;
+ /*
+ 422px : total height of table
+ -
+ 12px : total height of vertical borders of table
+ -
+ 10px : 5 times vertical border-spacing
+ ========
+ 400px
+ mult by
+ 40%
+ ========
+ 160px
+ */
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the orange stripe is exactly as high as the blue stripe and is vertically positioned the same.</p>
+ <div class="test">
+ <table>
+ <col>
+ <col>
+ <col id="test">
+ <col>
+ <tr>
+ <td></td>
+ <td></td>
+ <td id="third-cell">col</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="reference">ref</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-018-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-018-vrl.html
new file mode 100644
index 000000000..7b3f3f517
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-018-vrl.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-017-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated and predicted when in 'border-collapse: separate' model." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border: solid white;
+ border-width: 6px 0px;
+ border-collapse: separate;
+ border-spacing: 2px 4px;
+ table-layout: fixed;
+ height: 422px;
+ }
+ col#test
+ {
+ background-color: orange;
+ height: 40%;
+ }
+ td#third-cell {color: orange;}
+ td {padding: 0px;}
+ td { width: 24px; }
+ div#reference
+ {
+ background-color: blue;
+ color: blue;
+ width: 24px;
+ top: 172px;
+ /*
+ 3 vertical border-spacing and the table
+ border-left separate the start
+ of table box and the start of 3rd column.
+ The first 2 columns should each be 80px exactly
+ since "Any remaining columns equally divide the
+ remaining vertical table space (minus [table] borders or
+ cell spacing)." So:
+ 6px : table border-left
+ +
+ 2px : 1st border-spacing
+ +
+ 80px : 1st column : (422 - 10 - 12) mult by (60% divided by 3)
+ +
+ 2px : 2nd border-spacing
+ +
+ 80px : 2nd column : (422 - 10 - 12) mult by (60% divided by 3)
+ +
+ 2px : 3rd border-spacing
+ =========
+ 172px
+ */
+ position: relative;
+ height: 160px;
+ /*
+ 422px : total height of table
+ -
+ 12px : total height of vertical borders of table
+ -
+ 10px : 5 times vertical border-spacing
+ ========
+ 400px
+ mult by
+ 40%
+ ========
+ 160px
+ */
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the orange stripe is exactly as high as the blue stripe and is vertically positioned the same.</p>
+ <div class="test">
+ <div id="reference">ref</div>
+ <table>
+ <col>
+ <col>
+ <col id="test">
+ <col>
+ <tr>
+ <td></td>
+ <td></td>
+ <td id="third-cell">col</td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-021-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-021-ref.html
new file mode 100644
index 000000000..67214d000
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-021-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ div.wrapper {
+ writing-mode: vertical-lr;
+ margin-top: 52px;
+ }
+ div.stripe
+ {
+ display: inline-block;
+ margin-left: 4px;
+ margin-top: 8px;
+ margin-bottom: 7px;
+ width: 24px;
+ }
+ div.fuchsia
+ {
+ height: 52px;
+ background-color: fuchsia;
+ }
+ div.olive
+ {
+ height: 88px;
+ background-color: olive;
+ }
+ div.orange
+ {
+ height: 124px;
+ background-color: orange;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive and orange) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="wrapper">
+ <div><div class="fuchsia stripe"></div><div class="olive stripe"></div><div class="orange stripe"></div></div>
+ <div><div class="fuchsia stripe"></div><div class="olive stripe"></div><div class="orange stripe"></div></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-021-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-021-vlr.html
new file mode 100644
index 000000000..e929c92b2
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-021-vlr.html
@@ -0,0 +1,140 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-021-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border: white solid;
+ border-width: 29px 0px; /* vertical table border height is 58px total */
+ border-collapse: separate;
+ border-spacing: 15px 4px; /* vertical border-spacing height is 75px total */
+ table-layout: fixed;
+ height: 533px;
+ /*
+ "With this (fast) algorithm, the vertical layout of
+ the table does not depend on the contents of the cells;
+ it only depends on the table's height, the height of
+ the columns, and borders or cell spacing."
+ http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout
+ So,
+ 533px : total table height
+ -
+ 58px : total vertical border height
+ -
+ 75px : total vertical border-spacing height
+ ========
+ 400px : total to split among the 4 columns
+ */
+ }
+ col#first
+ {
+ background-color: fuchsia;
+ height: 13%;
+ /* 400px multiplied by 13% = 52px */
+ }
+ col#second
+ {
+ background-color: olive;
+ height: 22%;
+ /* 400px multiplied by 22% = 88px */
+ }
+ col#third
+ {
+ background-color: orange;
+ height: 31%;
+ /* 400px multiplied by 31% = 124px */
+ /*
+ 100% - (13% + 22% + 31%) == 34% for last column
+ */
+ }
+ td {padding: 10px 0px; width: 24px; }
+ td#first-cell {color: fuchsia;}
+ td#second-cell {color: olive;}
+ td#third-cell {color: orange;}
+ div {padding: 0px;}
+ div#reference1st
+ {
+ background-color: fuchsia;
+ color: fuchsia;
+ top: 44px; /* 29px border-top of table + 15px border-spacing == 44px */
+ position: relative;
+ height: 52px;
+ width: 24px;
+ }
+ div#reference2nd
+ {
+ background-color: olive;
+ color: olive;
+ right: 24px;
+ top: 111px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ =======
+ 111px
+ */
+ position: relative;
+ height: 88px;
+ width: 24px;
+ }
+ div#reference3rd
+ {
+ background-color: orange;
+ right: 48px;
+ color: orange;
+ top: 214px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ +
+ 88px : height of second column
+ +
+ 15px : 3rd border-spacing
+ =======
+ 214px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive and orange) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="test">
+ <table>
+ <col id="first">
+ <col id="second">
+ <col id="third">
+ <col>
+ <tr>
+ <td id="first-cell">1st</td>
+ <td id="second-cell">2nd</td>
+ <td id="third-cell">3rd</td>
+ <td></td>
+ </tr>
+ </table>
+ <div id="reference1st">ref</div>
+ <div id="reference2nd">ref</div>
+ <div id="reference3rd">ref</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-021-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-021-vrl.html
new file mode 100644
index 000000000..0486684b9
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-021-vrl.html
@@ -0,0 +1,140 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-021-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border: white solid;
+ border-width: 29px 0px; /* vertical table border height is 58px total */
+ border-collapse: separate;
+ border-spacing: 15px 4px; /* vertical border-spacing height is 75px total */
+ table-layout: fixed;
+ height: 533px;
+ /*
+ "With this (fast) algorithm, the vertical layout of
+ the table does not depend on the contents of the cells;
+ it only depends on the table's height, the height of
+ the columns, and borders or cell spacing."
+ http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout
+ So,
+ 533px : total table height
+ -
+ 58px : total vertical border height
+ -
+ 75px : total vertical border-spacing height
+ ========
+ 400px : total to split among the 4 columns
+ */
+ }
+ col#first
+ {
+ background-color: fuchsia;
+ height: 13%;
+ /* 400px multiplied by 13% = 52px */
+ }
+ col#second
+ {
+ background-color: olive;
+ height: 22%;
+ /* 400px multiplied by 22% = 88px */
+ }
+ col#third
+ {
+ background-color: orange;
+ height: 31%;
+ /* 400px multiplied by 31% = 124px */
+ /*
+ 100% - (13% + 22% + 31%) == 34% for last column
+ */
+ }
+ td {padding: 10px 0px; width: 24px; }
+ td#first-cell {color: fuchsia;}
+ td#second-cell {color: olive;}
+ td#third-cell {color: orange;}
+ div {padding: 0px; }
+ div#reference1st
+ {
+ background-color: fuchsia;
+ color: fuchsia;
+ right: 48px;
+ top: 44px; /* 29px border-top of table + 15px border-spacing == 44px */
+ position: relative;
+ height: 52px;
+ width: 24px;
+ }
+ div#reference2nd
+ {
+ background-color: olive;
+ color: olive;
+ right: 24px;
+ top: 111px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ =======
+ 111px
+ */
+ position: relative;
+ height: 88px;
+ width: 24px;
+ }
+ div#reference3rd
+ {
+ background-color: orange;
+ color: orange;
+ top: 214px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ +
+ 88px : height of second column
+ +
+ 15px : 3rd border-spacing
+ =======
+ 214px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive and orange) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="test">
+ <div id="reference1st">ref</div>
+ <div id="reference2nd">ref</div>
+ <div id="reference3rd">ref</div>
+ <table>
+ <col id="first">
+ <col id="second">
+ <col id="third">
+ <col>
+ <tr>
+ <td id="first-cell">1st</td>
+ <td id="second-cell">2nd</td>
+ <td id="third-cell">3rd</td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-022-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-022-ref.html
new file mode 100644
index 000000000..febe38ac4
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-022-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ div.wrapper {
+ writing-mode: vertical-lr;
+ margin-top: 52px;
+ }
+ div.stripe
+ {
+ display: inline-block;
+ margin-left: 4px;
+ margin-top: 8px;
+ margin-bottom: 7px;
+ width: 24px;
+ }
+ div.fuchsia
+ {
+ height: 52px;
+ background-color: fuchsia;
+ }
+ div.olive
+ {
+ height: 100px;
+ background-color: olive;
+ }
+ div.orange
+ {
+ height: 124px;
+ background-color: orange;
+ }
+ div.lime
+ {
+ height: 124px;
+ background-color: lime;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive, orange and lime) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="wrapper">
+ <div><div class="fuchsia stripe"></div><div class="olive stripe"></div><div class="orange stripe"></div><div class="lime stripe"></div></div>
+ <div><div class="fuchsia stripe"></div><div class="olive stripe"></div><div class="orange stripe"></div><div class="lime stripe"></div></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-022-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-022-vlr.html
new file mode 100644
index 000000000..cfeef6be8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-022-vlr.html
@@ -0,0 +1,170 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height and absolute height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-022-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ table
+ {
+ border: white solid;
+ border-width: 29px 0px; /* vertical table border height is 58px total */
+ border-collapse: separate;
+ border-spacing: 15px 4px; /* vertical border-spacing height is 75px total */
+ table-layout: fixed;
+ height: 533px;
+ /*
+ "With this (fast) algorithm, the vertical layout of
+ the table does not depend on the contents of the cells;
+ it only depends on the table's height, the height of
+ the columns, and [table] borders or cell spacing."
+ So,
+ 533px : total table height
+ -
+ 58px : total vertical border-spacing height
+ -
+ 75px : total vertical border-spacing height
+ ========
+ 400px : total to split among the 4 columns
+ */
+ }
+ col#first
+ {
+ background-color: fuchsia;
+ height: 13%;
+ /* 400px multiplied by 13% = 52px */
+ }
+ col#second
+ {
+ background-color: olive;
+ height: 100px;
+ }
+ col#third
+ {
+ background-color: orange;
+ height: 31%;
+ /* 400px multiplied by 31% = 124px */
+ /*
+ 300px - (52px + 124px) = 124px for last column
+ */
+ }
+ col#fourth {background-color: lime;}
+ td {padding: 10px 0px; width: 24px; }
+ td#first-cell {color: fuchsia;}
+ td#second-cell {color: olive;}
+ td#third-cell {color: orange;}
+ td#fourth-cell {color: lime;}
+ div {padding: 0px;}
+ div#reference1st
+ {
+ background-color: fuchsia;
+ color: fuchsia;
+ top: 44px; /* 29px border-top of table + 15px border-spacing == 44px */
+ position: relative;
+ height: 52px;
+ width: 24px;
+ }
+ div#reference2nd
+ {
+ background-color: olive;
+ color: olive;
+ right: 24px;
+ top: 111px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px border-spacing
+ ======
+ 111px
+ */
+ position: relative;
+ height: 100px;
+ width: 24px;
+ }
+ div#reference3rd
+ {
+ background-color: orange;
+ right: 48px;
+ color: orange;
+ top: 226px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 15px : 3rd border-spacing
+ =======
+ 226px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ div#reference4th
+ {
+ background-color: lime;
+ right: 72px;
+ color: lime;
+ top: 365px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 15px : 3rd border-spacing
+ +
+ 124px : height of third column
+ +
+ 15px : 4th border-spacing
+ =======
+ 365px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive, orange and lime) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="test">
+ <table>
+ <col id="first">
+ <col id="second">
+ <col id="third">
+ <col id="fourth">
+ <tr>
+ <td id="first-cell">1st</td>
+ <td id="second-cell">2nd</td>
+ <td id="third-cell">3rd</td>
+ <td id="fourth-cell">4th</td>
+ </tr>
+ </table>
+ <div id="reference1st">ref</div>
+ <div id="reference2nd">ref</div>
+ <div id="reference3rd">ref</div>
+ <div id="reference4th">ref</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-022-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-022-vrl.html
new file mode 100644
index 000000000..c26b0938f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-022-vrl.html
@@ -0,0 +1,170 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height and absolute height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-022-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ table
+ {
+ border: white solid;
+ border-width: 29px 0px; /* vertical table border height is 58px total */
+ border-collapse: separate;
+ border-spacing: 15px 4px; /* vertical border-spacing height is 75px total */
+ table-layout: fixed;
+ height: 533px;
+ /*
+ "With this (fast) algorithm, the vertical layout of
+ the table does not depend on the contents of the cells;
+ it only depends on the table's height, the height of
+ the columns, and [table] borders or cell spacing."
+ So,
+ 533px : total table height
+ -
+ 58px : total vertical border-spacing height
+ -
+ 75px : total vertical border-spacing height
+ ========
+ 400px : total to split among the 4 columns
+ */
+ }
+ col#first
+ {
+ background-color: fuchsia;
+ height: 13%;
+ /* 400px multiplied by 13% = 52px */
+ }
+ col#second
+ {
+ background-color: olive;
+ height: 100px;
+ }
+ col#third
+ {
+ background-color: orange;
+ height: 31%;
+ /* 400px multiplied by 31% = 124px */
+ /*
+ 300px - (52px + 124px) = 124px for last column
+ */
+ }
+ col#fourth {background-color: lime;}
+ td {padding: 10px 0px; width: 24px; }
+ td#first-cell {color: fuchsia;}
+ td#second-cell {color: olive;}
+ td#third-cell {color: orange;}
+ td#fourth-cell {color: lime;}
+ div {padding: 0px;}
+ div#reference1st
+ {
+ background-color: fuchsia;
+ color: fuchsia;
+ top: 44px; /* 29px border-top of table + 15px border-spacing == 44px */
+ right: 72px;
+ position: relative;
+ height: 52px;
+ width: 24px;
+ }
+ div#reference2nd
+ {
+ background-color: olive;
+ color: olive;
+ right: 48px;
+ top: 111px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px border-spacing
+ ======
+ 111px
+ */
+ position: relative;
+ height: 100px;
+ width: 24px;
+ }
+ div#reference3rd
+ {
+ background-color: orange;
+ right: 24px;
+ color: orange;
+ top: 226px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 15px : 3rd border-spacing
+ =======
+ 226px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ div#reference4th
+ {
+ background-color: lime;
+ color: lime;
+ top: 365px;
+ /*
+ 29px : border-top of table
+ +
+ 15px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 15px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 15px : 3rd border-spacing
+ +
+ 124px : height of third column
+ +
+ 15px : 4th border-spacing
+ =======
+ 365px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive, orange and lime) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="test">
+ <div id="reference1st">ref</div>
+ <div id="reference2nd">ref</div>
+ <div id="reference3rd">ref</div>
+ <div id="reference4th">ref</div>
+ <table>
+ <col id="first">
+ <col id="second">
+ <col id="third">
+ <col id="fourth">
+ <tr>
+ <td id="first-cell">1st</td>
+ <td id="second-cell">2nd</td>
+ <td id="third-cell">3rd</td>
+ <td id="fourth-cell">4th</td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-023-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-023-ref.html
new file mode 100644
index 000000000..4211763ab
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-023-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ div.wrapper {
+ writing-mode: vertical-lr;
+ margin-top: 34px;
+ }
+ div.stripe
+ {
+ display: inline-block;
+ margin-left: 4px;
+ margin-top: 11px;
+ margin-bottom: 7px;
+ width: 24px;
+ }
+ div.fuchsia
+ {
+ height: 52px;
+ background-color: fuchsia;
+ }
+ div.olive
+ {
+ height: 100px;
+ background-color: olive;
+ }
+ div.orange
+ {
+ height: 124px;
+ background-color: orange;
+ }
+ div.lime
+ {
+ height: 124px;
+ background-color: lime;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive, orange and lime) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="wrapper">
+ <div><div class="fuchsia stripe"></div><div class="olive stripe"></div><div class="orange stripe"></div><div class="lime stripe"></div></div>
+ <div><div class="fuchsia stripe"></div><div class="olive stripe"></div><div class="orange stripe"></div><div class="lime stripe"></div></div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-023-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-023-vlr.html
new file mode 100644
index 000000000..57eed6640
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-023-vlr.html
@@ -0,0 +1,175 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height and absolute height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-023-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-lr; }
+ body
+ {
+ margin: 8px;
+ height: 640px;
+ }
+ table
+ {
+ border: white solid;
+ border-width: 11px 0px; /* vertical table border height is 22px total */
+ border-collapse: separate;
+ border-spacing: 18px 4px; /* vertical border-spacing height is 90px total */
+ table-layout: fixed;
+ height: 80%; /* 640px mult by 80% == 512px */
+ /*
+ "With this (fast) algorithm, the vertical layout of
+ the table does not depend on the contents of the cells;
+ it only depends on the table's height, the height of
+ the columns, and [table] borders or cell spacing."
+ So,
+ 512px : total table height
+ -
+ 90px : total vertical border-spacing height
+ -
+ 22px : total vertical border-spacing height
+ ========
+ 400px : total to split among the 4 columns
+ */
+ }
+ col#first
+ {
+ background-color: fuchsia;
+ height: 13%;
+ /* 400px multiplied by 13% = 52px */
+ }
+ col#second
+ {
+ background-color: olive;
+ height: 100px;
+ }
+ col#third
+ {
+ background-color: orange;
+ height: 31%;
+ /* 400px multiplied by 31% = 124px */
+ /*
+ 400px - (52px + 100px + 124px) = 124px for last column
+ */
+ }
+ col#fourth {background-color: lime;}
+ td {padding: 10px 0px; width: 24px; }
+ td#first-cell {color: fuchsia;}
+ td#second-cell {color: olive;}
+ td#third-cell {color: orange;}
+ td#fourth-cell {color: lime;}
+ div {padding: 0px;}
+ div#reference1st
+ {
+ background-color: fuchsia;
+ color: fuchsia;
+ top: 29px; /* 11px border-top of table + 18px border-spacing == 29px */
+ position: relative;
+ height: 52px;
+ width: 24px;
+ }
+ div#reference2nd
+ {
+ background-color: olive;
+ right: 24px;
+ color: olive;
+ top: 99px;
+ /*
+ 11px : border-top of table
+ +
+ 18px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 18px : 2nd border-spacing
+ =======
+ 99px
+ */
+ position: relative;
+ height: 100px;
+ width: 24px;
+ }
+ div#reference3rd
+ {
+ background-color: orange;
+ right: 48px;
+ color: orange;
+ top: 217px;
+ /*
+ 11px : border-top of table
+ +
+ 18px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 18px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 18px : 3rd border-spacing
+ =======
+ 217px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ div#reference4th
+ {
+ background-color: lime;
+ right: 72px;
+ color: lime;
+ top: 359px;
+ /*
+ 11px : border-top of table
+ +
+ 18px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 18px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 18px : 3rd border-spacing
+ +
+ 124px : height of third column
+ +
+ 18px : 4th border-spacing
+ =======
+ 359px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive, orange and lime) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="test">
+ <table>
+ <col id="first">
+ <col id="second">
+ <col id="third">
+ <col id="fourth">
+ <tr>
+ <td id="first-cell">1st</td>
+ <td id="second-cell">2nd</td>
+ <td id="third-cell">3rd</td>
+ <td id="fourth-cell">4th</td>
+ </tr>
+ </table>
+ <div id="reference1st">ref</div>
+ <div id="reference2nd">ref</div>
+ <div id="reference3rd">ref</div>
+ <div id="reference4th">ref</div>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-023-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-023-vrl.html
new file mode 100644
index 000000000..3f6b042d8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-023-vrl.html
@@ -0,0 +1,175 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: table-layout fixed - columns with percentage height and absolute height</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="match" href="fixed-table-layout-023-ref.htm">
+ <meta content="" name="flags">
+ <meta content="A column with a percentage height in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert">
+ <style type="text/css">
+ div.test { writing-mode: vertical-rl; }
+ body
+ {
+ margin: 8px;
+ height: 640px;
+ }
+ table
+ {
+ border: white solid;
+ border-width: 11px 0px; /* vertical table border height is 22px total */
+ border-collapse: separate;
+ border-spacing: 18px 4px; /* vertical border-spacing height is 90px total */
+ table-layout: fixed;
+ height: 80%; /* 640px mult by 80% == 512px */
+ /*
+ "With this (fast) algorithm, the vertical layout of
+ the table does not depend on the contents of the cells;
+ it only depends on the table's height, the height of
+ the columns, and [table] borders or cell spacing."
+ So,
+ 512px : total table height
+ -
+ 90px : total vertical border-spacing height
+ -
+ 22px : total vertical border-spacing height
+ ========
+ 400px : total to split among the 4 columns
+ */
+ }
+ col#first
+ {
+ background-color: fuchsia;
+ height: 13%;
+ /* 400px multiplied by 13% = 52px */
+ }
+ col#second
+ {
+ background-color: olive;
+ height: 100px;
+ }
+ col#third
+ {
+ background-color: orange;
+ height: 31%;
+ /* 400px multiplied by 31% = 124px */
+ /*
+ 400px - (52px + 100px + 124px) = 124px for last column
+ */
+ }
+ col#fourth {background-color: lime;}
+ td {padding: 10px 0px; width: 24px; }
+ td#first-cell {color: fuchsia;}
+ td#second-cell {color: olive;}
+ td#third-cell {color: orange;}
+ td#fourth-cell {color: lime;}
+ div {padding: 0px;}
+ div#reference1st
+ {
+ background-color: fuchsia;
+ color: fuchsia;
+ top: 29px; /* 11px border-top of table + 18px border-spacing == 29px */
+ right: 72px;
+ position: relative;
+ height: 52px;
+ width: 24px;
+ }
+ div#reference2nd
+ {
+ background-color: olive;
+ right: 48px;
+ color: olive;
+ top: 99px;
+ /*
+ 11px : border-top of table
+ +
+ 18px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 18px : 2nd border-spacing
+ =======
+ 99px
+ */
+ position: relative;
+ height: 100px;
+ width: 24px;
+ }
+ div#reference3rd
+ {
+ background-color: orange;
+ right: 24px;
+ color: orange;
+ top: 217px;
+ /*
+ 11px : border-top of table
+ +
+ 18px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 18px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 18px : 3rd border-spacing
+ =======
+ 217px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ div#reference4th
+ {
+ background-color: lime;
+ color: lime;
+ top: 359px;
+ /*
+ 11px : border-top of table
+ +
+ 18px : 1st border-spacing
+ +
+ 52px : height of first column
+ +
+ 18px : 2nd border-spacing
+ +
+ 100px : height of second column
+ +
+ 18px : 3rd border-spacing
+ +
+ 124px : height of third column
+ +
+ 18px : 4th border-spacing
+ =======
+ 359px
+ */
+ position: relative;
+ height: 124px;
+ width: 24px;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if the colored (fuchsia, olive, orange and lime) stripes have respectively the same heights and the same vertical positions.</p>
+ <div class="test">
+ <div id="reference1st">ref</div>
+ <div id="reference2nd">ref</div>
+ <div id="reference3rd">ref</div>
+ <div id="reference4th">ref</div>
+ <table>
+ <col id="first">
+ <col id="second">
+ <col id="third">
+ <col id="fourth">
+ <tr>
+ <td id="first-cell">1st</td>
+ <td id="second-cell">2nd</td>
+ <td id="third-cell">3rd</td>
+ <td id="fourth-cell">4th</td>
+ </tr>
+ </table>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-025-ref.html b/layout/reftests/writing-mode/tables/fixed-table-layout-025-ref.html
new file mode 100644
index 000000000..172b85ac9
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-025-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <style type="text/css">
+ div.square
+ {
+ width: 100px;
+ height: 100px;
+ }
+ div.green
+ {
+ background-color: green;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <div class="green square"></div>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-025-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-025-vlr.html
new file mode 100644
index 000000000..530eeee5a
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-025-vlr.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.htm">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ height: 50%;
+ }
+ td#left-red-cell, td#right-red-cell {background-color: red;}
+ td {padding: 25px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="left-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="right-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-025-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-025-vrl.html
new file mode 100644
index 000000000..26ffd948b
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-025-vrl.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ height: 50%;
+ }
+ td#left-red-cell, td#right-red-cell {background-color: red;}
+ td {padding: 25px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="left-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="right-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-026-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-026-vlr.html
new file mode 100644
index 000000000..5abcba40f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-026-vlr.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 25px;
+ border-bottom: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-026-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-026-vrl.html
new file mode 100644
index 000000000..bd4b2438b
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-026-vrl.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 25px;
+ border-bottom: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-027-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-027-vlr.html
new file mode 100644
index 000000000..120475baa
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-027-vlr.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 25px;
+ border-bottom: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td#top-red-cell {border-bottom: red solid 24px;}
+ td#bottom-red-cell {border-top: red solid 25px;}
+ td {padding: 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-027-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-027-vrl.html
new file mode 100644
index 000000000..bd30dacef
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-027-vrl.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 25px;
+ border-bottom: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td#top-red-cell {border-bottom: red solid 24px;}
+ td#bottom-red-cell {border-top: red solid 25px;}
+ td {padding: 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-028-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-028-vlr.html
new file mode 100644
index 000000000..983752176
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-028-vlr.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 15px;
+ border-bottom: green solid 15px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 10px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-028-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-028-vrl.html
new file mode 100644
index 000000000..f975ed45f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-028-vrl.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 15px;
+ border-bottom: green solid 15px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 10px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-029-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-029-vlr.html
new file mode 100644
index 000000000..4b55f1f46
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-029-vlr.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 16px;
+ border-bottom: green solid 16px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td#top-red-cell {border-bottom: red solid 15px;}
+ td#bottom-red-cell {border-top: red solid 16px;}
+ td {padding: 9px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-029-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-029-vrl.html
new file mode 100644
index 000000000..08f7458d8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-029-vrl.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-collapse: collapse;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 16px;
+ border-bottom: green solid 16px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td#top-red-cell {border-bottom: red solid 15px;}
+ td#bottom-red-cell {border-top: red solid 16px;}
+ td {padding: 9px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-030-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-030-vlr.html
new file mode 100644
index 000000000..e68ff7642
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-030-vlr.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 25px 50px 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-030-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-030-vrl.html
new file mode 100644
index 000000000..a88bfe0cc
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-030-vrl.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-top: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 25px 50px 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-031-vlr.html b/layout/reftests/writing-mode/tables/fixed-table-layout-031-vlr.html
new file mode 100644
index 000000000..047daac23
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-031-vlr.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-lr;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-bottom: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 25px 50px 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/fixed-table-layout-031-vrl.html b/layout/reftests/writing-mode/tables/fixed-table-layout-031-vrl.html
new file mode 100644
index 000000000..cc9ea74c8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/fixed-table-layout-031-vrl.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>CSS Test: percentage height set on table-cell in 'table-layout: fixed' table</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Adapted for vertical layout by Simon Montagu" href="http:/mozilla.org/">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#separated-borders" title="17.6.1 The separated borders model">
+ <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0121.html" title="[CSS21] tables, percentages, and border-spacing">
+ <link rel="match" href="fixed-table-layout-025-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="A cell in the first row with a value other than 'auto' for the 'height' property determines the height for that column in the fixed table layout algorithm. The determination of the height of such column must nevertheless still take into account the vertical padding and vertical borders of such cell.">
+ <style type="text/css">
+ table
+ {
+ writing-mode: vertical-rl;
+ border-spacing: 0px;
+ table-layout: fixed;
+ height: 100px;
+ }
+ td#middle-green-cell
+ {
+ background-color: green;
+ border-bottom: green solid 25px;
+ height: 50%;
+ }
+ td#top-red-cell, td#bottom-red-cell {background-color: red;}
+ td {padding: 25px 50px 0px 50px;}
+ </style>
+ </head>
+ <body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <table>
+ <tr>
+ <td id="top-red-cell"></td>
+ <td id="middle-green-cell"></td>
+ <td id="bottom-red-cell"></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/multicol-count-002-ref.xht b/layout/reftests/writing-mode/tables/multicol-count-002-ref.xht
new file mode 100644
index 000000000..499debaf1
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/multicol-count-002-ref.xht
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2013-07-27 -->
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <meta name="flags" content="image" />
+ <style type="text/css"><![CDATA[
+ div
+ {
+ background-color: black;
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ width: 21em;
+ }
+
+ img {vertical-align: top;}
+ ]]></style>
+ </head>
+ <body>
+
+ <!-- body of reference case rewritten by Jonathan Kew to use Ahem glyphs instead of images,
+ to reduce antialiasing fuzz in comparison with testcases -->
+ <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &nbsp;XXXX&nbsp;XXXX&nbsp;XXXX&nbsp;XXXX&nbsp;
+ &nbsp;X&nbsp;&nbsp;X&nbsp;X&nbsp;&nbsp;X&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;
+ &nbsp;X&nbsp;&nbsp;X&nbsp;X&nbsp;&nbsp;X&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;
+ &nbsp;XXXX&nbsp;XXXX&nbsp;XXXX&nbsp;XXXX&nbsp;
+ &nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;
+ &nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;
+ &nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;XXXX&nbsp;XXXX&nbsp;
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+</div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/reftest-stylo.list b/layout/reftests/writing-mode/tables/reftest-stylo.list
new file mode 100644
index 000000000..331706545
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/reftest-stylo.list
@@ -0,0 +1,95 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== vertical-table-1a.html vertical-table-1a.html
+== vertical-table-1b.html vertical-table-1b.html
+== vertical-table-2a.html vertical-table-2a.html
+fuzzy-if(skiaContent,3,750) == vertical-table-2b.html vertical-table-2b.html
+== vertical-table-rowspan-1.html vertical-table-rowspan-1.html
+== vertical-table-rowspan-2.html vertical-table-rowspan-2.html
+== vertical-table-colspan-1.html vertical-table-colspan-1.html
+== vertical-table-colspan-2.html vertical-table-colspan-2.html
+== vertical-table-specified-width-1.html vertical-table-specified-width-1.html
+asserts(1) == vertical-table-specified-width-2.html vertical-table-specified-width-2.html
+# bug 1179741
+fuzzy-if(cocoaWidget,141,24) == vertical-border-collapse-1.html vertical-border-collapse-1.html
+fuzzy-if(cocoaWidget,141,24) == vertical-border-collapse-2.html vertical-border-collapse-2.html
+
+fuzzy-if(B2G,5,1) == fixed-table-layout-002-vlr.html fixed-table-layout-002-vlr.html
+fuzzy-if(B2G,5,1) == fixed-table-layout-003-vlr.html fixed-table-layout-003-vlr.html
+== fixed-table-layout-004-vlr.html fixed-table-layout-004-vlr.html
+== fixed-table-layout-005-vlr.html fixed-table-layout-005-vlr.html
+== fixed-table-layout-006-vlr.html fixed-table-layout-006-vlr.html
+fuzzy-if(B2G,5,1) == fixed-table-layout-007-vlr.html fixed-table-layout-007-vlr.html
+== fixed-table-layout-009-vlr.html fixed-table-layout-009-vlr.html
+fuzzy-if(Android,255,400) == fixed-table-layout-010-vlr.html fixed-table-layout-010-vlr.html
+fuzzy-if(B2G,5,1) == fixed-table-layout-012-vlr.html fixed-table-layout-012-vlr.html
+== fixed-table-layout-013-vlr.html fixed-table-layout-013-vlr.html
+== fixed-table-layout-014-vlr.html fixed-table-layout-014-vlr.html
+== fixed-table-layout-015-vlr.html fixed-table-layout-015-vlr.html
+== fixed-table-layout-016-vlr.html fixed-table-layout-016-vlr.html
+fails fuzzy-if(skiaContent,1,50) == fixed-table-layout-017-vlr.html fixed-table-layout-017-vlr.html
+fails fuzzy-if(skiaContent,1,50) == fixed-table-layout-018-vlr.html fixed-table-layout-018-vlr.html
+fails fuzzy-if(skiaContent,1,90) == fixed-table-layout-021-vlr.html fixed-table-layout-021-vlr.html
+fails fuzzy-if(skiaContent,1,90) == fixed-table-layout-022-vlr.html fixed-table-layout-022-vlr.html
+fails fuzzy-if(skiaContent,1,90) == fixed-table-layout-023-vlr.html fixed-table-layout-023-vlr.html
+== fixed-table-layout-025-vlr.html fixed-table-layout-025-vlr.html
+== fixed-table-layout-026-vlr.html fixed-table-layout-026-vlr.html
+== fixed-table-layout-027-vlr.html fixed-table-layout-027-vlr.html
+== fixed-table-layout-028-vlr.html fixed-table-layout-028-vlr.html
+== fixed-table-layout-029-vlr.html fixed-table-layout-029-vlr.html
+== fixed-table-layout-030-vlr.html fixed-table-layout-030-vlr.html
+== fixed-table-layout-031-vlr.html fixed-table-layout-031-vlr.html
+
+fuzzy-if(B2G,5,1) == fixed-table-layout-002-vrl.html fixed-table-layout-002-vrl.html
+fuzzy-if(B2G,5,1) == fixed-table-layout-003-vrl.html fixed-table-layout-003-vrl.html
+== fixed-table-layout-004-vrl.html fixed-table-layout-004-vrl.html
+== fixed-table-layout-005-vrl.html fixed-table-layout-005-vrl.html
+== fixed-table-layout-006-vrl.html fixed-table-layout-006-vrl.html
+fuzzy-if(B2G,5,1) == fixed-table-layout-007-vrl.html fixed-table-layout-007-vrl.html
+== fixed-table-layout-009-vrl.html fixed-table-layout-009-vrl.html
+fuzzy-if(Android,255,400) == fixed-table-layout-010-vrl.html fixed-table-layout-010-vrl.html
+fuzzy-if(B2G,5,1) == fixed-table-layout-012-vrl.html fixed-table-layout-012-vrl.html
+== fixed-table-layout-013-vrl.html fixed-table-layout-013-vrl.html
+== fixed-table-layout-014-vrl.html fixed-table-layout-014-vrl.html
+== fixed-table-layout-015-vrl.html fixed-table-layout-015-vrl.html
+== fixed-table-layout-016-vrl.html fixed-table-layout-016-vrl.html
+fails fuzzy-if(skiaContent,1,50) == fixed-table-layout-017-vrl.html fixed-table-layout-017-vrl.html
+fails fuzzy-if(skiaContent,1,50) == fixed-table-layout-018-vrl.html fixed-table-layout-018-vrl.html
+fails fuzzy-if(skiaContent,1,90) == fixed-table-layout-021-vrl.html fixed-table-layout-021-vrl.html
+fails fuzzy-if(skiaContent,1,90) == fixed-table-layout-022-vrl.html fixed-table-layout-022-vrl.html
+fails fuzzy-if(skiaContent,1,90) == fixed-table-layout-023-vrl.html fixed-table-layout-023-vrl.html
+== fixed-table-layout-025-vrl.html fixed-table-layout-025-vrl.html
+== fixed-table-layout-026-vrl.html fixed-table-layout-026-vrl.html
+== fixed-table-layout-027-vrl.html fixed-table-layout-027-vrl.html
+== fixed-table-layout-028-vrl.html fixed-table-layout-028-vrl.html
+== fixed-table-layout-029-vrl.html fixed-table-layout-029-vrl.html
+== fixed-table-layout-030-vrl.html fixed-table-layout-030-vrl.html
+== fixed-table-layout-031-vrl.html fixed-table-layout-031-vrl.html
+
+HTTP(../..) == s72-border-spacing-002.xht s72-border-spacing-002.xht
+HTTP(../..) == s72-border-spacing-003.xht s72-border-spacing-003.xht
+HTTP(../..) == s72-border-spacing-004.xht s72-border-spacing-004.xht
+HTTP(../..) == s72-border-spacing-005.xht s72-border-spacing-005.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-002.xht wm-row-progression-002.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-003.xht wm-row-progression-003.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-004.xht wm-row-progression-004.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-005.xht wm-row-progression-005.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-006.xht wm-row-progression-006.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-007.xht wm-row-progression-007.xht
+
+fuzzy-if(Android,255,38) == table-caption-top-1.html table-caption-top-1.html
+skip fuzzy-if(Android,255,38) == table-caption-bottom-1.html table-caption-bottom-1.html
+== table-caption-left-1.html table-caption-left-1.html
+== table-caption-right-1.html table-caption-right-1.html
+
+== border-collapse-bevels-1a.html border-collapse-bevels-1a.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1b.html border-collapse-bevels-1b.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1c.html border-collapse-bevels-1c.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1d.html border-collapse-bevels-1d.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1e.html border-collapse-bevels-1e.html
+
+== vertical-rl-row-progression-1a.html vertical-rl-row-progression-1a.html
+== vertical-rl-row-progression-1b.html vertical-rl-row-progression-1b.html
+== sideways-lr-row-progression-1a.html sideways-lr-row-progression-1a.html
+== sideways-lr-row-progression-1b.html sideways-lr-row-progression-1b.html
+== sideways-rl-row-progression-1a.html sideways-rl-row-progression-1a.html
+== sideways-rl-row-progression-1b.html sideways-rl-row-progression-1b.html
diff --git a/layout/reftests/writing-mode/tables/reftest.list b/layout/reftests/writing-mode/tables/reftest.list
new file mode 100644
index 000000000..66723ceeb
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/reftest.list
@@ -0,0 +1,93 @@
+== vertical-table-1a.html vertical-table-1-ref.html
+== vertical-table-1b.html vertical-table-1-ref.html
+== vertical-table-2a.html vertical-table-2-ref.html
+fuzzy-if(skiaContent,3,750) == vertical-table-2b.html vertical-table-2-ref.html
+== vertical-table-rowspan-1.html vertical-table-rowspan-1-ref.html
+== vertical-table-rowspan-2.html vertical-table-rowspan-2-ref.html
+== vertical-table-colspan-1.html vertical-table-colspan-1-ref.html
+== vertical-table-colspan-2.html vertical-table-colspan-2-ref.html
+== vertical-table-specified-width-1.html vertical-table-specified-width-1-ref.html
+asserts(1) == vertical-table-specified-width-2.html vertical-table-specified-width-2-ref.html # bug 1179741
+fuzzy-if(cocoaWidget,141,24) == vertical-border-collapse-1.html vertical-border-collapse-1-ref.html
+fuzzy-if(cocoaWidget,141,24) == vertical-border-collapse-2.html vertical-border-collapse-2-ref.html
+
+== fixed-table-layout-002-vlr.html fixed-table-layout-002-ref.html
+== fixed-table-layout-003-vlr.html fixed-table-layout-002-ref.html
+== fixed-table-layout-004-vlr.html fixed-table-layout-004-ref.html
+== fixed-table-layout-005-vlr.html fixed-table-layout-005-ref.html
+== fixed-table-layout-006-vlr.html fixed-table-layout-006-ref.html
+== fixed-table-layout-007-vlr.html fixed-table-layout-007-ref.html
+== fixed-table-layout-009-vlr.html fixed-table-layout-009-ref.html
+fuzzy-if(Android,255,400) == fixed-table-layout-010-vlr.html fixed-table-layout-010-ref.html
+== fixed-table-layout-012-vlr.html fixed-table-layout-012-ref.html
+== fixed-table-layout-013-vlr.html fixed-table-layout-002-ref.html
+== fixed-table-layout-014-vlr.html fixed-table-layout-002-ref.html
+== fixed-table-layout-015-vlr.html fixed-table-layout-002-ref.html
+== fixed-table-layout-016-vlr.html fixed-table-layout-002-ref.html
+fuzzy-if(skiaContent,1,50) == fixed-table-layout-017-vlr.html fixed-table-layout-017-ref.html
+fuzzy-if(skiaContent,1,50) == fixed-table-layout-018-vlr.html fixed-table-layout-017-ref.html
+fuzzy-if(skiaContent,1,90) == fixed-table-layout-021-vlr.html fixed-table-layout-021-ref.html
+fuzzy-if(skiaContent,1,90) == fixed-table-layout-022-vlr.html fixed-table-layout-022-ref.html
+fuzzy-if(skiaContent,1,90) == fixed-table-layout-023-vlr.html fixed-table-layout-023-ref.html
+== fixed-table-layout-025-vlr.html fixed-table-layout-025-ref.html
+== fixed-table-layout-026-vlr.html fixed-table-layout-025-ref.html
+== fixed-table-layout-027-vlr.html fixed-table-layout-025-ref.html
+== fixed-table-layout-028-vlr.html fixed-table-layout-025-ref.html
+== fixed-table-layout-029-vlr.html fixed-table-layout-025-ref.html
+== fixed-table-layout-030-vlr.html fixed-table-layout-025-ref.html
+== fixed-table-layout-031-vlr.html fixed-table-layout-025-ref.html
+
+== fixed-table-layout-002-vrl.html fixed-table-layout-002-ref.html
+== fixed-table-layout-003-vrl.html fixed-table-layout-002-ref.html
+== fixed-table-layout-004-vrl.html fixed-table-layout-004-ref.html
+== fixed-table-layout-005-vrl.html fixed-table-layout-005-ref.html
+== fixed-table-layout-006-vrl.html fixed-table-layout-006-ref.html
+== fixed-table-layout-007-vrl.html fixed-table-layout-007-ref.html
+== fixed-table-layout-009-vrl.html fixed-table-layout-009-ref.html
+fuzzy-if(Android,255,400) == fixed-table-layout-010-vrl.html fixed-table-layout-010-ref.html
+== fixed-table-layout-012-vrl.html fixed-table-layout-012-ref.html
+== fixed-table-layout-013-vrl.html fixed-table-layout-002-ref.html
+== fixed-table-layout-014-vrl.html fixed-table-layout-002-ref.html
+== fixed-table-layout-015-vrl.html fixed-table-layout-002-ref.html
+== fixed-table-layout-016-vrl.html fixed-table-layout-002-ref.html
+fuzzy-if(skiaContent,1,50) == fixed-table-layout-017-vrl.html fixed-table-layout-017-ref.html
+fuzzy-if(skiaContent,1,50) == fixed-table-layout-018-vrl.html fixed-table-layout-017-ref.html
+fuzzy-if(skiaContent,1,90) == fixed-table-layout-021-vrl.html fixed-table-layout-021-ref.html
+fuzzy-if(skiaContent,1,90) == fixed-table-layout-022-vrl.html fixed-table-layout-022-ref.html
+fuzzy-if(skiaContent,1,90) == fixed-table-layout-023-vrl.html fixed-table-layout-023-ref.html
+== fixed-table-layout-025-vrl.html fixed-table-layout-025-ref.html
+== fixed-table-layout-026-vrl.html fixed-table-layout-025-ref.html
+== fixed-table-layout-027-vrl.html fixed-table-layout-025-ref.html
+== fixed-table-layout-028-vrl.html fixed-table-layout-025-ref.html
+== fixed-table-layout-029-vrl.html fixed-table-layout-025-ref.html
+== fixed-table-layout-030-vrl.html fixed-table-layout-025-ref.html
+== fixed-table-layout-031-vrl.html fixed-table-layout-025-ref.html
+
+HTTP(../..) == s72-border-spacing-002.xht s72-border-spacing-002-ref.xht
+HTTP(../..) == s72-border-spacing-003.xht s72-border-spacing-002-ref.xht
+HTTP(../..) == s72-border-spacing-004.xht s72-border-spacing-002-ref.xht
+HTTP(../..) == s72-border-spacing-005.xht s72-border-spacing-002-ref.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-002.xht multicol-count-002-ref.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-003.xht multicol-count-002-ref.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-004.xht multicol-count-002-ref.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-005.xht multicol-count-002-ref.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-006.xht multicol-count-002-ref.xht
+fuzzy-if(winWidget,48,600) fuzzy-if(cocoaWidget,19,97) HTTP(../..) == wm-row-progression-007.xht multicol-count-002-ref.xht
+
+fuzzy-if(Android,255,38) == table-caption-top-1.html table-caption-top-1-ref.html
+fuzzy-if(Android,255,38) == table-caption-bottom-1.html table-caption-bottom-1-ref.html
+fuzzy-if(Android,244,27) == table-caption-left-1.html table-caption-left-1-ref.html
+fuzzy-if(Android,244,27) == table-caption-right-1.html table-caption-right-1-ref.html
+
+== border-collapse-bevels-1a.html border-collapse-bevels-1-ref.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1b.html border-collapse-bevels-1-ref.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1c.html border-collapse-bevels-1-ref.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1d.html border-collapse-bevels-1-ref.html
+fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1e.html border-collapse-bevels-1-ref.html
+
+== vertical-rl-row-progression-1a.html vertical-rl-row-progression-1-ref.html
+== vertical-rl-row-progression-1b.html vertical-rl-row-progression-1-ref.html
+== sideways-lr-row-progression-1a.html sideways-lr-row-progression-1-ref.html
+== sideways-lr-row-progression-1b.html sideways-lr-row-progression-1-ref.html
+== sideways-rl-row-progression-1a.html sideways-rl-row-progression-1-ref.html
+== sideways-rl-row-progression-1b.html sideways-rl-row-progression-1-ref.html
diff --git a/layout/reftests/writing-mode/tables/s72-border-spacing-002-ref.xht b/layout/reftests/writing-mode/tables/s72-border-spacing-002-ref.xht
new file mode 100644
index 000000000..958ba060f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/s72-border-spacing-002-ref.xht
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Reftest Reference</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+
+ <meta name="flags" content="image" />
+
+ </head>
+
+ <body>
+
+ <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
+
+ <div><img src="support/swatch-green.png" width="100" height="200" alt="Image download support must be enabled" /></div>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/s72-border-spacing-002.xht b/layout/reftests/writing-mode/tables/s72-border-spacing-002.xht
new file mode 100644
index 000000000..3e8ba5d5e
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/s72-border-spacing-002.xht
@@ -0,0 +1,144 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: border-spacing - first value is specified and non-zero in 'vertical-rl' table</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#dimension-mapping" title="7.2 Dimension Mapping" />
+ <link rel="help" href="http://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#separated-borders" title="17.6.1 The separated borders model" />
+ <link rel="match" href="s72-border-spacing-002-ref.xht" />
+
+ <!--
+ To be replaced with
+ <link rel="match" href="border-spacing-wm-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that first value of 'border-spacing' represents, from top to bottom, a) spacing between logical table right padding (physical table top padding) and rightmost cells and b) inter-column spacing and c) spacing between leftmost cells and logical table left padding (physical table bottom padding)." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ table
+ {
+ border-spacing: 0.5em 0em; /* computes to logical horizontal border-spacing: 10px */
+ font: 1.25em/1 Ahem; /* computes to 20px/20px */
+ padding: 1.25em 0em; /* computes to padding-top: 25px and padding-bottom: 25px */
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ td
+ {
+ height: 0.5em;
+ padding: 0em;
+ width: 1em;
+ }
+
+ /*
+
+ 0px width of nth row 20px TOP
+ | |
+ =================================== 0x (0em) |||
+ | table padding-top 25px (1.25em) | |||
+ | with red background=color | \ ||| /
+ | with red background=color | \ /
+ | with red background=color | \ /
+ | with red background=color | v
+ =================================== 25px (1.25em)
+ |logical righ border-spacing: 10px|
+ | with red background=color |
+ =================================== 35px (1.75em)
+ | height of 1st td 10px (0.5em) | |||
+ | with red background=color | |||
+ =================================== 45px (2.25em) \ ||| /
+ |inter-column spacing 10px (0.5em)| \ /
+ | with red background=color | \ /
+ =================================== 55px (2.75em) v
+ | height of 2nd td 10px (0.5em) |
+ | with red background=color |
+ =================================== 65px (3.25em)
+ |logical left border-spacing: 10px| |||
+ | with red background=color | |||
+ =================================== 75px (3.75em) \ ||| /
+ |tble padding-bottom 25px (1.25em)| \ /
+ | with red background=color | \ /
+ | with red background=color | v
+ | with red background=color |
+ | with red background=color |
+ =================================== 100px (5em) BOTTOM
+
+ */
+
+ div#reference-overlapping-green
+ {
+ background-color: green;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ z-index: -1;
+ }
+
+ table#test-overlapped-red
+ {
+ background-color: red;
+ }
+
+ table#test-overlapping-green
+ {
+ background-color: green;
+ }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
+
+ <div id="reference-overlapping-green"></div>
+
+ <table id="test-overlapped-red">
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ </table>
+
+ <div id="reference-overlapped-red"></div>
+
+ <table id="test-overlapping-green">
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/s72-border-spacing-003.xht b/layout/reftests/writing-mode/tables/s72-border-spacing-003.xht
new file mode 100644
index 000000000..eba0a9dd5
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/s72-border-spacing-003.xht
@@ -0,0 +1,144 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: border-spacing - first value is specified and non-zero in 'vertical-lr' table</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#dimension-mapping" title="7.2 Dimension Mapping" />
+ <link rel="help" href="http://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#separated-borders" title="17.6.1 The separated borders model" />
+ <link rel="match" href="s72-border-spacing-002-ref.xht" />
+
+ <!--
+ To be replaced with
+ <link rel="match" href="border-spacing-wm-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that first value of 'border-spacing' represents, from top to bottom, a) spacing between logical table left padding (physical table top padding) and leftmost cells and b) inter-column spacing and c) spacing between rightmost cells and logical table right padding (physical table bottom padding)." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ table
+ {
+ border-spacing: 0.5em 0em; /* computes to logical horizontal border-spacing: 10px */
+ font: 1.25em/1 Ahem; /* computes to 20px/20px */
+ padding: 1.25em 0em; /* computes to padding-top: 25px and padding-bottom: 25px */
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ td
+ {
+ height: 0.5em;
+ padding: 0em;
+ width: 1em;
+ }
+
+ /*
+
+ 0px width of nth row 20px TOP
+ | |
+ =================================== 0x (0em) |||
+ | table padding-top 25px (1.25em) | |||
+ | with red background=color | \ ||| /
+ | with red background=color | \ /
+ | with red background=color | \ /
+ | with red background=color | v
+ =================================== 25px (1.25em)
+ |logical left border-spacing: 10px|
+ | with red background=color |
+ =================================== 35px (1.75em)
+ | height of 1st td 10px (0.5em) | |||
+ | with red background=color | |||
+ =================================== 45px (2.25em) \ ||| /
+ |inter-column spacing 10px (0.5em)| \ /
+ | with red background=color | \ /
+ =================================== 55px (2.75em) v
+ | height of 2nd td 10px (0.5em) |
+ | with red background=color |
+ =================================== 65px (3.25em)
+ |logical righ border-spacing: 10px| |||
+ | with red background=color | |||
+ =================================== 75px (3.75em) \ ||| /
+ |tble padding-bottom 25px (1.25em)| \ /
+ | with red background=color | \ /
+ | with red background=color | v
+ | with red background=color |
+ | with red background=color |
+ =================================== 100px (5em) BOTTOM
+
+ */
+
+ div#reference-overlapping-green
+ {
+ background-color: green;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ z-index: -1;
+ }
+
+ table#test-overlapped-red
+ {
+ background-color: red;
+ }
+
+ table#test-overlapping-green
+ {
+ background-color: green;
+ }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
+
+ <div id="reference-overlapping-green"></div>
+
+ <table id="test-overlapped-red">
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ </table>
+
+ <div id="reference-overlapped-red"></div>
+
+ <table id="test-overlapping-green">
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ <tr><td></td><td></td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/s72-border-spacing-004.xht b/layout/reftests/writing-mode/tables/s72-border-spacing-004.xht
new file mode 100644
index 000000000..db81c77c8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/s72-border-spacing-004.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: border-spacing - second value is specified and non-zero in 'vertical-rl' table</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#dimension-mapping" title="7.2 Dimension Mapping" />
+ <link rel="help" href="http://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#separated-borders" title="17.6.1 The separated borders model" />
+ <link rel="match" href="s72-border-spacing-002-ref.xht" />
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that second value of 'border-spacing' represents, from right to left, a) spacing between logical table top padding (physical table right padding) and topmost cells and b) inter-row spacing and c) between bottommost cells and logical table bottom padding (physical table left padding)." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ table
+ {
+ border-spacing: 0em 0.5em; /* computes to logical vertical border-spacing: 10px */
+ font: 1.25em/1 Ahem; /* computes to 20px/20px */
+ padding: 0em 1.25em; /* computes to padding-left: 25px and padding-right: 25px */
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ td
+ {
+ height: 1em;
+ padding: 0em;
+ width: 0.5em;
+ }
+
+ /*
+
+ 0px 25px 35px 45px 55px 65px 75px 100px
+ | padding-left | left | 2nd | middle | 1st | right | padding-right|
+ | of table | vert. | right | vert. | right | vert. | of table |
+ | | border | most | border | most | border | |
+ | | spacing| row | spacing| row | spacing| |
+20| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+40| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+60| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+80| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+00| | | | | | | |
+px| | | | | | | |
+
+ */
+
+ div#reference-overlapping-green
+ {
+ background-color: green;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ z-index: -1;
+ }
+
+ table#test-overlapped-red
+ {
+ background-color: red;
+ }
+
+ table#test-overlapping-green
+ {
+ background-color: green;
+ }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
+
+ <div id="reference-overlapping-green"></div>
+
+ <table id="test-overlapped-red">
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ </table>
+
+ <div id="reference-overlapped-red"></div>
+
+ <table id="test-overlapping-green">
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/s72-border-spacing-005.xht b/layout/reftests/writing-mode/tables/s72-border-spacing-005.xht
new file mode 100644
index 000000000..0fd61d0f2
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/s72-border-spacing-005.xht
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: border-spacing - second value is specified and non-zero in 'vertical-lr' table</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#dimension-mapping" title="7.2 Dimension Mapping" />
+ <link rel="help" href="http://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#separated-borders" title="17.6.1 The separated borders model" />
+ <link rel="match" href="s72-border-spacing-002-ref.xht" />
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that second value of 'border-spacing' represents, from left to right, a) spacing between logical table top padding (physical table left padding) and topmost cells and b) inter-row spacing and c) spacing between bottommost cells and logical table bottom padding (physical table right padding)." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ table
+ {
+ border-spacing: 0em 0.5em; /* computes to logical vertical border-spacing: 10px */
+ font: 1.25em/1 Ahem; /* computes to 20px/20px */
+ padding: 0em 1.25em; /* computes to padding-left: 25px and padding-right: 25px */
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ td
+ {
+ height: 1em;
+ padding: 0em;
+ width: 0.5em;
+ }
+
+ /*
+
+ 0px 25px 35px 45px 55px 65px 75px 100px
+ | padding-left | left | 2nd | middle | 1st | right | padding-right|
+ | of table | vert. | row | vert. | right | vert. | of table |
+ | | border | | border | most | border | |
+ | | spacing| | spacing| row | spacing| |
+20| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+40| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+60| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+80| | | | | | | |
+px| | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+00| | | | | | | |
+px| | | | | | | |
+
+ */
+
+ div#reference-overlapping-green
+ {
+ background-color: green;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ height: 6.25em;
+ position: absolute;
+ width: 6.25em;
+ z-index: -1;
+ }
+
+ table#test-overlapped-red
+ {
+ background-color: red;
+ }
+
+ table#test-overlapping-green
+ {
+ background-color: green;
+ }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
+
+ <div id="reference-overlapping-green"></div>
+
+ <table id="test-overlapped-red">
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ </table>
+
+ <div id="reference-overlapped-red"></div>
+
+ <table id="test-overlapping-green">
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ <tr><td></td><td></td><td></td><td></td><td></td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1-ref.html b/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1-ref.html
new file mode 100644
index 000000000..930ce16dd
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1-ref.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<title>CSS Reference: sideways-lr Table Row/Rowgroup/Cell Ordering</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jfkthame@gmail.com">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+<!-- based on vertical-rl Table Row/Rowgroup/Cell Ordering tests by Elika J. Etemad -->
+
+<style>
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table>
+ <tr>
+ <td rowspan=2>
+ <td class="e">
+ <td rowspan=2 colspan=2>
+ <td rowspan=3>
+ <td class="d">
+ </tr>
+ <tr>
+ <td rowspan=2>
+ <td class="c">
+ </tr>
+ <tr>
+ <td class="b">
+ <td class="f">
+ <td class="g">
+ <td rowspan=2>
+ </tr>
+ <tr>
+ <td class="a">
+ <td colspan=3>
+ <td class="h">
+ </tr>
+</table>
diff --git a/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1a.html b/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1a.html
new file mode 100644
index 000000000..68d15a91c
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1a.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<title>CSS Test: sideways-lr Table Row/Rowgroup/Cell Ordering</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jfkthame@gmail.com">
+<meta name="assert" content="This test checks that sideways-lr tables order rows/rowgroups left to right and cells bottom-to-top (LTR) per 'direction'.">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+<!-- based on vertical-rl Table Row/Rowgroup/Cell Ordering tests by Elika J. Etemad -->
+
+<style>
+ .test {
+ writing-mode: sideways-lr;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="test">
+ <thead>
+ <tr>
+ <td class="a">
+ <td class="b">
+ <td colspan=2>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td colspan=2>
+ <td class="c">
+ <td class="d">
+ </tr>
+ </tfoot>
+ <tbody>
+ <tr>
+ <td rowspan=3>
+ <td colspan=2>
+ <td class="e">
+ </tr>
+ <tr>
+ <td class="f">
+ <td rowspan=2 colspan=2>
+ </tr>
+ <tr>
+ <td class="g">
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td class="h">
+ <td colspan=3>
+ </tr>
+ </tbody>
+</table>
diff --git a/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1b.html b/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1b.html
new file mode 100644
index 000000000..70172efb9
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/sideways-lr-row-progression-1b.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<title>CSS Test: sideways-lr Table Row/Rowgroup/Cell Ordering</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jfkthame@gmail.com">
+<meta name="assert" content="This test checks that sideways-lr tables order rows/rowgroups left to right and cells top-to-bottom (RTL) per 'direction'.">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+<!-- based on vertical-rl Table Row/Rowgroup/Cell Ordering tests by Elika J. Etemad -->
+
+<style>
+ .test {
+ writing-mode: sideways-lr;
+ direction: rtl;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="test">
+ <thead>
+ <tr>
+ <td colspan=2>
+ <td class="b">
+ <td class="a">
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td class="d">
+ <td class="c">
+ <td colspan=2>
+ </tr>
+ </tfoot>
+ <tbody>
+ <tr>
+ <td class="e">
+ <td colspan=2>
+ <td rowspan=3>
+ </tr>
+ <tr>
+ <td rowspan=2 colspan=2>
+ <td class="f">
+ </tr>
+ <tr>
+ <td class="g">
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td colspan=3>
+ <td class="h">
+ </tr>
+ </tbody>
+</table>
diff --git a/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1-ref.html b/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1-ref.html
new file mode 100644
index 000000000..64f29765e
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1-ref.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<title>CSS Reference: sideways-rl Table Row/Rowgroup/Cell Ordering</title>
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+<!-- based on equivalent testcase for vertical-rl mode by Elika J. Etemad -->
+
+<style>
+ .test {
+ writing-mode: sideways-rl;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="reference">
+ <tr>
+ <td rowspan=2>
+ <td class="h">
+ <td colspan=3">
+ <td class="a">
+ </tr>
+ <tr>
+ <td rowspan=3">
+ <td class="g">
+ <td class="f">
+ <td rowspan=2">
+ <td class="b">
+ </tr>
+ <tr>
+ <td class="c">
+ <td rowspan=2 colspan=2>
+ <td rowspan=2>
+ </tr>
+ <tr>
+ <td class="d">
+ <td class="e">
+ </tr>
+</table>
diff --git a/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1a.html b/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1a.html
new file mode 100644
index 000000000..c2096757f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1a.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<title>CSS Test: sideways-rl Table Row/Rowgroup/Cell Ordering</title>
+<meta name="assert" content="This test checks that sideways-rl tables order rows/rowgroups right to left and cells top-to-bottom (LTR) per 'direction'.">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+<!-- based on equivalent testcase for vertical-rl mode by Elika J. Etemad -->
+
+<style>
+ .test {
+ writing-mode: sideways-rl;
+ direction: ltr;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="test">
+ <thead>
+ <tr>
+ <td class="a">
+ <td class="b">
+ <td colspan=2>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td colspan=2>
+ <td class="c">
+ <td class="d">
+ </tr>
+ </tfoot>
+ <tbody>
+ <tr>
+ <td rowspan=3>
+ <td colspan=2>
+ <td class="e">
+ </tr>
+ <tr>
+ <td class="f">
+ <td rowspan=2 colspan=2>
+ </tr>
+ <tr>
+ <td class="g">
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td class="h">
+ <td colspan=3>
+ </tr>
+ </tbody>
+</table>
diff --git a/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1b.html b/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1b.html
new file mode 100644
index 000000000..5ef687551
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/sideways-rl-row-progression-1b.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<title>CSS Test: sideways-rl Table Row/Rowgroup/Cell Ordering</title>
+<meta name="assert" content="This test checks that sideways-rl tables order rows/rowgroups right to left and cells bottom-to-top (RTL) per 'direction'.">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+<!-- based on equivalent testcase for vertical-rl mode by Elika J. Etemad -->
+
+<style>
+ .test {
+ writing-mode: sideways-rl;
+ direction: rtl;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="test">
+ <thead>
+ <tr>
+ <td colspan=2>
+ <td class="b">
+ <td class="a">
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td class="d">
+ <td class="c">
+ <td colspan=2>
+ </tr>
+ </tfoot>
+ <tbody>
+ <tr>
+ <td class="e">
+ <td colspan=2>
+ <td rowspan=3>
+ </tr>
+ <tr>
+ <td rowspan=2 colspan=2>
+ <td class="f">
+ </tr>
+ <tr>
+ <td class="g">
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td colspan=3>
+ <td class="h">
+ </tr>
+ </tbody>
+</table>
diff --git a/layout/reftests/writing-mode/tables/support/ahem.css b/layout/reftests/writing-mode/tables/support/ahem.css
new file mode 100644
index 000000000..cf2cd818f
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/support/ahem.css
@@ -0,0 +1,4 @@
+@font-face {
+ font-family: Ahem;
+ src: url("../../../fonts/Ahem.ttf");
+}
diff --git a/layout/reftests/writing-mode/tables/support/swatch-green.png b/layout/reftests/writing-mode/tables/support/swatch-green.png
new file mode 100644
index 000000000..0aa79b0c8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/support/swatch-green.png
Binary files differ
diff --git a/layout/reftests/writing-mode/tables/table-caption-bottom-1-ref.html b/layout/reftests/writing-mode/tables/table-caption-bottom-1-ref.html
new file mode 100644
index 000000000..ae36e72e8
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-bottom-1-ref.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 0px sans-serif;
+}
+body > div {
+ margin-bottom: 10px;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.t {
+ width: 200px;
+ height: 100px;
+ background: silver;
+}
+.c {
+ background: cyan;
+ text-align: center;
+ min-block-size: 20px;
+ font-size: 12px;
+}
+</style>
+</head>
+<body>
+
+<div class="h">
+ <div class="t"></div>
+ <div class="c" style="width: 200px">table caption</div>
+</div>
+
+<div class="h">
+ <div class="t"></div>
+ <div class="c" style="width: 200px">table caption</div>
+</div>
+
+<div class="vlr">
+ <div class="t"></div>
+ <div class="c" style="height: 100px">table caption</div>
+</div>
+
+<div class="vrl">
+ <div class="t"></div>
+ <div class="c" style="height: 100px">table caption</div>
+</div>
diff --git a/layout/reftests/writing-mode/tables/table-caption-bottom-1.html b/layout/reftests/writing-mode/tables/table-caption-bottom-1.html
new file mode 100644
index 000000000..74cd13dd2
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-bottom-1.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 12px sans-serif;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.ltr {
+ direction: ltr;
+}
+.rtl {
+ direction: rtl;
+}
+table {
+ border-spacing: 0;
+ margin-bottom: 10px;
+ caption-side: bottom;
+}
+td {
+ width: 200px;
+ height: 100px;
+ background: silver;
+ padding: 0;
+}
+caption {
+ background: cyan;
+ min-block-size: 20px;
+}
+</style>
+</head>
+<body>
+
+<table class="h ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="h rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vlr ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vrl ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
diff --git a/layout/reftests/writing-mode/tables/table-caption-left-1-ref.html b/layout/reftests/writing-mode/tables/table-caption-left-1-ref.html
new file mode 100644
index 000000000..b9f46b081
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-left-1-ref.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 0px sans-serif;
+}
+body > div {
+ margin-bottom: 10px;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.t {
+ width: 200px;
+ height: 100px;
+ background: silver;
+}
+.c {
+ background: cyan;
+ text-align: center;
+ min-block-size: 20px;
+ font-size: 12px;
+ vertical-align: top;
+}
+</style>
+</head>
+<body>
+
+<div class="h">
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content">table caption</div>
+ <div class="t" style="display: inline-block"></div>
+</div>
+
+<div class="h">
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content">table caption</div>
+ <div class="t" style="display: inline-block"></div>
+</div>
+
+<div class="vlr">
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: bottom">table caption</div>
+ <div class="t" style="display: inline-block"></div>
+</div>
+
+<div class="vlr">
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: bottom">table caption</div>
+ <div class="t" style="display: inline-block"></div>
+</div>
+
+<div class="vrl">
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: top">table caption</div>
+ <div class="t" style="display: inline-block"></div>
+</div>
+
+<div class="vrl">
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: top">table caption</div>
+ <div class="t" style="display: inline-block"></div>
+</div>
diff --git a/layout/reftests/writing-mode/tables/table-caption-left-1.html b/layout/reftests/writing-mode/tables/table-caption-left-1.html
new file mode 100644
index 000000000..1096bcaeb
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-left-1.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 12px sans-serif;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.ltr {
+ direction: ltr;
+}
+.rtl {
+ direction: rtl;
+}
+table {
+ border-spacing: 0;
+ margin-bottom: 10px;
+ caption-side: left;
+}
+td {
+ width: 200px;
+ height: 100px;
+ background: silver;
+ padding: 0;
+}
+caption {
+ background: cyan;
+ min-block-size: 20px;
+}
+</style>
+</head>
+<body>
+
+<table class="h ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="h rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vlr ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vlr rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vrl ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vrl rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
diff --git a/layout/reftests/writing-mode/tables/table-caption-right-1-ref.html b/layout/reftests/writing-mode/tables/table-caption-right-1-ref.html
new file mode 100644
index 000000000..7e93276d1
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-right-1-ref.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 0px sans-serif;
+}
+body > div {
+ margin-bottom: 10px;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.t {
+ width: 200px;
+ height: 100px;
+ background: silver;
+}
+.c {
+ background: cyan;
+ text-align: center;
+ min-block-size: 20px;
+ font-size: 12px;
+ vertical-align: top;
+}
+</style>
+</head>
+<body>
+
+<div class="h">
+ <div class="t" style="display: inline-block"></div>
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content">table caption</div>
+</div>
+
+<div class="h">
+ <div class="t" style="display: inline-block"></div>
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content">table caption</div>
+</div>
+
+<div class="vlr">
+ <div class="t" style="display: inline-block"></div>
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: bottom">table caption</div>
+</div>
+
+<div class="vlr">
+ <div class="t" style="display: inline-block"></div>
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: bottom">table caption</div>
+</div>
+
+<div class="vrl">
+ <div class="t" style="display: inline-block"></div>
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: top">table caption</div>
+</div>
+
+<div class="vrl">
+ <div class="t" style="display: inline-block"></div>
+ <div class="c" style="display: inline-block; inline-size: -moz-min-content; vertical-align: top">table caption</div>
+</div>
diff --git a/layout/reftests/writing-mode/tables/table-caption-right-1.html b/layout/reftests/writing-mode/tables/table-caption-right-1.html
new file mode 100644
index 000000000..e6a4cd734
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-right-1.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 12px sans-serif;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.ltr {
+ direction: ltr;
+}
+.rtl {
+ direction: rtl;
+}
+table {
+ border-spacing: 0;
+ margin-bottom: 10px;
+ caption-side: right;
+}
+td {
+ width: 200px;
+ height: 100px;
+ background: silver;
+ padding: 0;
+}
+caption {
+ background: cyan;
+ min-block-size: 20px;
+}
+</style>
+</head>
+<body>
+
+<table class="h ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="h rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vlr ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vlr rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vrl ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vrl rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
diff --git a/layout/reftests/writing-mode/tables/table-caption-top-1-ref.html b/layout/reftests/writing-mode/tables/table-caption-top-1-ref.html
new file mode 100644
index 000000000..ac90c6ec2
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-top-1-ref.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 0px sans-serif;
+}
+body > div {
+ margin-bottom: 10px;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.t {
+ width: 200px;
+ height: 100px;
+ background: silver;
+}
+.c {
+ background: cyan;
+ text-align: center;
+ min-block-size: 20px;
+ font-size: 12px;
+}
+</style>
+</head>
+<body>
+
+<div class="h">
+ <div class="c" style="width: 200px">table caption</div>
+ <div class="t"></div>
+</div>
+
+<div class="h">
+ <div class="c" style="width: 200px">table caption</div>
+ <div class="t"></div>
+</div>
+
+<div class="vlr">
+ <div class="c" style="height: 100px">table caption</div>
+ <div class="t"></div>
+</div>
+
+<div class="vrl">
+ <div class="c" style="height: 100px">table caption</div>
+ <div class="t"></div>
+</div>
diff --git a/layout/reftests/writing-mode/tables/table-caption-top-1.html b/layout/reftests/writing-mode/tables/table-caption-top-1.html
new file mode 100644
index 000000000..5955d0146
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/table-caption-top-1.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html {
+ font: 12px sans-serif;
+}
+.h {
+ writing-mode: horizontal-tb;
+}
+.vlr {
+ writing-mode: vertical-lr;
+}
+.vrl {
+ writing-mode: vertical-rl;
+}
+.ltr {
+ direction: ltr;
+}
+.rtl {
+ direction: rtl;
+}
+table {
+ border-spacing: 0;
+ margin-bottom: 10px;
+ caption-side: top;
+}
+td {
+ width: 200px;
+ height: 100px;
+ background: silver;
+ padding: 0;
+}
+caption {
+ background: cyan;
+ min-block-size: 20px;
+}
+</style>
+</head>
+<body>
+
+<table class="h ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="h rtl">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vlr ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
+
+<table class="vrl ltr">
+ <caption>table caption</caption>
+ <tr><td></td></tr>
+</table>
diff --git a/layout/reftests/writing-mode/tables/vertical-border-collapse-1-ref.html b/layout/reftests/writing-mode/tables/vertical-border-collapse-1-ref.html
new file mode 100644
index 000000000..30e67d7dd
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-border-collapse-1-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border: 8px solid silver;
+ border-right-color: #666;
+ border-bottom-color: #333;
+ border-spacing: 5px;
+ border-collapse: collapse;
+}
+td {
+ border: 4px solid black;
+ height: 50px;
+ width: 20px;
+ text-align: center;
+}
+tr:nth-child(2) > td {
+ height: 80px;
+}
+tr:nth-child(4) > td {
+ height: 120px;
+}
+col:nth-child(even) {
+ background: #ffc;
+}
+col:nth-child(odd) {
+ background: #cff;
+}
+col:nth-child(1) {
+ background: #fcf;
+ width: 50px;
+}
+</style>
+</head>
+<body>
+
+<table>
+<col/><col/><col/><col/><col/>
+<tr> <td rowspan=3> </td> <td colspan=3> </td> <td> </td> </tr>
+<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
+<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
+<tr> <td> </td> <td> </td> <td colspan=2> </td> <td> </td> </tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-border-collapse-1.html b/layout/reftests/writing-mode/tables/vertical-border-collapse-1.html
new file mode 100644
index 000000000..599302ff7
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-border-collapse-1.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border: 8px solid silver;
+ border-right-color: #666;
+ border-bottom-color: #333;
+ border-spacing: 5px;
+ border-collapse: collapse;
+ writing-mode: vertical-lr;
+}
+td {
+ border: 4px solid black;
+ height: 50px;
+ width: 20px;
+ text-align: center;
+}
+td.w1 {
+ height: 80px;
+}
+td.w2 {
+ height: 120px;
+}
+tr:nth-child(even) {
+ background: #ffc;
+}
+tr:nth-child(odd) {
+ background: #cff;
+}
+tr:nth-child(1) {
+ background: #fcf;
+ width: 50px;
+}
+</style>
+</head>
+<body>
+
+<table>
+<tr><td colspan=3> </td> <td> </td> </tr>
+<tr><td rowspan=3> </td><td class="w1"> </td><td> </td><td> </td> </tr>
+<tr> <td> </td> <td> </td><td rowspan=2> </td> </tr>
+<tr> <td> </td> <td> </td> </tr>
+<tr><td> </td> <td> </td> <td> </td><td class="w2"> </td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-border-collapse-2-ref.html b/layout/reftests/writing-mode/tables/vertical-border-collapse-2-ref.html
new file mode 100644
index 000000000..a74ee0065
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-border-collapse-2-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border: 8px solid silver;
+ border-right-color: #666;
+ border-bottom-color: #333;
+ border-spacing: 5px;
+ border-collapse: collapse;
+}
+td {
+ border: 4px solid black;
+ height: 50px;
+ width: 20px;
+ text-align: center;
+}
+tr:nth-child(2) > td {
+ height: 80px;
+}
+tr:nth-child(4) > td {
+ height: 120px;
+}
+col:nth-child(even) {
+ background: #ffc;
+}
+col:nth-child(odd) {
+ background: #cff;
+}
+col:nth-child(5) {
+ background: #fcf;
+ width: 50px;
+}
+</style>
+</head>
+<body>
+
+<table>
+<col/><col/><col/><col/><col/>
+<tr> <td> </td> <td colspan=3> </td> <td rowspan=3> </td> </tr>
+<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
+<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
+<tr> <td> </td> <td colspan=2 style="background:#cff"> </td> <td> </td> <td> </td> </tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-border-collapse-2.html b/layout/reftests/writing-mode/tables/vertical-border-collapse-2.html
new file mode 100644
index 000000000..9c602ebdb
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-border-collapse-2.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table {
+ margin: 10px;
+ border: 8px solid silver;
+ border-right-color: #666;
+ border-bottom-color: #333;
+ border-spacing: 5px;
+ border-collapse: collapse;
+ writing-mode: vertical-rl;
+}
+td {
+ border: 4px solid black;
+ height: 50px;
+ width: 20px;
+ text-align: center;
+}
+td.w1 {
+ height: 80px;
+}
+td.w2 {
+ height: 120px;
+}
+tr:nth-child(even) {
+ background: #ffc;
+}
+tr:nth-child(odd) {
+ background: #cff;
+}
+tr:nth-child(1) {
+ background: #fcf;
+ width: 50px;
+}
+</style>
+</head>
+<body>
+
+<table>
+<tr><td colspan=3> </td> <td> </td> </tr>
+<tr><td rowspan=3> </td><td class="w1"> </td><td> </td><td> </td> </tr>
+<tr> <td> </td> <td> </td><td rowspan=2> </td> </tr>
+<tr> <td> </td> <td> </td> </tr>
+<tr><td> </td> <td> </td> <td> </td><td class="w2"> </td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1-ref.html b/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1-ref.html
new file mode 100644
index 000000000..60afb00d9
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1-ref.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<title>CSS Reference: vertical-rl Table Row/Rowgroup/Cell Ordering</title>
+<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+
+<style>
+ .test {
+ writing-mode: vertical-rl;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="reference">
+ <tr>
+ <td rowspan=2>
+ <td class="h">
+ <td colspan=3">
+ <td class="a">
+ <tr>
+ <td rowspan=3">
+ <td class="g">
+ <td class="f">
+ <td rowspan=2">
+ <td class="b">
+ <tr>
+ <td class="c">
+ <td rowspan=2 colspan=2>
+ <td rowspan=2>
+ <tr>
+ <td class="d">
+ <td class="e">
+</table>
diff --git a/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1a.html b/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1a.html
new file mode 100644
index 000000000..6b0929495
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1a.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<title>CSS Test: vertical-rl Table Row/Rowgroup/Cell Ordering</title>
+<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
+<meta name="assert" content="This test checks that vertical-rl tables order rows/rowgroups right to left and cells top-to-bottom (LTR) per 'direction'.">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+
+<style>
+ .test {
+ writing-mode: vertical-rl;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table class="test">
+ <thead>
+ <tr>
+ <td class="a">
+ <td class="b">
+ <td colspan=2>
+ <tfoot>
+ <tr>
+ <td colspan=2>
+ <td class="c">
+ <td class="d">
+ <tbody>
+ <tr>
+ <td rowspan=3>
+ <td colspan=2>
+ <td class="e">
+ <tr>
+ <td class="f">
+ <td rowspan=2 colspan=2>
+ <tr>
+ <td class="g">
+ <tbody>
+ <tr>
+ <td class="h">
+ <td colspan=3>
+</table>
diff --git a/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1b.html b/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1b.html
new file mode 100644
index 000000000..69f4f52e6
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-rl-row-progression-1b.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<title>CSS Test: vertical-rl Table Row/Rowgroup/Cell Ordering</title>
+<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
+<meta name="assert" content="This test checks that vertical-rl tables order rows/rowgroups right to left and cells bottom-to-top (RTL) per 'direction'.">
+<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode">
+
+<style>
+ .test {
+ writing-mode: vertical-rl;
+ }
+
+ table {
+ border-spacing: 0;
+ margin: 1em;
+ }
+ td {
+ width: 1em;
+ height: 1em;
+ border: solid gray;
+ }
+
+ .a { background: navy}
+ .b { background: blue }
+ .c { background: aqua }
+ .d { background: teal }
+ .e { background: purple }
+ .f { background: fuchsia }
+ .g { background: yellow }
+ .h { background: orange }
+</style>
+
+<table dir=rtl class="test">
+ <thead>
+ <tr>
+ <td colspan=2>
+ <td class="b">
+ <td class="a">
+ <tfoot>
+ <tr>
+ <td class="d">
+ <td class="c">
+ <td colspan=2>
+ <tbody>
+ <tr>
+ <td class="e">
+ <td colspan=2>
+ <td rowspan=3>
+ <tr>
+ <td rowspan=2 colspan=2>
+ <td class="f">
+ <tr>
+ <td class="g">
+ <tbody>
+ <tr>
+ <td colspan=3>
+ <td class="h">
+</table>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-1-ref.html b/layout/reftests/writing-mode/tables/vertical-table-1-ref.html
new file mode 100644
index 000000000..093acf6b0
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-1-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+#r1c1, #r1c2, #r1c3, #r1c4 { width: 50px; }
+#r2c1, #r2c2, #r2c3, #r2c4 { width: 100px; }
+#r1c1, #r2c1 { height: 20px; }
+#r1c2, #r2c2 { height: 30px; }
+#r1c3, #r2c3 { height: 40px; }
+#r1c4, #r2c4 { height: 50px; }
+#r1c1 { background: #003; }
+#r1c2 { background: #007; }
+#r1c3 { background: #00b; }
+#r1c4 { background: #00f; }
+#r2c1 { background: #030; }
+#r2c2 { background: #070; }
+#r2c3 { background: #0b0; }
+#r2c4 { background: #0f0; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td id="r1c1"></td>
+ <td id="r2c1"></td>
+</tr>
+<tr>
+ <td id="r1c2"></td>
+ <td id="r2c2"></td>
+</tr>
+<tr>
+ <td id="r1c3"></td>
+ <td id="r2c3"></td>
+</tr>
+<tr>
+ <td id="r1c4"></td>
+ <td id="r2c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-1a.html b/layout/reftests/writing-mode/tables/vertical-table-1a.html
new file mode 100644
index 000000000..aea9a2198
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-1a.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-lr; }
+#r1c1, #r1c2, #r1c3, #r1c4 { width: 50px; }
+#r2c1, #r2c2, #r2c3, #r2c4 { width: 100px; }
+#r1c1, #r2c1 { height: 20px; }
+#r1c2, #r2c2 { height: 30px; }
+#r1c3, #r2c3 { height: 40px; }
+#r1c4, #r2c4 { height: 50px; }
+#r1c1 { background: #003; }
+#r1c2 { background: #007; }
+#r1c3 { background: #00b; }
+#r1c4 { background: #00f; }
+#r2c1 { background: #030; }
+#r2c2 { background: #070; }
+#r2c3 { background: #0b0; }
+#r2c4 { background: #0f0; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td id="r1c1"></td>
+ <td id="r1c2"></td>
+ <td id="r1c3"></td>
+ <td id="r1c4"></td>
+</tr>
+<tr>
+ <td id="r2c1"></td>
+ <td id="r2c2"></td>
+ <td id="r2c3"></td>
+ <td id="r2c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-1b.html b/layout/reftests/writing-mode/tables/vertical-table-1b.html
new file mode 100644
index 000000000..8acd2ab10
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-1b.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-rl; }
+#r1c1, #r1c2, #r1c3, #r1c4 { width: 50px; }
+#r2c1, #r2c2, #r2c3, #r2c4 { width: 100px; }
+#r1c1, #r2c1 { height: 20px; }
+#r1c2, #r2c2 { height: 30px; }
+#r1c3, #r2c3 { height: 40px; }
+#r1c4, #r2c4 { height: 50px; }
+#r1c1 { background: #003; }
+#r1c2 { background: #007; }
+#r1c3 { background: #00b; }
+#r1c4 { background: #00f; }
+#r2c1 { background: #030; }
+#r2c2 { background: #070; }
+#r2c3 { background: #0b0; }
+#r2c4 { background: #0f0; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td id="r2c1"></td>
+ <td id="r2c2"></td>
+ <td id="r2c3"></td>
+ <td id="r2c4"></td>
+</tr>
+<tr>
+ <td id="r1c1"></td>
+ <td id="r1c2"></td>
+ <td id="r1c3"></td>
+ <td id="r1c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-2-ref.html b/layout/reftests/writing-mode/tables/vertical-table-2-ref.html
new file mode 100644
index 000000000..2e5b9fb2a
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-2-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+#r1c1, #r1c2, #r1c3, #r1c4 { width: 50px; }
+#r2c1, #r2c2, #r2c3, #r2c4 { width: 100px; }
+#r1c1, #r2c1 { height: 20px; }
+#r1c2, #r2c2 { height: 30px; }
+#r1c3, #r2c3 { height: 40px; }
+#r1c4, #r2c4 { height: 50px; }
+td {
+ border-left: 1px solid red;
+ border-right: 5px solid green;
+ border-top: 3px solid blue;
+ border-bottom: 5px dotted silver;
+}
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td id="r1c1"></td>
+ <td id="r2c1"></td>
+</tr>
+<tr>
+ <td id="r1c2"></td>
+ <td id="r2c2"></td>
+</tr>
+<tr>
+ <td id="r1c3"></td>
+ <td id="r2c3"></td>
+</tr>
+<tr>
+ <td id="r1c4"></td>
+ <td id="r2c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-2a.html b/layout/reftests/writing-mode/tables/vertical-table-2a.html
new file mode 100644
index 000000000..e73507617
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-2a.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-lr; }
+#r1c1, #r1c2, #r1c3, #r1c4 { width: 50px; }
+#r2c1, #r2c2, #r2c3, #r2c4 { width: 100px; }
+#r1c1, #r2c1 { height: 20px; }
+#r1c2, #r2c2 { height: 30px; }
+#r1c3, #r2c3 { height: 40px; }
+#r1c4, #r2c4 { height: 50px; }
+td {
+ border-left: 1px solid red;
+ border-right: 5px solid green;
+ border-top: 3px solid blue;
+ border-bottom: 5px dotted silver;
+}
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td id="r1c1"></td>
+ <td id="r1c2"></td>
+ <td id="r1c3"></td>
+ <td id="r1c4"></td>
+</tr>
+<tr>
+ <td id="r2c1"></td>
+ <td id="r2c2"></td>
+ <td id="r2c3"></td>
+ <td id="r2c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-2b.html b/layout/reftests/writing-mode/tables/vertical-table-2b.html
new file mode 100644
index 000000000..b07538817
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-2b.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-rl; }
+#r1c1, #r1c2, #r1c3, #r1c4 { width: 50px; }
+#r2c1, #r2c2, #r2c3, #r2c4 { width: 100px; }
+#r1c1, #r2c1 { height: 20px; }
+#r1c2, #r2c2 { height: 30px; }
+#r1c3, #r2c3 { height: 40px; }
+#r1c4, #r2c4 { height: 50px; }
+td {
+ border-left: 1px solid red;
+ border-right: 5px solid green;
+ border-top: 3px solid blue;
+ border-bottom: 5px dotted silver;
+}
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td id="r2c1"></td>
+ <td id="r2c2"></td>
+ <td id="r2c3"></td>
+ <td id="r2c4"></td>
+</tr>
+<tr>
+ <td id="r1c1"></td>
+ <td id="r1c2"></td>
+ <td id="r1c3"></td>
+ <td id="r1c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-colspan-1-ref.html b/layout/reftests/writing-mode/tables/vertical-table-colspan-1-ref.html
new file mode 100644
index 000000000..3c902df9d
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-colspan-1-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px; background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" rowspan=2></td>
+ <td class="r2 c1"></td>
+ <td class="r3 c1" rowspan=4></td>
+</tr>
+<tr>
+ <td class="r2 c2"></td>
+</tr>
+<tr>
+ <td class="r1 c3"></td>
+ <td class="r2 c3" rowspan=2></td>
+</tr>
+<tr>
+ <td class="r1 c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-colspan-1.html b/layout/reftests/writing-mode/tables/vertical-table-colspan-1.html
new file mode 100644
index 000000000..b93851d16
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-colspan-1.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-lr; }
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px ;background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" colspan=2></td>
+ <td class="r1 c3"></td>
+ <td class="r1 c4"></td>
+</tr>
+<tr>
+ <td class="r2 c1"></td>
+ <td class="r2 c2"></td>
+ <td class="r2 c3" colspan=2></td>
+</tr>
+<tr>
+ <td class="r3 c1" colspan=4></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-colspan-2-ref.html b/layout/reftests/writing-mode/tables/vertical-table-colspan-2-ref.html
new file mode 100644
index 000000000..47f7ed04d
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-colspan-2-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px; background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r3 c1" rowspan=4></td>
+ <td class="r2 c1"></td>
+ <td class="r1 c1" rowspan=2></td>
+</tr>
+<tr>
+ <td class="r2 c2"></td>
+</tr>
+<tr>
+ <td class="r2 c3" rowspan=2></td>
+ <td class="r1 c3"></td>
+</tr>
+<tr>
+ <td class="r1 c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-colspan-2.html b/layout/reftests/writing-mode/tables/vertical-table-colspan-2.html
new file mode 100644
index 000000000..eb840c5d7
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-colspan-2.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-rl; }
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px ;background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" colspan=2></td>
+ <td class="r1 c3"></td>
+ <td class="r1 c4"></td>
+</tr>
+<tr>
+ <td class="r2 c1"></td>
+ <td class="r2 c2"></td>
+ <td class="r2 c3" colspan=2></td>
+</tr>
+<tr>
+ <td class="r3 c1" colspan=4></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-rowspan-1-ref.html b/layout/reftests/writing-mode/tables/vertical-table-rowspan-1-ref.html
new file mode 100644
index 000000000..fd7a6738a
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-rowspan-1-ref.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px; background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" colspan=2></td>
+ <td class="r3 c1"></td>
+</tr>
+<tr>
+ <td class="r1 c2"></td>
+ <td class="r2 c2"></td>
+ <td class="r3 c2"></td>
+</tr>
+<tr>
+ <td class="r1 c3" colspan=3></td>
+</tr>
+<tr>
+ <td class="r1 c4"></td>
+ <td class="r2 c4" colspan=2></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-rowspan-1.html b/layout/reftests/writing-mode/tables/vertical-table-rowspan-1.html
new file mode 100644
index 000000000..bc368cce6
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-rowspan-1.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-lr; }
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px ;background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" rowspan=2></td>
+ <td class="r1 c2"></td>
+ <td class="r1 c3" rowspan=3></td>
+ <td class="r1 c4"></td>
+</tr>
+<tr>
+ <td class="r2 c2"></td>
+ <td class="r2 c4" rowspan=2></td>
+</tr>
+<tr>
+ <td class="r3 c1"></td>
+ <td class="r3 c2"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-rowspan-2-ref.html b/layout/reftests/writing-mode/tables/vertical-table-rowspan-2-ref.html
new file mode 100644
index 000000000..2c1b7d977
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-rowspan-2-ref.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+td { border: 1px solid black; }
+.r1 { width: 50px; }
+.r2 { width: 100px; }
+.r3 { width: 20px; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" colspan=2 style="background: #080;"></td>
+ <td class="r3 c1" style="background: #008;"></td>
+</tr>
+<tr>
+ <td class="r1 c2" style="background: #800;"></td>
+ <td class="r2 c2" style="background: #080;"></td>
+ <td class="r3 c2" style="background: #008;"></td>
+</tr>
+<tr>
+ <td class="r1 c3" colspan=3 style="background: #008;"></td>
+</tr>
+<tr>
+ <td class="r1 c4" style="background: #800;"></td>
+ <td class="r2 c4" colspan=2 style="background: #008;"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-rowspan-2.html b/layout/reftests/writing-mode/tables/vertical-table-rowspan-2.html
new file mode 100644
index 000000000..da4cc5892
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-rowspan-2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+table { writing-mode: vertical-rl; }
+td { border: 1px solid black; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px ;background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r3 c1"></td>
+ <td class="r3 c2"></td>
+ <td class="r3 c3" rowspan=3></td>
+ <td class="r3 c4" rowspan=2></td>
+</tr>
+<tr>
+ <td class="r2 c1" rowspan=2></td>
+ <td class="r2 c2"></td>
+</tr>
+<tr>
+ <td class="r1 c2"></td>
+ <td class="r1 c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-specified-width-1-ref.html b/layout/reftests/writing-mode/tables/vertical-table-specified-width-1-ref.html
new file mode 100644
index 000000000..03820b7f6
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-specified-width-1-ref.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html { overflow: hidden; }
+table { border-spacing: 0; }
+td { padding: 0; }
+.r1 { width: 80px; background: #800; }
+.r2 { width: 130px; background: #080; }
+.r3 { width: 50px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" colspan=2></td>
+ <td class="r3 c1"></td>
+</tr>
+<tr>
+ <td class="r1 c2"></td>
+ <td class="r2 c2"></td>
+ <td class="r3 c2"></td>
+</tr>
+<tr>
+ <td class="r1 c3" colspan=3></td>
+</tr>
+<tr>
+ <td class="r1 c4"></td>
+ <td class="r2 c4" colspan=2></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-specified-width-1.html b/layout/reftests/writing-mode/tables/vertical-table-specified-width-1.html
new file mode 100644
index 000000000..f8aaaf88a
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-specified-width-1.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html { overflow: hidden; }
+table {
+ writing-mode: vertical-lr;
+ border-spacing: 0;
+ width: 260px; /* natural width would be 170px; this adds 30px to each row */
+}
+td { padding: 0; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px; background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" rowspan=2></td>
+ <td class="r1 c2"></td>
+ <td class="r1 c3" rowspan=3></td>
+ <td class="r1 c4"></td>
+</tr>
+<tr>
+ <td class="r2 c2"></td>
+ <td class="r2 c4" rowspan=2></td>
+</tr>
+<tr>
+ <td class="r3 c1"></td>
+ <td class="r3 c2"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-specified-width-2-ref.html b/layout/reftests/writing-mode/tables/vertical-table-specified-width-2-ref.html
new file mode 100644
index 000000000..cbd125d8d
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-specified-width-2-ref.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html { overflow: hidden; }
+table { border-spacing: 0; }
+td { padding: 0; }
+.r1 { width: 80px; }
+.r2 { width: 130px; }
+.r3 { width: 50px; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r1 c1" colspan=2 style="background: #080;"></td>
+ <td class="r3 c1" style="background: #008;"></td>
+</tr>
+<tr>
+ <td class="r1 c2" style="background: #800;"></td>
+ <td class="r2 c2" style="background: #080;"></td>
+ <td class="r3 c2" style="background: #008;"></td>
+</tr>
+<tr>
+ <td class="r1 c3" colspan=3 style="background: #008;"></td>
+</tr>
+<tr>
+ <td class="r1 c4" style="background: #800;"></td>
+ <td class="r2 c4" colspan=2 style="background: #008;"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/vertical-table-specified-width-2.html b/layout/reftests/writing-mode/tables/vertical-table-specified-width-2.html
new file mode 100644
index 000000000..6d85079dd
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/vertical-table-specified-width-2.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+html { overflow: hidden; }
+table {
+ writing-mode: vertical-rl;
+ border-spacing: 0;
+ width: 260px; /* natural width would be 170px; this adds 30px to each row */
+}
+td { padding: 0; }
+.r1 { width: 50px; background: #800; }
+.r2 { width: 100px; background: #080; }
+.r3 { width: 20px; background: #008; }
+.c1 { height: 20px; }
+.c2 { height: 30px; }
+.c3 { height: 40px; }
+.c4 { height: 50px; }
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+ <td class="r3 c1"></td>
+ <td class="r3 c2"></td>
+ <td class="r3 c3" rowspan=3></td>
+ <td class="r3 c4" rowspan=2></td>
+</tr>
+<tr>
+ <td class="r2 c1" rowspan=2></td>
+ <td class="r2 c2"></td>
+</tr>
+<tr>
+ <td class="r1 c2"></td>
+ <td class="r1 c4"></td>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/writing-mode/tables/wm-row-progression-002.xht b/layout/reftests/writing-mode/tables/wm-row-progression-002.xht
new file mode 100644
index 000000000..4749c5f45
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/wm-row-progression-002.xht
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: vertical-rl - table rows progression</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode" title="3.1 Block Flow Direction: the writing-mode property" />
+ <link rel="match" href="multicol-count-002-ref.xht" />
+
+ <!--
+ to be replaced with
+ <link rel="match" href="../css-multicol-1/multicol-count-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that rows of a table element with in a 'vertical-rl' writing mode are laid out one after the other, leftwardedly, with the first beginning at the rightmost side of the table box; table rows are ordered from right to left meaning that the 1st row is the rightmost one and then the 2nd row is juxtaposed to its left-hand side, the 3rd row is juxtaposed to the 2nd row on its left-hand side, etc..." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ body
+ {
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ }
+
+ table
+ {
+ background-color: black;
+ border-spacing: 0em;
+ border: black solid 1em;
+ height: 7em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ td
+ {
+ padding-bottom: 0em;
+ padding-left: 1em;
+ padding-right: 0em;
+ padding-top: 0em;
+ }
+
+ td.left-most-cell { padding-left: 0em; }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <table>
+
+<!-- The right-most "S" -->
+ <tr><td>A&nbsp; B&nbsp; C&nbsp; DDD</td><td>EE F G H</td><td>JJ &nbsp;K &nbsp;L &nbsp;M</td></tr>
+
+<!-- The left-most "S" -->
+ <tr><td>N&nbsp; O&nbsp; Q&nbsp; RRR</td><td>SS T U V</td><td>WW &nbsp;X &nbsp;Y &nbsp;Z</td></tr>
+
+<!-- The "A" -->
+ <tr><td>aaa b&nbsp; c&nbsp; ddd</td><td>ee f g hh</td><td>jj &nbsp; &nbsp; kk</td></tr>
+
+<!-- The "P" -->
+ <tr><td class="left-most-cell">mmm n&nbsp; o&nbsp; qqq</td><td class="left-most-cell">r s t uu</td><td class="left-most-cell">&nbsp; &nbsp; &nbsp; vv</td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/wm-row-progression-003.xht b/layout/reftests/writing-mode/tables/wm-row-progression-003.xht
new file mode 100644
index 000000000..dbb7cf4fb
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/wm-row-progression-003.xht
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: vertical-lr - line boxes progression</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode" title="3.1 Block Flow Direction: the writing-mode property" />
+ <link rel="match" href="multicol-count-002-ref.xht" />
+
+ <!--
+ to be replaced with
+ <link rel="match" href="../css-multicol-1/multicol-count-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that rows of a table element with in a 'vertical-lr' writing mode are laid out one after the other, rightwardedly, with the first beginning at the leftmost side of the table box; table rows are ordered from left to right meaning that the 1st row is the leftmost one and then the 2nd row is juxtaposed to its right-hand side, the 3rd row is juxtaposed to the 2nd row on its right-hand side, etc..." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ body
+ {
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ }
+
+ table
+ {
+ background-color: black;
+ border-spacing: 0em;
+ border: black solid 1em;
+ height: 7em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ td
+ {
+ padding-bottom: 0em;
+ padding-left: 1em;
+ padding-right: 0em;
+ padding-top: 0em;
+ }
+
+ td.left-most-cell { padding-left: 0em; }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <table>
+
+<!-- The "P" -->
+ <tr><td class="left-most-cell">AAA B&nbsp; C&nbsp; DDD</td><td class="left-most-cell">EE F G H</td><td class="left-most-cell">JJ &nbsp; &nbsp; &nbsp;</td></tr>
+
+<!-- The "A" -->
+ <tr><td>KKK L&nbsp; M&nbsp; NNN</td><td>OO Q R SS</td><td>TT &nbsp; &nbsp; UU</td></tr>
+
+<!-- The left-most "S" -->
+ <tr><td>VVV W&nbsp; X&nbsp; Y&nbsp;</td><td>a b c dd</td><td>&nbsp;e &nbsp;f &nbsp;g hh</td></tr>
+
+<!-- The right-most "S" -->
+ <tr><td>jjj k&nbsp; m&nbsp; n&nbsp;</td><td>q r s tt</td><td>&nbsp;u &nbsp;v &nbsp;w xx</td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/wm-row-progression-004.xht b/layout/reftests/writing-mode/tables/wm-row-progression-004.xht
new file mode 100644
index 000000000..7178cc134
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/wm-row-progression-004.xht
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: vertical-rl - table rows progression and colspan</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode" title="3.1 Block Flow Direction: the writing-mode property" />
+ <link rel="match" href="multicol-count-002-ref.xht" />
+
+ <!--
+ to be replaced with
+ <link rel="match" href="../css-multicol-1/multicol-count-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that colspanned cells in a table are handled according to a top-to-bottom inline flow direction." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ body
+ {
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ }
+
+ table
+ {
+ background-color: black;
+ border-spacing: 0em;
+ border: black solid 1em;
+ height: 7em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ td
+ {
+ padding-bottom: 0em;
+ padding-left: 1em;
+ padding-right: 0em;
+ padding-top: 0em;
+ }
+
+ td.left-most-cell { padding-left: 0em; }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <table>
+
+<!-- The right-most "S" -->
+ <tr><td>A&nbsp; B&nbsp; C&nbsp; DDD</td><td>EE F G H</td><td>JJ &nbsp;K &nbsp;L &nbsp;M</td></tr>
+
+<!-- The left-most "S" -->
+ <tr><td colspan="2">N&nbsp; OO Q&nbsp; R&nbsp; S&nbsp; T&nbsp; UUUU</td><td>WW &nbsp;X &nbsp;Y &nbsp;Z</td></tr>
+
+<!-- The "A" -->
+ <tr><td>aaa b&nbsp; c&nbsp; ddd</td><td colspan="2">eeff g&nbsp;&nbsp; h&nbsp;&nbsp; jjjj</td></tr>
+
+<!-- The "P" -->
+ <tr><td class="left-most-cell">mmm n&nbsp; o&nbsp; qqq</td><td class="left-most-cell">r s t uu</td><td class="left-most-cell">&nbsp; &nbsp; &nbsp; vv</td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/wm-row-progression-005.xht b/layout/reftests/writing-mode/tables/wm-row-progression-005.xht
new file mode 100644
index 000000000..0d3abf653
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/wm-row-progression-005.xht
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: vertical-lr - table rows progression and colspan</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode" title="3.1 Block Flow Direction: the writing-mode property" />
+ <link rel="match" href="multicol-count-002-ref.xht" />
+
+ <!--
+ to be replaced with
+ <link rel="match" href="../css-multicol-1/multicol-count-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that colspanned cells in a table are handled according to a top-to-bottom inline flow direction." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ body
+ {
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ }
+
+ table
+ {
+ background-color: black;
+ border-spacing: 0em;
+ border: black solid 1em;
+ height: 7em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ td
+ {
+ padding-bottom: 0em;
+ padding-left: 1em;
+ padding-right: 0em;
+ padding-top: 0em;
+ }
+
+ td.left-most-cell { padding-left: 0em; }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <table>
+
+<!-- The "P" -->
+ <tr><td class="left-most-cell">AAA B&nbsp; C&nbsp; DDD</td><td class="left-most-cell">EE F G H</td><td class="left-most-cell">JJ &nbsp; &nbsp; &nbsp;</td></tr>
+
+<!-- The "A" -->
+ <tr><td colspan="2">KKKOO L&nbsp; Q&nbsp; M&nbsp; R&nbsp; NNNSS</td><td>TT &nbsp; &nbsp; UU</td></tr>
+
+<!-- The left-most "S" -->
+ <tr><td>VVV W&nbsp; X&nbsp; Y&nbsp;</td><td colspan="2">a&nbsp; b c&nbsp; d e&nbsp; f gggg</td></tr>
+
+<!-- The right-most "S" -->
+ <tr><td>jjj k&nbsp; m&nbsp; n&nbsp;</td><td>q r s tt</td><td>&nbsp;u &nbsp;v &nbsp;w xx</td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/wm-row-progression-006.xht b/layout/reftests/writing-mode/tables/wm-row-progression-006.xht
new file mode 100644
index 000000000..32d3b089d
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/wm-row-progression-006.xht
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: vertical-rl - table rows progression and rowspan</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode" title="3.1 Block Flow Direction: the writing-mode property" />
+ <link rel="match" href="multicol-count-002-ref.xht" />
+
+ <!--
+ to be replaced with
+ <link rel="match" href="../css-multicol-1/multicol-count-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that rowspanned cells in a table are handled according to a right-to-left direction." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ body
+ {
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ }
+
+ table
+ {
+ background-color: black;
+ border-spacing: 0em;
+ border: black solid 1em;
+ height: 7em;
+ -ah-writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+ writing-mode: tb-rl; /* IE11 */
+ writing-mode: vertical-rl;
+ }
+
+ td
+ {
+ padding-bottom: 0em;
+ padding-left: 1em;
+ padding-right: 0em;
+ padding-top: 0em;
+ }
+
+ td.left-most-cell { padding-left: 0em; }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <table>
+
+<!-- The right-most "S" -->
+ <tr><td>A&nbsp; B&nbsp; C&nbsp; DDD</td><td>EE F G H</td><td rowspan="2">JJ &nbsp;K &nbsp;L &nbsp;M &nbsp; WW &nbsp;X &nbsp;Y &nbsp;Z</td></tr>
+
+<!-- The left-most "S" -->
+ <tr><td>N&nbsp; O&nbsp; Q&nbsp; RRR</td><td>SS T U V</td></tr>
+
+<!-- The "A" -->
+ <tr><td>aaa b&nbsp; c&nbsp; ddd</td><td rowspan="2" class="left-most-cell">ee f g hh &nbsp; r s t uu</td><td>jj &nbsp; &nbsp; kk</td></tr>
+
+<!-- The "P" -->
+ <tr><td class="left-most-cell">mmm n&nbsp; o&nbsp; qqq</td><td class="left-most-cell">&nbsp; &nbsp; &nbsp; vv</td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/tables/wm-row-progression-007.xht b/layout/reftests/writing-mode/tables/wm-row-progression-007.xht
new file mode 100644
index 000000000..5280f845d
--- /dev/null
+++ b/layout/reftests/writing-mode/tables/wm-row-progression-007.xht
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+
+ <title>CSS Writing Modes Test: vertical-lr - table rows progression and rowspan</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#writing-mode" title="3.1 Block Flow Direction: the writing-mode property" />
+ <link rel="match" href="multicol-count-002-ref.xht" />
+
+ <!--
+ to be replaced with
+ <link rel="match" href="../css-multicol-1/multicol-count-002-ref.xht" />
+ -->
+
+ <meta content="ahem" name="flags" />
+ <meta content="This test checks that rowspanned cells in a table are handled according to a left-to-right direction." name="assert" />
+
+ <link type="text/css" rel="stylesheet" href="support/ahem.css" />
+
+ <style type="text/css"><![CDATA[
+ body
+ {
+ color: yellow;
+ font: 1.25em/1 Ahem;
+ }
+
+ table
+ {
+ background-color: black;
+ border-spacing: 0em;
+ border: black solid 1em;
+ height: 7em;
+ -ah-writing-mode: vertical-lr;
+ -webkit-writing-mode: vertical-lr;
+ writing-mode: tb-lr; /* IE11 */
+ writing-mode: vertical-lr;
+ }
+
+ td
+ {
+ padding-bottom: 0em;
+ padding-left: 1em;
+ padding-right: 0em;
+ padding-top: 0em;
+ }
+
+ td.left-most-cell { padding-left: 0em; }
+ ]]></style>
+ </head>
+
+ <body>
+
+ <table>
+
+<!-- The "P" -->
+ <tr><td class="left-most-cell">AAA B&nbsp; C&nbsp; DDD</td><td class="left-most-cell">EE F G H</td><td class="left-most-cell" rowspan="2">JJ &nbsp; &nbsp; &nbsp; &nbsp; TT &nbsp; &nbsp; UU</td></tr>
+
+<!-- The "A" -->
+ <tr><td>KKK L&nbsp; M&nbsp; NNN</td><td>OO Q R SS</td></tr>
+
+<!-- The left-most "S" -->
+ <tr><td>VVV W&nbsp; X&nbsp; Y&nbsp;</td><td rowspan="2">a b c dd &nbsp; q r s tt</td><td>&nbsp;e &nbsp;f &nbsp;g hh</td></tr>
+
+<!-- The right-most "S" -->
+ <tr><td>jjj k&nbsp; m&nbsp; n&nbsp;</td><td>&nbsp;u &nbsp;v &nbsp;w xx</td></tr>
+
+ </table>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-border-1-ref.html
new file mode 100644
index 000000000..6ae48c1f2
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-1-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on blockquote elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+.ltr blockquote { margin: 1em 0; padding: 0 0 0 1em; border: none; border-left: thin solid blue; }
+.rtl blockquote { margin: 1em 0; padding: 0 1em 0 0; border: none; border-right: thin solid blue; }
+.v-rl blockquote { margin: 0 1em; padding: 1em 0 0 0; border: none; border-top: thin solid blue; }
+</style>
+<div class=ltr>
+ <blockquote type=cite>Block quote</blockquote>
+</div>
+<div class=rtl dir=rtl>
+ <blockquote type=cite>Block quote</blockquote>
+</div>
+<div class=v-rl>
+ <blockquote type=cite>Block quote</blockquote>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-1.html b/layout/reftests/writing-mode/ua-style-sheet-border-1.html
new file mode 100644
index 000000000..793965838
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical borders on blockquote elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+</style>
+<div class=ltr>
+ <blockquote type=cite>Block quote</blockquote>
+</div>
+<div class=rtl dir=rtl>
+ <blockquote type=cite>Block quote</blockquote>
+</div>
+<div class=v-rl>
+ <blockquote type=cite>Block quote</blockquote>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-2-ref.html b/layout/reftests/writing-mode/ua-style-sheet-border-2-ref.html
new file mode 100644
index 000000000..8514ad2aa
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-2-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on tr elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+tr { border: none; }
+.ltr tr { border-top: thin solid; border-bottom: thin solid; }
+.rtl tr { border-top: thin solid; border-bottom: thin solid; }
+.v-rl tr { border-left: thin solid; border-right: thin solid; }
+</style>
+<div class=ltr>
+ <table rules=rows>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=rows>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=rows>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-2.html b/layout/reftests/writing-mode/ua-style-sheet-border-2.html
new file mode 100644
index 000000000..a63dff861
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-2.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical borders on tr elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+</style>
+<div class=ltr>
+ <table rules=rows>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=rows>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=rows>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-3-ref.html b/layout/reftests/writing-mode/ua-style-sheet-border-3-ref.html
new file mode 100644
index 000000000..1a34cea72
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-3-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on td elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+td { border: none; }
+.ltr td { border-left: thin solid; border-right: thin solid; }
+.rtl td { border-left: thin solid; border-right: thin solid; }
+.v-rl td { border-top: thin solid; border-bottom: thin solid; }
+</style>
+<div class=ltr>
+ <table rules=cols>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=cols>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=cols>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-3.html b/layout/reftests/writing-mode/ua-style-sheet-border-3.html
new file mode 100644
index 000000000..951d5b7ca
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-3.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical borders on td elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+</style>
+<div class=ltr>
+ <table rules=cols>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=cols>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=cols>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-4-ref.html b/layout/reftests/writing-mode/ua-style-sheet-border-4-ref.html
new file mode 100644
index 000000000..e0e957a1b
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-4-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on colgroup elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+colgroup { border: none; }
+.ltr colgroup { border-left: thin solid; border-right: thin solid; }
+.rtl colgroup { border-left: thin solid; border-right: thin solid; }
+.v-rl colgroup { border-top: thin solid; border-bottom: thin solid; }
+</style>
+<div class=ltr>
+ <table rules=groups>
+ <colgroup span=2><col><col></colgroup>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=groups>
+ <colgroup span=2><col><col></colgroup>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=groups>
+ <colgroup span=2><col><col></colgroup>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-4.html b/layout/reftests/writing-mode/ua-style-sheet-border-4.html
new file mode 100644
index 000000000..8ebce6b67
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-4.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical borders on colgroup elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+</style>
+<div class=ltr>
+ <table rules=groups>
+ <colgroup span=2><col><col></colgroup>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=groups>
+ <colgroup span=2><col><col></colgroup>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=groups>
+ <colgroup span=2><col><col></colgroup>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-5-ref.html b/layout/reftests/writing-mode/ua-style-sheet-border-5-ref.html
new file mode 100644
index 000000000..85ec56e2b
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-5-ref.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on tbody elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+tbody { border: none; }
+.ltr tbody { border-top: thin solid; border-bottom: thin solid; }
+.rtl tbody { border-top: thin solid; border-bottom: thin solid; }
+.v-rl tbody { border-left: thin solid; border-right: thin solid; }
+</style>
+<div class=ltr>
+ <table rules=groups>
+ <tbody>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </tbody>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=groups>
+ <tbody>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </tbody>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=groups>
+ <tbody>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </tbody>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-border-5.html b/layout/reftests/writing-mode/ua-style-sheet-border-5.html
new file mode 100644
index 000000000..0ef74346c
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-border-5.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical borders on tbody elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+</style>
+<div class=ltr>
+ <table rules=groups>
+ <tbody>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </tbody>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table rules=groups>
+ <tbody>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </tbody>
+ </table>
+</div>
+<div class=v-rl>
+ <table rules=groups>
+ <tbody>
+ <tr><td>A1</td><td>A2</td><td>A3</td></tr>
+ </tbody>
+ <tbody>
+ <tr><td>B1</td><td>B2</td><td>B3</td></tr>
+ </tbody>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-button-1.html b/layout/reftests/writing-mode/ua-style-sheet-button-1.html
new file mode 100644
index 000000000..f1ee2792a
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-button-1.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of button in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.a { -moz-appearance: none; }
+</style>
+<div class=ltr>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
+
+<div class=v-rl>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-button-1a-ref.html b/layout/reftests/writing-mode/ua-style-sheet-button-1a-ref.html
new file mode 100644
index 000000000..1c3bc7390
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-button-1a-ref.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of button in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.a { -moz-appearance: none; }
+
+.ltr button,
+.rtl button,
+.ltr input[type="button"],
+.rtl input[type="button"] {
+ padding: 0px 6px;
+}
+
+.v-rl button,
+.v-rl input[type="button"] {
+ padding: 6px 0px;
+}
+</style>
+<div class=ltr>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
+
+<div class=v-rl>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-button-1b-ref.html b/layout/reftests/writing-mode/ua-style-sheet-button-1b-ref.html
new file mode 100644
index 000000000..a20f63223
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-button-1b-ref.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of button in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.a { -moz-appearance: none; }
+
+.ltr button,
+.rtl button,
+.ltr input[type="button"],
+.rtl input[type="button"] {
+ padding: 0 7px;
+}
+
+.v-rl button,
+.v-rl input[type="button"] {
+ padding: 7px 0;
+}
+</style>
+<div class=ltr>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
+
+<div class=v-rl>
+ <button>one</button><br>
+ <button class=a>two</button><br>
+ <button disabled>three</button><br>
+ <button class=a disabled>four</button><br>
+ <input type="button" value="five"><br>
+ <input type="button" value="six" class=a><br>
+ <input type="button" value="seven" disabled><br>
+ <input type="button" value="eight" class=a disabled><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1-ref.html
new file mode 100644
index 000000000..033b312f0
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1-ref.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of checkbox and radio button in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+
+input[type="radio"],
+input[type="checkbox"] {
+ width: 13px;
+ height: 13px;
+}
+
+.ltr input[type="radio"] {
+ margin: 3px 3px 0px 5px;
+}
+.rtl input[type="radio"] {
+ margin: 3px 5px 0px 3px;
+}
+.v-rl input[type="radio"] {
+ margin: 5px 3px 3px 0px;
+}
+
+.ltr input[type="checkbox"] {
+ margin: 3px 3px 3px 4px;
+}
+.rtl input[type="checkbox"] {
+ margin: 3px 4px 3px 3px;
+}
+.v-rl input[type="checkbox"] {
+ margin: 4px 3px 3px 3px;
+}
+
+</style>
+<div class=ltr>
+ <input type=radio checked>radio 1</input><br>
+ <input type=radio>radio 2</input><br>
+ <input type=checkbox checked>checkbox 1</input><br>
+ <input type=checkbox>checkbox 2</input><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <input type=radio checked>radio 1</input><br>
+ <input type=radio>radio 2</input><br>
+ <input type=checkbox checked>checkbox 1</input><br>
+ <input type=checkbox>checkbox 2</input><br>
+</div>
+
+<div class=v-rl>
+ <input type=radio checked>radio 1</input><br>
+ <input type=radio>radio 2</input><br>
+ <input type=checkbox checked>checkbox 1</input><br>
+ <input type=checkbox>checkbox 2</input><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1.html b/layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1.html
new file mode 100644
index 000000000..7cf1129e2
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-checkbox-radio-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of checkbox and radio button in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <input type=radio checked>radio 1</input><br>
+ <input type=radio>radio 2</input><br>
+ <input type=checkbox checked>checkbox 1</input><br>
+ <input type=checkbox>checkbox 2</input><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <input type=radio checked>radio 1</input><br>
+ <input type=radio>radio 2</input><br>
+ <input type=checkbox checked>checkbox 1</input><br>
+ <input type=checkbox>checkbox 2</input><br>
+</div>
+
+<div class=v-rl>
+ <input type=radio checked>radio 1</input><br>
+ <input type=radio>radio 2</input><br>
+ <input type=checkbox checked>checkbox 1</input><br>
+ <input type=checkbox>checkbox 2</input><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-fieldset-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-fieldset-1-ref.html
new file mode 100644
index 000000000..dc3857082
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-fieldset-1-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of fieldset in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+
+fieldset { height: 100px; width: 100px; }
+
+.ltr .a, .rtl .a { height: 40%; background: #eee; }
+.ltr .b, .rtl .b { height: 60%; background: #ddd; }
+.v-rl .a { width: 40%; background: #eee; }
+.v-rl .b { width: 60%; background: #ddd; }
+
+.ltr fieldset, .rtl fieldset { margin: 0 2px; padding: 0.35em 0.625em 0.75em; }
+.v-rl fieldset { margin: 2px 0; padding: 0.625em 0.35em 0.625em 0.75em; }
+
+.ltr legend, .rtl legend { padding: 0 2px; }
+.v-rl legend { padding: 2px 0; }
+</style>
+<div class=ltr>
+ <fieldset>
+ <legend>Legend</legend>
+ <div class=a></div>
+ <div class=b></div>
+ </fieldset>
+</div>
+
+<div class=rtl dir=rtl>
+ <fieldset>
+ <legend>Legend</legend>
+ <div class=a></div>
+ <div class=b></div>
+ </fieldset>
+</div>
+
+<div class=v-rl>
+ <fieldset>
+ <legend>Legend</legend>
+ <div class=a></div>
+ <div class=b></div>
+ </fieldset>
+</div>
+
diff --git a/layout/reftests/writing-mode/ua-style-sheet-fieldset-1.html b/layout/reftests/writing-mode/ua-style-sheet-fieldset-1.html
new file mode 100644
index 000000000..3cc77041d
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-fieldset-1.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of fieldset in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+
+fieldset { height: 100px; width: 100px; }
+
+.a { block-size: 40%; background: #eee; }
+.b { block-size: 60%; background: #ddd; }
+</style>
+<div class=ltr>
+ <fieldset>
+ <legend>Legend</legend>
+ <div class=a></div>
+ <div class=b></div>
+ </fieldset>
+</div>
+
+<div class=rtl dir=rtl>
+ <fieldset>
+ <legend>Legend</legend>
+ <div class=a></div>
+ <div class=b></div>
+ </fieldset>
+</div>
+
+<div class=v-rl>
+ <fieldset>
+ <legend>Legend</legend>
+ <div class=a></div>
+ <div class=b></div>
+ </fieldset>
+</div>
+
diff --git a/layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html
new file mode 100644
index 000000000..ddd3c7ec4
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of input type=color in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.a { -moz-appearance: none; }
+
+.ltr input[type="color"]:-moz-system-metric(color-picker-available),
+.rtl input[type="color"]:-moz-system-metric(color-picker-available) {
+ width: 64px;
+ height: 23px;
+ padding: 0px 6px;
+}
+
+.v-rl input[type="color"]:-moz-system-metric(color-picker-available) {
+ height: 64px;
+ width: 23px;
+ padding: 6px 0px;
+}
+</style>
+<div class=ltr>
+ <input type=color><br>
+ <input type=color class=a><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <input type=color><br>
+ <input type=color class=a><br>
+</div>
+
+<div class=v-rl>
+ <input type=color><br>
+ <input type=color class=a><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-input-color-1.html b/layout/reftests/writing-mode/ua-style-sheet-input-color-1.html
new file mode 100644
index 000000000..4fef0094f
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-input-color-1.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of input type=color in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.a { -moz-appearance: none; }
+</style>
+<div class=ltr>
+ <input type=color><br>
+ <input type=color class=a><br>
+</div>
+
+<div class=rtl dir=rtl>
+ <input type=color><br>
+ <input type=color class=a><br>
+</div>
+
+<div class=v-rl>
+ <input type=color><br>
+ <input type=color class=a><br>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-input-number-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-input-number-1-ref.html
new file mode 100644
index 000000000..c2a8e31e7
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-input-number-1-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of input type=number in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+div { padding: 10px; }
+.a { -moz-appearance:textfield; }
+.b { -moz-appearance:none; }
+
+.ltr input[type="number"],
+.rtl input[type="number"] {
+ width: 20ch;
+}
+
+.v-rl input[type="number"] {
+ height: 20ch;
+}
+
+</style>
+<div class=ltr>
+ <input type=number value=123><br><br>
+ <input type=number value=456 class=a><br><br>
+ <input type=number value=7890 class=b>
+</div>
+
+<div class=rtl dir=rtl>
+ <input type=number value=123><br><br>
+ <input type=number value=456 class=a><br><br>
+ <input type=number value=7890 class=b>
+</div>
+
+<div class=v-rl>
+ <input type=number value=123><br><br>
+ <input type=number value=456 class=a><br><br>
+ <input type=number value=7890 class=b>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-input-number-1.html b/layout/reftests/writing-mode/ua-style-sheet-input-number-1.html
new file mode 100644
index 000000000..b46b24426
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-input-number-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of input type=number in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+div { padding: 10px; }
+.a { -moz-appearance:textfield; }
+.b { -moz-appearance:none; }
+</style>
+<div class=ltr>
+ <input type=number value=123><br><br>
+ <input type=number value=456 class=a><br><br>
+ <input type=number value=7890 class=b>
+</div>
+
+<div class=rtl dir=rtl>
+ <input type=number value=123><br><br>
+ <input type=number value=456 class=a><br><br>
+ <input type=number value=7890 class=b>
+</div>
+
+<div class=v-rl>
+ <input type=number value=123><br><br>
+ <input type=number value=456 class=a><br><br>
+ <input type=number value=7890 class=b>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-1-ref.html
new file mode 100644
index 000000000..cfa58ff51
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-1-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on p elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr p { margin: 1em 0; }
+.rtl p { margin: 1em 0; }
+.v-rl p { margin: 0 1em; }
+</style>
+<div class=ltr>
+ <p>Paragraph</p>
+</div>
+<div class=rtl dir=rtl>
+ <p>Paragraph</p>
+</div>
+<div class=v-rl>
+ <p>Paragraph</p>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-1.html b/layout/reftests/writing-mode/ua-style-sheet-margin-1.html
new file mode 100644
index 000000000..c6e0a793b
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on p elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <p>Paragraph</p>
+</div>
+<div class=rtl dir=rtl>
+ <p>Paragraph</p>
+</div>
+<div class=v-rl>
+ <p>Paragraph</p>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-10-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-10-ref.html
new file mode 100644
index 000000000..94cae4380
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-10-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on caption elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+table { border: 1px solid purple; }
+caption { border: 1px solid orange; display: block; width: 100px; height: 100px; }
+caption { margin: 0; }
+.ltr caption { margin: 0 auto 0 0; }
+.rtl caption { margin: 0 auto 0 0; }
+.v-rl caption { margin: 0 0 auto 0; }
+</style>
+<div class=ltr>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
+<div class=v-rl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-10.html b/layout/reftests/writing-mode/ua-style-sheet-margin-10.html
new file mode 100644
index 000000000..23ec26ada
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-10.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on caption elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+table { border: 1px solid purple; }
+caption { border: 1px solid orange; display: block; width: 100px; height: 100px; }
+</style>
+<div class=ltr>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=right>Caption</caption>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=right>Caption</caption>
+ </table>
+</div>
+<div class=v-rl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=right>Caption</caption>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-11-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-11-ref.html
new file mode 100644
index 000000000..7f3306163
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-11-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on ul elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr ul { margin: 1em 0; padding: 0 0 0 40px; }
+.rtl ul { margin: 1em 0; padding: 0 40px 0 0; }
+.v-rl ul { margin: 0 1em; padding: 40px 0 0 0; }
+</style>
+<div class=ltr>
+ <ul>
+ <li>Item</li>
+ </ul>
+</div>
+<div class=rtl dir=rtl>
+ <ul>
+ <li>Item</li>
+ </ul>
+</div>
+<div class=v-rl>
+ <ul>
+ <li>Item</li>
+ </ul>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-11.html b/layout/reftests/writing-mode/ua-style-sheet-margin-11.html
new file mode 100644
index 000000000..3b0b460ea
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-11.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on ul elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <ul>
+ <li>Item</li>
+ </ul>
+</div>
+<div class=rtl dir=rtl>
+ <ul>
+ <li>Item</li>
+ </ul>
+</div>
+<div class=v-rl>
+ <ul>
+ <li>Item</li>
+ </ul>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-12-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-12-ref.html
new file mode 100644
index 000000000..6bad60d6a
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-12-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on ol elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr ol { margin: 1em 0; padding: 0 0 0 40px; }
+.rtl ol { margin: 1em 0; padding: 0 40px 0 0; }
+.v-rl ol { margin: 0 1em; padding: 40px 0 0 0; }
+</style>
+<div class=ltr>
+ <ol>
+ <li>Item</li>
+ </ol>
+</div>
+<div class=rtl dir=rtl>
+ <ol>
+ <li>Item</li>
+ </ol>
+</div>
+<div class=v-rl>
+ <ol>
+ <li>Item</li>
+ </ol>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-12.html b/layout/reftests/writing-mode/ua-style-sheet-margin-12.html
new file mode 100644
index 000000000..8d8cd065a
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-12.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on ol elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <ol>
+ <li>Item</li>
+ </ol>
+</div>
+<div class=rtl dir=rtl>
+ <ol>
+ <li>Item</li>
+ </ol>
+</div>
+<div class=v-rl>
+ <ol>
+ <li>Item</li>
+ </ol>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-13-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-13-ref.html
new file mode 100644
index 000000000..f29796da6
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-13-ref.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on nested ul/ol elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+ul { border: 1px solid purple; }
+.ltr ul { margin: 1em 0; padding: 0 0 0 40px; }
+.rtl ul { margin: 1em 0; padding: 0 40px 0 0; }
+.v-rl ul { margin: 0 1em; padding: 40px 0 0 0; }
+ol { margin: 0; }
+</style>
+<div class=ltr>
+ <ul>
+ <li>
+ <ol>
+ <li>Item</li>
+ </ol>
+ </li>
+ </ul>
+</div>
+<div class=rtl dir=rtl>
+ <ul>
+ <li>
+ <ol>
+ <li>Item</li>
+ </ol>
+ </li>
+ </ul>
+</div>
+<div class=v-rl>
+ <ul>
+ <li>
+ <ol>
+ <li>Item</li>
+ </ol>
+ </li>
+ </ul>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-13.html b/layout/reftests/writing-mode/ua-style-sheet-margin-13.html
new file mode 100644
index 000000000..77c9c0a49
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-13.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on nested ul/ol elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+ul { border: 1px solid purple; }
+</style>
+<div class=ltr>
+ <ul>
+ <li>
+ <ol>
+ <li>Item</li>
+ </ol>
+ </li>
+ </ul>
+</div>
+<div class=rtl dir=rtl>
+ <ul>
+ <li>
+ <ol>
+ <li>Item</li>
+ </ol>
+ </li>
+ </ul>
+</div>
+<div class=v-rl>
+ <ul>
+ <li>
+ <ol>
+ <li>Item</li>
+ </ol>
+ </li>
+ </ul>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-14-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-14-ref.html
new file mode 100644
index 000000000..08fb4d292
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-14-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on hr elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+hr { width: 100px; height: 100px; }
+.ltr hr { margin: 0.5em auto; }
+.rtl hr { margin: 0.5em auto; }
+.v-rl hr { margin: auto 0.5em; }
+</style>
+<div class=ltr>
+ <hr>
+</div>
+<div class=rtl dir=rtl>
+ <hr>
+</div>
+<div class=v-rl>
+ <hr>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-14.html b/layout/reftests/writing-mode/ua-style-sheet-margin-14.html
new file mode 100644
index 000000000..3376ad9f3
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-14.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on hr elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+hr { width: 100px; height: 100px; }
+</style>
+<div class=ltr>
+ <hr>
+</div>
+<div class=rtl dir=rtl>
+ <hr>
+</div>
+<div class=v-rl>
+ <hr>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-2-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-2-ref.html
new file mode 100644
index 000000000..275e8df59
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-2-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on dl and dd elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr dl { margin: 1em 0; }
+.rtl dl { margin: 1em 0; }
+.v-rl dl { margin: 0 1em; }
+dd { margin: 0; }
+.ltr dd { margin-left: 40px; }
+.rtl dd { margin-right: 40px; }
+.v-rl dd { margin-top: 40px; }
+</style>
+<div class=ltr>
+ <dl><dt>term</dt><dd>definition</dd></dl>
+</div>
+<div class=rtl dir=rtl>
+ <dl><dt>term</dt><dd>definition</dd></dl>
+</div>
+<div class=v-rl>
+ <dl><dt>term</dt><dd>definition</dd></dl>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-2.html b/layout/reftests/writing-mode/ua-style-sheet-margin-2.html
new file mode 100644
index 000000000..95d88e122
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-2.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on dl and dd elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <dl><dt>term</dt><dd>definition</dd></dl>
+</div>
+<div class=rtl dir=rtl>
+ <dl><dt>term</dt><dd>definition</dd></dl>
+</div>
+<div class=v-rl>
+ <dl><dt>term</dt><dd>definition</dd></dl>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-3-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-3-ref.html
new file mode 100644
index 000000000..cab6208fe
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-3-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on blockquote elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr blockquote { margin: 1em 40px; }
+.rtl blockquote { margin: 1em 40px; }
+.v-rl blockquote { margin: 40px 1em; }
+</style>
+<div class=ltr>
+ <blockquote>Block quote</blockquote>
+</div>
+<div class=rtl dir=rtl>
+ <blockquote>Block quote</blockquote>
+</div>
+<div class=v-rl>
+ <blockquote>Block quote</blockquote>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-3.html b/layout/reftests/writing-mode/ua-style-sheet-margin-3.html
new file mode 100644
index 000000000..433e0dbcb
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-3.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on blockquote elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <blockquote>Block quote</blockquote>
+</div>
+<div class=rtl dir=rtl>
+ <blockquote>Block quote</blockquote>
+</div>
+<div class=v-rl>
+ <blockquote>Block quote</blockquote>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-4-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-4-ref.html
new file mode 100644
index 000000000..107cceb3b
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-4-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on h[123] elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+h1, h2, h3 { font-size: 16px; border: 1px solid purple; }
+.ltr h1 { margin: 0.67em 0; }
+.rtl h1 { margin: 0.67em 0; }
+.v-rl h1 { margin: 0 0.67em; }
+.ltr h2 { margin: 0.83em 0; }
+.rtl h2 { margin: 0.83em 0; }
+.v-rl h2 { margin: 0 0.83em; }
+.ltr h3 { margin: 1em 0; }
+.rtl h3 { margin: 1em 0; }
+.v-rl h3 { margin: 0 1em; }
+</style>
+<div class=ltr>
+ <h1>Heading 1</h1>
+ <h2>Heading 2</h2>
+ <h3>Heading 3</h3>
+</div>
+<div class=rtl dir=rtl>
+ <h1>Heading 1</h1>
+ <h2>Heading 2</h2>
+ <h3>Heading 3</h3>
+</div>
+<div class=v-rl>
+ <h1>Heading 1</h1>
+ <h2>Heading 2</h2>
+ <h3>Heading 3</h3>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-4.html b/layout/reftests/writing-mode/ua-style-sheet-margin-4.html
new file mode 100644
index 000000000..b1e544bef
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-4.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on h[123] elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+h1, h2, h3 { font-size: 16px; border: 1px solid purple; }
+</style>
+<div class=ltr>
+ <h1>Heading 1</h1>
+ <h2>Heading 2</h2>
+ <h3>Heading 3</h3>
+</div>
+<div class=rtl dir=rtl>
+ <h1>Heading 1</h1>
+ <h2>Heading 2</h2>
+ <h3>Heading 3</h3>
+</div>
+<div class=v-rl>
+ <h1>Heading 1</h1>
+ <h2>Heading 2</h2>
+ <h3>Heading 3</h3>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-5-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-5-ref.html
new file mode 100644
index 000000000..ae99fa8fd
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-5-ref.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on h[456] elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+h4, h5, h6 { font-size: 16px; border: 1px solid purple; }
+.ltr h4 { margin: 1.33em 0; }
+.rtl h4 { margin: 1.33em 0; }
+.v-rl h4 { margin: 0 1.33em; }
+.ltr h5 { margin: 1.67em 0; }
+.rtl h5 { margin: 1.67em 0; }
+.v-rl h5 { margin: 0 1.67em; }
+.ltr h6 { margin: 2.33em 0; }
+.rtl h6 { margin: 2.33em 0; }
+.v-rl h6 { margin: 0 2.33em; }
+</style>
+<div class=ltr>
+ <h4>Heading 4</h4>
+ <h5>Heading 5</h5>
+ <h6>Heading 6</h6>
+</div>
+<div class=rtl dir=rtl>
+ <h4>Heading 4</h4>
+ <h5>Heading 5</h5>
+ <h6>Heading 6</h6>
+</div>
+<div class=v-rl>
+ <h4>Heading 4</h4>
+ <h5>Heading 5</h5>
+ <h6>Heading 6</h6>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-5.html b/layout/reftests/writing-mode/ua-style-sheet-margin-5.html
new file mode 100644
index 000000000..b9f22c7ff
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-5.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on h[456] elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+h4, h5, h6 { font-size: 16px; border: 1px solid purple; }
+</style>
+<div class=ltr>
+ <h4>Heading 4</h4>
+ <h5>Heading 5</h5>
+ <h6>Heading 6</h6>
+</div>
+<div class=rtl dir=rtl>
+ <h4>Heading 4</h4>
+ <h5>Heading 5</h5>
+ <h6>Heading 6</h6>
+</div>
+<div class=v-rl>
+ <h4>Heading 4</h4>
+ <h5>Heading 5</h5>
+ <h6>Heading 6</h6>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-6-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-6-ref.html
new file mode 100644
index 000000000..19fc72db5
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-6-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on listing elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr listing { margin: 1em 0; }
+.rtl listing { margin: 1em 0; }
+.v-rl listing { margin: 0 1em; }
+</style>
+<div class=ltr>
+ <listing>Listing line 1
+Listing line 2</listing>
+</div>
+<div class=rtl dir=rtl>
+ <listing>Listing line 1
+Listing line 2</listing>
+</div>
+<div class=v-rl>
+ <listing>Listing line 1
+Listing line 2</listing>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-6.html b/layout/reftests/writing-mode/ua-style-sheet-margin-6.html
new file mode 100644
index 000000000..21f1da291
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-6.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on listing elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <listing>Listing line 1
+Listing line 2</listing>
+</div>
+<div class=rtl dir=rtl>
+ <listing>Listing line 1
+Listing line 2</listing>
+</div>
+<div class=v-rl>
+ <listing>Listing line 1
+Listing line 2</listing>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-7-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-7-ref.html
new file mode 100644
index 000000000..4041028cd
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-7-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on pre elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+.ltr pre { margin: 1em 0; }
+.rtl pre { margin: 1em 0; }
+.v-rl pre { margin: 0 1em; }
+</style>
+<div class=ltr>
+ <pre>pre line 1
+pre line 2</pre>
+</div>
+<div class=rtl dir=rtl>
+ <pre>pre line 1
+pre line 2</pre>
+</div>
+<div class=v-rl>
+ <pre>pre line 1
+pre line 2</pre>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-7.html b/layout/reftests/writing-mode/ua-style-sheet-margin-7.html
new file mode 100644
index 000000000..1d9f26e34
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-7.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on pre elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <pre>pre line 1
+pre line 2</pre>
+</div>
+<div class=rtl dir=rtl>
+ <pre>pre line 1
+pre line 2</pre>
+</div>
+<div class=v-rl>
+ <pre>pre line 1
+pre line 2</pre>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-8-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-8-ref.html
new file mode 100644
index 000000000..885d99080
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-8-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on caption elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+table { border: 1px solid purple; }
+caption { border: 1px solid orange; }
+caption { margin: 0; }
+.ltr caption { margin: 0 auto; }
+.rtl caption { margin: 0 auto; }
+.v-rl caption { margin: auto 0; }
+</style>
+<div class=ltr>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption>Caption</caption>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption>Caption</caption>
+ </table>
+</div>
+<div class=v-rl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption>Caption</caption>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-8.html b/layout/reftests/writing-mode/ua-style-sheet-margin-8.html
new file mode 100644
index 000000000..e445ea802
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-8.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on caption elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+table { border: 1px solid purple; }
+caption { border: 1px solid orange; }
+</style>
+<div class=ltr>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption>Caption</caption>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption>Caption</caption>
+ </table>
+</div>
+<div class=v-rl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption>Caption</caption>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-9-ref.html b/layout/reftests/writing-mode/ua-style-sheet-margin-9-ref.html
new file mode 100644
index 000000000..853a4f636
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-9-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on caption elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+table { border: 1px solid purple; }
+caption { border: 1px solid orange; display: block; width: 100px; height: 100px; }
+caption { margin: 0; }
+.ltr caption { margin: 0 0 0 auto; }
+.rtl caption { margin: 0 0 0 auto; }
+.v-rl caption { margin: auto 0 0 0; }
+</style>
+<div class=ltr>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
+<div class=v-rl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-margin-9.html b/layout/reftests/writing-mode/ua-style-sheet-margin-9.html
new file mode 100644
index 000000000..826f88893
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-margin-9.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on caption elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+table { border: 1px solid purple; }
+caption { border: 1px solid orange; display: block; width: 100px; height: 100px; }
+</style>
+<div class=ltr>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
+<div class=rtl dir=rtl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
+<div class=v-rl>
+ <table align=center>
+ <td>Table that is bigger than its caption</td>
+ <caption align=left>Caption</caption>
+ </table>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-size-1-ref.html b/layout/reftests/writing-mode/ua-style-sheet-size-1-ref.html
new file mode 100644
index 000000000..06f6d5700
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-size-1-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on marquee elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+marquee { background-color: yellow; color: transparent; }
+.ltr marquee { width: -moz-available; height: auto; }
+.rtl marquee { width: -moz-available; height: auto; }
+.v-rl marquee { width: auto; height: -moz-available; }
+</style>
+<div class=ltr>
+ <marquee>A</marquee>
+</div>
+<div class=rtl dir=rtl>
+ <marquee>A</marquee>
+</div>
+<!-- disabled until bug 1132308
+<div class=v-rl>
+ <marquee>A</marquee>
+</div>
+-->
diff --git a/layout/reftests/writing-mode/ua-style-sheet-size-1.html b/layout/reftests/writing-mode/ua-style-sheet-size-1.html
new file mode 100644
index 000000000..754908501
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-size-1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical sizes on marquee elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+marquee { background-color: yellow; color: transparent; }
+</style>
+<div class=ltr>
+ <marquee>A</marquee>
+</div>
+<div class=rtl dir=rtl>
+ <marquee>A</marquee>
+</div>
+<!-- disabled until bug 1132308
+<div class=v-rl>
+ <marquee>A</marquee>
+</div>
+-->
diff --git a/layout/reftests/writing-mode/ua-style-sheet-size-2-ref.html b/layout/reftests/writing-mode/ua-style-sheet-size-2-ref.html
new file mode 100644
index 000000000..3c53326ba
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-size-2-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical margins on marquee elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+marquee { background-color: yellow; color: transparent; }
+.ltr marquee { width: -moz-available; height: 200px; }
+.rtl marquee { width: -moz-available; height: 200px; }
+.v-rl marquee { width: 200px; height: -moz-available; }
+</style>
+<div class=ltr>
+ <marquee direction=down>A</marquee>
+</div>
+<div class=rtl dir=rtl>
+ <marquee direction=down>A</marquee>
+</div>
+<!-- disabled until bug 1132308
+<div class=v-rl>
+ <marquee direction=down>A</marquee>
+</div>
+-->
diff --git a/layout/reftests/writing-mode/ua-style-sheet-size-2.html b/layout/reftests/writing-mode/ua-style-sheet-size-2.html
new file mode 100644
index 000000000..1c0be6f4b
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-size-2.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical sizes on marquee elements in the UA style sheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; padding: 16px; }
+marquee { background-color: yellow; color: transparent; }
+</style>
+<div class=ltr>
+ <marquee direction=down>A</marquee>
+</div>
+<div class=rtl dir=rtl>
+ <marquee direction=down>A</marquee>
+</div>
+<!-- disabled until bug 1132308
+<div class=v-rl>
+ <marquee direction=down>A</marquee>
+</div>
+-->
diff --git a/layout/reftests/writing-mode/ua-style-sheet-textarea-1.html b/layout/reftests/writing-mode/ua-style-sheet-textarea-1.html
new file mode 100644
index 000000000..c55c998d7
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-textarea-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of textarea in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+</style>
+<div class=ltr>
+ <textarea>hello</textarea>
+</div>
+
+<div class=rtl dir=rtl>
+ <textarea>hello</textarea>
+</div>
+
+<div class=v-rl>
+ <textarea>hello</textarea>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-textarea-1a-ref.html b/layout/reftests/writing-mode/ua-style-sheet-textarea-1a-ref.html
new file mode 100644
index 000000000..0fc2b83eb
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-textarea-1a-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of textarea in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+
+.ltr textarea, .rtl textarea {
+ margin: 1px 0;
+ padding: 0 1px;
+}
+.v-rl textarea {
+ margin: 0 1px;
+ padding: 1px 0;
+}
+</style>
+<div class=ltr>
+ <textarea>hello</textarea>
+</div>
+
+<div class=rtl dir=rtl>
+ <textarea>hello</textarea>
+</div>
+
+<div class=v-rl>
+ <textarea>hello</textarea>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-textarea-1b-ref.html b/layout/reftests/writing-mode/ua-style-sheet-textarea-1b-ref.html
new file mode 100644
index 000000000..236b960c5
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-textarea-1b-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of textarea in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+
+.ltr textarea, .rtl textarea {
+ margin: 1px 0;
+ padding: 2px 1px;
+}
+.v-rl textarea {
+ margin: 0 1px;
+ padding: 1px 2px;
+}
+</style>
+<div class=ltr>
+ <textarea>hello</textarea>
+</div>
+
+<div class=rtl dir=rtl>
+ <textarea>hello</textarea>
+</div>
+
+<div class=v-rl>
+ <textarea>hello</textarea>
+</div>
diff --git a/layout/reftests/writing-mode/ua-style-sheet-textarea-1c-ref.html b/layout/reftests/writing-mode/ua-style-sheet-textarea-1c-ref.html
new file mode 100644
index 000000000..0833c0863
--- /dev/null
+++ b/layout/reftests/writing-mode/ua-style-sheet-textarea-1c-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Test for logical properties of textarea in the UA stylesheet</title>
+<style>
+.v-rl { writing-mode: vertical-rl; }
+.ltr, .rtl, .v-rl { border: 1px solid blue; }
+
+/* Vista or later wants 2px padding on textareas by default,
+ see nsNativeThemeWin::GetWidgetPadding(). */
+textarea {
+ padding: 2px;
+}
+.ltr textarea, .rtl textarea {
+ margin: 1px 0;
+}
+.v-rl textarea {
+ margin: 0 1px;
+}
+</style>
+<div class=ltr>
+ <textarea>hello</textarea>
+</div>
+
+<div class=rtl dir=rtl>
+ <textarea>hello</textarea>
+</div>
+
+<div class=v-rl>
+ <textarea>hello</textarea>
+</div>