summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-text/white-space
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-text/white-space')
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/append-whitespace-only-node-crash-001.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-001.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-002.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-003.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-004.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-005.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-006.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-007.html34
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-008.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-009.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-010.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-011.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-051.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-052.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-001.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-002.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-003.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-004.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-005.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-006.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-007.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-008.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-009.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-010.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-011.html42
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-012.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-013.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-014.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-015.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-016.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-017.html42
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-018.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-001.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-002.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-003.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-004.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-005.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-006.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-007.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-008.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-009.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-010.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-011.html42
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-012.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-013.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-014.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-015.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-016.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-017.html42
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-018.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-011.html52
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-012.html52
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-013.html52
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-014.html52
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-015.html52
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-016.html49
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-001.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-002.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-003.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-004.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-005.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-006.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-001.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-002.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-003.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-004.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-005.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-006.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-007.html34
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-008.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-009.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-010.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-001.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-002.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-003.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-004.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-005.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-006.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-007.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-008.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-009.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-010.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-000.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-001.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-002.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-003.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-004.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-005.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-006.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-007.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-008.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-00B.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-00C.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-00D.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-00E.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-00F.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-010.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-011.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-012.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-013.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-014.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-015.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-016.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-017.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-018.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-019.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-01A.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-01B.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-01C.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-01D.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-01E.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-01F.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-07F.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-080.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-081.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-082.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-083.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-084.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-085.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-086.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-087.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-088.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-089.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-08A.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-08B.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-08C.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-08D.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-08E.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-08F.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-090.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-091.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-092.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-093.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-094.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-095.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-096.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-097.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-098.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-099.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-09A.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-09B.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-09C.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-09D.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-09E.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/control-chars-09F.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/display-contents-remove-whitespace-change.html12
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-001.html51
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-002.html74
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-003.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-004.html41
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-001.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-002.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-003.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-004.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-005.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-001.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-002.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/lone-cr-001-ref.html3
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/lone-cr-001.tentative.html10
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/nowrap-wbr-and-space-crash.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/object-replacement-1.html14
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/object-replacement-2.html14
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-float-001.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-line-051.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-line-052.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-line-br-with-whitespace-child-crash.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-line-with-space-and-newline.html44
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-with-whitespace-crash.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-001.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-002.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-003.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-004.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-005.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-006.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-007.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-008.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-009.html40
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-010.html40
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-011.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-012.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-013.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-014.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-015.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-016.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-017.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-018.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-019.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-020.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-051.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-052.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-001.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-002.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-003.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-001.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-002.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-003.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-001.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-002.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-003.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-001.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-002.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-003.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-001.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-002.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-003.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-float-001.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-001.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-002.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-003.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-004.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-005.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-006.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-007.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-008.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-009.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-010.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-011.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-012.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-013.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-014.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-015.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-016.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-017.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-001.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-002.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-003.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-004.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-005.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-006.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-003-ref.html14
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-005-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/control-chars-000-ref.html6
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/control-chars-00D-ref.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-001-ref.html43
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-002-ref.html52
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-003-ref.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-004-ref.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-003-ref.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-004-ref.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/full-width-leading-spaces-001-ref.html6
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-001-ref.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-002-ref.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-1-notref.html13
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-2-notref.html13
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-float-001-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-001-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-012-ref.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-013-ref.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-014-ref.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-018-ref.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-019-ref.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-020-ref.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-001-ref.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-002-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-003-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-001-ref.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-002-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-003-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-001-ref.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-002-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-003-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-float-001-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/tab-bidi-001-ref.html42
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-001-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-002-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-002-ref.html12
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-align-001-ref.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-dynamic-001-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-001-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-002-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-005-ref.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-line-clamp-001-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-001-ref.html11
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-002-ref.html13
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-text-indent-001-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html34
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-014-ref.html5
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-001-ref.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-002-ref.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-003-ref.html11
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-004-ref.html11
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-011-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-003-ref.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-011-ref.html11
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-break-spaces-001-ref.html13
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-ogham-001-ref.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-001-ref.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-002-ref.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-001-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-002-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-009-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-013-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-align-start-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-rtl-001-ref.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-applies-to-text-001-ref.html139
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-discard-001-ref.xht26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-preserve-breaks-001-ref.xht32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-001-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-002-ref.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-003-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-004-ref.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-letter-spacing-001-ref.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-normal-011-ref.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-nowrap-011-ref.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-011-ref.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-031-ref.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-034-ref.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-001-ref.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-002-ref.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-003-ref.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-004-ref.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-001-ref.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-002-ref.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-003-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-004-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-012-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-013-ref.html13
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-014-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-015-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-021-ref.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-012-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-013-ref.html13
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-014-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-015-ref.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-trim-discard-inner-001-ref.xht36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-001-ref.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-002-ref.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-wrap-after-nowrap-001-ref.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-001-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-002-ref.html17
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-001-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-003-ref.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-006-ref.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-012-ref.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html11
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-000.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-001.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-002.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-003.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html97
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-005.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-006.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-007.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-008.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-009.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-010.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-011.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-012.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-014.tentative.html62
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-015.tentative.html98
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-016.tentative.html86
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-017.tentative.html83
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-018.tentative.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-019.tentative.html48
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/support/trailing-space-and-text-alignment.css24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-bidi-001.html45
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-001.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-002.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-003.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-004.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-005.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-006.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-001.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-002.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-align-001.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-dynamic-001.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-001.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-002.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-003.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-004.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-005.html41
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-line-clamp-001.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-narrow-crash.html2
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-001.html15
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-002.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-text-indent-001.html19
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-001.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-002.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-001.html36
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-002.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-003.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-004.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-005.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-006.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-007.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-011.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-012.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-013.html38
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-014.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-001.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-002.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-003.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-004.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-005.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-006.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-007.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-008.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-009.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-010.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-011.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-012.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-013.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-014.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-015.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-016.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-017.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-018.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-019.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-020.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-021.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-022.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-023.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-024.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-025.html33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-001.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-002.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-003.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-004.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-005.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-006.html18
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-007.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-008.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ogham-001.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ogham-002.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-ogham-003.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-001.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-002.html65
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-003.html48
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-004.html47
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-001.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-002.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-003.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-004.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-005.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-006.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-007.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-009.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-010.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-011.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-012.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-013.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-014.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-015.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-align-start.tentative.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-001.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-002.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-003.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-004.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-005.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-before-br-001.html45
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-in-inline-box.html34
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-position-001.html41
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/trailing-space-rtl-001.html24
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-applies-to-text-001.html149
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-collapse-000.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-collapse-001.html66
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-collapse-002.html161
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-collapse-discard-001.xht33
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-collapse-preserve-breaks-001.xht39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-empty-text-sibling.html11
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-001.html46
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-002.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-003.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-004.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-005.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-006.html23
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-013.html85
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-014.html84
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-015.html76
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-016.html84
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-017.html89
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-018.html89
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-019.html81
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-020.html83
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-letter-spacing-001.html40
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-normal-011.html57
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-nowrap-011.html55
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-011.html72
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-031.html75
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-032.html76
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-034.html76
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-035.html76
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-051.html45
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-052.html45
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-001.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-002.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-003.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-004.html31
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-001.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-002.html28
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-003.html22
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-004.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-005.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-006.html32
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-007.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-008.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-010.html30
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-011.html35
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-012.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-013.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-014.html26
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-015.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-021.html63
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-022.html25
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-023.html27
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-trim-discard-inner-001.xht49
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-001.html37
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-002.html29
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-wrap-after-nowrap-001.html39
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-001.html20
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-002.html21
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-001.html77
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-002.html75
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-003.html77
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-005.html76
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-006.html96
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-007.html96
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-008.html104
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-009.html104
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-010.html104
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-011.html97
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-012.html102
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-013.html102
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-014.html96
-rw-r--r--testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-015.html88
538 files changed, 17910 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-text/white-space/append-whitespace-only-node-crash-001.html b/testing/web-platform/tests/css/css-text/white-space/append-whitespace-only-node-crash-001.html
new file mode 100644
index 0000000000..b32555b188
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/append-whitespace-only-node-crash-001.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<link rel="help" href="https://crbug.com/971811">
+<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+ <div id="log"></div>
+<script>
+const strings = [' ', '\t', '\n', '\f', '\r'];
+const whitespace_values = ['normal', 'pre', 'nowrap', 'pre-wrap', 'break-spaces', 'pre-line'];
+const container = document.body;
+for (let whitespace_value of whitespace_values) {
+ for (let string of strings) {
+ test(() => {
+ let div = document.createElement('div');
+ div.style.whiteSpace = whitespace_value;
+ div.textContent = 'test';
+ container.appendChild(div);
+ container.offsetTop; // Force layout
+ div.appendChild(document.createTextNode(string));
+ container.offsetTop; // Force layout
+ }, `Append ${toCodePoints(string)} to 'white-space: ${whitespace_value}'`);
+ }
+}
+
+function toCodePoints(string) {
+ let results = [];
+ for (let ch of string) {
+ let hex = ch.codePointAt(0).toString(16).toUpperCase();
+ hex = ('000' + hex).substr(-4)
+ results.push('U+' + hex);
+ }
+ return results.join(' ');
+}
+</script>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-001.html
new file mode 100644
index 0000000000..f3b881afc1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-001.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of line and white-space is break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is wrapped when the white-space property is set to break-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: break-spaces;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ margin-left: -1ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div> XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-002.html
new file mode 100644
index 0000000000..1fec090991
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-002.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: single preserved white space at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="a single preserved white space at the end of the line is not wrapped when the white-space property is set to break-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: break-spaces;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 2ch;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-003.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-003.html
new file mode 100644
index 0000000000..9ff9180625
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-003.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do not allow a break
+between the last character of a word and the first space of a sequence of preserved spaces
+if there are other wrapping opportunities earlier in the line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XX<span>XX</span><br>X<span>X</span>X<span>X<br>XXXX<br>XXXX</span></div>
+ <div class="test">XX X X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-004.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-004.html
new file mode 100644
index 0000000000..8d7915fccc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-004.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the 'white-space: break-spaces' value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XX</span><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-005.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-005.html
new file mode 100644
index 0000000000..01c760726d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="If 'white-space' is set to 'break-spaces', collapsing preserved white-spaces' advance width is not allowed, so that they can be wrapped honoring the 'white-space' propery.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 10px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 100px;
+
+ white-space: break-spaces;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<span>XXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XX</span>XXXX<span>XXXX</span></div>
+ <div class="test">XXXX XXXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-006.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-006.html
new file mode 100644
index 0000000000..056aa8a21b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-006.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', but the words are broken, honring the 'word-beak: break-all' even though there are previous breaking opportunities in the white-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4.1ch; /* ".1" to cover floating point errors. */
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>X</span>XXX<br>X<span>X</span>XX<br>X<span>XXX</span><br><span>XXXX</span></div>
+ <div class="test"> XXXX XXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-007.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-007.html
new file mode 100644
index 0000000000..4b9df29042
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-007.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A single leading white-space should be used, honoring white-space: break-spaces, to avoid overflow; however, a single preserved white-space at the end of the line cannot be wrapped, hence it overflows when breaking after it to move the rest of the text to the next line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XXXX</span><br>XXXX<br>XXX<span>X</span><br><span>XXXX</span></div>
+ <div class="test"> XXXX XXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-008.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-008.html
new file mode 100644
index 0000000000..4612996c52
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-008.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', which may lead to overfow. However, we can break before the las letter in the word honoring the 'break-all' value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXX<span>X</span><br>X<span>X</span>XX<br><span>XXXX</span><br><span>XXXX</span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-009.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-009.html
new file mode 100644
index 0000000000..58682d6044
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-009.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: word-break:break-word + white-space:break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do allow a break
+between the last character of a word and the first space of a sequence of preserved spaces
+if there are no other wrapping opportunities earlier in the line">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.expected {
+ position: absolute;
+ color: green;
+ width: 100px;
+ height: 100px;
+ white-space: pre;
+}
+.test {
+ background: green;
+ color: red;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="expected">XXXX<br> <br>XXXX<br></div>
+<div class="test">XXXX XXXX </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-010.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-010.html
new file mode 100644
index 0000000000..a72dc67aff
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-010.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-spaces only allows breaking after a white space, hence, a preserved white space may overflow.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="fail">XXXX<br><span>X</span>XX<span>X<br>XXXX<br>XXXX</span></div>
+<div class="test">XXXX XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-011.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-011.html
new file mode 100644
index 0000000000..0355d6d6b5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-011.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: line breaking with white-space: break-spaces and element boundaries</title>
+<link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.1. Line Breaking Details" href="https://drafts.csswg.org/css-text-3/#line-break-details">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="An element boundary doesn't allow breaking if white-space is set to break-spaces at both sides of the boundary">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+.fail span { color: green; }
+.test {
+ color: green;
+ width: 4.1ch; /* ".1" to cover floating point errors. */
+ white-space: break-spaces;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="fail">XXXX<br>X<span>X</span>X<span>X</span><br>XX<span>XX</span><br>X<span>X</span>X<span>X</span></div>
+<div class="test"><span>XXXX</span> X X XX<span> </span><span> </span>X X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-051.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-051.html
new file mode 100644
index 0000000000..2626511808
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-051.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ float: left;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#break-spaces
+ {
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="break-spaces">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-052.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-052.html
new file mode 100644
index 0000000000..28219d55c6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-052.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ display: inline-block;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#break-spaces
+ {
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="break-spaces">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-001.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-001.html
new file mode 100644
index 0000000000..6fd97f39d0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-002.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-002.html
new file mode 100644
index 0000000000..dbafa34816
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-002.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-003.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-003.html
new file mode 100644
index 0000000000..6eb32b57f3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-003.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-004.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-004.html
new file mode 100644
index 0000000000..88c3727c69
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-004.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-005.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-005.html
new file mode 100644
index 0000000000..d4259a13d6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-005.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the overflow-wrap property is not applied.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-006.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-006.html
new file mode 100644
index 0000000000..367d95f9d1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-006.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the overflow-wrap property is not applied.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-007.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-007.html
new file mode 100644
index 0000000000..4534cc96ea
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-007.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-008.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-008.html
new file mode 100644
index 0000000000..4e1e69325b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-008.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-009.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-009.html
new file mode 100644
index 0000000000..bec4520b11
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-009.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-010.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-010.html
new file mode 100644
index 0000000000..4c44d054ab
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-010.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-011.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-011.html
new file mode 100644
index 0000000000..cf1babeb5e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-011.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ word-break: break-all;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-012.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-012.html
new file mode 100644
index 0000000000..52669c2221
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-012.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-013.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-013.html
new file mode 100644
index 0000000000..828058f53d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-013.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-014.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-014.html
new file mode 100644
index 0000000000..6eb32b57f3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-014.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-015.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-015.html
new file mode 100644
index 0000000000..785c2f2a4e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-015.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a preserved white space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the 'overflow-wrap' property is not applied.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-016.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-016.html
new file mode 100644
index 0000000000..bec4520b11
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-016.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-017.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-017.html
new file mode 100644
index 0000000000..9cb8fdbebc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-017.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ word-break: break-all;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X XX X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-018.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-018.html
new file mode 100644
index 0000000000..828058f53d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-char-018.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of preserved white spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-001.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-001.html
new file mode 100644
index 0000000000..733da5334b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a ideographic space character.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-002.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-002.html
new file mode 100644
index 0000000000..faa69b6b01
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-002.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-003.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-003.html
new file mode 100644
index 0000000000..71bb366668
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-003.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-004.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-004.html
new file mode 100644
index 0000000000..9d8829b70e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-004.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a ideographic space character, but it's possible to avoid the overflow honoring the 'word-break' property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-005.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-005.html
new file mode 100644
index 0000000000..0bb0673fd8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-005.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a ideographic space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the overflow-wrap property is not applied.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-006.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-006.html
new file mode 100644
index 0000000000..acd6fa20c6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-006.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a ideographic space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the overflow-wrap property is not applied.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-007.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-007.html
new file mode 100644
index 0000000000..c8c53b5737
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-007.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-008.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-008.html
new file mode 100644
index 0000000000..f3ffdf28d9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-008.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-009.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-009.html
new file mode 100644
index 0000000000..39118f4b4f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-009.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-010.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-010.html
new file mode 100644
index 0000000000..0fb4dccd7f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-010.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-011.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-011.html
new file mode 100644
index 0000000000..6aae96fd7b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-011.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: ideographic space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ word-break: break-all;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-012.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-012.html
new file mode 100644
index 0000000000..bcc68e0385
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-012.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">XXXX&#x3000;XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-013.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-013.html
new file mode 100644
index 0000000000..d888f6c9e4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-013.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">XXXX&#x3000;XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-014.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-014.html
new file mode 100644
index 0000000000..71bb366668
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-014.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the overflow-wrap property, except when there are previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>XXX<br></span>XX<span>X</span>X<br><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-015.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-015.html
new file mode 100644
index 0000000000..02ca9c2d1b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-015.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists only after a ideographic space character, but it's possible to avoid the overflow honoring the 'word-break' property, hence the 'overflow-wrap' property is not applied.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+ word-break: break-all;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>X<span>X<br></span>X<span>X</span>X<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-016.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-016.html
new file mode 100644
index 0000000000..39118f4b4f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-016.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-017.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-017.html
new file mode 100644
index 0000000000..df8a8d58c7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-017.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property " href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" title="5.3. Line Breaking Strictness: the line-break property" href="https://drafts.csswg.org/css-text-3/#propdef-line-break">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the 'line-break' property, ignoring previous breaking opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ line-break: anywhere;
+ word-break: break-all;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">X<span>X</span>XX<br><span>X</span>X<span>XX<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">X&#x3000;XX&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-018.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-018.html
new file mode 100644
index 0000000000..d888f6c9e4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-before-first-ideographic-char-018.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A breaking opportunity exists before the first character of a sequence of ideographic spaces to avoid the line overflow, honoring the overflow-wrap property.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X<br></span><span>XXXX<br></span><span>XXXX<br></span></div>
+ <div class="test">XXXX&#x3000;XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-011.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-011.html
new file mode 100644
index 0000000000..4eb2d8742a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-011.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: break-spaces' with 4 white spaces and 4 line feeda</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="This test checks that when 'white-space' is set to 'break-spaces', then line feeds (&amp;NewLine; in the code) are preserved, just like with 'white-space: pre' or with 'white-space: pre-wrap'.">
+
+ <style>
+ div
+ {
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 4em;
+ }
+
+ div#overlapped-red-reference
+ {
+ background-color: red;
+ height: 4em;
+ }
+
+ div#overlapping-green-test
+ {
+ background-color: green;
+ bottom: 4em;
+ color: red;
+ position: relative;
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="overlapped-red-reference"></div>
+
+ <div id="overlapping-green-test">&NewLine;&NewLine; &NewLine;&NewLine;</div>
+ <!-- ^ ^
+ 4 consecutive white spaces: 1234
+ -->
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-012.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-012.html
new file mode 100644
index 0000000000..50496200a2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-012.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: break-spaces', 10 white spaces and 1 line feed</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="This test checks that when 'white-space' is set to 'break-spaces', then line feeds (&amp;NewLine; in the code) are preserved, just like with 'white-space: pre' or with 'white-space: pre-wrap'.">
+
+ <style>
+ div
+ {
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 4em;
+ }
+
+ div#overlapped-red-reference
+ {
+ background-color: red;
+ height: 4em;
+ }
+
+ div#overlapping-green-test
+ {
+ background-color: green;
+ bottom: 4em;
+ color: red;
+ position: relative;
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="overlapped-red-reference"></div>
+
+ <div id="overlapping-green-test"> &NewLine; </div>
+ <!-- ^ ^ ^
+ 10 white spaces: 1 234567890
+ -->
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-013.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-013.html
new file mode 100644
index 0000000000..af2d0df598
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-013.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: break-spaces', 7 white spaces and 2 line feeds</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="This test checks that when 'white-space' is set to 'break-spaces', then line feeds (&amp;NewLine; in the code) are preserved, just like with 'white-space: pre' or with 'white-space: pre-wrap'.">
+
+ <style>
+ div
+ {
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 4em;
+ }
+
+ div#overlapped-red-reference
+ {
+ background-color: red;
+ height: 4em;
+ }
+
+ div#overlapping-green-test
+ {
+ background-color: green;
+ bottom: 4em;
+ color: red;
+ position: relative;
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="overlapped-red-reference"></div>
+
+ <div id="overlapping-green-test"> &NewLine; &NewLine; </div>
+ <!-- ^ ^ ^ ^
+ 7 white spaces: 1 2 34567
+ -->
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-014.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-014.html
new file mode 100644
index 0000000000..424cb2a261
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-014.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: break-spaces', 4 white spaces and 3 line feeds</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="This test checks that when 'white-space' is set to 'break-spaces', then line feeds (&amp;NewLine; in the code) are preserved, just like with 'white-space: pre' or with 'white-space: pre-wrap'.">
+
+ <style>
+ div
+ {
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 4em;
+ }
+
+ div#overlapped-red-reference
+ {
+ background-color: red;
+ height: 4em;
+ }
+
+ div#overlapping-green-test
+ {
+ background-color: green;
+ bottom: 4em;
+ color: red;
+ position: relative;
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="overlapped-red-reference"></div>
+
+ <div id="overlapping-green-test"> &NewLine; &NewLine; &NewLine; </div>
+ <!-- ^ ^ ^ ^
+ 4 white spaces: 1 2 3 4
+ -->
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-015.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-015.html
new file mode 100644
index 0000000000..bd33269143
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-015.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: break-spaces', 3 white spaces and 3 line feeds</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="This test checks that when 'white-space' is set to 'break-spaces', then line feeds (&amp;NewLine; in the code) are preserved, just like with 'white-space: pre' or with 'white-space: pre-wrap'.">
+
+ <style>
+ div
+ {
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 4em;
+ }
+
+ div#overlapped-red-reference
+ {
+ background-color: red;
+ height: 4em;
+ }
+
+ div#overlapping-green-test
+ {
+ background-color: green;
+ bottom: 4em;
+ color: red;
+ position: relative;
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="overlapped-red-reference"></div>
+
+ <div id="overlapping-green-test">&NewLine; &NewLine; &NewLine; </div>
+ <!-- ^ ^ ^
+ 3 white spaces: 1 2 3
+ -->
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-016.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-016.html
new file mode 100644
index 0000000000..b504983cc6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-newline-016.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: break-spaces' and 4 consecutive line feeds</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="This test checks that when 'white-space' is set to 'break-spaces', then line feeds (&amp;NewLine; in the code) are preserved, just like with 'white-space: pre' or with 'white-space: pre-wrap'.">
+
+ <style>
+ div
+ {
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 4em;
+ }
+
+ div#overlapped-red-reference
+ {
+ background-color: red;
+ height: 4em;
+ }
+
+ div#overlapping-green-test
+ {
+ background-color: green;
+ bottom: 4em;
+ color: red;
+ position: relative;
+ white-space: break-spaces;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="overlapped-red-reference"></div>
+
+ <div id="overlapping-green-test">&NewLine;&NewLine;&NewLine;&NewLine;</div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-001.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-001.html
new file mode 100644
index 0000000000..4b01a60395
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-001.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: wrapping opportunity after break-spaces tabs</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="There is a wrapping opportunity at the end of a sequence of tabs with white-space:break-spaces">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: break-spaces;
+ color: green;
+ width: 16ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>XX&#x09;&#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-002.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-002.html
new file mode 100644
index 0000000000..d86918b75f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-002.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: wrapping opportunity after break-spaces tabs and space</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="There is a wrapping opportunity at the end of a sequence of tabs and spaces with white-space:break-spaces">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: break-spaces;
+ color: green;
+ width: 16ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>XX &#x09; &#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-003.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-003.html
new file mode 100644
index 0000000000..0d762a426a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-003.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: wrapping opportunity after each break-spaces tab</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/break-spaces-tab-003-ref.html">
+<meta name="assert" content="There is a wrapping opportunity after each tab in a sequence with white-space:break-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: break-spaces;
+ color: green;
+ width: 1ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there are two <strong>filled green squares</strong> and <strong>no red</strong>.</p>
+<div id=ref>X<br><br><br><br><br>X</div>
+<div id=test>X&#x09;&#x09;&#x09;&#x09;&#x09;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-004.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-004.html
new file mode 100644
index 0000000000..bee61597fa
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-004.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: wrapping opportunity after each break-spaces space and tab</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/break-spaces-tab-003-ref.html">
+<meta name="assert" content="There is a wrapping opportunity after each tab and space in a sequence with white-space:break-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: break-spaces;
+ color: green;
+ width: 1ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there are two <strong>filled green squares</strong> and <strong>no red</strong>.</p>
+<div id=ref>X<br><br><br><br><br>X</div>
+<div id=test>X&#x09; &#x09;&#x09;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-005.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-005.html
new file mode 100644
index 0000000000..81c39aa27f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-005.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: break-space tabs don't hang</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/break-spaces-tab-005-ref.html">
+<meta name="assert" content="a sequence of break-spaces tabs at the end of a line does not hang.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: break-spaces;
+ color: green;
+ width: 2ch;
+}
+#ref {
+ white-space: pre;
+ width: 2ch;
+ background: red;
+ color: green;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a green rectangle and no red.
+<div id=ref> X<br> X<br>XX<br>XX<br>XX<br>XX<br> </div>
+<div id=test>X<wbr>X&#x09;&#x09;&#x09;&#x09;&#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-006.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-006.html
new file mode 100644
index 0000000000..34df3bfc1b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-tab-006.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: break-spaces tabs and spaces don't hang</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/break-spaces-tab-005-ref.html">
+<meta name="assert" content="a sequence of break-spaces tabs and spaces at the end of a line does not hang, and can wrap after each tab or space.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: break-spaces;
+ color: green;
+ width: 2ch;
+}
+#ref {
+ white-space: pre;
+ width: 2ch;
+ background: red;
+ color: green;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a green rectangle and no red.
+<div id=ref> X<br> X<br>XX<br>XX<br>XX<br>XX<br> </div>
+<div id=test>X<wbr>X&#x09; &#x09;&#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-001.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-001.html
new file mode 100644
index 0000000000..60e0dcae30
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-001.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: ideographic space at the end of line and white-space is break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="ideographic space at the end of the line is wrapped when the white-space property is set to break-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: break-spaces;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ margin-left: -1ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>&#x3000;XX&#x3000;&#x3000;XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-002.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-002.html
new file mode 100644
index 0000000000..9d060e0904
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-002.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do not allow a break
+between the last character of a word and the first space of a sequence of ideographic spaces
+if there are other wrapping opportunities earlier in the line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XX<span>XX</span><br>X<span>X</span>X<span>X<br>XXXX<br>XXXX</span></div>
+ <div class="test">XX&#x3000;X&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-003.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-003.html
new file mode 100644
index 0000000000..9d060e0904
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-003.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do not allow a break
+between the last character of a word and the first space of a sequence of ideographic spaces
+if there are other wrapping opportunities earlier in the line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XX<span>XX</span><br>X<span>X</span>X<span>X<br>XXXX<br>XXXX</span></div>
+ <div class="test">XX&#x3000;X&#x3000;X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-004.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-004.html
new file mode 100644
index 0000000000..c61fcced0d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-004.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the 'white-space: break-spaces' value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XX</span><br>XX</div>
+ <div class="test">&#x3000;XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-005.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-005.html
new file mode 100644
index 0000000000..7df2f06eec
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="If 'white-space' is set to 'break-spaces', collapsing preserved white-spaces' advance width is not allowed, so that they can be wrapped honoring the 'white-space' propery.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 10px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 100px;
+
+ white-space: break-spaces;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<span>XXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XX</span>XXXX<span>XXXX</span></div>
+ <div class="test">XXXX&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;XXXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-006.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-006.html
new file mode 100644
index 0000000000..a04970f984
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-006.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="Ideographic spaces can be wrapped, honoring the 'white-space: break-spaces', but the words are broken, honring the 'word-beak: break-all' even though there are previous breaking opportunities in the white-spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>X</span>XXX<br>X<span>X</span>XX<br>X<span>XXX</span><br><span>XXXX</span></div>
+ <div class="test">&#x3000;XXXX&#x3000;XXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-007.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-007.html
new file mode 100644
index 0000000000..44fb3d2fc6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-007.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A single leading ideographic space should be used as breaking opportunity, honoring white-space: break-spaces, to avoid overflow; however, a single ideographic space at the end of the line cannot be wrapped, hence it overflows when breaking after it to move the rest of the text to the next line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XXXX</span><br>XXXX<br>XXX<span>X</span><br><span>XXXX</span></div>
+ <div class="test">&#x3000;XXXX&#x3000;XXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-008.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-008.html
new file mode 100644
index 0000000000..7102439d46
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-008.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="Ideographic spaces can be wrapped, honoring the 'white-space: break-spaces', which may lead to overfow. However, we can break before the las letter in the word honoring the 'break-all' value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXX<span>X</span><br>X<span>X</span>XX<br><span>XXXX</span><br><span>XXXX</span></div>
+ <div class="test">XXXX&#x3000;XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-009.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-009.html
new file mode 100644
index 0000000000..52bd181af6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-009.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: word-break:break-word + white-space:break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do allow a break
+between the last character of a word and the first space of a sequence of ideographic spaces
+if there are no other wrapping opportunities earlier in the line">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.expected {
+ position: absolute;
+ color: green;
+ width: 100px;
+ height: 100px;
+ white-space: pre;
+}
+.test {
+ background: green;
+ color: red;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="expected">XXXX<br> <br>XXXX<br></div>
+<div class="test">XXXX&#x3000;XXXX&#x3000;</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-010.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-010.html
new file mode 100644
index 0000000000..d59afcf56d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-ideographic-space-010.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-spaces only allows breaking after an ideographic space, hence, it may overflow.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="fail">XXXX<br><span>X</span>XX<span>X<br>XXXX<br>XXXX</span></div>
+<div class="test">XXXX&#x3000;&#x3000;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-001.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-001.html
new file mode 100644
index 0000000000..6912bafee9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-001.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do not allow a break
+between the last character of a word and the first space of a sequence of preserved spaces
+if there are other wrapping opportunities earlier in the line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XX<span>XX</span><br>X<span>X</span>X<span>X<br>XXXX<br>XXXX</span></div>
+ <div class="test">XX X X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-002.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-002.html
new file mode 100644
index 0000000000..caef57ec60
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-002.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="anywhere + break-spaces do not allow a break
+between the last character of a word and the first space of a sequence of preserved spaces
+if there are other wrapping opportunities earlier in the line.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XX<span>XX</span><br>X<span>X</span>X<span>X<br>XXXX<br>XXXX</span></div>
+ <div class="test">XX X X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-003.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-003.html
new file mode 100644
index 0000000000..9f91d085d8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-003.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the 'white-space: break-spaces' value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XX</span><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-004.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-004.html
new file mode 100644
index 0000000000..911cff021a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-004.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the 'white-space: break-spaces' value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XX</span><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-005.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-005.html
new file mode 100644
index 0000000000..9f494da2aa
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-005.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', and the words aren't broken honring the 'overflow-wrap: break-word'.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XXXX</span><br>XXXX<br><span>X</span>XXX<br><span>XXXX</span></div>
+ <div class="test"> XXXX XXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-006.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-006.html
new file mode 100644
index 0000000000..ef3471c16e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-006.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', and the words aren't broken honring the 'overflow-wrap: break-word'.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XXXX</span><br>XXXX<br><span>X</span>XXX<br><span>XXXX</span></div>
+ <div class="test"> XXXX XXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-007.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-007.html
new file mode 100644
index 0000000000..3b2e7fb4d2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-007.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces and Overflow Wrapping</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', but we can break before the first space after a word honoring 'overflow-wrap: break-word'.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X</span><br><span>XXXX</span><br><span>XXXX</span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-008.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-008.html
new file mode 100644
index 0000000000..9826449ecc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-008.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', but we can break before the first space after a word honoring 'overflow-wrap: anywhere'.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X</span><br><span>XXXX</span><br><span>XXXX</span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-009.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-009.html
new file mode 100644
index 0000000000..3b6e764330
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-009.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: word-break:break-word + white-space:break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="break-word + break-spaces do allow a break
+between the last character of a word and the first space of a sequence of preserved spaces
+if there are no other wrapping opportunities earlier in the line">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.expected {
+ position: absolute;
+ color: green;
+ width: 100px;
+ height: 100px;
+ white-space: pre;
+}
+.test {
+ background: green;
+ color: red;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="expected">XXXX<br> <br>XXXX<br></div>
+<div class="test">XXXX XXXX </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-010.html b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-010.html
new file mode 100644
index 0000000000..d479c5e567
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/break-spaces-with-overflow-wrap-010.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: word-break:break-word + white-space:break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="anywhere + break-spaces do allow a break
+between the last character of a word and the first space of a sequence of preserved spaces
+if there are no other wrapping opportunities earlier in the line">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.expected {
+ position: absolute;
+ color: green;
+ width: 100px;
+ height: 100px;
+ white-space: pre;
+}
+.test {
+ background: green;
+ color: red;
+ width: 4ch;
+
+ white-space: break-spaces;
+ overflow-wrap: anywhere;
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="expected">XXXX<br> <br>XXXX<br></div>
+<div class="test">XXXX XXXX </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-000.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-000.html
new file mode 100644
index 0000000000..b038fe9a90
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-000.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0000</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0000, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0000" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-001.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-001.html
new file mode 100644
index 0000000000..e43fda5543
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-001.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0001</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0001, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0001" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-002.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-002.html
new file mode 100644
index 0000000000..a81a30723a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-002.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0002</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0002, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0002" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-003.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-003.html
new file mode 100644
index 0000000000..e0d156a979
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-003.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0003</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0003, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0003" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-004.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-004.html
new file mode 100644
index 0000000000..b33c4475ba
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-004.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0004</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0004, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0004" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-005.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-005.html
new file mode 100644
index 0000000000..d14e86b80b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-005.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0005</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0005, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0005" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-006.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-006.html
new file mode 100644
index 0000000000..2b05272fec
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-006.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0006</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0006, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0006" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-007.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-007.html
new file mode 100644
index 0000000000..60587d9abd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-007.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0007</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0007, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0007" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-008.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-008.html
new file mode 100644
index 0000000000..fbe91aae05
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-008.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0008</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0008, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0008" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-00B.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-00B.html
new file mode 100644
index 0000000000..6cdf0b35cf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-00B.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+000B</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+000B, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\000B" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-00C.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-00C.html
new file mode 100644
index 0000000000..db20bc7205
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-00C.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+000C</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+000C, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\000C" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-00D.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-00D.html
new file mode 100644
index 0000000000..7a85cc8813
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-00D.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>U+000D must be treated the same as U+0020</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=match href="reference/control-chars-00D-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+000D must be treated as U+0020">
+<style>
+div {
+ font-size: 2em;
+ font-family: monospace;
+ color: blue;
+ width: 4ch;
+}
+#ref {
+ color: orange;
+}
+.p {white-space: pre;}
+.pw {white-space: pre-wrap;}
+.pl {white-space: pre-line;}
+.bs {white-space: break-spaces;}
+.nw {white-space: nowrap;}
+</style>
+
+<p>Test passes if blue charaters are arranged exactly in the same way as the orange ones.
+
+<div>A&#x0D;&#x0D;&#x0D;&#x0D;&#x0D;&#x0D;B&#x0D;C<span class=p>&#x0D;&#x0D;&#x0D;</span>D<span class=pw>&#x0D;&#x0D;&#x0D;</span>E<span class=pl>&#x0D;&#x0D;&#x0D;&#x0D;&#x0D;&#x0D;</span>F<span class=bs>&#x0D;&#x0D;&#x0D;</span>G<span class=nw>&#x0D;&#x0D;&#x0D;&#x0D;&#x0D;</span>H</div>
+
+<div id=ref>A B C<span class=p> </span>D<span class=pw> </span>E<span class=pl> </span>F<span class=bs> </span>G<span class=nw> </span>H</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-00E.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-00E.html
new file mode 100644
index 0000000000..826b4bb0d6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-00E.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+000E</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+000E, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\000E" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-00F.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-00F.html
new file mode 100644
index 0000000000..53618a8b79
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-00F.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+000F</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+000F, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\000F" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-010.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-010.html
new file mode 100644
index 0000000000..52c6638769
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-010.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0010</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0010, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0010" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-011.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-011.html
new file mode 100644
index 0000000000..8aa8d94b91
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-011.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0011</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0011, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0011" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-012.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-012.html
new file mode 100644
index 0000000000..9300ae3a90
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-012.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0012</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0012, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0012" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-013.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-013.html
new file mode 100644
index 0000000000..f0e2b547ce
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-013.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0013</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0013, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0013" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-014.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-014.html
new file mode 100644
index 0000000000..e8c776a9d7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-014.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0014</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0014, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0014" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-015.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-015.html
new file mode 100644
index 0000000000..718909dd47
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-015.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0015</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0015, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0015" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-016.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-016.html
new file mode 100644
index 0000000000..2ba460c03c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-016.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0016</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0016, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0016" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-017.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-017.html
new file mode 100644
index 0000000000..b4c96ca652
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-017.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0017</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0017, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0017" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-018.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-018.html
new file mode 100644
index 0000000000..3a4c59e18a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-018.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0018</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0018, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0018" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-019.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-019.html
new file mode 100644
index 0000000000..9517e79e4a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-019.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0019</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0019, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0019" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-01A.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-01A.html
new file mode 100644
index 0000000000..4f61bcb753
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-01A.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+001A</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+001A, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\001A" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-01B.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-01B.html
new file mode 100644
index 0000000000..fe9842b9ac
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-01B.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+001B</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+001B, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\001B" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-01C.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-01C.html
new file mode 100644
index 0000000000..aadc1a9138
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-01C.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+001C</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+001C, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\001C" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-01D.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-01D.html
new file mode 100644
index 0000000000..266d30084e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-01D.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+001D</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+001D, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\001D" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-01E.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-01E.html
new file mode 100644
index 0000000000..8cd3ddff51
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-01E.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+001E</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+001E, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\001E" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-01F.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-01F.html
new file mode 100644
index 0000000000..61db980951
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-01F.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+001F</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+001F, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\001F" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-07F.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-07F.html
new file mode 100644
index 0000000000..27d5f02c4b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-07F.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+007F</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+007F, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\007F" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-080.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-080.html
new file mode 100644
index 0000000000..ceedd01361
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-080.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0080</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0080, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0080" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-081.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-081.html
new file mode 100644
index 0000000000..0e16b01046
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-081.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0081</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0081, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0081" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-082.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-082.html
new file mode 100644
index 0000000000..c8461a7b2e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-082.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0082</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0082, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0082" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-083.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-083.html
new file mode 100644
index 0000000000..ec723809ff
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-083.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0083</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0083, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0083" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-084.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-084.html
new file mode 100644
index 0000000000..2493681738
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-084.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0084</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0084, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0084" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-085.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-085.html
new file mode 100644
index 0000000000..52dba2a1b6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-085.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0085</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0085, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0085" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-086.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-086.html
new file mode 100644
index 0000000000..39b132c588
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-086.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0086</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0086, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0086" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-087.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-087.html
new file mode 100644
index 0000000000..2320088a7f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-087.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0087</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0087, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0087" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-088.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-088.html
new file mode 100644
index 0000000000..12acc23325
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-088.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0088</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0088, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0088" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-089.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-089.html
new file mode 100644
index 0000000000..367503c88c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-089.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0089</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0089, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0089" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-08A.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-08A.html
new file mode 100644
index 0000000000..1a21992d97
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-08A.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+008A</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+008A, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\008A" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-08B.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-08B.html
new file mode 100644
index 0000000000..1ed441a455
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-08B.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+008B</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+008B, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\008B" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-08C.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-08C.html
new file mode 100644
index 0000000000..0c63ee54b6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-08C.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+008C</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+008C, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\008C" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-08D.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-08D.html
new file mode 100644
index 0000000000..e908f8e1a8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-08D.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+008D</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+008D, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\008D" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-08E.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-08E.html
new file mode 100644
index 0000000000..55e87a556b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-08E.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+008E</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+008E, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\008E" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-08F.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-08F.html
new file mode 100644
index 0000000000..2d9bac9730
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-08F.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+008F</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+008F, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\008F" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-090.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-090.html
new file mode 100644
index 0000000000..c93258878c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-090.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0090</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0090, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0090" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-091.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-091.html
new file mode 100644
index 0000000000..a21f8779ad
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-091.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0091</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0091, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0091" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-092.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-092.html
new file mode 100644
index 0000000000..5304eac57e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-092.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0092</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0092, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0092" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-093.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-093.html
new file mode 100644
index 0000000000..a092e87306
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-093.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0093</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0093, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0093" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-094.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-094.html
new file mode 100644
index 0000000000..9005e8d098
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-094.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0094</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0094, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0094" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-095.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-095.html
new file mode 100644
index 0000000000..6befbaa1bb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-095.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0095</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0095, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0095" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-096.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-096.html
new file mode 100644
index 0000000000..75e69d976b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-096.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0096</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0096, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0096" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-097.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-097.html
new file mode 100644
index 0000000000..8a2c4467ae
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-097.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0097</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0097, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0097" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-098.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-098.html
new file mode 100644
index 0000000000..47e097789b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-098.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0098</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0098, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0098" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-099.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-099.html
new file mode 100644
index 0000000000..73a6ea6f22
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-099.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+0099</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+0099, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\0099" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-09A.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-09A.html
new file mode 100644
index 0000000000..b34f9dc146
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-09A.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+009A</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+009A, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\009A" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-09B.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-09B.html
new file mode 100644
index 0000000000..4c5fcdd45a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-09B.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+009B</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+009B, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\009B" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-09C.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-09C.html
new file mode 100644
index 0000000000..6056a1c3de
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-09C.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+009C</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+009C, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\009C" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-09D.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-09D.html
new file mode 100644
index 0000000000..850d2696c4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-09D.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+009D</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+009D, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\009D" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-09E.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-09E.html
new file mode 100644
index 0000000000..9613f9d01e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-09E.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+009E</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+009E, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\009E" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/control-chars-09F.html b/testing/web-platform/tests/css/css-text/white-space/control-chars-09F.html
new file mode 100644
index 0000000000..44f6f83f2d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/control-chars-09F.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Control charcters must be visible: U+009F</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel=help href="https://drafts.csswg.org/css-text-3/#white-space-processing">
+<link rel=mismatch href="reference/control-chars-000-ref.html">
+<meta name=flags content="">
+<meta name=assert content="U+009F, which is in the unicode category CC, must be visible">
+<style>
+div {
+ font-size: 4em;
+}
+div::after { content: "\009F" } /* Injecting via CSS, to avoid any mangling by the html parser */
+</style>
+
+<p>Test passes if there is a visible character below.
+
+<div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/display-contents-remove-whitespace-change.html b/testing/web-platform/tests/css/css-text/white-space/display-contents-remove-whitespace-change.html
new file mode 100644
index 0000000000..baf42aa3a8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/display-contents-remove-whitespace-change.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Remove display:contents with block child and whitespace sibling</title>
+<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
+<link rel="match" href="../../reference/pass_if_two_words.html">
+<p>There should be a space between "two" and "words" below.</p>
+two<div id="rm" style="display:contents"><div></div></div> <span>words</span>
+<script>
+ rm.offsetTop;
+ rm.remove();
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-001.html b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-001.html
new file mode 100644
index 0000000000..570f22de7b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-001.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text 3 test: trailing collapsible spaces and bidi</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/eol-spaces-bidi-001-ref.html">
+<meta name="assert" content="Space before a line break is removed even if reordered to the middle of line by bidi reordering">
+
+<style>
+@font-face {
+ font-family: "Hasubi Mono";
+ src: url("/fonts/hasubi-mono/HasubiMono-Regular.woff2");
+}
+
+div {
+ font-family: "Hasubi Mono", monospace;
+ border: solid blue;
+ font-size: 1.5em;
+}
+.ref {
+ border-color: orange;
+ white-space: pre;
+}
+.w5 { width: 5.01ch; } /* .01 to cover floating point errors */
+.w6 { width: 6.01ch; }
+.w7 { width: 7.01ch; }
+
+.blue { background: #aaaaff; }
+.red { background: #ffaaaa; }
+.green { background: #aaffaa; }
+.pink { background: #ffaaff; }
+.yellow { background: #ffffaa; }
+</style>
+
+<p>Test passes if each pair of blue / orange boxes are identical (except for the color of their border).
+
+<div class=w5><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
+
+<div class="w5 ref">A<span class=blue> </span>B<span class=red> </span>ا<br>ب</div>
+
+<hr>
+
+<div class=w6><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
+
+<div class="w6 ref">A<span class=blue> </span>B<span class=red> </span>ا<br>ب</div>
+
+<hr>
+
+<div class=w7><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
+
+<div class="w7 ref">A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-002.html b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-002.html
new file mode 100644
index 0000000000..47a1952832
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-002.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text 3 test: trailing pre-wrap spaces and bidi</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://www.w3.org/TR/css-writing-modes/#text-direction">
+<link rel="help" href="http://www.unicode.org/reports/tr9/#L1">
+<link rel="match" href="reference/eol-spaces-bidi-002-ref.html">
+<meta name="assert" content="Use UAX9L1 to determine which space is at the end of the line, taking into account that such spaces, when pre-wrap, must hang.">
+
+<style>
+@font-face {
+ font-family: "Hasubi Mono";
+ src: url("/fonts/hasubi-mono/HasubiMono-Regular.woff2");
+}
+
+div {
+ font-family: "Hasubi Mono", monospace;
+ border: solid blue;
+ font-size: 1.5em;
+ white-space: pre-wrap;
+}
+.ref {
+ border-color: orange;
+ white-space: pre;
+}
+.w6 { width: 6.01ch; } /* .01 to cover floating point errors */
+.w7 { width: 7.01ch; }
+.w8 { width: 8.01ch; }
+.w9 { width: 9.01ch; }
+
+.blue { background: #aaaaff; }
+.red { background: #ffaaaa; }
+.green { background: #aaffaa; }
+.pink { background: #ffaaff; }
+.yellow { background: #ffffaa; }
+</style>
+
+<p>Test passes if each pair of blue / orange boxes are identical (except for the color of their border).
+
+
+<!-- not coloring the space between ا and ب in this particular case,
+ because per UAX9 L1 and css-text-3 4.1.2 point 4 bullet 2:
+ this space MUST be at the end of the line and hang,
+ but also the UA MAY collapse it's advance width.
+ Not giving it a color lets the test pass either way.
+-->
+
+<div class="w6"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span> </span>ب<span class=yellow> </span></div>
+<div class="w6 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<br>ب<span class=yellow> </span></div>
+
+<hr>
+
+<div class="w7"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
+<div class="w7 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span><br>ب<span class=yellow> </span></div>
+
+<hr>
+
+<!-- not coloring the last space in this particular case,
+ because per 4.1.2 point 4 bullet 2:
+ this space MUST hang,
+ but also the UA MAY collapse it's advance width.
+ So we know for sure it won't cause a line break,
+ but it may or may not be visible at the end of the line.
+ Not giving it a color lets the test pass either way.
+-->
+
+<div class="w8"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span> </span></div>
+<div class="w8 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div>
+
+<hr>
+
+<div class="w9"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
+<div class="w9 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-003.html b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-003.html
new file mode 100644
index 0000000000..4161c95514
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-003.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CSS Text 3 test: trailing collapsible spaces and bidi</title>
+<link rel="author" title="Jose Dapena Paz" href="mailto:jdapena@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/eol-spaces-bidi-003-ref.html">
+<link rel="match" href="reference/eol-spaces-bidi-alt-003-ref.html">
+<meta name="assert" content="Hanging space between OP and D should take paragraph direction and show in the end of the line (blue box to the left)">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+ div {
+ direction: rtl;
+
+ font: 20px/1 Ahem;
+ margin-left: 20px;
+ background: green;
+
+ width: 4ch;
+ white-space: pre-wrap;
+ }
+ span {
+ background: blue;
+ }
+</style>
+<p>Test passes if a blue box (the white space) is visible at the left start in first line.</p>
+<div>ب <span>OP</span><span> </span>D</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-004.html b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-004.html
new file mode 100644
index 0000000000..6d3ef99887
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/eol-spaces-bidi-004.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Text 3 test: trailing collapsible spaces and bidi</title>
+<link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/eol-spaces-bidi-004-ref.html">
+<link rel="match" href="reference/eol-spaces-bidi-alt-004-ref.html">
+<meta name="assert" content="Hanging space should take paragraph direction and show at the end of the line (blue box to the left)">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+ div#test {
+ direction: rtl;
+ text-align: left;
+
+ font: 20px/1 Ahem;
+ margin-left: 20px;
+ background: green;
+ color: red;
+
+ width: 4ch;
+ white-space: pre-wrap;
+ }
+ span {
+ background: blue;
+ }
+ #green-cover {
+ position: absolute;
+ margin-left: 20px;
+ width: 60px;
+ height: 40px;
+ background:
+ linear-gradient(green, green) 0 0 / 60px 20px no-repeat,
+ linear-gradient(green, green) 0 20px / 20px 20px no-repeat;
+ z-index: 1;
+ }
+</style>
+<p>Test passes if a blue box (the white space) is visible at the left start in first line and <strong>no red</strong> is shown.</p>
+<div id="green-cover"></div>
+<div id="test"><span>XXX </span>X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-001.html
new file mode 100644
index 0000000000..c23e4fdbc7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-001.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/full-width-leading-spaces-001-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) sequence at the beginning of the line must not be collapsed.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div { font: 20px/1 Ahem; }
+.test {
+ width: 5em;
+ color: green;
+ background: green;
+}
+.ref {
+ position: absolute;
+ z-index: -1;
+ color: red;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in a green rectangle and if there is no red.
+<div class="ref">XXXXX</div>
+<div class="test">&#x3000;&#x3000;&#x3000;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-002.html
new file mode 100644
index 0000000000..610e5ae463
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-002.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) sequence at the beginning of the line must not be collapsed.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div { font: 50px/1 Ahem; }
+.test {
+ width: 2em;
+ color: green;
+ background: green;
+}
+.ref {
+ position: absolute;
+ z-index: -1;
+ color: red;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div class="test">&#x3000;&#x3000;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-003.html b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-003.html
new file mode 100644
index 0000000000..610e5ae463
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-003.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) sequence at the beginning of the line must not be collapsed.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div { font: 50px/1 Ahem; }
+.test {
+ width: 2em;
+ color: green;
+ background: green;
+}
+.ref {
+ position: absolute;
+ z-index: -1;
+ color: red;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div class="test">&#x3000;&#x3000;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-004.html b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-004.html
new file mode 100644
index 0000000000..f52ae6254c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-004.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Ideographic space sequences at the end of line must hang, and therefore not be taken into account for min content sizing.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.ref {
+ width: 100px;
+ height: 100px;
+ background: green;
+}
+.test {
+ width: min-content;
+ font-size: 100px;
+ line-height: 1;
+ background: red;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"><div class="test">&#x03000;</div></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-005.html b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-005.html
new file mode 100644
index 0000000000..8fd86a9002
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/full-width-leading-spaces-005.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="There is a breaking opportunity at the end of a leading ideographic space (U+3000) sequence.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div { font: 50px/1 Ahem; }
+.test {
+ width: 2em;
+ color: green;
+ background: green;
+}
+.ref {
+ position: absolute;
+ z-index: -1;
+ color: red;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div class="test">&#x3000;&#x3000;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-001.html b/testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-001.html
new file mode 100644
index 0000000000..3c5e7052a2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-001.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+<meta charset=utf-8>
+<link rel="author" title="Mike Bremford" href="mailto:mike@bfo.com">
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/line-edge-white-space-collapse-001-ref.html">
+<title>White space collapse at end of line collapses through an inline</title>
+<style>
+div { font: 30px/30px monospace; }
+span span { border-left: 30px solid green }
+aside {
+ font: 30px/30px monospace;
+ width: 30px;
+ background: red;
+ position: absolute;
+ z-index:-1;
+ height: 300px;
+
+ /* to avoid accidental bleeding at the edges by a pixel or a sub pixel*/
+ box-sizing: border-box;
+ border: solid white 5px;
+ margin-left: 1ch;
+}
+</style>
+
+<p>Test passes if there is a single green rectangle next to ABCDEFGHIJ, and no red.
+
+<aside></aside>
+<div><span>A <span> </span> </span></div>
+<div><span>B <span> </span> </span></div>
+<div><span>C <span> </span> </span></div>
+<div><span>D <span> </span></span></div>
+<div><span>E <span> </span> </span></div>
+<div><span>F <span> </span> </span></div>
+<div><span>G <span> </span></span></div>
+<div><span>H<span> </span> </span></div>
+<div><span>I<span> </span></span></div>
+<div><span>J<span></span></span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-002.html b/testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-002.html
new file mode 100644
index 0000000000..940d77abe2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/line-edge-white-space-collapse-002.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+<meta charset=utf-8>
+<link rel="author" title="Mike Bremford" href="mailto:mike@bfo.com">
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/line-edge-white-space-collapse-002-ref.html">
+<title>White space collapse at start of line collapses through an inline</title>
+<style>
+div { font: 30px/30px monospace; }
+span span { border-left: 30px solid green }
+aside {
+ font: 30px/30px monospace;
+ width: 30px;
+ background: red;
+ position: absolute;
+ z-index:-1;
+ height: 300px;
+
+ /* to avoid accidental bleeding at the edges by a pixel or a sub pixel*/
+ box-sizing: border-box;
+ border: solid white 5px;
+}
+</style>
+
+<p>Test passes if there is a single green rectangle, and no red. The letters KLMNOPQRST must be immediately to its right, vertically aligned with each other.
+
+<aside></aside>
+<div><span> <span> </span> K</span></div>
+<div><span> <span> </span> L</span></div>
+<div><span> <span> </span> M</span></div>
+<div><span><span> </span> N</span></div>
+<div><span> <span> </span> O </span></div>
+<div><span> <span> </span> P</span></div>
+<div><span><span> </span> Q</span></div>
+<div><span> <span> </span>R</span></div>
+<div><span><span> </span>S</span></div>
+<div><span><span></span>T</span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/lone-cr-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/lone-cr-001-ref.html
new file mode 100644
index 0000000000..943daefee0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/lone-cr-001-ref.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<p>A B</p>
diff --git a/testing/web-platform/tests/css/css-text/white-space/lone-cr-001.tentative.html b/testing/web-platform/tests/css/css-text/white-space/lone-cr-001.tentative.html
new file mode 100644
index 0000000000..ed5ff05a70
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/lone-cr-001.tentative.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>Lone CR shouldn't cause previous spaces to collapse</title>
+<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.org" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1657437">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/855#issuecomment-380435969">
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5410">
+<link rel="match" href="lone-cr-001-ref.html">
+<p>A &#013;B</p>
diff --git a/testing/web-platform/tests/css/css-text/white-space/nowrap-wbr-and-space-crash.html b/testing/web-platform/tests/css/css-text/white-space/nowrap-wbr-and-space-crash.html
new file mode 100644
index 0000000000..6a58083e35
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/nowrap-wbr-and-space-crash.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=950209">
+<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+div {
+ white-space: nowrap;
+ width: 3ch;
+}
+</style>
+<body>
+ <div>12345<wbr> 678</div>
+<script>
+test(() => {
+ document.body.offsetTop;
+});
+</script>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/object-replacement-1.html b/testing/web-platform/tests/css/css-text/white-space/object-replacement-1.html
new file mode 100644
index 0000000000..0192dfef69
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/object-replacement-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>CSS Text: U+FFFC OBJECT REPLACEMENT CHARACTER presence</title>
+<link rel="author" title="Myles C. Maxfield" href="mailto:mmaxfield@apple.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/">
+<link rel="mismatch" href="reference/object-replacement-1-notref.html">
+</head>
+<body>
+This test makes sure that the U+FFFC OBJECT REPLACEMENT CHARACTER doesn't get deleted. The test passes if the letter below isn't at the left edge of the green box.
+<div style="background: green; font-size: 100px; height: 300px;">&#xFFFC;e&#x0301;<span style="display: inline-block; height: 200px; width: 1px;"></span></div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/object-replacement-2.html b/testing/web-platform/tests/css/css-text/white-space/object-replacement-2.html
new file mode 100644
index 0000000000..14c5e3ba35
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/object-replacement-2.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>CSS Text: U+FFFC OBJECT REPLACEMENT CHARACTER presence</title>
+<link rel="author" title="Myles C. Maxfield" href="mailto:mmaxfield@apple.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/">
+<link rel="mismatch" href="reference/object-replacement-2-notref.html">
+</head>
+<body>
+This test makes sure that the U+FFFC OBJECT REPLACEMENT CHARACTER doesn't get deleted. The test passes if the letter below isn't at the left edge of the green box.
+<div style="background: green; font-size: 100px; height: 300px;">&#xFFFC;e<span style="display: inline-block; height: 200px; width: 1px;"></span></div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-float-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-float-001.html
new file mode 100644
index 0000000000..8dd08d8099
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-float-001.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>CSS test preserved spaces and floats interaction</title>
+<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
+<link rel="match" href="reference/pre-float-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+html {
+ font-family: Ahem;
+ font-size: 20px;
+ line-height: 1;
+}
+.container {
+ white-space: pre;
+ width: 10ch;
+ margin-bottom: 1em;
+}
+.float {
+ float: left;
+ width: 3ch;
+ height: 2em;
+ background: orange;
+}
+</style>
+<body>
+ <div class="float"></div>
+ <div class="container">123456 <br>123456</div>
+ <div class="float"></div>
+ <div class="container">1234567 <br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567 <br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567 <br>1234567</div>
+ <div class="float"></div>
+ <div class="container">12345678 <br>12345678</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-line-051.html b/testing/web-platform/tests/css/css-text/white-space/pre-line-051.html
new file mode 100644
index 0000000000..2a918fc28e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-line-051.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ float: left;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#pre-line
+ {
+ white-space: pre-line;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="pre-line">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-line-052.html b/testing/web-platform/tests/css/css-text/white-space/pre-line-052.html
new file mode 100644
index 0000000000..76eea85972
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-line-052.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ display: inline-block;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#pre-line
+ {
+ white-space: pre-line;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="pre-line">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-line-br-with-whitespace-child-crash.html b/testing/web-platform/tests/css/css-text/white-space/pre-line-br-with-whitespace-child-crash.html
new file mode 100644
index 0000000000..c7e1855f97
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-line-br-with-whitespace-child-crash.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<title>CSS Text Test: Chrome pre-line crash test</title>
+<link rel="help" href="https://crbug.com/989827">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+ br { white-space: pre-line }
+</style>
+<script>
+ test(() => {
+ document.documentElement.remove();
+ const br = document.createElement("br");
+ br.appendChild(document.createTextNode(""));
+ document.appendChild(br);
+ br.offsetTop;
+ br.firstChild.data = " ";
+ }, "Modifying data of a text child of a root br element with pre-line should not crash.");
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-line-with-space-and-newline.html b/testing/web-platform/tests/css/css-text/white-space/pre-line-with-space-and-newline.html
new file mode 100644
index 0000000000..5d75597d83
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-line-with-space-and-newline.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: 'white-space: pre-line' with space and newline</title>
+<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text/#white-space-phase-1">
+<link rel="help" href="https://crbug.com/1136688">
+<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
+<meta name="assert" content="
+ Checks that collapsible spaces immediately preceding a sequent break are removed.
+ That still applies if they are separated into different inline elements.
+ Also, if some text is inserted dynamically, the browser should not crash.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+span {
+ font: 25px/1 Ahem;
+ background: red;
+ color: green;
+}
+i {
+ white-space: pre-line;
+}
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div class="static together">
+ <span>XXXXXXXX<i> &#10;</i>XXXXXXXX</span>
+</div>
+<div class="static separated">
+ <span>XXXXXXXX<i> </i><i>&#10;</i>XXXXXXXX</span>
+</div>
+<div class="dynamic together">
+ <span>XXXXXXXX<i> &#10;</i></span>
+</div>
+<div class="dynamic separated">
+ <span>XXXXXXXX<i> </i><i>&#10;</i></span>
+</div>
+<script>
+// Force layout
+document.body.offsetLeft;
+
+// Insert text, should not crash
+for (let span of document.querySelectorAll(".dynamic > span")) {
+ span.append("XXXXXXXX");
+}
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-with-whitespace-crash.html b/testing/web-platform/tests/css/css-text/white-space/pre-with-whitespace-crash.html
new file mode 100644
index 0000000000..89e5c3a71f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-with-whitespace-crash.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+<head>
+ <title>pre(white-space's one of values) crash if there is no available width</title>
+ <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=999863">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>test(()=>{})</script>
+</head>
+<body>
+ abc<b style="margin-left: 100%; white-space: pre;">def</b>
+ <div>
+ <li>
+ <a href="dummy">success if does not crash</a>
+ </li>
+ </div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-001.html
new file mode 100644
index 0000000000..87ffad9631
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-001.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap is not wrapped</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-002.html
new file mode 100644
index 0000000000..e35c65f300
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-002.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of the line and white-space:pre-wrap does not change based on word-break:break-all</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if word-break is break-all">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-003.html
new file mode 100644
index 0000000000..6c4524d4d1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-003.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on word-break:keep-all</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if word-break is keep-all.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ word-break: keep-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-004.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-004.html
new file mode 100644
index 0000000000..cdaf900e3b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-004.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on line-break:loose</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if line-break is loose.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ line-break: loose;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-005.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-005.html
new file mode 100644
index 0000000000..8c91a11c5f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-005.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on line-break:normal</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if line-break is normal.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ line-break: normal;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-006.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-006.html
new file mode 100644
index 0000000000..8da2926819
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-006.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on line-break:strict</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if line-break is strict.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ line-break: strict;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-007.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-007.html
new file mode 100644
index 0000000000..32fe4f3354
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-007.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on overflow-wrap:break-word</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if overflow-wrap is break-word.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ word-wrap: break-word; /* deprecated alias */
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-008.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-008.html
new file mode 100644
index 0000000000..e2faf3671c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-008.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="The word is not broken despite the 'word-break: break-word' if there are previous breaking opportunities, honoring the white-space: pre-wrap value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+}
+.red {
+ position: absolute;
+ background: green;
+ color: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+ white-space: pre;
+}
+.test {
+ color: green;
+ line-height: 1em;
+ width: 5ch;
+
+ white-space: pre-wrap;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"> XX <br>XXX</div>
+ <div class="test"> XX XXX </div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-009.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-009.html
new file mode 100644
index 0000000000..0912a2d3a1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-009.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="The word is not broken despite the 'word-break: break-word' if there are previous breaking opportunities, honoring the white-space: pre-wrap value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+}
+.red {
+ position: absolute;
+ background: green;
+ color: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+ white-space: pre;
+}
+.test {
+ color: green;
+ line-height: 1em;
+ width: 5ch;
+
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"> XX <br>XXX</div>
+ <div class="test"> XX XXX </div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-010.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-010.html
new file mode 100644
index 0000000000..71d169c65c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-010.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property " href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the white-space: pre-wrap value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+}
+.red {
+ position: absolute;
+ white-space: pre;
+ background: green;
+ color: red;
+ width: 40px;
+ height: 40px;
+ z-index: -1;
+}
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-011.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-011.html
new file mode 100644
index 0000000000..9945e3ae2d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-011.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not cause wrapping</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="When the white-space property is set to pre-wrap, preserved white space at the end of the line must hang or be collapsed, and must not cause preceeding content to be wrapped.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 3ch;
+ margin-left: -1ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div> XX&#x20;
+ XX </div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-012.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-012.html
new file mode 100644
index 0000000000..e844d97860
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-012.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of soft-wrapped lines and white-space:pre-wrap with right alignement</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-012-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, spaces at the end of soft-wrapped lines hang, so they do not have any effect when right-aligning.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 3ch;
+ text-align: right;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-013.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-013.html
new file mode 100644
index 0000000000..23c4b536cd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-013.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of soft-wrapped lines and white-space:pre-wrap with center alignement</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-013-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, spaces at the end of soft-wrapped lines hang, so they do not have any effect when centering.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0.5ch 0/2ch 2ch no-repeat;
+
+ width: 3ch;
+ text-align: center;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-014.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-014.html
new file mode 100644
index 0000000000..26423c1928
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-014.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of soft-wrapped lines and white-space:pre-wrap with justification</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-014-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, spaces at the end of soft-wrapped lines hang, so they do not have any effect when justifying.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ height: 1em;
+ white-space: pre-wrap;
+
+ color: transparent;
+ background: red;
+
+ width: 4ch;
+ text-align: justify;
+}
+span {
+ color: green;
+ background: green;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green rectangle</strong> and <strong>no red</strong>.</p>
+ <div><span>X X</span> X</div>
+ <!-- invisible last line, because justification works on non-last lines-->
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-015.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-015.html
new file mode 100644
index 0000000000..3d03260eb3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-015.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The text is broken at the end of the space between the two words, never before, so it hangs and cause an overflow">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+.test {
+ color: green;
+ width: 20px;
+
+ white-space: pre-wrap;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="ref">X<span style="color: green">X</span><br>X<span style="color: green">X</span></div>
+ <div class="test">X X</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-016.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-016.html
new file mode 100644
index 0000000000..0590f669e9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-016.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the white-space: pre-wrap value.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+}
+.red {
+ position: absolute;
+ white-space: pre;
+ background: green;
+ color: red;
+ width: 40px;
+ height: 40px;
+ z-index: -1;
+}
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: pre-wrap;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-017.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-017.html
new file mode 100644
index 0000000000..541e1abe57
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-017.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: pre-wrap trailing spaces and max-content</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, trailing spaces spaces are taken into account for max-content">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+#red {
+ position: absolute;
+ z-index:-1;
+ width: 40px;
+ height: 40px;
+ background: red;
+}
+#test {
+ margin-left: -1em;
+ font: 40px/1 Ahem;
+ color: white;
+ background: green;
+ width: max-content;
+ white-space: pre-wrap
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+
+<div id=red></div>
+<div id=test>X&#x0020;</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-018.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-018.html
new file mode 100644
index 0000000000..f911b2dcde
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-018.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: pre-wrap spaces and centering</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-018-ref.html">
+<meta name="assert" content="conditionally hanging white space at the end of lines with forced breaks provides symmetry with the start of the line">
+<style>
+div {
+ font-size: 2rem;
+ margin: 1rem;
+}
+#test {
+ white-space: pre-wrap;
+ width: 5ch;
+ border: solid 1px;
+ font-family: monospace;
+ text-align: center;
+ text-decoration: underline;
+}
+
+#ref {
+ white-space: pre;
+ width: 5ch;
+ border: solid 1px;
+ font-family: monospace;
+}
+#ref span {
+ text-decoration: underline;
+}
+
+</style>
+
+<p>Test passes if the two boxes below are identical.
+
+<div id=test> 0 </div>
+<div id=ref> <span> 0 </span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-019.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-019.html
new file mode 100644
index 0000000000..58dae9f500
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-019.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: trailing pre-wrap spaces and hanging</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-019-ref.html">
+<meta name="assert" content="trailing pre-wrap spaces hang at soft-wrapped lines, and hang conditionally before forced breaks.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 2rem;
+ font-family: Ahem;
+ width: 3ch;
+}
+#test1, #test2 {
+ white-space: pre-wrap;
+ color: green;
+}
+#test2 {
+ text-align: right;
+}
+
+.ref {
+ white-space: pre;
+ color: red;
+ position: absolute;
+ z-index: -1;
+}
+
+</style>
+
+<p>Test passes if there are green squares below and no red.
+
+<div class=ref> 0 <br>0 0 <br>0 </div>
+<div id=test1> 0 0 0 0 </div>
+
+<div class=ref> 0<br>0 0 <br> 0</div>
+<div id=test2> 0 0 0 0 </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-020.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-020.html
new file mode 100644
index 0000000000..ec3e862115
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-020.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: trailing pre-wrap spaces and conditional hanging</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-020-ref.html">
+<meta name="assert" content="trailing pre-wrap spaces hang conditionally before forced breaks, which is different from not hanging at all, as it doesn't cause wrapping at earlier opportunities.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 2rem;
+ font-family: Ahem;
+ width: 3ch;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+}
+
+.ref {
+ white-space: pre;
+ color: red;
+ position: absolute;
+ z-index: -1;
+}
+
+</style>
+
+<p>Test passes if there are green rectangles below and no red.
+
+<div class=ref>0 0<br>0 0</div>
+<div id=test>0 0 0 0 </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-051.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-051.html
new file mode 100644
index 0000000000..19d7f4dbbc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-051.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ float: left;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#pre-wrap
+ {
+ white-space: pre-wrap;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="pre-wrap">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-052.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-052.html
new file mode 100644
index 0000000000..4794f52e16
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-052.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ display: inline-block;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#pre-wrap
+ {
+ white-space: pre-wrap;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="pre-wrap">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-001.html
new file mode 100644
index 0000000000..0d923665b2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-center-001-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: center;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly centered:</p>
+
+<div class=test>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-002.html
new file mode 100644
index 0000000000..9e28158fdc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-002.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-center-002-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: center;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly centered:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-003.html
new file mode 100644
index 0000000000..8225e80fe0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-center-003.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-center-003-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: center;
+ unicode-bidi: bidi-override;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly centered:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-001.html
new file mode 100644
index 0000000000..3d002c20df
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-right-001-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: end;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-002.html
new file mode 100644
index 0000000000..c1bd5902d7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-002.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-left-002-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: end;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-003.html
new file mode 100644
index 0000000000..72530985f3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-end-003.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-left-003-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: end;
+ unicode-bidi: bidi-override;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-001.html
new file mode 100644
index 0000000000..a6a286b9c4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-left-001-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: left;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-002.html
new file mode 100644
index 0000000000..0671b0e7eb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-002.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-left-002-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: left;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-003.html
new file mode 100644
index 0000000000..bdef8ada0b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-left-003.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-left-003-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: left;
+ unicode-bidi: bidi-override;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-001.html
new file mode 100644
index 0000000000..878b297df4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-right-001-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: right;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-002.html
new file mode 100644
index 0000000000..0c13f9ca18
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-002.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-right-002-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: right;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-003.html
new file mode 100644
index 0000000000..e3cae16720
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-right-003.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-right-003-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: right;
+ unicode-bidi: bidi-override;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-001.html
new file mode 100644
index 0000000000..c9b884e892
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-left-001-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: start;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-002.html
new file mode 100644
index 0000000000..e226a19c94
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-002.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-right-002-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: start;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-003.html
new file mode 100644
index 0000000000..f91b38c6ac
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-align-start-003.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text test: white-space:pre-wrap vs text-align</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<meta name="assert" content="white-space at end of line must hang">
+<link rel="match" href="reference/pre-wrap-align-right-003-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: pre-wrap;
+ text-align: start;
+ unicode-bidi: bidi-override;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test dir=rtl>one two three four five
+six seven eight nine ten.
+un deux trois quatre cinq
+six sept huit neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-float-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-float-001.html
new file mode 100644
index 0000000000..af29b0505e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-float-001.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>CSS test preserved spaces and floats interaction</title>
+<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
+<link rel="match" href="reference/pre-wrap-float-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+html {
+ font-family: Ahem;
+ font-size: 20px;
+ line-height: 1;
+}
+.container {
+ white-space: pre-wrap;
+ width: 10ch;
+ margin-bottom: 1em;
+}
+.float {
+ float: left;
+ width: 3ch;
+ height: 2em;
+ background: orange;
+}
+</style>
+<body>
+ <div class="float"></div>
+ <div class="container">123456 123456</div>
+ <div class="float"></div>
+ <div class="container">1234567 1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567 1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567 1234567</div>
+ <div class="float"></div>
+ <div class="container">12345678 12345678</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-001.html
new file mode 100644
index 0000000000..756a04dea5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-001.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space at the beginning of the line are breaking opportunities when white-space is pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 50px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 2ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"><span>XX</span><br>XX</div>
+<div class="test"> XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-002.html
new file mode 100644
index 0000000000..b3136f37fa
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-002.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should be breaking opportunities when white-space is pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<span>XX<br>XXXX</span><br>XXXX<br><span>XXXX</span></div>
+<div class="test">XX&#x000a; XXXX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-003.html
new file mode 100644
index 0000000000..797eb25b39
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-003.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should be breaking opportunities when white-space is pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<span>XX<br>XXXX</span><br>XXXX<br><span>XXXX</span></div>
+<div class="test">XX<br> XXXX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-004.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-004.html
new file mode 100644
index 0000000000..882ffc610c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-004.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>XX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX<br>XXXXX</span></div>
+<div class="test">XXX<br> XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-005.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-005.html
new file mode 100644
index 0000000000..a896a44dcc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-005.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>XX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX<br>XXXXX</span></div>
+<div class="test">XXX <br> XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-006.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-006.html
new file mode 100644
index 0000000000..3d64853dcb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-006.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>XX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX<br>XXXXX</span></div>
+<div class="test">XXX <!--end of line space intentional-->
+ XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-007.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-007.html
new file mode 100644
index 0000000000..7ab8bca45c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-007.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>XX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX<br>XXXXX</span></div>
+<div class="test">XXX <!--end of line spaces intentional-->
+ XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-008.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-008.html
new file mode 100644
index 0000000000..aa5ab5b408
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-008.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<span>XXX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX<br>XXXXX</span></div>
+<div class="test">XX <!--end of line spaces intentional-->
+ XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-009.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-009.html
new file mode 100644
index 0000000000..f49a8ee9ea
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-009.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">X<span>XXXX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX<br>XXXXX</span></div>
+<div class="test">X <!--end of line spaces intentional-->
+ XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-010.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-010.html
new file mode 100644
index 0000000000..64db374102
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-010.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>XX<br>XXXXX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX</span></div>
+<div class="test">XXX<br>
+ XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-011.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-011.html
new file mode 100644
index 0000000000..7a003fecb3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-011.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: forced breaks create preserverd leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should not be collapsed, honoring white-space: pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>XX</span><br>XXX<span>XX<br>XXX</span>XX<br><span>XXXXX<br>XXXXX</span></div>
+<div class="test">XXX XXX
+ XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-012.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-012.html
new file mode 100644
index 0000000000..c9e8541300
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-012.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should be breaking opportunities when white-space is pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"><span>X</span>X<span>XX<br>XXXX</span><br>XXXX<br><span>XXXX</span></div>
+<div class="test"> <span>X </span>&#x000a; XXXX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-013.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-013.html
new file mode 100644
index 0000000000..d089902f34
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-013.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should be breaking opportunities when white-space is pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"><span>XX</span>X<span>X<br>XXXX</span><br>XXXX<br><span>XXXX</span></div>
+<div class="test"> <span> </span>X&#x000a; XXXX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-014.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-014.html
new file mode 100644
index 0000000000..b3ad933f9e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-014.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Preserved white space after forced breaks become leading white-spaces and should be breaking opportunities when white-space is pre-wrap.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"><span>X</span>X<span>XX</span>X<br><span>XXXXX</span><br>XXXXX<br><span>XXXXX<br>XXXXX</span></div>
+<div class="test"> X<span> </span> X&#x000a; XXXXX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-015.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-015.html
new file mode 100644
index 0000000000..9b9b3690e5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-015.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Empty line with preserved white spaces must account for box sizing.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+.ref {
+ position: absolute;
+ background: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+.test {
+ font: 50px/1 Ahem;
+ width: 2ch;
+ background: green;
+ color: green;
+
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"></div>
+<div class="test">&#32;&#32;&#32;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-016.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-016.html
new file mode 100644
index 0000000000..57a121815d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-016.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Empty line with preserved white spaces must account for box sizing.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+.ref {
+ position: absolute;
+ background: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+.test {
+ font: 25px/1 Ahem;
+ width: 4ch;
+ background: green;
+ color: green;
+
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"></div>
+<div class="test">&#32;&#32;&#32;&#32;&#32;XXXX<br>&#32;&#32;&#32;&#32;&#32;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-017.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-017.html
new file mode 100644
index 0000000000..9aad17e9c5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-leading-spaces-017.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: breaking opportunities at leading spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Empty line with preserved white spaces must account fpor box sizing.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+.ref {
+ position: absolute;
+ background: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+.test {
+ font: 50px/1 Ahem;
+ width: 2ch;
+ background: green;
+ color: green;
+
+ white-space: pre-wrap;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref"></div>
+<div class="test">&#32;<span>&#32;&#32;</span>X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-001.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-001.html
new file mode 100644
index 0000000000..e57da83e9f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-001.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: wrapping opportunity after pre-wrap tabs</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="There is a wrapping opportunity at the end of a sequence of tabs with white-space:pre-wrap">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+ width: 16ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>XX&#x09;&#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-002.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-002.html
new file mode 100644
index 0000000000..11ec850940
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-002.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: wrapping opportunity after pre-wrap tabs and spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="There is a wrapping opportunity at the end of a sequence of tabs and spaces with white-space:pre-wrap">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+ width: 16ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>XX &#x09; &#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-003.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-003.html
new file mode 100644
index 0000000000..a54debe80a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-003.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: no wrapping opportunity between pre-wrap tabs</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="There is a wrapping opportunity at the end of a sequence of tabs with white-space:pre-wrap, but not between or before each tab.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+ width: 2ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>XX&#x09;&#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-004.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-004.html
new file mode 100644
index 0000000000..22c3ec45c6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-004.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: no wrapping opportunity between pre-wrap tabs and spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-1">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="There is a wrapping opportunity at the end of a sequence of tabs and spaces with white-space:pre-wrap, but not between or before each.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+ width: 2ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>XX &#x09; &#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-005.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-005.html
new file mode 100644
index 0000000000..edbc5974c1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-005.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: pre-wrap tabs hang</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="a sequence of pre-wrap tabs at the end of a line hangs.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+ width: 2ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>X<wbr>X&#x09;&#x09;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-006.html b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-006.html
new file mode 100644
index 0000000000..4bdb7a21c7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/pre-wrap-tab-006.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: pre-wrap tabs and spaces hang</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="a sequence of pre-wrap tabs and spaces at the end of a line hangs.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+}
+#test {
+ white-space: pre-wrap;
+ color: green;
+ width: 2ch;
+}
+#ref {
+ color: red;
+ position: absolute;
+ z-index:-1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div id=ref>XX<br>XX</div>
+<div id=test>X<wbr>X&#x09; &#x09;&#x09; XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-003-ref.html
new file mode 100644
index 0000000000..52a8c491cc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-003-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+ color: green;
+}
+</style>
+
+<p>Test passes if there are two <strong>filled green squares</strong> and <strong>no red</strong>.</p>
+<div>X<br><br><br><br><br>X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-005-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-005-ref.html
new file mode 100644
index 0000000000..798e35fd66
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/break-spaces-tab-005-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+ white-space: break-spaces;
+ color: green;
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if there is a green rectangle and no red.
+<div>XX<br>XX<br>XX<br>XX<br>XX<br>XX<br>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/control-chars-000-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/control-chars-000-ref.html
new file mode 100644
index 0000000000..9d5fcb2714
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/control-chars-000-ref.html
@@ -0,0 +1,6 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test mismatch reference</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+
+<p>Test passes if there is a visible character below.
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/control-chars-00D-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/control-chars-00D-ref.html
new file mode 100644
index 0000000000..ae214b7485
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/control-chars-00D-ref.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Reference file</title>
+<link rel=author title="Florian Rivoal" href="https://florian.rivoal.net">
+<style>
+div {
+ font-size: 2em;
+ font-family: monospace;
+ color: blue;
+ width: 4ch;
+}
+#ref {
+ color: orange;
+}
+.p {white-space: pre;}
+.pw {white-space: pre-wrap;}
+.pl {white-space: pre-line;}
+.bs {white-space: break-spaces;}
+.nw {white-space: nowrap;}
+</style>
+
+<p>Test passes if blue charaters are arranged exactly in the same way as the orange ones.
+
+<div>A B C<span class=p> </span>D<span class=pw> </span>E<span class=pl> </span>F<span class=bs> </span>G<span class=nw> </span>H</div>
+
+<div id=ref>A B C<span class=p> </span>D<span class=pw> </span>E<span class=pl> </span>F<span class=bs> </span>G<span class=nw> </span>H</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-001-ref.html
new file mode 100644
index 0000000000..2aa8f4a83c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-001-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text 3 test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+
+<style>
+@font-face {
+ font-family: "Hasubi Mono";
+ src: url("/fonts/hasubi-mono/HasubiMono-Regular.woff2");
+}
+
+div {
+ font-family: "Hasubi Mono", monospace;
+ border: solid blue;
+ font-size: 1.5em;
+ white-space: pre;
+}
+.ref {
+ border-color: orange;
+}
+.w5 { width: 5.01ch; }
+.w6 { width: 6.01ch; }
+.w7 { width: 7.01ch; }
+
+.blue { background: #aaaaff; }
+.red { background: #ffaaaa; }
+.green { background: #aaffaa; }
+</style>
+
+<p>Test passes if each pair of blue / orange boxes are identical (except for the color of their border).
+
+<div class="w5">A<span class=blue> </span>B<span class=red> </span>ا<br>ب</div>
+<div class="w5 ref">A<span class=blue> </span>B<span class=red> </span>ا<br>ب</div>
+
+<hr>
+
+<div class="w6">A<span class=blue> </span>B<span class=red> </span>ا<br>ب</div>
+<div class="w6 ref">A<span class=blue> </span>B<span class=red> </span>ا<br>ب</div>
+
+<hr>
+
+<div class="w7">A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div>
+<div class="w7 ref">A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-002-ref.html
new file mode 100644
index 0000000000..05b5546397
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-002-ref.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text 3 test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+
+<style>
+@font-face {
+ font-family: "Hasubi Mono";
+ src: url("/fonts/hasubi-mono/HasubiMono-Regular.woff2");
+}
+
+div {
+ font-family: "Hasubi Mono", monospace;
+ border: solid blue;
+ font-size: 1.5em;
+ white-space: pre;
+}
+.ref {
+ border-color: orange;
+}
+.w6 { width: 6.01ch; }
+.w7 { width: 7.01ch; }
+.w8 { width: 8.01ch; }
+.w9 { width: 9.01ch; }
+
+.blue { background: #aaaaff; }
+.red { background: #ffaaaa; }
+.green { background: #aaffaa; }
+.pink { background: #ffaaff; }
+.yellow { background: #ffffaa; }
+</style>
+
+<p>Test passes if each pair of blue / orange boxes are identical (except for the color of their border).
+
+
+<div class="w6"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<br>ب<span class=yellow> </span></div>
+<div class="w6 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<br>ب<span class=yellow> </span></div>
+
+<hr>
+
+<div class="w7"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span><br>ب<span class=yellow> </span></div>
+<div class="w7 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span><br>ب<span class=yellow> </span></div>
+
+<hr>
+
+<div class="w8"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div>
+<div class="w8 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div>
+
+<hr>
+
+<div class="w9"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
+<div class="w9 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-003-ref.html
new file mode 100644
index 0000000000..57e23bdc10
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-003-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text 3 test reference</title>
+<link rel="author" title="Jose Dapena Paz" href="mailto:jdapena@igalia.com">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+ div {
+ direction: rtl;
+
+ font: 20px/1 Ahem;
+ margin-left: 20px;
+ background: green;
+
+ width: 4ch;
+ }
+ .blue { color: blue; }
+ .space { color: transparent; }
+ .text { background: blue; }
+</style>
+<p>Test passes if a blue box (the white space) is visible at the left start in first line.</p>
+<div>ب<span class="blue">X</span><span class="text">OP</span><span class="space">X<br>XXX</span>D</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-004-ref.html
new file mode 100644
index 0000000000..d845f2ac95
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-004-ref.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Text 3 test reference</title>
+<link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+ div#test {
+ text-align: right;
+
+ font: 20px/1 Ahem;
+ background: linear-gradient(green, green) 1ch 0 / cover no-repeat;
+
+ width: 5ch;
+ white-space: pre;
+
+ color: blue;
+ }
+</style>
+<p>Test passes if a blue box (the white space) is visible at the left start in first line and <strong>no red</strong> is shown.</p>
+<div id="test">X <br> </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-003-ref.html
new file mode 100644
index 0000000000..6861ec61de
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-003-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text 3 test reference</title>
+<link rel="author" title="Jose Dapena Paz" href="mailto:jdapena@igalia.com">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+ div {
+ direction: rtl;
+
+ font: 20px/1 Ahem;
+ margin-left: 20px;
+ background: green;
+
+ width: 4ch;
+ overflow: hidden;
+ }
+ .blue { color: blue; }
+ .space { color: transparent; }
+ .text { background: blue; }
+</style>
+<p>Test passes if a blue box (the white space) is visible at the left start in first line.</p>
+<div>ب<span class="blue">X</span><span class="text">OP</span><span class="space">X<br>XXX</span>D</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-004-ref.html
new file mode 100644
index 0000000000..4d068654a7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/eol-spaces-bidi-alt-004-ref.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Text 3 test reference</title>
+<link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+ div#test {
+ font: 20px/1 Ahem;
+ margin-left: 20px;
+ background: green;
+
+ width: 4ch;
+ white-space: pre;
+ }
+</style>
+<p>Test passes if a blue box (the white space) is visible at the left start in first line and <strong>no red</strong> is shown.</p>
+<div id="test"> <br> </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/full-width-leading-spaces-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/full-width-leading-spaces-001-ref.html
new file mode 100644
index 0000000000..2b9cf1c3b2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/full-width-leading-spaces-001-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<p>Test passes if the characters below are arranged in a green rectangle and if there is no red.
+<div style="width: 100px; height: 20px; background: green"></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-001-ref.html
new file mode 100644
index 0000000000..02fa594255
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-001-ref.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html>
+<meta charset=utf-8>
+<link rel="author" title="Mike Bremford" href="mailto:mike@bfo.com">
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<title>CSS test reference</title>
+<style>
+div { font: 30px/30px monospace; }
+span { border-left: 30px solid green }
+</style>
+
+<p>Test passes if there is a single green rectangle next to ABCDEFGHIJ, and no red.
+
+<div>A<span></span></div>
+<div>B<span></span></div>
+<div>C<span></span></div>
+<div>D<span></span></div>
+<div>E<span></span></div>
+<div>F<span></span></div>
+<div>G<span></span></div>
+<div>H<span></span></div>
+<div>I<span></span></div>
+<div>J<span></span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-002-ref.html
new file mode 100644
index 0000000000..ea1faa2ed1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/line-edge-white-space-collapse-002-ref.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<html>
+<meta charset=utf-8>
+<link rel="author" title="Mike Bremford" href="mailto:mike@bfo.com">
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<title>CSS test reference</title>
+<style>
+div { font: 30px/30px monospace; }
+span { border-left: 30px solid green }
+</style>
+
+<p>Test passes if there is a single green rectangle, and no red. The letters KLMNOPQRST must be immediately to its right, vertically aligned with each other.
+
+<div><span>K</span></div>
+<div><span>L</span></div>
+<div><span>M</span></div>
+<div><span>N</span></div>
+<div><span>O</span></div>
+<div><span>P</span></div>
+<div><span>Q</span></div>
+<div><span>R</span></div>
+<div><span>S</span></div>
+<div><span>T</span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-1-notref.html b/testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-1-notref.html
new file mode 100644
index 0000000000..c4280f5fdd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-1-notref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>CSS Text: U+FFFC OBJECT REPLACEMENT CHARACTER presence</title>
+<link rel="author" title="Myles C. Maxfield" href="mailto:mmaxfield@apple.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/">
+</head>
+<body>
+This test makes sure that the U+FFFC OBJECT REPLACEMENT CHARACTER doesn't get deleted. The test passes if the letter below isn't at the left edge of the green box.
+<div style="background: green; font-size: 100px; height: 300px;">e&#x0301;<span style="display: inline-block; height: 200px; width: 1px;"></span></div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-2-notref.html b/testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-2-notref.html
new file mode 100644
index 0000000000..644dfc4b02
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/object-replacement-2-notref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>CSS Text: U+FFFC OBJECT REPLACEMENT CHARACTER presence</title>
+<link rel="author" title="Myles C. Maxfield" href="mailto:mmaxfield@apple.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/">
+</head>
+<body>
+This test makes sure that the U+FFFC OBJECT REPLACEMENT CHARACTER doesn't get deleted. The test passes if the letter below isn't at the left edge of the green box.
+<div style="background: green; font-size: 100px; height: 300px;">e<span style="display: inline-block; height: 200px; width: 1px;"></span></div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-float-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-float-001-ref.html
new file mode 100644
index 0000000000..9753cb37b6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-float-001-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+html {
+ font-family: Ahem;
+ font-size: 20px;
+ line-height: 1;
+}
+.container {
+ white-space: pre;
+ margin-bottom: 1em;
+}
+.float {
+ float: left;
+ width: 3ch;
+ height: 2em;
+ background: orange;
+}
+</style>
+<body>
+ <div class="float"></div>
+ <div class="container">123456<br>123456</div>
+ <div class="float"></div>
+ <div class="container">1234567<br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567<br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567<br>1234567</div>
+ <div class="float"></div>
+ <div class="container">12345678<br>12345678</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-001-ref.html
new file mode 100644
index 0000000000..c60a342a03
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-001-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test reference file</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ color: green;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX<br>XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-012-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-012-ref.html
new file mode 100644
index 0000000000..a0aee138b9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-012-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ color: green;
+
+ width: 2ch;
+ margin-left: 1ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX
+XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-013-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-013-ref.html
new file mode 100644
index 0000000000..b91fc8b6c1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-013-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ color: green;
+
+ width: 2ch;
+ margin-left: 0.5ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div>XX
+XX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-014-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-014-ref.html
new file mode 100644
index 0000000000..87d51f6067
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-014-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ color: green;
+
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green rectangle</strong> and <strong>no red</strong>.</p>
+ <div>XXXX</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-018-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-018-ref.html
new file mode 100644
index 0000000000..a87649432f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-018-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<style>
+div {
+ font-size: 2rem;
+ margin: 1rem;
+ white-space: pre;
+ width: 5ch;
+ border: solid 1px;
+ font-family: monospace;
+}
+span {
+ text-decoration: underline;
+}
+
+</style>
+
+<p>Test passes if the two boxes below are identical.
+
+<div> <span> 0 </span></div>
+<div> <span> 0 </span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-019-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-019-ref.html
new file mode 100644
index 0000000000..e3be478a35
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-019-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 2rem;
+ font-family: Ahem;
+ width: 3ch;
+ white-space: pre;
+ color: green;
+}
+
+</style>
+
+<p>Test passes if there are green squares below and no red.
+
+<div class=ref> 0 <br>0 0 <br>0 </div>
+
+<div class=ref> 0<br>0 0 <br> 0</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-020-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-020-ref.html
new file mode 100644
index 0000000000..2ef5e7f408
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-020-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 2rem;
+ font-family: Ahem;
+ width: 3ch;
+ white-space: pre;
+ color: green;
+}
+
+</style>
+
+<p>Test passes if there are green rectangles below and no red.
+
+<div>0 0<br>0 0</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-001-ref.html
new file mode 100644
index 0000000000..c06d4ce4ca
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-001-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: center;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly centered:</p>
+
+<div class=test>one two three<br>
+four five<br>
+six seven eight<br>
+nine ten.<br>
+un deux trois<br>
+quatre cinq<br>
+six sept huit<br>
+neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-002-ref.html
new file mode 100644
index 0000000000..ea211e2fa0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-002-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: center;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly centered:</p>
+
+<!-- testcase has dir=rtl -->
+<div class=test>one two three<br>
+four five<br>
+six seven eight<br>
+.nine ten<br>
+un deux trois<br>
+quatre cinq<br>
+six sept huit<br>
+neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-003-ref.html
new file mode 100644
index 0000000000..1970d9045b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-center-003-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: center;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly centered:</p>
+
+<!-- testcase has dir=rtl and bidi-override -->
+<div class=test>eerht owt eno<br>
+evif ruof<br>
+thgie neves xis<br>
+.net enin<br>
+siort xued nu<br>
+qnic ertauq<br>
+tiuh tpes xis<br>
+xid fuen</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-001-ref.html
new file mode 100644
index 0000000000..ee7153726d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-001-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: left;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<div class=test>one two three<br>
+four five<br>
+six seven eight<br>
+nine ten.<br>
+un deux trois<br>
+quatre cinq<br>
+six sept huit<br>
+neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-002-ref.html
new file mode 100644
index 0000000000..ace8924065
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-002-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: left;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<!-- testcase has dir=rtl -->
+<div class=test>one two three<br>
+four five<br>
+six seven eight<br>
+.nine ten<br>
+un deux trois<br>
+quatre cinq<br>
+six sept huit<br>
+neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-003-ref.html
new file mode 100644
index 0000000000..d86c035115
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-left-003-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: left;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly left-aligned:</p>
+
+<!-- testcase has dir=rtl and bidi-override -->
+<div class=test>eerht owt eno<br>
+evif ruof<br>
+thgie neves xis<br>
+.net enin<br>
+siort xued nu<br>
+qnic ertauq<br>
+tiuh tpes xis<br>
+xid fuen</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-001-ref.html
new file mode 100644
index 0000000000..45782ddcea
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-001-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: right;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<div class=test>one two three<br>
+four five<br>
+six seven eight<br>
+nine ten.<br>
+un deux trois<br>
+quatre cinq<br>
+six sept huit<br>
+neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-002-ref.html
new file mode 100644
index 0000000000..45f59e3b5f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-002-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: right;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<!-- testcase has dir=rtl -->
+<div class=test>one two three<br>
+four five<br>
+six seven eight<br>
+.nine ten<br>
+un deux trois<br>
+quatre cinq<br>
+six sept huit<br>
+neuf dix</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-003-ref.html
new file mode 100644
index 0000000000..4d294b22d3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-align-right-003-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Text reference</title>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+.test {
+ font: 20px Ahem, monospace;
+ width: 15ch;
+ border: 1px solid gray;
+ padding: 5px;
+ white-space: normal;
+ text-align: right;
+}
+</style>
+</head>
+
+<p>The text on each line should be neatly right-aligned:</p>
+
+<!-- testcase has dir=rtl and bidi-override -->
+<div class=test>eerht owt eno<br>
+evif ruof<br>
+thgie neves xis<br>
+.net enin<br>
+siort xued nu<br>
+qnic ertauq<br>
+tiuh tpes xis<br>
+xid fuen</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-float-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-float-001-ref.html
new file mode 100644
index 0000000000..e72b3c94ea
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/pre-wrap-float-001-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+html {
+ font-family: Ahem;
+ font-size: 20px;
+ line-height: 1;
+}
+.container {
+ white-space: pre;
+ margin-bottom: 1em;
+}
+.float {
+ float: left;
+ width: 3ch;
+ height: 2em;
+ background: orange;
+}
+</style>
+<body>
+ <div class="float"></div>
+ <div class="container">123456<br>123456</div>
+ <div class="float"></div>
+ <div class="container">1234567<br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567<br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567<br>1234567</div>
+ <div class="float"></div>
+ <div class="container"><br><br>12345678<br>12345678</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/tab-bidi-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/tab-bidi-001-ref.html
new file mode 100644
index 0000000000..9f081f9103
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/tab-bidi-001-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference: Tabs vs. Bidi</title>
+<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
+<style>
+body > div {
+ border: solid blue;
+ margin: 1em;
+}
+div > div {
+ white-space: pre;
+ font: 20px/1 monospace;
+ text-align: left;
+}
+div > span { /* measure bounds */
+ border: orange;
+ border-style: none solid;
+}
+</style>
+
+<p>Test passes if all three rows of each box are identical.
+
+<div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>A B C D </span></div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>A B C D </span></div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>A B C D </span></div>
+</div>
+<div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>א בּ ג ד </span></div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>א בּ ג ד </span></div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>א בּ ג ד </span></div>
+</div>
+<div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>A B C D </span></div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>A B C D </span></div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>A B C D </span></div>
+</div>
+<div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>א בּ ג ד </span></div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>א בּ ג ד </span></div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>א בּ ג ד </span></div>
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-001-ref.html
new file mode 100644
index 0000000000..5694dd2f52
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div {
+ white-space: pre;
+ font-family: monospace;
+}
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div> P</div>
+<div> A</div>
+<div> S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-002-ref.html
new file mode 100644
index 0000000000..35c568bbca
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/tab-stop-threshold-002-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<style>
+div {
+ white-space: pre;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+</style>
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div> P</div>
+<div> A</div>
+<div> S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-002-ref.html
new file mode 100644
index 0000000000..d8c1834d95
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-002-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+.container {
+ font-family: Ahem;
+ font-size: 20px;
+ width: 20ch;
+}
+</style>
+<div class="container">
+ 123 567 901 345 789 123
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-align-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-align-001-ref.html
new file mode 100644
index 0000000000..e522e3711c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-align-001-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<style>
+.container {
+ font-family: monospace;
+ font-size: 20px;
+ width: 20ch;
+ border: solid 1px;
+}
+</style>
+<div class="container" style="text-align: right">
+ 123456789 123 567
+ 123456789 123 567
+</div>
+<div class="container" style="text-align: center">
+ 123456789 123 567
+ 123456789 123 567
+</div>
+<div class="container" style="text-align: justify">
+ 123456789 123 567
+ 123456789 123 567
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-dynamic-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-dynamic-001-ref.html
new file mode 100644
index 0000000000..43202e4d97
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-dynamic-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+#container {
+ width: 20ch;
+ text-wrap: balance;
+}
+span:hover {
+ color: red;
+}
+</style>
+<div id="container">
+ 123 567 901 345 789
+ 123 567 901 345 789
+ 123 567 901 345 789
+ 999
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-001-ref.html
new file mode 100644
index 0000000000..0e3e5c7967
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 23.5ch;
+ border: solid 1px;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: left;
+}
+</style>
+
+<div class="container"><div class="float">FLOAT<br>FLOAT</div>abc de fg<br>hij klm<br>nop qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-002-ref.html
new file mode 100644
index 0000000000..fc068905f2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-002-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 23.5ch;
+ border: solid 1px;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: right;
+}
+</style>
+
+<div class="container"><div class="float">FLOAT<br>FLOAT</div>abc de fg<br>hij klm<br>nop qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-005-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-005-ref.html
new file mode 100644
index 0000000000..b28426f575
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-float-005-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 26.5ch;
+ border: solid 1px;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: left;
+}
+.float2 {
+ background: cyan;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: right;
+}
+</style>
+
+<div class="container"><div class="float">FLOAT<br>FLOAT</div>abcde fghi<br>jklm nop<div class="float2">FLOAT<br>FLOAT</div><br>qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-line-clamp-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-line-clamp-001-ref.html
new file mode 100644
index 0000000000..4e465be7cc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-line-clamp-001-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<style>
+.container {
+ font-family: monospace;
+ font-size: 20px;
+ width: 20ch;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+}
+</style>
+<div class="container">
+ 123 567 901 345 789
+ 123 567 901 345 789
+ 123
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-001-ref.html
new file mode 100644
index 0000000000..64a1cf3d8d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-001-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<style>
+.container {
+ font-family: monospace;
+ font-size: 20px;
+ inline-size: 15ch;
+ border: 1px solid;
+}
+</style>
+<div class="container">CONTROLLING<br>YOUR BU</div>
+<div class="container">CONTROLLING<br>YOUR BU BU</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-002-ref.html
new file mode 100644
index 0000000000..6d49010185
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-overflow-002-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<style>
+#test {
+ border: 1px solid gray;
+ font: 15px monospace;
+ width: 20ch;
+}
+</style>
+
+<body>
+<div id=test>
+Interconnect<br>your build
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-text-indent-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-text-indent-001-ref.html
new file mode 100644
index 0000000000..401e35e2f1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/text-wrap-balance-text-indent-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ border: 1px solid;
+ font-family: Ahem;
+ font-size: 10px;
+ text-indent: 5ch;
+ width: 10ch;
+}
+</style>
+<div>
+ 01<br>
+ 34 6 89<br>
+ 12 3 56
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html
new file mode 100644
index 0000000000..31070ea928
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-001-ref.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test reference file</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<!-- pre-wrap-001-ref.html could probably be used instead,
+but since textarea is a form control that's not fully specified,
+using a separate reference just in case something is indeed different
+is safer. -->
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ color: green;
+ white-space: pre;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX
+XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-014-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-014-ref.html
new file mode 100644
index 0000000000..99a38bf88b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/textarea-pre-wrap-014-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<p>Test passes if there is <strong>no red</strong> below.</p>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-001-ref.html
new file mode 100644
index 0000000000..d9a040ae77
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-001-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div {
+ line-height: 1;
+ color: transparent;
+ float: left;
+ clear: left;
+}
+span {
+ background: green;
+}
+</style>
+
+<p>Test passes if the shape below is green and if there is no red.
+
+<div><span>あああ</span></div>
+<div><span>ああ</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-002-ref.html
new file mode 100644
index 0000000000..a153844a97
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-002-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div {
+ line-height: 1;
+ color: transparent;
+ float: left;
+ clear: left;
+}
+span {
+ background: green;
+}
+</style>
+
+<p>Test passes if the shape below is green and if there is no red.
+
+<div><span>ああああ あ あ</span></div>
+<div><span>ああ</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-003-ref.html
new file mode 100644
index 0000000000..7c59b1f6f2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-003-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div { white-space: pre; }
+span { background: blue; }
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;</span><br>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-004-ref.html
new file mode 100644
index 0000000000..a72e050031
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-004-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div { white-space: pre; }
+span { background: blue; }
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span><br>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-011-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-011-ref.html
new file mode 100644
index 0000000000..a2efec2490
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-011-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+}
+span { background: blue; }
+</style>
+
+<p>Test passes if the characters below are arranged in a single line and if there is a blue square at the end of the first line.
+<div>X X<span> </span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-003-ref.html
new file mode 100644
index 0000000000..9f579f29e0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-003-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div { white-space: pre; }
+span {
+ background: blue;
+
+ /* to make the span go under the right border */
+ z-index:-1;
+ position: relative;
+}
+aside {
+ display: inline-block;
+ width: 0.5em;
+ border-right: 1em white solid;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<aside><span>&#x3000;</span></aside><br>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-011-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-011-ref.html
new file mode 100644
index 0000000000..03023f5359
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-alt-011-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div { font: 20px/1 Ahem; }
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>X X<span>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-break-spaces-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-break-spaces-001-ref.html
new file mode 100644
index 0000000000..293f752174
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ideographic-space-break-spaces-001-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<style>
+ div {
+ white-space: pre;
+ line-height: 1;
+ }
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div>ああ<br><br>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ogham-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ogham-001-ref.html
new file mode 100644
index 0000000000..1b6fddd30e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-ogham-001-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test Reference</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<style>
+div {
+ border: solid;
+ width: min-content;
+}
+.soft-wrap { border-color: blue; }
+.hard-break { border-color: orange; }
+
+</style>
+
+<p>Test passes if the content of the blue and orange boxes is identical to that of the black box.
+
+<div class=soft-wrap>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>
+<div class=hard-break>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>
+<div class=ref>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-001-ref.html
new file mode 100644
index 0000000000..e406b86a3a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-001-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div {
+ line-height: 1;
+ color: transparent;
+ background: green;
+ float: left;
+ clear: left;
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the shape below is green and if there is no red.
+
+<div>xx&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</div>
+<div>xx</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-002-ref.html
new file mode 100644
index 0000000000..3939dabe5d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-002-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: pre-wrap;
+ font-family: Ahem;
+ font-size: 10px;
+ line-height: 1;
+ color: green;
+}
+</style>
+
+<p>Test passes if there are two green tall boxes below and no red.
+
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
+<div>x x<br>x x</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-001-ref.html
new file mode 100644
index 0000000000..1be4e240bc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-001-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: pre;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<section class=ref>
+ <div>xx&#x1680;<br>あ<br>あ&#x1680;<br>あ<br>あ&#x1680;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x1680;<br>あ<br>あ&#x1680;<br>あ<br>あ&#x1680;<br>xx</div><!-- BA, tailorable -->
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-002-ref.html
new file mode 100644
index 0000000000..98115699a2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-002-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: pre;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<section class=ref>
+ <div>xx<br>あ<br>あ<br>あ<br>あ<br>xx</div>
+</section>
+<section>
+ <div>xx<br>あ<br>あ<br>あ<br>あ<br>xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-009-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-009-ref.html
new file mode 100644
index 0000000000..d62e758e2f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-009-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: pre;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<section class=ref>
+ <div>xx&#x2007;あ<br>あ&#x2007;あ<br>あ&#x2007;xx</div><!--GL, non tailorable after, tailorable before-->
+</section>
+<section>
+ <div>xx&#x2007;あ<br>あ&#x2007;あ<br>あ&#x2007;xx</div><!--GL, non tailorable after, tailorable before-->
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-013-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-013-ref.html
new file mode 100644
index 0000000000..07a78787cb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-other-space-separators-break-spaces-013-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: pre;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<section class=ref>
+ <div>xx&#x202F;あ<br>あ&#x202F;あ<br>あ&#x202F;xx</div>
+</section>
+<section>
+ <div>xx&#x202F;あ<br>あ&#x202F;あ<br>あ&#x202F;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-align-start-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-align-start-ref.html
new file mode 100644
index 0000000000..b65a8fe754
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-align-start-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<style>
+div {
+ font-family: monospace;
+ font-size: 30px;
+ width: 3ch;
+ overflow: auto;
+ white-space: pre;
+}
+</style>
+<body>
+ <div>0 00</div>
+ <div>0 0</div>
+ <div>0 0</div>
+ <div>0 0</div>
+ <div>0 0<br>0 0</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html
new file mode 100644
index 0000000000..3dbb85a711
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ display: inline-block;
+ width: 3ch;
+ height: 100px;
+ font: 40px/1 Ahem;
+ border: 1px solid black;
+ box-sizing: content-box;
+ overflow-y: hidden;
+ overflow-x: auto;
+ }
+.left { text-align: left; }
+.center { text-align: center; }
+.right { text-align: right; }
+.start { text-align: start; }
+.end { text-align: end; }
+</style>
+<div class="left">XXX&#10;X</div>
+<div class="center">XXX&#10;X</div>
+<div class="right">XXX&#10;X</div>
+<div class="start">XXX&#10;X</div>
+<div class="end">XXX&#10;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html
new file mode 100644
index 0000000000..a0811e61a1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ display: inline-block;
+ width: 3ch;
+ height: 100px;
+ font: 40px/1 Ahem;
+ border: 1px solid black;
+ box-sizing: content-box;
+ overflow-y: hidden;
+ overflow-x: auto;
+ }
+.left { text-align: left; }
+.center { text-align: center; }
+.right { text-align: right; }
+.start { text-align: start; }
+.end { text-align: end; }
+</style>
+<div class="left">XXXX&#10;X</div>
+<div class="center">XXXX&#10;X</div>
+<div class="right">XXXX&#10;X</div>
+<div class="start">XXXX&#10;X</div>
+<div class="end">XXXX&#10;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html
new file mode 100644
index 0000000000..3de3f475b0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ display: inline-block;
+ width: 3ch;
+ height: 100px;
+ font: 40px/1 Ahem;
+ border: 1px solid black;
+ box-sizing: content-box;
+ overflow-y: hidden;
+ overflow-x: auto;
+
+ direction: rtl;
+ }
+.left { text-align: left; }
+.center { text-align: center; }
+.right { text-align: right; }
+.start { text-align: start; }
+.end { text-align: end; }
+</style>
+<div class="left">XXX&#10;X</div>
+<div class="center">XXX&#10;X</div>
+<div class="right">XXX&#10;X</div>
+<div class="start">XXX&#10;X</div>
+<div class="end">XXX&#10;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html
new file mode 100644
index 0000000000..8b29f31dbf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ display: inline-block;
+ width: 3ch;
+ height: 100px;
+ font: 40px/1 Ahem;
+ border: 1px solid black;
+ box-sizing: content-box;
+ overflow-y: hidden;
+ overflow-x: auto;
+
+ direction: rtl;
+ }
+.left { text-align: left; }
+.center { text-align: center; }
+.right { text-align: right; }
+.start { text-align: start; }
+.end { text-align: end; }
+</style>
+<div class="left">XXXX&#10;X</div>
+<div class="center">XXXX&#10;X</div>
+<div class="right">XXXX&#10;X</div>
+<div class="start">XXXX&#10;X</div>
+<div class="end">XXXX&#10;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html
new file mode 100644
index 0000000000..e93ee65281
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ display: inline-block;
+ width: 3ch;
+ height: 100px;
+ font: 40px/1 Ahem;
+ border: 1px solid black;
+ box-sizing: content-box;
+ overflow-y: hidden;
+ overflow-x: auto;
+
+ direction: rtl;
+ }
+.left { text-align: left; }
+.center { text-align: center; }
+.right { text-align: right; }
+.start { text-align: start; }
+.end { text-align: end; }
+</style>
+<div class="left">&nbsp;XXX&#10;X</div>
+<div class="center">&nbsp;XXX&#10;X</div>
+<div class="right">&nbsp;XXX&#10;X</div>
+<div class="start">&nbsp;XXX&#10;X</div>
+<div class="end">&nbsp;XXX&#10;X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-rtl-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-rtl-001-ref.html
new file mode 100644
index 0000000000..25094d539d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/trailing-space-rtl-001-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<style>
+body {
+ direction: rtl;
+ white-space: pre-wrap;
+}
+.bg {
+ background: orange;
+}
+.override {
+ unicode-bidi: bidi-override;
+}
+</style>
+<body>
+<div>אבג <span class="bg">אבגד</span> אבגדה</div>
+<div>אבג <span class="bg">אבגד</span> אבגדה</div>
+<div class="override">123 <span class="bg override">12345</span> 1234567</div>
+<div class="override">123 <span class="bg override">12345</span> 1234567</div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-applies-to-text-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-applies-to-text-001-ref.html
new file mode 100644
index 0000000000..d9d8336365
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-applies-to-text-001-ref.html
@@ -0,0 +1,139 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ section
+ {
+ border: black solid 2px;
+ float: left;
+ font-family: monospace;
+ font-size: 14px;
+ line-height: 1; /* computes to 14px */
+ margin-bottom: 10px;
+ width: 16ch;
+ }
+
+ section.odds
+ {
+ clear: both;
+ }
+
+ section.even
+ {
+ margin-left: 10em;
+ }
+
+ div.first-subtest
+ {
+ white-space: normal;
+ }
+
+ div.second-subtest
+ {
+ white-space: nowrap;
+ }
+
+ div.third-subtest
+ {
+ white-space: pre;
+ }
+
+ div.fourth-subtest
+ {
+ white-space: pre-wrap;
+ }
+
+ div.fifth-subtest
+ {
+ white-space: break-spaces;
+ }
+
+ div.sixth-subtest
+ {
+ white-space: pre-line;
+ }
+
+ hr
+ {
+ clear: both;
+ margin: 4em auto 1.5em 0em;
+ width: 480px;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black bordered rectangles on the lefthand side are laid out identically to their counterparts on the righthand side.
+
+ <section class="odds">
+ <div class="first-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="even">
+ <div class="first-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <hr>
+
+ <section class="odds">
+ <div class="second-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="even">
+ <div class="second-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <hr>
+
+ <section class="odds">
+ <div class="third-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="even">
+ <div class="third-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <hr>
+
+ <section class="odds">
+ <div class="fourth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="even">
+ <div class="fourth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <hr>
+
+ <section class="odds">
+ <div class="fifth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="even">
+ <div class="fifth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <hr>
+
+ <section class="odds">
+ <div class="sixth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="even">
+ <div class="sixth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html
new file mode 100644
index 0000000000..dece5f7394
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<style>
+div {
+ width: 100px;
+ height: 100px;
+ background: green;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div></div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-discard-001-ref.xht b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-discard-001-ref.xht
new file mode 100644
index 0000000000..02649bebce
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-discard-001-ref.xht
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 Test: white-space-collapse - discard - basic cases Reftest Reference</title>
+ <link rel="author" title="Satoshi Umehara" href="mailto:umehara@est.co.jp" />
+ <style type="text/css">
+ <![CDATA[
+ span {
+ color: Blue;
+ }
+ ]]>
+ </style>
+ </head>
+ <body>
+ <p>
+ Test passes if the first sentence matches the second one.
+ </p>
+ <div>
+ <span>AllWhiteSpaceInTheElementShouldBeDiscarded.</span>
+ </div>
+ <div>
+ <span>AllWhiteSpaceInTheElementShouldBeDiscarded.</span>
+ </div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-preserve-breaks-001-ref.xht b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-preserve-breaks-001-ref.xht
new file mode 100644
index 0000000000..462c2fc426
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-collapse-preserve-breaks-001-ref.xht
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 Test: white-space-collapse - preserve-breaks - basic cases Reftest Reference</title>
+ <link rel="author" title="Satoshi Umehara" href="mailto:umehara@est.co.jp" />
+ <style type="text/css">
+ <![CDATA[
+ span {
+ color: Blue;
+ }
+ ]]>
+ </style>
+ </head>
+ <body>
+ <p>
+ Test passes if the first two sentences matches the second one.
+ </p>
+ <p>
+ <span>
+ Sequences of white space should collapse into a single character.<br />
+ But segment breaks as forced line breaks are preserved.
+ </span>
+ </p>
+ <p>
+ <span>
+ Sequences of white space should collapse into a single character.<br />
+ But segment breaks as forced line breaks are preserved.
+ </span>
+ </p>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-001-ref.html
new file mode 100644
index 0000000000..3fbc32b1b1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-001-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-family: Ahem;
+ color: transparent;
+ font-size: 50px;
+ background: green;
+ width: 2em;
+}
+</style>
+
+<p>Test passes if there is a green rectangle below and no red.
+<div>XS<br>S<br>XS<br>S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-002-ref.html
new file mode 100644
index 0000000000..dfc2690923
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-002-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ color: transparent;
+ background: blue;
+ font-family: Ahem;
+ font-size: 50px;
+ width: 3ch;
+}
+</style>
+
+<p>Test passes if there is a single blue rectangle below.
+<div>
+XXX<br>
+XXX
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-003-ref.html
new file mode 100644
index 0000000000..0047109982
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-003-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-family: Ahem;
+ color: transparent;
+ font-size: 50px;
+ background: green;
+ width: 1em;
+}
+</style>
+
+<p>Test passes if there is a green rectangle below and no red.
+<div>X<br>X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-004-ref.html
new file mode 100644
index 0000000000..93b8b913cc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-intrinsic-size-004-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>test reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<style>
+div {
+ color: transparent;
+ font-family: monospace;
+ font-size: 50px;
+ width: 3ch;
+ height: 2em;
+ background: green;
+}
+</style>
+
+<p>Test passes if there is a single green rectangle below and no red.
+<div>
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-letter-spacing-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-letter-spacing-001-ref.html
new file mode 100644
index 0000000000..2324661d08
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-letter-spacing-001-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8"/>
+<title>CSS Test reference</title>
+<style>
+div {
+ font: 16px monospace;
+ float: left;
+ clear: left;
+ border: 1px solid silver;
+ margin: 1em;
+ letter-spacing: .5em;
+}
+</style>
+<p>The five boxes below should all look the same:</p>
+<div>Two lines<br>of text</div>
+<div>Two lines<br>of text</div>
+<div>Two lines<br>of text</div>
+<div>Two lines<br>of text</div>
+<div>Two lines<br>of text</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-normal-011-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-normal-011-ref.html
new file mode 100644
index 0000000000..ac1f95f623
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-normal-011-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ white-space: pre;
+ width: 16ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="reference">Lorem ipsum.
+Dolor sit amet.
+consectetur</div>
+
+ <div id="reference">Lorem ipsum.
+Dolor sit amet.
+consectetur</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-nowrap-011-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-nowrap-011-ref.html
new file mode 100644
index 0000000000..b70f993c80
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-nowrap-011-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically. Only "or sit amet." should be outside of black-bordered rectangles.
+
+ <div id="reference">Lorem&nbsp;ipsum.&nbsp;Dolor&nbsp;sit&nbsp;amet.<br>
+consectetur</div>
+
+ <div id="reference">Lorem&nbsp;ipsum.&nbsp;Dolor&nbsp;sit&nbsp;amet.<br>
+consectetur</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-011-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-011-ref.html
new file mode 100644
index 0000000000..c3aecc8dfb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-011-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically. Only "Dolor" should be outside of black-bordered rectangles.
+
+ <div id="reference">Lorem&nbsp;ipsum.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.&nbsp;<br>
+consectetur</div>
+
+ <div id="reference">Lorem&nbsp;ipsum.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.&nbsp;<br>
+consectetur</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-031-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-031-ref.html
new file mode 100644
index 0000000000..93181354ba
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-031-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div>Lorem ipsum. <br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
+
+ <div>Lorem ipsum. <br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-034-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-034-ref.html
new file mode 100644
index 0000000000..b920bdb111
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-034-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div>Lorem ipsum.&nbsp;&nbsp;&nbsp;&nbsp;<br>
+&nbsp;&nbsp;Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
+
+ <div>Lorem ipsum.&nbsp;&nbsp;&nbsp;&nbsp;<br>
+&nbsp;&nbsp;Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-001-ref.html
new file mode 100644
index 0000000000..82b10ac6a4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-001-ref.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text reference</title>
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=ref>one two three four five six seven eight nine ten</div>
+
+<div class=ref>one two three four five six seven eight nine ten</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-002-ref.html
new file mode 100644
index 0000000000..cd228e234c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-002-ref.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text reference</title>
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=ref>one two&nbsp; three &nbsp; four five six seven eight nine &nbsp; ten</div>
+
+<div class=ref>one two&nbsp; three &nbsp; four five six seven eight nine &nbsp; ten</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-003-ref.html
new file mode 100644
index 0000000000..d72988230e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-003-ref.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text reference</title>
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=ref>one two&nbsp; three<br>&nbsp; &nbsp;four&nbsp; five&nbsp; six seven &nbsp; eight &nbsp; nine ten</div>
+
+<div class=ref>one two&nbsp; three<br>&nbsp; &nbsp;four&nbsp; five&nbsp; six seven &nbsp; eight &nbsp; nine ten</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-004-ref.html
new file mode 100644
index 0000000000..be487e6f3c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-justify-004-ref.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text reference</title>
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+ text-align-last: right;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=ref>,one, two, three<br>four, five, six, !seven, eight, nine</div>
+
+<div class=ref>,one, two, three<br>four, five, six, !seven, eight, nine</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-001-ref.html
new file mode 100644
index 0000000000..8db147766b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-001-ref.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+
+<style>
+div {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
+</style>
+
+<p>This test passes if the 4 letters below are verticaly aligned.
+
+<div> P</div>
+<div> A</div>
+<div> S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-002-ref.html
new file mode 100644
index 0000000000..0971868116
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-002-ref.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+}
+#test { color: orange; }
+#ref { color: blue; }
+</style>
+
+<p>This test passes if the orange blocks below are vertically aligned with the blue ones.
+
+<div id=test>X X X X</div>
+<div id=ref>X X X X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-003-ref.html
new file mode 100644
index 0000000000..1b50b667c0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-003-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+}
+</style>
+
+<p>This test passes if there is a green rectangle and no red.
+
+<div>X<br>X<br>X<br>X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-004-ref.html
new file mode 100644
index 0000000000..de92f22e62
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-004-ref.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+}
+span { color: blue; }
+</style>
+
+<p>This test passes if there is a green square and no red.
+
+<div>XX<span>X</span><br>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-012-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-012-ref.html
new file mode 100644
index 0000000000..c4751fa5ea
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-012-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+ }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX&#x0020;X<span>&#x0020;<br>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-013-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-013-ref.html
new file mode 100644
index 0000000000..af1f6bf268
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-013-ref.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta http-equiv="content-language" content="en, ja" />
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<style>
+ div { white-space: pre; }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is after the white space, which hangs (blue).
+
+<div>ああ<span>&#x0020;<br>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-014-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-014-ref.html
new file mode 100644
index 0000000000..29f69dc142
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-014-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+ }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX&#x0020;<span>X&#x0020;<br>XXXX&#x0020;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-015-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-015-ref.html
new file mode 100644
index 0000000000..ffcabadeb3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-015-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+ }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX&#x0020;X<span>X&#x0020;<br>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-021-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-021-ref.html
new file mode 100644
index 0000000000..02c25f4d1a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-021-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ line-height: 1.25; /* computes to 40px */
+ margin-bottom: 0.25em;
+ width: 16ch;
+ overflow: hidden;
+ }
+
+ span
+ {
+ background-color: yellow;
+ }
+ </style>
+
+ <p>Test passes if the characters inside each black-bordered rectangle are laid out identically and if each black-bordered rectangle does not generate a horizontal scrollbar.
+
+ <div>Lorem&nbsp;ipsum.<span>&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit amet. <br>
+consectetur</div>
+
+ <div>Lorem&nbsp;ipsum.<span>&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit amet. <br>
+consectetur</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html
new file mode 100644
index 0000000000..0cbc7b231f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+
+<div>XX<br>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-012-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-012-ref.html
new file mode 100644
index 0000000000..fc485c42b1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-012-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+ }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX&#x0020;X<span><br>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-013-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-013-ref.html
new file mode 100644
index 0000000000..ca5032540b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-013-ref.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta http-equiv="content-language" content="en, ja" />
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<style>
+ div { white-space: pre; }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is after the white space, which hangs (blue).
+
+<div>ああ<span><br>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-014-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-014-ref.html
new file mode 100644
index 0000000000..0df3b9f738
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-014-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+ }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX&#x0020;<span>X<br>XXXX</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-015-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-015-ref.html
new file mode 100644
index 0000000000..0faae57a3e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-pre-wrap-trailing-spaces-alt-015-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test Reference</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ font: 20px/1 Ahem;
+ white-space: pre;
+ }
+ span { background: blue; }
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX&#x0020;X<span>X<br>X</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-trim-discard-inner-001-ref.xht b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-trim-discard-inner-001-ref.xht
new file mode 100644
index 0000000000..64be70b5f1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-trim-discard-inner-001-ref.xht
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 Test: white-space-trim - discard-inner - basic cases Reftest Reference</title>
+ <link rel="author" title="Satoshi Umehara" href="mailto:umehara@est.co.jp" />
+ <style type="text/css">
+ <![CDATA[
+ span {
+ color: Blue;
+ }
+ ]]>
+ </style>
+ </head>
+ <body>
+ <p>
+ Test passes if each text positions in the first line match the corresponding positions in the second line.
+ </p>
+ <div>
+ [<span>1 2</span>]
+ [<span>  3  4  </span>]
+ [<span>5 6</span>]
+ [<span>7
+
+8</span>]
+ </div>
+ <div>
+ [<span>1 2</span>]
+ [<span>  3  4  </span>]
+ [<span>5 6</span>]
+ [<span>7
+
+8</span>]
+ </div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-001-ref.html
new file mode 100644
index 0000000000..cab5556406
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-001-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<title>CSS Text reference</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+
+<style>
+p {
+ width: fit-content;
+ border: 2px solid green;
+ font: 24px monospace;
+}
+</style>
+
+<body>
+</body>
+
+<script>
+for (i = 0x200b; i <= 0x200f; ++i) {
+ txt = "This should have no leading or trailing ["
+ + i.toString(16)
+ + "]";
+ p = document.createElement("p");
+ p.textContent = txt;
+ document.body.appendChild(p);
+}
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-002-ref.html
new file mode 100644
index 0000000000..63bbe7ac02
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-vs-joiners-002-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<title>CSS Text reference</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+
+<style>
+p {
+ width: min-content;
+ border: 2px solid green;
+ font: 24px monospace;
+}
+</style>
+
+<body>
+ <p>
+ This
+ is
+ a
+ simple
+ test
+ </p>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-wrap-after-nowrap-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-wrap-after-nowrap-001-ref.html
new file mode 100644
index 0000000000..71e1c82465
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-wrap-after-nowrap-001-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<style>
+div {
+ width: 10ch;
+ border: 2px solid blue;
+ line-height: 1;
+}
+.ideo > div {
+ width: 1em;
+}
+</style>
+<body>
+ <section>
+ <div>12345<br>67890</div>
+ <div>12345<br>67890</div>
+ <div>12345<br>67890</div>
+ <div>12345<br>67890</div>
+
+ <div>12345<br>67890</div>
+ <div>12345<br>67890</div>
+ </section>
+
+ <section class="ideo">
+ <div>国<br>国</div>
+ <div>国<br>国</div>
+ </section>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-001-ref.html
new file mode 100644
index 0000000000..3c27ed25be
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>CSS Text test reference</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<style>
+pre {
+ font-size: 12px;
+ float: left;
+ border: 1px solid black;
+ margin: 12px;
+}
+</style>
+<pre>
+foo
+bar
+</pre>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-002-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-002-ref.html
new file mode 100644
index 0000000000..6d2134ac4d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/white-space-zero-fontsize-002-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>CSS Text test reference</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<style>
+pre {
+ font-size: 12px;
+ float: left;
+ border: 1px solid black;
+ margin: 12px;
+ -moz-tab-size: 100px;
+ tab-size: 100px;
+}
+</style>
+<pre>
+<span>foo</span>&#x9;<span>bar</span>
+</pre>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-001-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-001-ref.html
new file mode 100644
index 0000000000..842f46913d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-001-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ white-space: pre;
+ width: 4ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div>123
+ 8</div>
+
+ <div>123
+ 8</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-003-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-003-ref.html
new file mode 100644
index 0000000000..3bb3617760
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-003-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ li
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ white-space: pre;
+ width: 4ch;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles (both preceded with a small filled disc) are laid out identically.
+
+ <ul><li>123
+ 8</ul>
+
+ <ul><li>123
+ 8</ul>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-006-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-006-ref.html
new file mode 100644
index 0000000000..d8a5b90638
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-006-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ table
+ {
+ border: black solid 2px;
+ border-spacing: 0px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ white-space: pre;
+ width: 4ch;
+ }
+
+ td
+ {
+ padding: 0px;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <table><tr><td>123
+ 8</table>
+
+ <table><tr><td>123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-012-ref.html b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-012-ref.html
new file mode 100644
index 0000000000..942bd8fe92
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/reference/ws-break-spaces-applies-to-012-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Reference Test</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+
+ <style>
+ table
+ {
+ border: black solid 2px;
+ border-spacing: 0px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ }
+
+ td
+ {
+ padding: 0px;
+ width: 4ch;
+ white-space: normal;
+ }
+ </style>
+
+ <body>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <table><tr><td>123
+ 8</table>
+
+ <table><tr><td>123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html b/testing/web-platform/tests/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html
new file mode 100644
index 0000000000..806bf05eac
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
+<link rel="match" href="../../reference/pass_if_two_words.html">
+<p>There should be a space between "two" and "words" below.</p>
+<div id="host">two<div id="rm"></div> <span>words</span></div>
+<script>
+ let root = host.attachShadow({mode:"open"});
+ root.innerHTML = "<slot></slot>";
+ host.offsetTop;
+ rm.slot = "unknown";
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-000.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-000.tentative.html
new file mode 100644
index 0000000000..cb7b0f30b5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-000.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Whitespace and line break transformation</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="All spaces and tabs immediately preceding or following a segment break are removed. If no F, H, W or ZWSP characters involved, the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color:#2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color:#270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>hello
+there</span></div>
+<div id='test2' class="test"><span>hello&#x20;&#x20;&#x20;
+there</span></div>
+<div id='test3' class="test"><span>hello
+&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id='test4' class="test"><span>hello&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id='test5' class="test"><span>hello
+
+
+there</span></div>
+<div id='test6' class="test"><span>hello&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;there</span></div>
+<div id="ref" class="ref"><span>hello there</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if more than one space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-001.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-001.tentative.html
new file mode 100644
index 0000000000..1640878a00
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-001.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Wide characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is W and neither side is Hangul, then the segment break is removed.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color:#2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color:#270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>日本語
+中国话</span></div>
+<div id='test2' class="test"><span>日本語&#x20;&#x20;&#x20;
+中国话</span></div>
+<div id='test3' class="test"><span>日本語
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;中国话</span></div>
+<div id='test4' class="test"><span>日本語&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;中国话</span></div>
+<div id='test5' class="test"><span>日本語
+
+
+中国话</span></div>
+<div id='test6' class="test"><span>日本語&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;中国话</span></div>
+<div id="ref" class="ref"><span>日本語中国话</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-002.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-002.tentative.html
new file mode 100644
index 0000000000..de51bf6f81
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-002.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Fullwidth characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F and neither side is Hangul, then the segment break is removed.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>FULL
+WIDTH</span></div>
+<div id='test2' class="test"><span>FULL&#x20;&#x20;&#x20;
+WIDTH</span></div>
+<div id='test3' class="test"><span>FULL
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id='test4' class="test"><span>FULL&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id='test5' class="test"><span>FULL
+
+
+WIDTH</span></div>
+<div id='test6' class="test"><span>FULL&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id="ref" class="ref"><span>FULLWIDTH</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-003.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-003.tentative.html
new file mode 100644
index 0000000000..15b98b6917
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-003.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Halfwidth characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is H and neither side is Hangul, then the segment break is removed.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>ハン
+カク</span></div>
+<div id='test2' class="test"><span>ハン&#x20;&#x20;&#x20;
+カク</span></div>
+<div id='test3' class="test"><span>ハン
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id='test4' class="test"><span>ハン&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id='test5' class="test"><span>ハン
+
+
+カク</span></div>
+<div id='test6' class="test"><span>ハン&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;カク</span></div>
+<div id="ref" class="ref"><span>ハンカク</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html
new file mode 100644
index 0000000000..e7a12b1337
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Won and halfwidth characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F or H and neither side is Hangul, then the segment break is removed.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>₩
+24</span></div>
+<div id='test2' class="test"><span>₩&#x20;&#x20;&#x20;
+24</span></div>
+<div id='test3' class="test"><span>₩
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;24</span></div>
+<div id='test4' class="test"><span>₩&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;24</span></div>
+<div id='test5' class="test"><span>₩
+
+
+24</span></div>
+<div id='test6' class="test"><span>₩&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;24</span></div>
+<div id="ref1" class="ref"><span>₩24</span></div>
+<div id='test7' class="test"><span>24
+₩</span></div>
+<div id='test8' class="test"><span>24&#x20;&#x20;&#x20;
+₩</span></div>
+<div id='test9' class="test"><span>24
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;₩</span></div>
+<div id='test10' class="test"><span>24&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;₩</span></div>
+<div id='test11' class="test"><span>24
+
+
+₩</span></div>
+<div id='test12' class="test"><span>24&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;₩</span></div>
+<div id="ref2" class="ref"><span>24₩</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "linebreak only ₩24");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "spaces linebreak ₩24");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "linebreak spaces ₩24");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "spaces linebreak spaces ₩24");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "multiple linebreaks ₩24");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces ₩24");
+test(function() {
+assert_equals(document.getElementById('test7').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "linebreak only 24₩");
+test(function() {
+assert_equals(document.getElementById('test8').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "spaces linebreak 24₩");
+test(function() {
+assert_equals(document.getElementById('test9').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "linebreak spaces 24₩");
+test(function() {
+assert_equals(document.getElementById('test10').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "spaces linebreak spaces 24₩");
+test(function() {
+assert_equals(document.getElementById('test11').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "multiple linebreaks 24₩");
+test(function() {
+assert_equals(document.getElementById('test12').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces 24₩");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-005.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-005.tentative.html
new file mode 100644
index 0000000000..92f91c3bf8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-005.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Wide character and non-wide character around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of only one character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>漢字
+kanji</span></div>
+<div id='test2' class="test"><span>漢字&#x20;&#x20;&#x20;
+kanji</span></div>
+<div id='test3' class="test"><span>漢字
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;kanji</span></div>
+<div id='test4' class="test"><span>漢字&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;kanji</span></div>
+<div id='test5' class="test"><span>漢字
+
+
+kanji</span></div>
+<div id='test6' class="test"><span>漢字&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;kanji</span></div>
+<div id="ref" class="ref"><span>漢字&#x20;kanji</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if more or less than one space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-006.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-006.tentative.html
new file mode 100644
index 0000000000..c4fed83d3d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-006.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Fullwidth character and non-fullwidth character around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of only one character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>FULL
+width</span></div>
+<div id='test2' class="test"><span>FULL&#x20;&#x20;&#x20;
+width</span></div>
+<div id='test3' class="test"><span>FULL
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;width</span></div>
+<div id='test4' class="test"><span>FULL&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;width</span></div>
+<div id='test5' class="test"><span>FULL
+
+
+width</span></div>
+<div id='test6' class="test"><span>FULL&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;width</span></div>
+<div id="ref" class="ref"><span>FULL&#x20;width</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if more or less than one space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-007.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-007.tentative.html
new file mode 100644
index 0000000000..4f4f4ab7a4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-007.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Halfwidth character and non-halfwidth character around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of only one character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>han
+カク</span></div>
+<div id='test2' class="test"><span>han&#x20;&#x20;&#x20;
+カク</span></div>
+<div id='test3' class="test"><span>han
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id='test4' class="test"><span>han&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id='test5' class="test"><span>han
+
+
+カク</span></div>
+<div id='test6' class="test"><span>han&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;カク</span></div>
+<div id="ref" class="ref"><span>han&#x20;カク</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if more or less than one space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-008.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-008.tentative.html
new file mode 100644
index 0000000000..6d04366bb6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-008.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Wide and fullwidth characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>日本語
+WIDTH</span></div>
+<div id='test2' class="test"><span>日本語&#x20;&#x20;&#x20;
+WIDTH</span></div>
+<div id='test3' class="test"><span>日本語
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id='test4' class="test"><span>日本語&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id='test5' class="test"><span>日本語
+
+
+WIDTH</span></div>
+<div id='test6' class="test"><span>日本語&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id="ref" class="ref"><span>日本語WIDTH</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-009.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-009.tentative.html
new file mode 100644
index 0000000000..c7a79cecac
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-009.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Fullwidth and halfwidth characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>FULL
+カク</span></div>
+<div id='test2' class="test"><span>FULL&#x20;&#x20;&#x20;
+カク</span></div>
+<div id='test3' class="test"><span>FULL
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id='test4' class="test"><span>FULL&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id='test5' class="test"><span>FULL
+
+
+カク</span></div>
+<div id='test6' class="test"><span>FULL&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;カク</span></div>
+<div id="ref" class="ref"><span>FULLカク</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-010.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-010.tentative.html
new file mode 100644
index 0000000000..43b4218df3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-010.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Hangul characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>한글
+쓰기</span></div>
+<div id='test2' class="test"><span>한글&#x20;&#x20;&#x20;
+쓰기</span></div>
+<div id='test3' class="test"><span>한글
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;쓰기</span></div>
+<div id='test4' class="test"><span>한글&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;쓰기</span></div>
+<div id='test5' class="test"><span>한글
+
+
+쓰기</span></div>
+<div id='test6' class="test"><span>한글&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;쓰기</span></div>
+<div id="ref" class="ref"><span>한글&#x20;쓰기</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if more or less than one space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-011.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-011.tentative.html
new file mode 100644
index 0000000000..d88a8efd34
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-011.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Hangul jamo characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>하ᄂ
+그ᄅ</span></div>
+<div id='test2' class="test"><span>하ᄂ&#x20;&#x20;&#x20;
+그ᄅ</span></div>
+<div id='test3' class="test"><span>하ᄂ
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;그ᄅ</span></div>
+<div id='test4' class="test"><span>하ᄂ&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;그ᄅ</span></div>
+<div id='test5' class="test"><span>하ᄂ
+
+
+그ᄅ</span></div>
+<div id='test6' class="test"><span>하ᄂ&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;그ᄅ</span></div>
+<div id="ref" class="ref"><span>하ᄂ&#x20;그ᄅ</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-012.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-012.tentative.html
new file mode 100644
index 0000000000..2c8b186c3b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-012.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Hangul halfwidth jamo characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>하ᄂ
+그ᄅ</span></div>
+<div id='test2' class="test"><span>하ᄂ&#x20;&#x20;&#x20;
+그ᄅ</span></div>
+<div id='test3' class="test"><span>하ᄂ
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;그ᄅ</span></div>
+<div id='test4' class="test"><span>하ᄂ&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;그ᄅ</span></div>
+<div id='test5' class="test"><span>하ᄂ
+
+
+그ᄅ</span></div>
+<div id='test6' class="test"><span>하ᄂ&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;그ᄅ</span></div>
+<div id="ref" class="ref"><span>하ᄂ&#x20;그ᄅ</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-014.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-014.tentative.html
new file mode 100644
index 0000000000..93dc18a8c9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-014.tentative.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Thai characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>ภาษา
+ไทย</span></div>
+<div id='test2' class="test"><span>ภาษา&#x20;&#x20;&#x20;
+ไทย</span></div>
+<div id='test3' class="test"><span>ภาษา
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;ไทย</span></div>
+<div id='test4' class="test"><span>ภาษา&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;ไทย</span></div>
+<div id='test5' class="test"><span>ภาษา
+
+
+ไทย</span></div>
+<div id='test6' class="test"><span>ภาษา&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;ไทย</span></div>
+<div id="ref" class="ref"><span>ภาษา&#x20;ไทย</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+</script>
+<!-- Notes:
+The assertion will fail if more or less than one space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-015.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-015.tentative.html
new file mode 100644
index 0000000000..095fcd0dd9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-015.tentative.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Thai and Latin characters around line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>ภาษา
+latin</span></div>
+<div id='test2' class="test"><span>ภาษา&#x20;&#x20;&#x20;
+latin</span></div>
+<div id='test3' class="test"><span>ภาษา
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;latin</span></div>
+<div id='test4' class="test"><span>ภาษา&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;latin</span></div>
+<div id='test5' class="test"><span>ภาษา
+
+
+latin</span></div>
+<div id='test6' class="test"><span>ภาษา&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;latin</span></div>
+<div id="ref1" class="ref"><span>ภาษา&#x20;latin</span></div>
+
+<div id='test7' class="test"><span>latin
+ภาษา</span></div>
+<div id='test8' class="test"><span>latin&#x20;&#x20;&#x20;
+ภาษา</span></div>
+<div id='test9' class="test"><span>latin
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;ภาษา</span></div>
+<div id='test10' class="test"><span>latin&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;ภาษา</span></div>
+<div id='test11' class="test"><span>latin
+
+
+ภาษา</span></div>
+<div id='test12' class="test"><span>latin&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;ภาษา</span></div>
+<div id="ref2" class="ref"><span>latin&#x20;ภาษา</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "linebreak only thai latin");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "spaces linebreak thai latin");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "linebreak spaces thai latin");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "spaces linebreak spaces thai latin");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "multiple linebreaks thai latin");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces thai latin");
+test(function() {
+assert_equals(document.getElementById('test7').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "linebreak only latin thai");
+test(function() {
+assert_equals(document.getElementById('test8').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "spaces linebreak latin thai");
+test(function() {
+assert_equals(document.getElementById('test9').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "linebreak spaces latin thai");
+test(function() {
+assert_equals(document.getElementById('test10').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "spaces linebreak spaces latin thai");
+test(function() {
+assert_equals(document.getElementById('test11').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "multiple linebreaks latin thai");
+test(function() {
+assert_equals(document.getElementById('test12').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces latin thai");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-016.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-016.tentative.html
new file mode 100644
index 0000000000..2cb36a5b1e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-016.tentative.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Thai with ZWSP before line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the character immediately before or immediately after the segment break is the zero-width space character (U+200B), then the break is removed, leaving behind the zero-width space.">
+<style type='text/css'>
+/* the CSS below is not part of the test */
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>ภาษา&#x200B;
+ไทย</span></div>
+<div id='test2' class="test"><span>ภาษา&#x200B;&#x20;&#x20;&#x20;
+ไทย</span></div>
+<div id='test3' class="test"><span>ภาษา&#x200B;
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;ไทย</span></div>
+<div id='test4' class="test"><span>ภาษา&#x200B;&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;ไทย</span></div>
+<div id='test5' class="test"><span>ภาษา&#x200B;
+
+
+ไทย</span></div>
+<div id='test6' class="test"><span>ภาษา&#x200B;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;ไทย</span></div>
+<div id="ref" class="ref"><span>ภาษาไทย</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+var matches = document.getElementById('test1').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 1");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+var matches = document.getElementById('test2').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 2");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+var matches = document.getElementById('test3').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 3");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+var matches = document.getElementById('test4').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 4");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+var matches = document.getElementById('test5').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 5");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+var matches = document.getElementById('test6').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 6");
+</script>
+<!-- Notes:
+The assertion will fail if a normal space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-017.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-017.tentative.html
new file mode 100644
index 0000000000..52b7ce1f6a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-017.tentative.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Thai with ZWSP after line break</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="If the character immediately before or immediately after the segment break is the zero-width space character (U+200B), then the break is removed, leaving behind the zero-width space.">
+<style type='text/css'>
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test1' class="test"><span>ภาษา
+&#x200B;ไทย</span></div>
+<div id='test2' class="test"><span>ภาษา
+&#x20;&#x20;&#x20;&#x200B;ไทย</span></div>
+<div id='test3' class="test"><span>ภาษา&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;
+&#x200B;ไทย</span></div>
+<div id='test4' class="test"><span>ภาษา&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;&#x200B;ไทย</span></div>
+<div id='test5' class="test"><span>ภาษา
+
+
+&#x200B;ไทย</span></div>
+<div id='test6' class="test"><span>ภาษา&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x200B;ไทย</span></div>
+<div id="ref" class="ref"><span>ภาษาไทย</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak only");
+var matches = document.getElementById('test1').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 1");
+test(function() {
+assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak");
+var matches = document.getElementById('test2').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 2");
+test(function() {
+assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "linebreak spaces");
+var matches = document.getElementById('test3').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 3");
+test(function() {
+assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces linebreak spaces");
+var matches = document.getElementById('test4').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 4");
+test(function() {
+assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks");
+var matches = document.getElementById('test5').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 5");
+test(function() {
+assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "multiple linebreaks + spaces");
+var matches = document.getElementById('test6').firstChild.textContent.match(/\u200B/g)
+test(function() {
+assert_equals(matches.length, 1);
+}, "zwsp retained 6");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-018.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-018.tentative.html
new file mode 100644
index 0000000000..2faf185856
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-018.tentative.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: inline element boundary and segment break transformations</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-encoding">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#line-break-transform">
+<link rel=match href="../../reference/ref-filled-green-100px-square.xht">
+<meta name="assert" content="intervening inline box boundaries must be ignored for segment break transformations">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+ color: green;
+}
+#b { border-right: solid 20px green; }
+#p { padding-right: 20px; background: green; }
+#m { margin-right: 20px; }
+#m2 { margin-right: -20px; }
+
+#red {
+ width: 100px;
+ height: 100px;
+ background: red;
+ position: absolute;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+<div id=red></div>
+
+<div>aa&#x200b;
+bbb</div>
+
+<div>aa<span>&#x200b;</span>
+bbb</div>
+
+<div>aa<span id=b>&#x200b;</span>
+bb</div>
+
+<div>aa<span id=p>&#x200b;</span>
+bb</div>
+
+<div>aa<span id=m>&#x200b;</span><span id=m2></span>
+bbb</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-019.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-019.tentative.html
new file mode 100644
index 0000000000..afbba26425
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-019.tentative.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: out of flow elements and segment break transformations</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-encoding">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#line-break-transform">
+<link rel=match href="../../reference/ref-filled-green-100px-square.xht">
+<meta name="assert" content="Out-of-flow elements must be ignored for segment break transformations">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 20px/1 Ahem;
+ color: green;
+}
+aside {
+ color: transparent;
+}
+#abs { position: absolute; }
+#fixed { position: fixed; }
+#float-r { float: right; }
+#float-l { float: left; margin-left: -3em; }
+#red {
+ width: 100px;
+ height: 100px;
+ background: red;
+ position: absolute;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+<div id=red></div>
+
+<div>aa&#x200b;
+bbb</div>
+
+<div>aa&#x200b;<aside id=abs>foo</aside>
+bbb</div>
+
+<div>aa&#x200b;<aside id=fixed>foo</aside>
+bbb</div>
+
+<div>aa&#x200b;<aside id=float-r>foo</aside>
+bbb</div>
+
+<div>aa&#x200b;<aside id=float-l>foo</aside>
+bbb</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/support/trailing-space-and-text-alignment.css b/testing/web-platform/tests/css/css-text/white-space/support/trailing-space-and-text-alignment.css
new file mode 100644
index 0000000000..3bb9b369fc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/support/trailing-space-and-text-alignment.css
@@ -0,0 +1,24 @@
+textarea {
+ /* Reset user-agent style */
+ margin: initial;
+ padding: initial;
+ border: initial;
+ border-radius: initial;
+ outline: initial;
+ resize: initial;
+ overflow-wrap: initial;
+
+ height: 100px;
+ font: 40px/1 Ahem;
+ border: 1px solid black;
+ overflow-y: hidden;
+ overflow-x: auto;
+
+ /* testing */
+ width: 3ch;
+}
+.left { text-align: left; }
+.center { text-align: center; }
+.right { text-align: right; }
+.start { text-align: start; }
+.end { text-align: end; }
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-bidi-001.html b/testing/web-platform/tests/css/css-text/white-space/tab-bidi-001.html
new file mode 100644
index 0000000000..cf3190ff9b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-bidi-001.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: Tabs vs. Bidi</title>
+<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/tab-bidi-001-ref.html">
+<meta name="assert" content="Tabs segment bidi reordering per UAX9.">
+<style>
+body > div {
+ border: solid blue;
+ margin: 1em;
+}
+div > div {
+ white-space: pre;
+ font: 20px/1 monospace;
+ text-align: left;
+}
+div > span { /* measure bounds */
+ border: orange;
+ border-style: none solid;
+}
+</style>
+
+<p>Test passes if all three rows of each box are identical.
+
+<div>
+ <div dir=ltr><span>A <span dir="rtl">B C</span> D </span></div>
+ <div dir=ltr><span><bdo dir=rtl>A B C</bdo> D </span></div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>A B C D </span></div>
+</div>
+<div>
+ <div dir=ltr><span>א <span dir="rtl">בּ ג</span> ד </span></div>
+ <div dir=ltr><span><bdo dir=rtl>א בּ ג</bdo> ד </span></div>
+ <div style="unicode-bidi: bidi-override; direction: ltr"><span>א בּ ג ד </span></div>
+</div>
+<div>
+ <div dir=rtl><span>A <span dir="ltr">B C</span> D </span></div>
+ <div dir=rtl><span><bdo dir=ltr>A B C</bdo> D </span></div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>A B C D </span></div>
+</div>
+<div>
+ <div dir=rtl><span>א <span dir="ltr">בּ ג</span> ד </span></div>
+ <div dir=rtl><span><bdo dir=ltr>א בּ ג</bdo> ד </span></div>
+ <div style="unicode-bidi: bidi-override; direction: rtl"><span>א בּ ג ד </span></div>
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-001.html b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-001.html
new file mode 100644
index 0000000000..dae6012bf7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-001.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: the nearest tab stop is more than 0.5 ch away</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<link rel="match" href="reference/tab-stop-threshold-001-ref.html">
+<meta name="assert" content="A preserved tab pushes to the nearest tap stop as long as we're not closer to it than 0.5ch.">
+<style>
+div {
+ white-space: pre;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+span { display: inline-block; }
+#s1 { width: 6ch; }
+#s2 { width: 7ch; }
+#s3 { width: 7.3ch; }
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div><span id=s1></span>&#9;P</div>
+<div><span id=s2></span>&#9;A</div>
+<div><span id=s3></span>&#9;S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-002.html b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-002.html
new file mode 100644
index 0000000000..1147e4b041
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-002.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: the nearest tab stop is less than 0.5 ch away</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<link rel="match" href="reference/tab-stop-threshold-002-ref.html">
+<meta name="assert" content="A preserved tab pushes to the tab stop after the nearest one as long as we're closer to the nearest one than 0.5ch.">
+<style>
+div {
+ white-space: pre;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+span { display: inline-block; }
+#s1 { width: 7.6ch; }
+#s2 { width: 7.8ch; }
+#s3 { width: 7.9ch; }
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div><span id=s1></span>&#9;P</div>
+<div><span id=s2></span>&#9;A</div>
+<div><span id=s3></span>&#9;S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-003.html b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-003.html
new file mode 100644
index 0000000000..24cf10defc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-003.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: the nearest tab stop is more than 0.5 ch away, white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<link rel="match" href="reference/tab-stop-threshold-001-ref.html">
+<meta name="assert" content="A preserved tab pushes to the nearest tap stop as long as we're not closer to it than 0.5ch, under white-space:pre-wrap">
+<style>
+div {
+ white-space: pre-wrap;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+span { display: inline-block; }
+#s1 { width: 6ch; }
+#s2 { width: 7ch; }
+#s3 { width: 7.3ch; }
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div><span id=s1></span>&#9;P</div>
+<div><span id=s2></span>&#9;A</div>
+<div><span id=s3></span>&#9;S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-004.html b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-004.html
new file mode 100644
index 0000000000..3949c55a44
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-004.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: the nearest tab stop is less than 0.5 ch away, white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<link rel="match" href="reference/tab-stop-threshold-002-ref.html">
+<meta name="assert" content="A preserved tab pushes to the tab stop after the nearest one as long as we're closer to the nearest one than 0.5ch, under white-space:pre-wrap.">
+<style>
+div {
+ white-space: pre-wrap;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+span { display: inline-block; }
+#s1 { width: 7.6ch; }
+#s2 { width: 7.8ch; }
+#s3 { width: 7.9ch; }
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div><span id=s1></span>&#9;P</div>
+<div><span id=s2></span>&#9;A</div>
+<div><span id=s3></span>&#9;S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-005.html b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-005.html
new file mode 100644
index 0000000000..f82e5e5174
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-005.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: the nearest tab stop is more than 0.5 ch away, white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<link rel="match" href="reference/tab-stop-threshold-001-ref.html">
+<meta name="assert" content="A preserved tab pushes to the nearest tap stop as long as we're not closer to it than 0.5ch, under white-space:break-spaces">
+<style>
+div {
+ white-space: break-spaces;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+span { display: inline-block; }
+#s1 { width: 6ch; }
+#s2 { width: 7ch; }
+#s3 { width: 7.3ch; }
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div><span id=s1></span>&#9;P</div>
+<div><span id=s2></span>&#9;A</div>
+<div><span id=s3></span>&#9;S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-006.html b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-006.html
new file mode 100644
index 0000000000..7d1299124d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/tab-stop-threshold-006.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: the nearest tab stop is less than 0.5 ch away, white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<link rel="match" href="reference/tab-stop-threshold-002-ref.html">
+<meta name="assert" content="A preserved tab pushes to the tab stop after the nearest one as long as we're closer to the nearest one than 0.5ch, under white-space:break-spaces.">
+<style>
+div {
+ white-space: break-spaces;
+ font-family: monospace;
+ tab-size: 8; /* the initial value, but since we're measuring against it, we might as well be sure */
+}
+span { display: inline-block; }
+#s1 { width: 7.6ch; }
+#s2 { width: 7.8ch; }
+#s3 { width: 7.9ch; }
+</style>
+
+<p>Test passes if the 4 letters bellow are vertically aligned.
+<div><span id=s1></span>&#9;P</div>
+<div><span id=s2></span>&#9;A</div>
+<div><span id=s3></span>&#9;S</div>
+<div> S</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-001.html
new file mode 100644
index 0000000000..4e1829f499
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-001.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-wrap">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+#container {
+ width: 20ch;
+}
+.balance {
+ text-wrap: balance;
+}
+</style>
+<div id="container"></div>
+<script>
+const container = document.getElementById('container');
+for (const text of [
+ 'Balancing should',
+ 'Balancing should not change',
+ 'Balancing should not change the number of lines.',
+ ]) {
+ const normal = document.createElement('div');
+ const balance = document.createElement('div');
+ normal.textContent = text;
+ balance.textContent = text;
+ balance.classList.add('balance');
+ container.appendChild(normal);
+ container.appendChild(balance);
+ test(() => {
+ assert_equals(normal.offsetHeight, balance.offsetHeight);
+ });
+}
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-002.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-002.html
new file mode 100644
index 0000000000..cae9d54de0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-002.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="mismatch" href="reference/text-wrap-balance-002-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+.container {
+ font-family: Ahem;
+ font-size: 20px;
+ width: 20ch;
+ text-wrap: balance;
+}
+</style>
+<div class="container">
+ 123 567 901 345 789 123
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-align-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-align-001.html
new file mode 100644
index 0000000000..b27823b72a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-align-001.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-align-001-ref.html">
+<style>
+.container {
+ font-family: monospace;
+ font-size: 20px;
+ width: 20ch;
+ border: solid 1px;
+ text-wrap: balance;
+}
+</style>
+<div class="container" style="text-align: right">
+ 123456789 123 567
+ 123456789 123 567
+</div>
+<div class="container" style="text-align: center">
+ 123456789 123 567
+ 123456789 123 567
+</div>
+<div class="container" style="text-align: justify">
+ 123456789 123 567
+ 123456789 123 567
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-dynamic-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-dynamic-001.html
new file mode 100644
index 0000000000..76b4cbbb43
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-dynamic-001.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-dynamic-001-ref.html">
+<style>
+#container {
+ width: 20ch;
+ text-wrap: balance;
+}
+span:hover {
+ color: red;
+}
+</style>
+<div id="container">
+ 123 567 901 345 789
+ 123 567 901 345 789
+ 123 567 901 345 789
+</div>
+<script>
+document.body.offsetTop;
+container.appendChild(document.createTextNode('999'));
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-001.html
new file mode 100644
index 0000000000..3f00fdfbf4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-001.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-float-001-ref.html">
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 23.5ch;
+ border: solid 1px;
+ text-wrap: balance;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: left;
+}
+</style>
+
+<div class="container"><div class="float">FLOAT<br>FLOAT</div>abc de fg hij klm nop qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-002.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-002.html
new file mode 100644
index 0000000000..b611b8d796
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-002.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-float-002-ref.html">
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 23.5ch;
+ border: solid 1px;
+ text-wrap: balance;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: right;
+}
+</style>
+
+<div class="container"><div class="float">FLOAT<br>FLOAT</div>abc de fg hij klm nop qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-003.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-003.html
new file mode 100644
index 0000000000..b2a4c7a43b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-003.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-float-001-ref.html">
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 23.5ch;
+ border: solid 1px;
+ text-wrap: balance;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: left;
+}
+</style>
+
+<div class="container">abc de<div class="float">FLOAT<br>FLOAT</div> fg hij klm nop qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-004.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-004.html
new file mode 100644
index 0000000000..b39f329255
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-004.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-float-002-ref.html">
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 23.5ch;
+ border: solid 1px;
+ text-wrap: balance;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: right;
+}
+</style>
+
+<div class="container">abc de <div class="float">FLOAT<br>FLOAT</div>fg hij klm nop qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-005.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-005.html
new file mode 100644
index 0000000000..177be0e10a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-float-005.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-float-005-ref.html">
+<style>
+.container {
+ font: 20px/1.5 monospace;
+ width: 26.5ch;
+ border: solid 1px;
+ text-wrap: balance;
+}
+.float {
+ background: yellow;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: left;
+}
+.float2 {
+ background: cyan;
+ padding: 0.2em 1ch;
+ line-height: 1.2;
+ float: right;
+}
+</style>
+
+<!--
+The floats (inc. padding) are 7ch wide, and occupy ~2 lines,
+so without balancing, layout would be
+ +--------------------------+
+ | FLOAT abcde fghi jklm nop|
+ | FLOAT qrst uvw FLOAT |
+ |xyx! FLOAT |
+ +--------------------------+
+
+Applying text-wrap:balance results in
+ +--------------------------+
+ | FLOAT abcde fghi |
+ | FLOAT jklm nop FLOAT |
+ |qrst uvw xyx! FLOAT |
+ +--------------------------+
+-->
+<div class="container"><div class="float">FLOAT<br>FLOAT</div>abcde fghi jklm nop<div class="float2">FLOAT<br>FLOAT</div> qrst uvw xyz!</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-line-clamp-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-line-clamp-001.html
new file mode 100644
index 0000000000..f104a5261b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-line-clamp-001.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-line-clamp-001-ref.html">
+<style>
+.container {
+ font-family: monospace;
+ font-size: 20px;
+ width: 20ch;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+ text-wrap: balance;
+}
+</style>
+<div class="container">
+ 123 567 901 345 789
+ 123 567 901 345 789
+ 123
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-narrow-crash.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-narrow-crash.html
new file mode 100644
index 0000000000..dcc0d8773d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-narrow-crash.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="width: 1px; text-wrap: balance">A</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-001.html
new file mode 100644
index 0000000000..5f79832549
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-001.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-overflow-001-ref.html">
+<style>
+.container {
+ font-family: monospace;
+ font-size: 20px;
+ inline-size: 15ch;
+ border: 1px solid;
+ overflow-wrap: break-word;
+ text-wrap: balance;
+}
+</style>
+<div class="container">CONTROLLING YOUR BU</div>
+<div class="container">CONTROLLING YOUR BU BU</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-002.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-002.html
new file mode 100644
index 0000000000..0eee3bdbc8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-overflow-002.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1878865">
+<link rel="match" href="reference/text-wrap-balance-overflow-002-ref.html">
+
+<style>
+#test {
+ border: 1px solid gray;
+ font: 15px monospace;
+ width: 20ch;
+ text-wrap: balance;
+}
+</style>
+
+<body onload="test.style.overflowWrap='anywhere'">
+<div id=test>
+Interconnect your build
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-text-indent-001.html b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-text-indent-001.html
new file mode 100644
index 0000000000..0fe4447acf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/text-wrap-balance-text-indent-001.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance">
+<link rel="match" href="reference/text-wrap-balance-text-indent-001-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ border: 1px solid;
+ font-family: Ahem;
+ font-size: 10px;
+ text-indent: 5ch;
+ text-wrap: balance;
+ width: 10ch;
+}
+</style>
+<div>
+ 01
+ 34 6 89
+ 12 3 56
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-001.html
new file mode 100644
index 0000000000..ad81e99768
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-001.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of line is wrapped when white-space is break-spaces in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is wrapped when the white-space property is set to break-spaces in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: break-spaces;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ margin-left: -1ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea> XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-002.html
new file mode 100644
index 0000000000..f9c2f50b32
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-break-spaces-002.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: single preserved white space at the end of with white-space:break-spaces in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="a single preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap and overflow-wrap is break-spaces in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: break-spaces;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 2ch;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-001.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-001.html
new file mode 100644
index 0000000000..19d8735790
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-001.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap is not wrapped in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap in a textarea">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-002.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-002.html
new file mode 100644
index 0000000000..de16f5b951
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-002.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on word-break:break-all in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if word-break is break-all in a textarea">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-003.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-003.html
new file mode 100644
index 0000000000..204f626a78
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-003.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on word-break:keep-all in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if word-break is keep-all in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ word-break: keep-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-004.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-004.html
new file mode 100644
index 0000000000..82d53bc7be
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-004.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on line-break:loose in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if line-break is loose in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ line-break: loose;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-005.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-005.html
new file mode 100644
index 0000000000..49797372c8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-005.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on line-break:normal in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if line-break is normal in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ line-break: normal;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-006.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-006.html
new file mode 100644
index 0000000000..8711a71de6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-006.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on line-break:strict in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if line-break is strict in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ line-break: strict;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-007.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-007.html
new file mode 100644
index 0000000000..5d6b57b14b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-007.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not change based on overflow-wrap:break-word in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="preserved white space at the end of the line is not wrapped when the white-space property is set to pre-wrap, even if overflow-wrap is break-word in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0 0/2ch 2ch no-repeat;
+
+ width: 4ch;
+ word-wrap: break-word; /* deprecated alias */
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-011.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-011.html
new file mode 100644
index 0000000000..ef4a84d3be
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-011.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of and white-space:pre-wrap does not cause wrapping in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="match" href="reference/textarea-pre-wrap-001-ref.html">
+<meta name="assert" content="When the white-space property is set to pre-wrap, preserved white space at the end of the line must hang or be collapsed, and must not cause preceeding content to be wrapped in a textarea.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 3ch;
+ margin-left: -1ch;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea> XX&#x20;
+ XX </textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-012.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-012.html
new file mode 100644
index 0000000000..5ca1281128
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-012.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of soft-wrapped lines and white-space:pre-wrap with right alignement in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-012-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, only spaces at the end of soft-wrapped lines get collapsed or hanged, so they do not have any effect when right aligning.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 1ch 0/2ch 2ch no-repeat;
+
+ width: 3ch;
+ text-align: right;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX&#x20;
+XX </textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-013.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-013.html
new file mode 100644
index 0000000000..3aa1360856
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-013.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of soft-wrapped line and white-space:pre-wrap with center alignement in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/pre-wrap-013-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, spaces at the end of soft-wrapped lines get collapsed or hanged, so they do not have any effect when centering.">
+<meta name="fuzzy" content="maxDifference=0-36; totalPixels=0-12">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: green;
+
+ background: linear-gradient(red, red) 0.5ch 0/2ch 2ch no-repeat;
+
+ width: 3ch;
+ text-align: center;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <textarea>XX XX</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-014.html b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-014.html
new file mode 100644
index 0000000000..f2812af2fb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/textarea-pre-wrap-014.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved white space at the end of soft-wrapped lines and white-space:pre-wrap with justification in a textarea</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/textarea-pre-wrap-014-ref.html">
+<meta name="assert" content="When white-space is pre-wrap, spaces at the end of a soft-wrapped line get collapsed or hanged, and don't influence justification.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+textarea {
+ word-wrap: initial; /*deprecated alias*/
+ overflow-wrap: initial;
+ line-break: initial;
+ word-break: initial;
+ margin: 0;
+ padding: 0;
+ border: none;
+ outline: none;
+ resize: none;
+ overflow: hidden; /* I don't want scrollbars, and overflow:visible isn't typically supported on textarea */
+
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+ color: white;
+
+ background: linear-gradient(red, red) 3ch 0/2ch 1ch no-repeat;
+
+ width: 4ch;
+ text-align: justify;
+}
+</style>
+<body>
+ <p>Test passes if there is <strong>no red</strong> below.</p>
+ <textarea>X X X</textarea>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-001.html
new file mode 100644
index 0000000000..96fd312176
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: ideographic space at the end of line must hang</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ideographic-space-001-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) at the end of the line must hang.">
+<style>
+div {
+ position: absolute;
+ width: max-content;
+ line-height: 1;
+ color: transparent;
+}
+.red { background: red; }
+.green { background: green; }
+</style>
+
+<p>Test passes if the shape below is green and if there is no red.
+
+<div class=red>あああ</div>
+<div class=red>ああ<span class=green>&#x3000;</span><br>ああ</div>
+<div><span class=green>ああ<br>ああ</span></div>
+<!-- the ideographic space must not be removed,
+ so it should hide the third red あ of the first div.
+ However, it should hang and therefore not extend the width of its parent div,
+ which would be visible as red on the second line if it were expanded.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-002.html
new file mode 100644
index 0000000000..864a8f87b5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-002.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequence of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ideographic-space-002-ref.html">
+<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must hang.">
+<style>
+div {
+ position: absolute;
+ width: max-content;
+ line-height: 1;
+ color: transparent;
+}
+.red { background: red; }
+.green { background: green; }
+</style>
+
+<p>Test passes if the shape below is green and if there is no red.
+<div class=red>ああああ あ あ</div>
+<div class=red>ああ<span class=green>&#x3000;&#x3000; &#x3000; &#x3000;</span><br>ああ</div>
+<div><span class=green>ああ<br>ああ</span></div>
+<!-- the trailing sequence of spaces must not be removed,
+ so it should hide all of the first (red) div.
+ However, it should hang and therefore not extend the width of its parent div,
+ which would be visible as red on the second line if it were expanded.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-003.html
new file mode 100644
index 0000000000..f5ad8cb871
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-003.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved ideographic space at the end of line must hang</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ideographic-space-003-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) at the end of the line must hang if white-space preserves spaces.">
+<style>
+div {
+ width: 2.5em;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;</span>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole sequence of preserved spaces will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-004.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-004.html
new file mode 100644
index 0000000000..af3187ae8d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-004.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved sequences of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ideographic-space-004-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must hang if white-space preserves spaces.">
+<style>
+div {
+ width: 2.5em;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the spaces are removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole space will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-005.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-005.html
new file mode 100644
index 0000000000..b33531bff9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-005.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequences of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="match" href="reference/trailing-ideographic-space-004-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must hang unconditionally .">
+<style>
+div {
+ width: 2.5em;
+ white-space: normal;
+}
+span { background: blue; } /* If the spaces are removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole space will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-006.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-006.html
new file mode 100644
index 0000000000..f5a8ab1dfb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-006.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequences of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="match" href="reference/trailing-ideographic-space-003-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) at the end of the line must unconditionally hang.">
+<style>
+div {
+ width: 2.5em;
+ white-space: normal;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;</span>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole sequence of preserved spaces will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-007.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-007.html
new file mode 100644
index 0000000000..d58d5ba9cf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-007.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequences of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-nowrap">
+<link rel="match" href="reference/trailing-ideographic-space-003-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) at the end of the line must unconditionally hang.">
+<style>
+div {
+ width: 2.5em;
+ white-space: nowrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;</span><br>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole sequence of preserved spaces will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-008.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-008.html
new file mode 100644
index 0000000000..50de162540
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-008.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequences of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-line">
+<link rel="match" href="reference/trailing-ideographic-space-003-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An ideographic space (U+3000) at the end of the line must unconditionally hang.">
+<style>
+div {
+ width: 2.5em;
+ white-space: pre-line;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;</span>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole sequence of preserved spaces will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-009.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-009.html
new file mode 100644
index 0000000000..2a642bbc6f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-009.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequences of spaces and ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-nowrap">
+<link rel="match" href="reference/trailing-ideographic-space-004-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must hang unconditionally .">
+<style>
+div {
+ width: 2.5em;
+ white-space: nowrap;
+}
+span { background: blue; } /* If the spaces are removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span><br>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole space will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-010.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-010.html
new file mode 100644
index 0000000000..eef3613edd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-010.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequence of ideographic spaces at the end of line must hang</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-line">
+<link rel="match" href="reference/trailing-ideographic-space-004-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
+<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must hang unconditionally .">
+<style>
+div {
+ width: 2.5em;
+ white-space: pre-line;
+}
+span { background: blue; } /* If the spaces are removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
+<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span>ああ</div>
+
+<!--
+We're using a 2.5em width and two references, instead of 2em and just the first one,
+because in addition to requiring the spaces to hang,
+the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
+In browsers that don't do that, the whole space will be visible, and the first ref will be matched.
+In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-011.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-011.html
new file mode 100644
index 0000000000..381d7a41b0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-011.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ideographic-space-011-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-011-ref.html">
+<meta name="assert" content="Trailing ideographic spaces should hang.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 3ch;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a single line and if there is a blue square at the end of the first line.
+<div>X&#x03000;<span>X&#x03000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-012.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-012.html
new file mode 100644
index 0000000000..2b73db1820
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-012.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Trailing ideographic spaces should hang.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: 2ch;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div>XX<span>&#x03000;</span>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-013.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-013.html
new file mode 100644
index 0000000000..fa8195e4a8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-013.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Trailing ideographic spaces should hang, despite the use of overflow-wrap: break-word.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: 2ch;
+ overflow-wrap: break-word;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div>XX<span>&#x03000;</span>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-014.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-014.html
new file mode 100644
index 0000000000..8eab5924c5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-014.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Trailing ideographic spaces should hang, despite the use of overflow-wrap: anywhere.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: 2ch;
+ overflow-wrap: anywhere;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div>XX<span>&#x03000;</span>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-015.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-015.html
new file mode 100644
index 0000000000..efcb2c8a05
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-015.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/trailing-ideographic-space-011-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-011-ref.html">
+<meta name="assert" content="Trailing ideographic spaces should hang, despite the use of overflow-wrap: anywhere.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 3ch;
+
+ overflow-wrap: anywhere;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a single line and if there is a blue square at the end of the first line.
+<div>X&#x03000;<span>X&#x03000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-016.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-016.html
new file mode 100644
index 0000000000..3e65785f39
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-016.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling leading ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/trailing-ideographic-space-011-ref.html">
+<link rel="match" href="reference/trailing-ideographic-space-alt-011-ref.html">
+<meta name="assert" content="Trailing ideographic spaces should hang, despite the use of overflow-wrap: break-word.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 3ch;
+
+ overflow-wrap: break-word;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>Test passes if the characters below are arranged in a single line and if there is a blue square at the end of the first line.
+<div>X&#x03000;<span>X&#x03000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-017.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-017.html
new file mode 100644
index 0000000000..742e389950
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-017.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-none">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Disabled hypenation and unicode-bidi 'plaintext' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: plaintext;
+ hyphens: none;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>&#x3000;&#x3000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-018.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-018.html
new file mode 100644
index 0000000000..16bb876751
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-018.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-none">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Disabled hypenation and unicode-bidi 'plaintext' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: plaintext;
+ hyphens: none;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>XX</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-019.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-019.html
new file mode 100644
index 0000000000..0707000512
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-019.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-none">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Disabled hypenation and unicode-bidi 'plaintext' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: plaintext;
+ hyphens: none;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>X&#x3000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-020.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-020.html
new file mode 100644
index 0000000000..97ae007898
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-020.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-isolate">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-none">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Disabled hypenation and unicode-bidi 'isolate' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: isolate;
+ hyphens: none;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>&#x3000;&#x3000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-021.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-021.html
new file mode 100644
index 0000000000..b75327a64b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-021.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-isolate">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-none">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Disabled hypenation and unicode-bidi 'isolate' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: isolate;
+ hyphens: none;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>XX</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-022.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-022.html
new file mode 100644
index 0000000000..71720c2b2d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-022.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-isolate">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-none">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Disabled hypenation and unicode-bidi 'isolate' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: isolate;
+ hyphens: none;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>X&#x3000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-023.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-023.html
new file mode 100644
index 0000000000..ea95ab1e0f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-023.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-auto">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Auto hypenation and unicode-bidi 'plaintext' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: plaintext;
+ hyphens: auto;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>&#x3000;&#x3000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-024.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-024.html
new file mode 100644
index 0000000000..2a65400c60
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-024.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-auto">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Auto hypenation and unicode-bidi 'plaintext' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: plaintext;
+ hyphens: auto;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>XX</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-025.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-025.html
new file mode 100644
index 0000000000..5123e10524
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-025.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: handling trailing ideographic space sequence</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-hyphens-auto">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Auto hypenation and unicode-bidi 'plaintext' should not affect, hence the trailing ideographic spaces must hang; however, the rest of the sequence is wrapped due to the forced break.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 50px/1 Ahem;
+ width: 1ch;
+}
+span {
+ background: green;
+ color: transparent;
+
+ unicode-bidi: plaintext;
+ hyphens: auto;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<br>XX</div>
+<div><span>X&#x3000;<br>X&#x3000;</span></div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-001.html
new file mode 100644
index 0000000000..9ecfdb3eac
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-001.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-ideographic-space-break-spaces-001-ref.html">
+<meta name="assert" content="If white-space is set to 'break-spaces', the overflowing idegraphic spaces must wrap to the next line.">
+<style>
+div {
+ width: 3em;
+ white-space: break-spaces;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div>ああ&#x3000;&#x3000;&#x3000;&#x3000;ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-002.html
new file mode 100644
index 0000000000..587f4e04b9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-002.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-ideographic-space-break-spaces-001-ref.html">
+<meta name="assert" content="If white-space is set to 'break-spaces', the overflowing idegraphic spaces must wrap to the next line.">
+<style>
+div {
+ width: 3em;
+ white-space: break-spaces;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div>ああ<span>&#x3000;&#x3000;&#x3000;&#x3000;</span>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-003.html
new file mode 100644
index 0000000000..08eacdd2cf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-003.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-ideographic-space-break-spaces-001-ref.html">
+<meta name="assert" content="If white-space is set to 'break-spaces', the overflowing idegraphic spaces must wrap to the next line.">
+<style>
+div {
+ width: 3em;
+ white-space: break-spaces;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div contenteditable="true">ああ&#x3000;&#x3000;&#x3000;&#x3000;ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-004.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-004.html
new file mode 100644
index 0000000000..e9c32cfabb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-004.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-ideographic-space-break-spaces-001-ref.html">
+<meta name="assert" content="If white-space is set to 'break-spaces', the overflowing idegraphic spaces must wrap to the next line.">
+<style>
+div {
+ width: 3em;
+ white-space: break-spaces;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div contenteditable="true">ああ<span>&#x3000;&#x3000;&#x3000;&#x3000;<span>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-005.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-005.html
new file mode 100644
index 0000000000..a8c68aa2a9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-005.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-ideographic-space-break-spaces-001-ref.html">
+<meta name="assert" content="If white-space is set to 'break-spaces', the overflowing idegraphic spaces must wrap to the next line.">
+<style>
+div {
+ width: 3em;
+ white-space: break-spaces;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div>ああ&#x3000;<span>&#x3000;&#x3000;&#x3000;</span>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-006.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-006.html
new file mode 100644
index 0000000000..e43d7c8774
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-006.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-ideographic-space-break-spaces-001-ref.html">
+<meta name="assert" content="If white-space is set to 'break-spaces', the overflowing idegraphic spaces must wrap to the next line.">
+<style>
+div {
+ width: 3em;
+ white-space: break-spaces;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if the characters below are arranged in pairs with a empty line in between.</p>
+<div contenteditable="true">ああ&#x3000;<span>&#x3000;&#x3000;&#x3000;</span>ああ</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-007.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-007.html
new file mode 100644
index 0000000000..79c23acba9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-007.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Setting white-space to 'break-spaces', hanging or collapsing the advance width of the spaces is not allowed.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div { font: 25px/1 Ahem; }
+.test {
+ z-index: -1;
+ color: green;
+
+ width: 4ch;
+ white-space: break-spaces;
+}
+.test > span { background: red; }
+.ref {
+ color: transparent;
+ background: green;
+ position: absolute;
+}
+.ref > span { color: transparent; }
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XX<span>XX<br>XXXX<br>XXXX</br>XX</span>XX</div>
+<div class="test">XX<span>&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;</span>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-008.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-008.html
new file mode 100644
index 0000000000..386083f100
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ideographic-space-break-spaces-008.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: Breaking sequences of trailing ideograohic spaces </title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="Setting white-space to 'break-spaces' doesn't prevent overflow if the first ideographic space of the sequence doesn't fit, which must hang.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: transparent;
+ height: 100px;
+}
+.test {
+ width: 3ch;
+ white-space: break-spaces;
+}
+.test > span { background: green; }
+.ref {
+ width: 100px;
+ background: green;
+ position: absolute;
+ z-index: -1;
+}
+.ref > span { color: red; }
+</style>
+
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div class="ref">XXX<span>X</span></div>
+<div class="test">XXX<span>&#x3000;</span>X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-001.html
new file mode 100644
index 0000000000..f687c7cdc3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-001.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: trailing ogham spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ogham-001-ref.html">
+<meta name="assert" content="tailing collaspible ogham spaces are removed">
+<style>
+div {
+ border: solid;
+ width: min-content;
+}
+.soft-wrap { border-color: blue; }
+.hard-break { border-color: orange; }
+
+</style>
+
+<p>Test passes if the content of the blue and orange boxes is identical to that of the black box.
+
+<div class=soft-wrap>᚛ᚑᚌᚐᚋ᚜&#x1680;᚛ᚑᚌᚐᚋ᚜</div>
+<div class=hard-break>᚛ᚑᚌᚐᚋ᚜&#x1680;<br>᚛ᚑᚌᚐᚋ᚜</div>
+<div class=ref>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-002.html
new file mode 100644
index 0000000000..7bf1775078
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-002.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: trailing pre-line ogham spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ogham-001-ref.html">
+<meta name="assert" content="tailing collaspible (with pre-line) ogham spaces are removed">
+<style>
+div {
+ border: solid;
+ width: min-content;
+ white-space: pre-line;
+}
+.soft-wrap { border-color: blue; }
+.hard-break { border-color: orange; }
+
+</style>
+
+<p>Test passes if the content of the blue and orange boxes is identical to that of the black box.
+
+<div class=soft-wrap>᚛ᚑᚌᚐᚋ᚜&#x1680;᚛ᚑᚌᚐᚋ᚜</div>
+<div class=hard-break>᚛ᚑᚌᚐᚋ᚜&#x1680;<br>᚛ᚑᚌᚐᚋ᚜</div>
+<div class=ref>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-003.html
new file mode 100644
index 0000000000..2cc1203da3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-ogham-003.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: trailing nowrap ogham spaces</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-ogham-001-ref.html">
+<meta name="assert" content="tailing collaspible (nowrap) ogham spaces are removed">
+<style>
+div {
+ border: solid;
+ width: min-content;
+ white-space: nowrap;
+}
+.br { border-color: blue; }
+.end-of-element { border-color: orange; }
+
+</style>
+
+<p>Test passes if the content of the blue and orange boxes is identical to that of the black box.
+
+<div class=br>᚛ᚑᚌᚐᚋ᚜&#x1680;<br>᚛ᚑᚌᚐᚋ᚜</div>
+<div class=end-of-element>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜&#x1680;</div>
+<div class=ref>᚛ᚑᚌᚐᚋ᚜<br>᚛ᚑᚌᚐᚋ᚜</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-001.html
new file mode 100644
index 0000000000..ce5740bd0e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-001.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequence of spaces and other space separators at the end of line must hang</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-001-ref.html">
+<meta name="assert" content="An sequence of regular spaces and other space separators at the end of the line must hang.">
+<style>
+div {
+ position: absolute;
+ width: max-content;
+ line-height: 1;
+ color: transparent;
+}
+.red { background: red; }
+.green { background: green; }
+#pre { white-space:pre; }
+</style>
+<p>Test passes if the shape below is green and if there is no red.
+
+<div class=red id=pre>xx&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</div>
+<div class=red>xx<span class=green>&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x1680;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2000;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2001;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2002;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2003;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2004;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2005;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2006;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2007;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2008;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2009;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x200A;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x202F;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x205F;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x3000;</span><br>xx</div>
+<div class=green>xx<br>xx</div>
+<!-- the trailing sequence of spaces must not be removed,
+ so it should hide all of the first (red) div.
+ However, it should hang and therefore not extend the width of its parent div,
+ which would be visible as red on the second line if it were expanded.
+ The extra red divs with one character each are for ease of debugging:
+ if the first one is fine, they will all be fine,
+ but if it is not, they should help find which one is wrong.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-002.html
new file mode 100644
index 0000000000..269b691b61
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-002.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequence of spaces and other space separators at the end of line with white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-002-ref.html">
+<meta name="assert" content="An sequence of regular spaces and other space separators at the end of the line must hang if white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: pre-wrap;
+ font-family: Ahem;
+ font-size: 10px;
+ line-height: 1;
+ width: 3ch;
+ color: green;
+}
+.red {
+ position: absolute;
+ z-index: -1;
+}
+.red div {
+ color: red;
+}
+span { color: transparent; } /* because ogham space is otherwise visible*/
+</style>
+
+<p>Test passes if there are two green tall boxes below and no red.
+
+<section class=red>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+ <div>x x<br>x x</div>
+</section>
+<section>
+ <div>x x<span>&#x1680;</span>&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;x x</div>
+ <div>x x<span>&#x1680;</span>x x</div>
+ <div>x x&#x2000;x x</div>
+ <div>x x&#x2001;x x</div>
+ <div>x x&#x2002;x x</div>
+ <div>x x&#x2003;x x</div>
+ <div>x x&#x2004;x x</div>
+ <div>x x&#x2005;x x</div>
+ <div>x x&#x2006;x x</div>
+ <div>x x&#x2007;<wbr>x x</div>
+ <div>x x&#x2008;x x</div>
+ <div>x x&#x2009;x x</div>
+ <div>x x&#x200A;x x</div>
+ <div>x x&#x202F;<wbr>x x</div>
+ <div>x x&#x205F;x x</div>
+ <div>x x&#x3000;x x</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-003.html
new file mode 100644
index 0000000000..dad554e98d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-003.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequence of spaces and other space separators at the end of line, white-space:pre-line</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-001-ref.html">
+<meta name="assert" content="An sequence of regular spaces and other space separators at the end of the line must hang, with white-space:pre-line.">
+<style>
+div {
+ position: absolute;
+ width: max-content;
+ line-height: 1;
+ color: transparent;
+ white-space: pre-line;
+}
+.red { background: red; }
+.green { background: green; }
+#pre { white-space:pre; }
+</style>
+
+<p>Test passes if the shape below is green and if there is no red.
+
+<div class=red id=pre>xx&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</div>
+<div class=red>xx<span class=green>&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x1680;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2000;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2001;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2002;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2003;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2004;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2005;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2006;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2007;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2008;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2009;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x200A;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x202F;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x205F;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x3000;</span><br>xx</div>
+<div class=green>xx<br>xx</div>
+<!-- the trailing sequence of spaces must not be removed,
+ so it should hide all of the first (red) div.
+ However, it should hang and therefore not extend the width of its parent div,
+ which would be visible as red on the second line if it were expanded.
+ The extra red divs with one character each are for ease of debugging:
+ if the first one is fine, they will all be fine,
+ but if it is not, they should help find which one is wrong.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-004.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-004.html
new file mode 100644
index 0000000000..0fce061b45
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-004.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: sequence of spaces and other space separators at the end of line, white-space:nowrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-001-ref.html">
+<meta name="assert" content="An sequence of regular spaces and other space separators at the end of the line must hang, with white-space:nowrap.">
+<style>
+div {
+ position: absolute;
+ width: max-content;
+ line-height: 1;
+ color: transparent;
+ white-space: nowrap;
+}
+.red { background: red; }
+.green { background: green; }
+#pre { white-space:pre; }
+</style>
+<p>Test passes if the shape below is green and if there is no red.
+
+<div class=red id=pre>xx&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</div>
+<div class=red>xx<span class=green>&#x1680;&#x2000; &#x2001;&#x2002;&#x2003; &#x2004;&#x2005;&#x2006; &#x2007;&#x2008;&#x2009;&#x200A; &#x202F;&#x205F; &#x3000;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x1680;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2000;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2001;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2002;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2003;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2004;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2005;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2006;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2007;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2008;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x2009;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x200A;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x202F;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x205F;</span><br>xx</div>
+<div class=red>xx<span class=green>&#x3000;</span><br>xx</div>
+<div class=green>xx<br>xx</div>
+<!-- the trailing sequence of spaces must not be removed,
+ so it should hide all of the first (red) div.
+ However, it should hang and therefore not extend the width of its parent div,
+ which would be visible as red on the second line if it were expanded.
+ The extra red divs with one character each are for ease of debugging:
+ if the first one is fine, they will all be fine,
+ but if it is not, they should help find which one is wrong.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-001.html
new file mode 100644
index 0000000000..bf1ef08d57
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-001.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+1680 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-001-ref.html">
+<meta name="assert" content="U+1680 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x1680;<br>あ<br>あ&#x1680;<br>あ<br>あ&#x1680;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x1680;ああ&#x1680;ああ&#x1680;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-002.html
new file mode 100644
index 0000000000..156d54650a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-002.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2000 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2000 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2000;<br>あ<br>あ&#x2000;<br>あ<br>あ&#x2000;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2000;ああ&#x2000;ああ&#x2000;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-003.html
new file mode 100644
index 0000000000..06a5817bea
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-003.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2001 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2001 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2001;<br>あ<br>あ&#x2001;<br>あ<br>あ&#x2001;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2001;ああ&#x2001;ああ&#x2001;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-004.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-004.html
new file mode 100644
index 0000000000..66460d9ede
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-004.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2002 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2002 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2002;<br>あ<br>あ&#x2002;<br>あ<br>あ&#x2002;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2002;ああ&#x2002;ああ&#x2002;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-005.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-005.html
new file mode 100644
index 0000000000..96d5b53224
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-005.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2003 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2003 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2003;<br>あ<br>あ&#x2003;<br>あ<br>あ&#x2003;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2003;ああ&#x2003;ああ&#x2003;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-006.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-006.html
new file mode 100644
index 0000000000..50b0645dbf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-006.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2004 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2004 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2004;<br>あ<br>あ&#x2004;<br>あ<br>あ&#x2004;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2004;ああ&#x2004;ああ&#x2004;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-007.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-007.html
new file mode 100644
index 0000000000..ea21144175
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-007.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2005 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2005 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2005;<br>あ<br>あ&#x2005;<br>あ<br>あ&#x2005;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2005;ああ&#x2005;ああ&#x2005;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html
new file mode 100644
index 0000000000..60712e787c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2006 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2006 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2006;<br>あ<br>あ&#x2006;<br>あ<br>あ&#x2006;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2006;ああ&#x2006;ああ&#x2006;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-009.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-009.html
new file mode 100644
index 0000000000..6b4e9fa509
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-009.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2007 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-009-ref.html">
+<meta name="assert" content="U+2007 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2007;あ<br>あ&#x2007;あ<br>あ&#x2007;xx</div><!--GL, non tailorable after, tailorable before-->
+</section>
+<section>
+ <div>xx&#x2007;ああ&#x2007;ああ&#x2007;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-010.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-010.html
new file mode 100644
index 0000000000..158b6303f0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-010.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2008 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2008 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2008;<br>あ<br>あ&#x2008;<br>あ<br>あ&#x2008;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2008;ああ&#x2008;ああ&#x2008;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-011.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-011.html
new file mode 100644
index 0000000000..e1de3fe016
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-011.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+2009 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+2009 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x2009;<br>あ<br>あ&#x2009;<br>あ<br>あ&#x2009;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x2009;ああ&#x2009;ああ&#x2009;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-012.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-012.html
new file mode 100644
index 0000000000..303a453bdd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-012.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+200A at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+200A at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x200A;<br>あ<br>あ&#x200A;<br>あ<br>あ&#x200A;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x200A;ああ&#x200A;ああ&#x200A;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-013.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-013.html
new file mode 100644
index 0000000000..becdee10fe
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-013.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+202F at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-013-ref.html">
+<meta name="assert" content="U+202F at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x202F;あ<br>あ&#x202F;あ<br>あ&#x202F;xx</div><!--GL, non-tailorable after, tailorable before-->
+</section>
+<section>
+ <div>xx&#x202F;ああ&#x202F;ああ&#x202F;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-014.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-014.html
new file mode 100644
index 0000000000..418bbfb431
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-014.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+205F at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+205F at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x205F;<br>あ<br>あ&#x205F;<br>あ<br>あ&#x205F;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x205F;ああ&#x205F;ああ&#x205F;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-015.html b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-015.html
new file mode 100644
index 0000000000..8ac39cf663
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-other-space-separators-break-spaces-015.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: U+3000 at the end of line with white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/trailing-other-space-separators-break-spaces-002-ref.html">
+<meta name="assert" content="U+3000 at the end of the line must not hang or be discarded if white-space is break-spaces. It thus keeps its usual line breaking properties, as defined in UAX14.">
+<meta name="flags" content="should">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ white-space: break-spaces;
+ font-size: 10px;
+ line-height: 1;
+ width: 2em;
+}
+section {
+ font-family: Ahem;
+ float: left;
+ margin: 0 1em;
+ color: blue;
+}
+.ref {
+ color: orange;
+}
+.ref div {
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the orange and blue parts of this page are identical.
+
+<!--
+ * There is no line breaking opportunity between two "x"
+ * There is a line breaking opportunity between two "あ"
+ * There is a line breaking opportunity after "x" or "あ"
+ unless suppressed by the next character (BA, GL).
+ * There is a line breaking opportunity before "x" or "あ"
+ unless suppressed by the previous character (BB, GL).
+-->
+<section class=ref>
+ <div>xx&#x3000;<br>あ<br>あ&#x3000;<br>あ<br>あ&#x3000;<br>xx</div><!-- BA, tailorable -->
+</section>
+<section>
+ <div>xx&#x3000;ああ&#x3000;ああ&#x3000;xx</div>
+</section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-align-start.tentative.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-align-start.tentative.html
new file mode 100644
index 0000000000..7908de12ad
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-align-start.tentative.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>Preserved trailing spaces when `text-align: left`</title>
+<link rel="help" href="http://crbug.com/966773">
+<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
+<link rel="match" href="reference/trailing-space-align-start-ref.html">
+<style>
+div {
+ font-family: monospace;
+ font-size: 30px;
+ width: 3ch;
+ overflow: auto;
+}
+.pre { white-space: pre; }
+.pre-wrap { white-space: pre-wrap; }
+</style>
+<body>
+ <div class="pre">0 0 </div>
+ <div class="pre">0 0</div>
+ <div class="pre-wrap">0 0</div>
+ <div class="pre-wrap">0 0 </div>
+ <div class="pre-wrap">0 0 0 0 </div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-001.html
new file mode 100644
index 0000000000..2165e7fe4a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-001.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="match" href="reference/trailing-space-and-text-alignment-001-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: normal' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: normal;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-002.html
new file mode 100644
index 0000000000..30e37908a2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-002.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre">
+<link rel="match" href="reference/trailing-space-and-text-alignment-002-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre' shouldn't hang and may cause overflow and activate the scrollbars.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: pre;
+}
+</style>
+<textarea class="left">XXX &#10;X</textarea>
+<textarea class="center">XXX &#10;X</textarea>
+<textarea class="right">XXX &#10;X</textarea>
+<textarea class="start">XXX &#10;X</textarea>
+<textarea class="end">XXX &#10;X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-003.html
new file mode 100644
index 0000000000..9995e24058
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-003.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/trailing-space-and-text-alignment-001-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre-wrap' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: pre-wrap;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-004.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-004.html
new file mode 100644
index 0000000000..3d7aad0541
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-004.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-space-and-text-alignment-002-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: break-spaces' shouldn't hang and may cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: break-spaces;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-005.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-005.html
new file mode 100644
index 0000000000..76348aaf21
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-005.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-line">
+<link rel="match" href="reference/trailing-space-and-text-alignment-001-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre-line' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: pre-line;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html
new file mode 100644
index 0000000000..6e70740cdd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal">
+<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-001-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: normal' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: normal;
+ direction: rtl;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html
new file mode 100644
index 0000000000..0422506b51
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre">
+<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-002-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre' shouldn't hang and may cause overflow and activate the scrollbars.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: pre;
+ direction: rtl;
+}
+</style>
+<textarea class="left">XXX &#10;X</textarea>
+<textarea class="center">XXX &#10;X</textarea>
+<textarea class="right">XXX &#10;X</textarea>
+<textarea class="start">XXX &#10;X</textarea>
+<textarea class="end">XXX &#10;X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html
new file mode 100644
index 0000000000..70fc786924
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-001-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre-wrap' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: pre-wrap;
+ direction: rtl;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html
new file mode 100644
index 0000000000..7705d6dfb1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-005-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: break-spaces' shouldn't hang and may cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: break-spaces;
+ direction: rtl;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html
new file mode 100644
index 0000000000..31afbe4b3a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-line">
+<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-001-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre-line' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" href="/fonts/ahem.css">
+<link rel="stylesheet" href="support/trailing-space-and-text-alignment.css">
+<style>
+textarea {
+ white-space: pre-line;
+ direction: rtl;
+}
+</style>
+<textarea class="left">XXX X</textarea>
+<textarea class="center">XXX X</textarea>
+<textarea class="right">XXX X</textarea>
+<textarea class="start">XXX X</textarea>
+<textarea class="end">XXX X</textarea>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-before-br-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-before-br-001.html
new file mode 100644
index 0000000000..fcc2bdfa43
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-before-br-001.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<title>CSS Text: A sequence of collapsible spaces at the end of a line is removed</title>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#white-space-phase-2'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+#container > div {
+ display: inline-block;
+ -font-family: Ahem;
+ font-size: 10px;
+}
+</style>
+<body>
+<div id=log></div>
+<div id=container>
+ <div>1111</div>
+ <div>1111 </div>
+ <div> 1111</div>
+ <div> 1111 </div>
+ <div>1111<br></div>
+ <div>1111<br> </div>
+ <div>1111 <br></div>
+ <div>1111 <br> </div>
+</div>
+<script>
+(function () {
+ const epsilon = 1;
+ let elements = Array.from(container.children);
+ let reference = elements[0];
+ let reference_width = reference.offsetWidth;
+ for (let element of elements) {
+ test(() => {
+ assert_approx_equals(element.offsetWidth, reference_width, epsilon);
+ }, escapeSpaces(element.innerHTML));
+ }
+})();
+
+function escapeSpaces(text) {
+ return text
+ .replace(/ /g, '&#x20;')
+ .replace(/\n/g, '&#x0A;')
+}
+</script>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-in-inline-box.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-in-inline-box.html
new file mode 100644
index 0000000000..fee5101879
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-in-inline-box.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<title>Preserved trailing spaces in inline boxes should hang</title>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="http://crbug.com/1130310">
+<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+.target {
+ font-family: Consolas, 'Courier New', Courier, monospace;
+ font-size: 20px;
+ width: 5ch;
+ white-space: pre-wrap;
+ overflow: auto visible;
+ border: 1px solid blue;
+}
+.not-culled span {
+ background: orange;
+}
+</style>
+<body>
+ <div class="target">12345 678</div>
+ <div class="target"><span>12345 678</span></div>
+ <div class="target not-culled"><span>12345 678</span></div>
+<script>
+for (let target of document.getElementsByClassName('target')) {
+ test(() => {
+ let width = target.offsetWidth;
+ let scroll_width = target.scrollWidth;
+ assert_less_than_equal(scroll_width, width);
+ });
+}
+</script>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-position-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-position-001.html
new file mode 100644
index 0000000000..648ae23dcc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-position-001.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<title>CSS Test: Positions of trailing collapsible spaces</title>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+.container > div {
+ font-family: Ahem;
+ font-size: 10px;
+ line-height: 1;
+ color: gray;
+ width: 5ch;
+ outline: 2px solid orange;
+ margin-bottom: 6px;
+ position: relative;
+}
+.pre-wrap {
+ white-space: pre-wrap;
+}
+.bg { background: purple; }
+.h { outline: 4px red solid; }
+</style>
+<body>
+ <section class="container">
+ <div>1234<span data-line="0" class="h"> </span>567</div>
+ <div>1234 <span data-line="0" class="h"> </span>567</div>
+ <div>1234567<span data-line="0" class="h"> </span>567</div>
+ <div>1234567 <span data-line="0" class="h"> </span>567</div>
+ <div class="pre-wrap">1234<span data-line="0" class="bg"> </span>567</div>
+ </section>
+<script>
+for (let e of document.querySelectorAll('[data-line]')) {
+ test(() => {
+ let y = e.offsetTop;
+ assert_equals(Math.round(y / 10), parseInt(e.dataset.line));
+ });
+}
+</script>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/trailing-space-rtl-001.html b/testing/web-platform/tests/css/css-text/white-space/trailing-space-rtl-001.html
new file mode 100644
index 0000000000..0550f7279f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/trailing-space-rtl-001.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>CSS Test: Preserved trailing spaces in RTL</title>
+<link rel="match" href="reference/trailing-space-rtl-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
+<style>
+body {
+ direction: rtl;
+ white-space: pre-wrap;
+}
+.bg {
+ background: orange;
+}
+.override {
+ unicode-bidi: bidi-override;
+}
+</style>
+<body>
+<div>אבג <span class="bg">אבגד</span> אבגדה</div>
+<div>אבג <span class="bg">אבגד</span> אבגדה </div>
+<div class="override">123 <span class="bg override">12345</span> 1234567</div>
+<div class="override">123 <span class="bg override">12345</span> 1234567 </div>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-applies-to-text-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-applies-to-text-001.html
new file mode 100644
index 0000000000..1a9a62a220
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-applies-to-text-001.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: white-space property applies to text</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-processing">
+ <link rel="help" href="https://www.w3.org/TR/css-display-3/#box-generation">
+ <link rel="match" href="reference/white-space-applies-to-text-001-ref.html">
+
+ <meta content="This test checks that 'white-space', which applies to inlines, also applies to text. In this test, we verify that 'white-space: normal', 'white-space: nowrap', 'white-space: pre', 'white-space: pre-wrap', 'white-space: break-spaces' and 'white-space: pre-line' apply to text." name="assert">
+
+ <style>
+ section
+ {
+ border: black solid 2px;
+ float: left;
+ font-family: monospace;
+ font-size: 14px;
+ line-height: 1; /* computes to 14px */
+ margin-bottom: 10px;
+ width: 16ch;
+ }
+
+ section.applies-to-text
+ {
+ clear: both;
+ }
+
+ section.applies-to-inline
+ {
+ margin-left: 10em;
+ }
+
+ div
+ {
+ display: contents;
+ }
+
+ div.first-subtest
+ {
+ white-space: normal;
+ }
+
+ div.second-subtest
+ {
+ white-space: nowrap;
+ }
+
+ div.third-subtest
+ {
+ white-space: pre;
+ }
+
+ div.fourth-subtest
+ {
+ white-space: pre-wrap;
+ }
+
+ div.fifth-subtest
+ {
+ white-space: break-spaces;
+ }
+
+ div.sixth-subtest
+ {
+ white-space: pre-line;
+ }
+
+ hr
+ {
+ clear: both;
+ margin: 4em auto 1.5em 0em;
+ width: 480px;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black bordered rectangles on the lefthand side are laid out identically to their counterparts on the righthand side.
+
+ <section class="applies-to-text">
+ <div class="first-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="applies-to-inline">
+ <div class="first-subtest"><span>Lorem ipsum. Dolor&NewLine;
+ sit.</span></div>
+ </section>
+
+ <hr>
+
+ <section class="applies-to-text">
+ <div class="second-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="applies-to-inline">
+ <div class="second-subtest"><span>Lorem ipsum. Dolor&NewLine;
+ sit.</span></div>
+ </section>
+
+ <hr>
+
+ <section class="applies-to-text">
+ <div class="third-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="applies-to-inline">
+ <div class="third-subtest"><span>Lorem ipsum. Dolor&NewLine;
+ sit.</span></div>
+ </section>
+
+ <hr>
+
+ <section class="applies-to-text">
+ <div class="fourth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="applies-to-inline">
+ <div class="fourth-subtest"><span>Lorem ipsum. Dolor&NewLine;
+ sit.</span></div>
+ </section>
+
+ <hr>
+
+ <section class="applies-to-text">
+ <div class="fifth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="applies-to-inline">
+ <div class="fifth-subtest"><span>Lorem ipsum. Dolor&NewLine;
+ sit.</span></div>
+ </section>
+
+ <hr>
+
+ <section class="applies-to-text">
+ <div class="sixth-subtest">Lorem ipsum. Dolor&NewLine;
+ sit.</div>
+ </section>
+
+ <section class="applies-to-inline">
+ <div class="sixth-subtest"><span>Lorem ipsum. Dolor&NewLine;
+ sit.</span></div>
+ </section>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-000.html b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-000.html
new file mode 100644
index 0000000000..224a350cc7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-000.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>White space collapse</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="Every tab is converted to a space. Any space immediately following another collapsible space is collapsed to have zero advance width.">
+<style type='text/css'>
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='test' class="test"><span>hello&#x20;&#x20;&#x20;&#x0009;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="ref" class="ref"><span>hello&#x20;there</span></div>
+<div id='testW' class="test"><span>缔造真正全球通行&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x0009;&#x20;&#x20;&#x20;的万维网</span></div>
+<div id="refW" class="ref"><span>缔造真正全球通行&#x20;的万维网</span></div>
+<div id='testF' class="test"><span>FULL&#x20;&#x20;&#x20;&#x0009;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;WIDTH</span></div>
+<div id="refF" class="ref"><span>FULL&#x20;&#x20;WIDTH</span></div>
+<div id='testH' class="test"><span>ハン&#x20;&#x20;&#x20;&#x0009;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;カク</span></div>
+<div id="refH" class="ref"><span>ハン&#x20;&#x20;&#x20;カク</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('test').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
+}, "spaces removed");
+test(function() {
+assert_equals(document.getElementById('testW').firstChild.offsetWidth, document.getElementById('refW').firstChild.offsetWidth);
+}, "spaces removed between Wide characters");
+test(function() {
+assert_equals(document.getElementById('testF').firstChild.offsetWidth, document.getElementById('refF').firstChild.offsetWidth);
+}, "spaces removed between Fullwidth characters");
+test(function() {
+assert_equals(document.getElementById('testH').firstChild.offsetWidth, document.getElementById('refH').firstChild.offsetWidth);
+}, "spaces removed between Halfwidth characters");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-001.html
new file mode 100644
index 0000000000..7b4f2333d1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-001.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>White space and non-ASCII spaces</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="Any space immediately following another collapsible space is collapsed to have zero advance width. Only refers to U+0020, not other Unicode spaces.">
+<style type='text/css'>
+.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='testNB' class="test"><span>hello&#x20;&#x20;&#x20;&#x00A0;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refNB" class="ref"><span>hello&#x20;&#x00A0;&#x20;there</span></div>
+<div id='testEN' class="test"><span>hello&#x20;&#x20;&#x20;&#x2002;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refEN" class="ref"><span>hello&#x20;&#x2002;&#x20;there</span></div>
+<div id='testEM' class="test"><span>hello&#x20;&#x20;&#x20;&#x2003;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refEM" class="ref"><span>hello&#x20;&#x2003;&#x20;there</span></div>
+<div id='testTS' class="test"><span>hello&#x20;&#x20;&#x20;&#x2009;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refTS" class="ref"><span>hello&#x20;&#x2009;&#x20;there</span></div>
+<div id='testZW' class="test"><span>hello&#x20;&#x20;&#x20;&#x200B;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refZW" class="ref"><span>hello&#x20;&#x200B;&#x20;there</span></div>
+<div id='testNNB' class="test"><span>hello&#x20;&#x20;&#x20;&#x202F;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refNNB" class="ref"><span>hello&#x20;&#x202F;&#x20;there</span></div>
+<div id='testIS' class="test"><span>hello&#x20;&#x20;&#x20;&#x00A0;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
+<div id="refIS" class="ref"><span>hello&#x20;&#x00A0;&#x20;there</span></div>
+<div id='testIS2' class="test"><span>缔造真正全球通行&#x20;&#x20;&#x20;&#x00A0;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;的万维网</span></div>
+<div id="refIS2" class="ref"><span>缔造真正全球通行&#x20;&#x00A0;&#x20;的万维网</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('testNB').firstChild.offsetWidth, document.getElementById('refNB').firstChild.offsetWidth);
+}, "no-break space");
+test(function() {
+assert_equals(document.getElementById('testEN').firstChild.offsetWidth, document.getElementById('refEN').firstChild.offsetWidth);
+}, "en space");
+test(function() {
+assert_equals(document.getElementById('testEM').firstChild.offsetWidth, document.getElementById('refEM').firstChild.offsetWidth);
+}, "em space");
+test(function() {
+assert_equals(document.getElementById('testTS').firstChild.offsetWidth, document.getElementById('refTS').firstChild.offsetWidth);
+}, "thin space");
+test(function() {
+assert_equals(document.getElementById('testZW').firstChild.offsetWidth, document.getElementById('refZW').firstChild.offsetWidth);
+}, "zero width space");
+test(function() {
+assert_equals(document.getElementById('testZW').firstChild.offsetWidth, document.getElementById('refZW').firstChild.offsetWidth);
+}, "narrow no-break space");
+test(function() {
+assert_equals(document.getElementById('testIS').firstChild.offsetWidth, document.getElementById('refIS').firstChild.offsetWidth);
+}, "ideographic space");
+test(function() {
+assert_equals(document.getElementById('testIS2').firstChild.offsetWidth, document.getElementById('refIS2').firstChild.offsetWidth);
+}, "ideographic space inside ideographic text");
+</script>
+<!-- Notes:
+The assertion will fail if space is produced for any line in the test paragraph.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-002.html b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-002.html
new file mode 100644
index 0000000000..22f914ad60
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-002.html
@@ -0,0 +1,161 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+<meta charset="utf-8">
+<title>Whitespace and bidi control characters</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
+<meta name="assert" content="All spaces and tabs immediately preceding or following a segment break are removed, ignoring bidi formatting characters as if they were not there.">
+<style type='text/css'>
+.test span { font-size: 24px; font-family: sans-serif; background-color:#2AA5F7; color: white; }
+.ref span { font-size: 24px; font-family: sans-serif; background-color:#270CEF; color: white; }
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id='log'></div>
+<div id='testRLO1' class="test"><span>RLO&#x202E;
+level&#x202C;here</span></div>
+<div id="refRLO1" class="ref"><span>RLOlevel&#x20;here</span></div>
+<div id='testRLO2' class="test"><span>RLO&#x20;&#x20;&#x202E;&#x20;
+level&#x202C;</span></div>
+<div id="refRLO2" class="ref"><span>RLO&#x20;level</span></div>
+<div id='testRLO3' class="test"><span>RLO
+&#x20;&#x20;&#x20;&#x202E;&#x20;&#x20;&#x20;&#x20;&#x20;level&#x202C;</span></div>
+<div id="refRLO3" class="ref"><span>RLO&#x20;level</span></div>
+<div id='testRLO4' class="test"><span>RLO&#x20;&#x202E;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;level&#x202C;</span></div>
+<div id="refRLO4" class="ref"><span>RLO&#x20;level</span></div>
+<div id='testRLO5' class="test"><span>RLO
+
+&#x202E;
+
+level&#x202C;</span></div>
+<div id="refRLO5" class="ref"><span>RLO&#x20;level</span></div>
+<div id='testRLE1' class="test"><span>RLE&#x202B;
+level&#x202C;here</span></div>
+<div id="refRLE1" class="ref"><span>RLElevel&#x20;here</span></div>
+<div id='testRLE2' class="test"><span>RLE&#x20;&#x20;&#x202B;&#x20;
+level&#x202C;</span></div>
+<div id="refRLE2" class="ref"><span>RLE&#x20;level</span></div>
+<div id='testRLE3' class="test"><span>RLE
+&#x20;&#x20;&#x20;&#x202B;&#x20;&#x20;&#x20;&#x20;&#x20;level&#x202C;</span></div>
+<div id="refRLE3" class="ref"><span>RLE&#x20;level</span></div>
+<div id='testRLE4' class="test"><span>RLE&#x20;&#x202B;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;level&#x202C;</span></div>
+<div id="refRLE4" class="ref"><span>RLE&#x20;level</span></div>
+<div id='testRLE5' class="test"><span>RLE
+
+&#x202B;
+
+level&#x202C;</span></div>
+<div id="refRLE5" class="ref"><span>RLE&#x20;level</span></div>
+<div id='testRLI1' class="test"><span>RLI&#x2067;
+level&#x2069;here</span></div>
+<div id="refRLI1" class="ref"><span>RLIlevel&#x20;here</span></div>
+<div id='testRLI2' class="test"><span>RLI&#x20;&#x20;&#x2067;&#x20;
+level&#x2069;</span></div>
+<div id="refRLI2" class="ref"><span>RLI&#x20;level</span></div>
+<div id='testRLI3' class="test"><span>RLI
+&#x20;&#x20;&#x20;&#x2067;&#x20;&#x20;&#x20;&#x20;&#x20;level&#x2069;</span></div>
+<div id="refRLI3" class="ref"><span>RLI&#x20;level</span></div>
+<div id='testRLI4' class="test"><span>RLI&#x20;&#x2067;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;level&#x2069;</span></div>
+<div id="refRLI4" class="ref"><span>RLI&#x20;level</span></div>
+<div id='testRLI5' class="test"><span>RLI
+
+&#x2067;
+
+level&#x2069;</span></div>
+<div id="refRLI5" class="ref"><span>RLI&#x20;level</span></div>
+<div id='testRLM1' class="test"><span>RLM&#x200F;
+mark</span></div>
+<div id="refRLM1" class="ref"><span>RLM&#x20;mark</span></div>
+<div id='testRLM2' class="test"><span>RLM&#x20;&#x20;&#x200F;&#x20;
+mark</span></div>
+<div id="refRLM2" class="ref"><span>RLM&#x20;mark</span></div>
+<div id='testRLM3' class="test"><span>RLM
+&#x20;&#x20;&#x20;&#x200F;&#x20;&#x20;&#x20;&#x20;&#x20;mark</span></div>
+<div id="refRLM3" class="ref"><span>RLM&#x20;mark</span></div>
+<div id='testRLM4' class="test"><span>RLM&#x20;&#x200F;&#x20;&#x20;
+&#x20;&#x20;&#x20;&#x20;&#x20;mark</span></div>
+<div id="refRLM4" class="ref"><span>RLM&#x20;mark</span></div>
+<div id='testRLM5' class="test"><span>RLM
+
+&#x200F;
+
+mark</span></div>
+<div id="refRLM5" class="ref"><span>RLM&#x20;mark</span></div>
+<script>
+test(function() {
+assert_equals(document.getElementById('testRLO1').firstChild.offsetWidth, document.getElementById('refRLO1').firstChild.offsetWidth);
+}, "RLO 1");
+test(function() {
+assert_equals(document.getElementById('testRLO2').firstChild.offsetWidth, document.getElementById('refRLO2').firstChild.offsetWidth);
+}, "RLO 2");
+test(function() {
+assert_equals(document.getElementById('testRLO3').firstChild.offsetWidth, document.getElementById('refRLO3').firstChild.offsetWidth);
+}, "RLO 3");
+test(function() {
+assert_equals(document.getElementById('testRLO4').firstChild.offsetWidth, document.getElementById('refRLO4').firstChild.offsetWidth);
+}, "RLO 4");
+test(function() {
+assert_equals(document.getElementById('testRLO5').firstChild.offsetWidth, document.getElementById('refRLO5').firstChild.offsetWidth);
+}, "RLO 5");
+
+test(function() {
+assert_equals(document.getElementById('testRLE1').firstChild.offsetWidth, document.getElementById('refRLE1').firstChild.offsetWidth);
+}, "RLE 1");
+test(function() {
+assert_equals(document.getElementById('testRLE2').firstChild.offsetWidth, document.getElementById('refRLE2').firstChild.offsetWidth);
+}, "RLE 2");
+test(function() {
+assert_equals(document.getElementById('testRLE3').firstChild.offsetWidth, document.getElementById('refRLE3').firstChild.offsetWidth);
+}, "RLE 3");
+test(function() {
+assert_equals(document.getElementById('testRLE4').firstChild.offsetWidth, document.getElementById('refRLE4').firstChild.offsetWidth);
+}, "RLE 4");
+test(function() {
+assert_equals(document.getElementById('testRLE5').firstChild.offsetWidth, document.getElementById('refRLE5').firstChild.offsetWidth);
+}, "RLE 5");
+
+test(function() {
+assert_equals(document.getElementById('testRLI1').firstChild.offsetWidth, document.getElementById('refRLI1').firstChild.offsetWidth);
+}, "RLI 1");
+test(function() {
+assert_equals(document.getElementById('testRLI2').firstChild.offsetWidth, document.getElementById('refRLI2').firstChild.offsetWidth);
+}, "RLI 2");
+test(function() {
+assert_equals(document.getElementById('testRLI3').firstChild.offsetWidth, document.getElementById('refRLI3').firstChild.offsetWidth);
+}, "RLI 3");
+test(function() {
+assert_equals(document.getElementById('testRLI4').firstChild.offsetWidth, document.getElementById('refRLI4').firstChild.offsetWidth);
+}, "RLI 4");
+test(function() {
+assert_equals(document.getElementById('testRLI5').firstChild.offsetWidth, document.getElementById('refRLI5').firstChild.offsetWidth);
+}, "RLI 5");
+
+test(function() {
+assert_equals(document.getElementById('testRLM1').firstChild.offsetWidth, document.getElementById('refRLM1').firstChild.offsetWidth);
+}, "RLM 1");
+test(function() {
+assert_equals(document.getElementById('testRLM2').firstChild.offsetWidth, document.getElementById('refRLM2').firstChild.offsetWidth);
+}, "RLM 2");
+test(function() {
+assert_equals(document.getElementById('testRLM3').firstChild.offsetWidth, document.getElementById('refRLM3').firstChild.offsetWidth);
+}, "RLM 3");
+test(function() {
+assert_equals(document.getElementById('testRLM4').firstChild.offsetWidth, document.getElementById('refRLM4').firstChild.offsetWidth);
+}, "RLM 4");
+test(function() {
+assert_equals(document.getElementById('testRLM5').firstChild.offsetWidth, document.getElementById('refRLM5').firstChild.offsetWidth);
+}, "RLM 5");
+</script>
+<!-- Notes:
+The first test has an extra word to make the reference easier to create, given that the space ends up at the end of the sequence.
+-->
+</body>
+</html>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-discard-001.xht b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-discard-001.xht
new file mode 100644
index 0000000000..dc7e5e5708
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-discard-001.xht
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 Test: white-space-collapse - discard - basic cases</title>
+ <link rel="author" title="Satoshi Umehara" href="mailto:umehara@est.co.jp" />
+ <link rel="help" title="CSS Text Level 4: 3.1. White Space Collapsing: the ‘white-space-collapse’ property" href="https://drafts.csswg.org/css-text-4/#white-space-collapsing" />
+ <link rel="match" href="reference/white-space-collapse-discard-001-ref.xht"/>
+ <meta name="assert" content="The UA should discard all white space in the element when white-space-collapse is set to discard." />
+ <style type="text/css">
+ <![CDATA[
+ .test span {
+ white-space-collapse: discard;
+ }
+ /* the CSS below is not part of the test */
+ span {
+ color: Blue;
+ }
+ ]]>
+ </style>
+ </head>
+ <body>
+ <p>
+ Test passes if the first sentence matches the second one.
+ </p>
+ <div class="test">
+ <span>All White Space In The Element Should Be Discarded.</span>
+ </div>
+ <div class="control">
+ <span>AllWhiteSpaceInTheElementShouldBeDiscarded.</span>
+ </div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-preserve-breaks-001.xht b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-preserve-breaks-001.xht
new file mode 100644
index 0000000000..50113eade1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-collapse-preserve-breaks-001.xht
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 Test: white-space-collapse - preserve-breaks - basic cases</title>
+ <link rel="author" title="Satoshi Umehara" href="mailto:umehara@est.co.jp" />
+ <link rel="help" title="CSS Text Level 4: 3.1. White Space Collapsing: the ‘white-space-collapse’ property" href="https://drafts.csswg.org/css-text-4/#white-space-collapsing" />
+ <link rel="match" href="reference/white-space-collapse-preserve-breaks-001-ref.xht"/>
+ <meta name="assert" content="The UA should collapse sequences of white space into a single character but preserve segment breaks as forced line breaks when white-space-collapse is set to preserve-breaks." />
+ <style type="text/css">
+ <![CDATA[
+ .test span {
+ white-space-collapse: preserve-breaks;
+ }
+ /* the CSS below is not part of the test */
+ span {
+ color: Blue;
+ }
+ ]]>
+ </style>
+ </head>
+ <body>
+ <p>
+ Test passes if the first two sentences matches the second one.
+ </p>
+ <p class="test">
+ <span>
+ Sequences of white space should collapse into a single character.
+ But segment breaks as forced line breaks are preserved.
+ </span>
+ </p>
+ <p>
+ <span>
+ Sequences of white space should collapse into a single character.<br />
+ But segment breaks as forced line breaks are preserved.
+ </span>
+ </p>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-empty-text-sibling.html b/testing/web-platform/tests/css/css-text/white-space/white-space-empty-text-sibling.html
new file mode 100644
index 0000000000..50439df433
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-empty-text-sibling.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
+<link rel="match" href="../../reference/pass_if_two_words.html">
+<p>There should be a space between "two" and "words" below.</p>
+<div id="block"> <span>words</span></div>
+<script>
+ block.insertBefore(document.createTextNode(""), block.firstChild);
+ block.insertBefore(document.createTextNode(""), block.firstChild);
+ block.offsetTop;
+ block.firstChild.data = "two";
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-001.html
new file mode 100644
index 0000000000..e4c306358d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-001.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: min-content sizing and white-space: break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-intrinsic-size-001-ref.html">
+<meta name="assert" content="When white-space is break-spaces, preserved spaces at the end of the line do affect the intrinsic min-content size. Overflow-wrap makes no difference.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+aside {
+ float: left;
+ white-space: break-spaces;
+ background: green;
+}
+aside:last-of-type { overflow-wrap: break-word; }
+div {
+ font-family: Ahem;
+ color: transparent;
+ font-size: 50px;
+ width: 0ch;
+}
+
+#red {
+ position: absolute;
+ background: red;
+ width: auto;
+ z-index: -1;
+}
+</style>
+
+<p>Test passes if there is a green rectangle below and no red.
+<div id=red>XS<br>S<br>XS<br>S</div>
+<div>
+ <aside>X </aside>
+ <aside>X </aside>
+</div>
+<!-- Note: the space immediately following the X does not get wrapped,
+even under break-spaces+break-word:
+The parent of the flow is 0-width,
+so the float is min-content sized,
+which should leave enough room for both the X and one space.
+break-space+break-word would allow for an emergency wrap before the space
+if the float itself was sized too small,
+but it isn't.
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-002.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-002.html
new file mode 100644
index 0000000000..f4f3fb688d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-002.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: max-content sizing and white-space:break-spaces</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-intrinsic-size-002-ref.html">
+<meta name="assert" content="If white-space is break-spaces, preserved spaces at the end of the line do affect the intrinsic max-content size. The value of overflow-wrap makes no difference.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+aside {
+ float: left;
+ white-space: break-spaces;
+ background: blue;
+}
+aside:last-of-type {
+ float:right;
+ overflow-wrap: break-word;
+}
+div {
+ color: transparent;
+ font-family: Ahem;
+ font-size: 50px;
+ width: 3ch;
+ /* both floats should take the full 3ch,
+ one on each line
+ and therefore line up to look like a single large box.
+
+ If the spaces are not taken into account for min-content sizing,
+ the floats will leave a gap between them */
+}
+.owbw { overflow-wrap: break-word; }
+</style>
+
+<p>Test passes if there is a single blue rectangle below.
+<div>
+ <aside>X </aside>
+ <aside>X </aside>
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-003.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-003.html
new file mode 100644
index 0000000000..02341f2eae
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-003.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: min-content sizing and white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-intrinsic-size-003-ref.html">
+<meta name="assert" content="Preserved spaces at the end of the line do not affect the intrinsic min-content size when white-space is pre-wrap. The value of overflow-wrap makes no difference.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+aside {
+ float: left;
+ white-space: pre-wrap;
+ background: red;
+}
+div {
+ color: transparent;
+ font-family: Ahem;
+ font-size: 50px;
+ width: 0ch;
+}
+.own { overflow-wrap: normal; }
+.owbw{ overflow-wrap: break-word; }
+
+#green {
+ position: absolute;
+ background: green;
+ z-index: 1;
+ width: auto;
+}
+</style>
+
+<p>Test passes if there is a green rectangle below and no red.
+<div id=green>X<br>X</div>
+<div>
+ <aside class=own>X </aside>
+ <aside class=owbw>X </aside>
+</div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-004.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-004.html
new file mode 100644
index 0000000000..69de5f3428
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-004.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: max-content sizing and white-space: pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-intrinsic-size-004-ref.html">
+<meta name="assert" content="Preserved spaces at the end of the line do affect the intrinsic max-content size when white-space is pre-wrap, as spaces before a forced break, at the end of un unwrapped line, only hanging conditionally, which does not prevent contributing to the max-content size. The value of overflow-wrap makes no difference.">
+<style>
+aside {
+ float: left;
+ white-space: pre-wrap;
+ background: green;
+}
+aside:last-of-type { overflow-wrap: break-word; }
+div {
+ background: red;
+ color: transparent;
+ font-family: monospace;
+ font-size: 50px;
+ width: 3ch;
+ line-height: 1;
+}
+</style>
+
+<p>Test passes if there is a single green rectangle below and no red.
+<div>
+ <aside>X </aside>
+ <aside>X </aside>
+</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-005.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-005.html
new file mode 100644
index 0000000000..89dddf0408
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-005.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: min-content sizing and white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved spaces at the end of the line unconditioanlly hang, hence they do not affect the intrinsic min-content size.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: min-content;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if there is a green square and no red.
+
+<div>XX<span>&#x0020;</span>XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-006.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-006.html
new file mode 100644
index 0000000000..572b744234
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-006.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: min-content sizing and white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#propdef-white-space">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved spaces unconditionally hang if they might overflow otherwise, hence they do not affect the intrinsic min-content size.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: min-content;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+
+<div>XX&#x0020;XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-013.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-013.html
new file mode 100644
index 0000000000..0c4f28b2cb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-013.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: min-content sizing and 'white-space: pre-wrap'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#hanging">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="When 'white-space' is 'pre-wrap', white spaces at the end of the line are preserved. In this test, the overflowing end-of-line white spaces following the 'A', the 'GH', the 'MNO' and the 'WXYZ' conditionally 'hang' while they do not affect the intrinsic min-content size." name="assert">
+
+ <style>
+ div
+ {
+ color: transparent;
+ /*
+ so that background-color can
+ shine through the "A", the "GH",
+ the "MNO" and the "WXYZ" glyphs
+ */
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 0;
+ /*
+ 'width: 0' will trigger
+ min-content size
+ for div#min-sized-parent
+ */
+ }
+
+ div#test-overlapped-red
+ {
+ background-color: red;
+ float: left;
+ white-space: pre-wrap;
+ width: auto;
+ }
+
+ div#reference-overlapping-green
+ {
+ background-color: green;
+ position: absolute;
+ width: auto;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="min-sized-parent">
+
+ <div id="test-overlapped-red">A &NewLine;GH &NewLine;MNO &NewLine;WXYZ </div>
+
+ </div>
+
+ <!--
+
+ The sequences of white spaces following
+ the "A", the "GH", the "MNO" and the
+ "WXYZ" do not get collapsed. That is by
+ definition of 'white-space: pre-wrap'.
+ They 'hang': they behave like 'ink
+ overflow' while not contributing to
+ min-content sizing.
+
+ The line feeds (&NewLine;) wrap
+ content to the next line box.
+
+ Since div#test-overlapped-red
+ is floated and since its parent in
+ the flow is 0-width, then the float
+ is min-content sized.
+ Since the widest line box
+ is created by the 4th line box
+ (due to "WXYZ" content), then
+ div#test-overlapped-red
+ must not be wider than 100px.
+
+ -->
+
+ <div id="reference-overlapping-green">1234<br>5678<br>90AB<br>CDEF</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-014.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-014.html
new file mode 100644
index 0000000000..b28f6a5468
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-014.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: min-content sizing and 'white-space: pre-wrap'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#hanging">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="When 'white-space' is 'pre-wrap', white spaces at the end of the line are preserved. In this test, the 4 overflowing white spaces following the 'ABCD', following the 'GHIJ', following the 'MNOP' and following the 'WXYZ' conditionally 'hang' while they do not affect the intrinsic min-content size." name="assert">
+
+ <style>
+ div
+ {
+ color: transparent;
+ /*
+ so that background-color can
+ shine through the ABCD, GHIJ,
+ MNOP, WXYZ glyphs
+ */
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 0;
+ /*
+ 'width: 0' will trigger
+ min-content size
+ for div#min-sized-parent
+ */
+ }
+
+ div.test-overlapped-red
+ {
+ background-color: red;
+ float: left;
+ white-space: pre-wrap;
+ width: auto;
+ }
+
+ div#reference-overlapping-green
+ {
+ background-color: green;
+ position: absolute;
+ width: auto;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="min-sized-parent">
+
+ <div class="test-overlapped-red">ABCD </div>
+
+ <div class="test-overlapped-red">GHIJ </div>
+
+ <div class="test-overlapped-red">MNOP </div>
+
+ <div class="test-overlapped-red">WXYZ </div>
+
+ </div>
+
+ <!--
+
+ The sequences of 4 white spaces following
+ the "ABCD", following the "GHIJ", following
+ the "MNOP" and following the "WXYZ" do not
+ get collapsed due to
+ 'white-space: pre-wrap': they hang. Such
+ sequences of 4 hanging-overflowing end-of-line
+ white spaces are not considered with regards
+ to the line box content for fit.
+
+ Since the 4 div.test-overlapped-red
+ are floated and since its parent in
+ the flow is 0-width, then these 4 floats
+ are min-content sized.
+
+ -->
+
+ <div id="reference-overlapping-green">1234<br>5678<br>90AB<br>CDEF</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-015.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-015.html
new file mode 100644
index 0000000000..7c11c6dfa0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-015.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: min-content sizing and 'white-space: pre'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="When 'white-space' is 'pre', preserved white spaces at the end of the line affect the intrinsic min-content size." name="assert">
+
+ <style>
+ div
+ {
+ color: transparent;
+ /*
+ so that background-color can
+ shine through the A, G, M, Z glyphs
+ */
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 0;
+ /*
+ This will trigger
+ min-content size
+ for div#min-sized-parent
+ */
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ position: absolute;
+ width: auto;
+ z-index: -1;
+ }
+
+ div#test-overlapping-green
+ {
+ background-color: green;
+ float: left;
+ white-space: pre;
+ width: auto;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="reference-overlapped-red">1234<br>567<br>89<br>0</div>
+
+ <div id="min-sized-parent">
+
+ <div id="test-overlapping-green">A&NewLine;G &NewLine; M&NewLine; Z </div>
+
+ </div>
+
+ <!--
+
+ The white spaces preceding or following
+ the "G", "M" and "Z" do not get
+ wrapped. That is by definition of
+ 'white-space: pre'.
+
+ The line feeds (&NewLine;) wrap
+ content to the next line box.
+
+ Since div#test-overlapping-green
+ is floated and since its parent in
+ the flow is 0-width, then the float
+ is min-content sized.
+
+ -->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-016.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-016.html
new file mode 100644
index 0000000000..ac5695b9fa
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-016.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: min-content sizing and 'white-space: pre'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="When 'white-space' is 'pre', preserved white spaces at the end of the line affect the intrinsic min-content size. Overflow-wrap makes no difference." name="assert">
+
+ <style>
+ div
+ {
+ color: transparent;
+ /*
+ so that background-color can
+ shine through the A, G, M, Z glyphs
+ */
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 0;
+ /*
+ This will trigger
+ min-content size
+ for div#min-sized-parent
+ */
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ position: absolute;
+ width: auto;
+ z-index: -1;
+ }
+
+ div.test-overlapping-green
+ {
+ background-color: green;
+ float: left;
+ white-space: pre;
+ width: auto;
+ }
+
+ div#last
+ {
+ overflow-wrap: break-word;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="reference-overlapped-red">1234<br>567<br>89<br>0</div>
+
+ <div id="min-sized-parent">
+
+ <div class="test-overlapping-green">A </div>
+
+ <div class="test-overlapping-green"> G </div>
+
+ <div class="test-overlapping-green"> M </div>
+
+ <div class="test-overlapping-green" id="last"> Z</div>
+
+ </div>
+
+ <!--
+
+ The 3 white spaces following or preceding
+ the "A", "G", "M" and "Z" do not
+ get wrapped. That is by definition of
+ 'white-space: pre'.
+
+ Since the div.test-overlapping-green
+ are floated and since their parent in
+ the flow is 0-width, then these floats
+ are min-content sized.
+
+ -->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-017.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-017.html
new file mode 100644
index 0000000000..978dfb8ba4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-017.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: max-content sizing and 'white-space: pre-wrap'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="help" href="https://www.w3.org/TR/css-sizing-3/#auto-box-sizes">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-4400">
+ <meta content="When 'white-space' is 'pre-wrap', preserved white spaces at the beginning and at the end of the line affect the intrinsic max-content size." name="assert">
+
+ <style>
+ div#wrapper
+ {
+ color: transparent;
+ /*
+ so that background colors can
+ shine through the A, G, M, Z glyphs
+ */
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 7em;
+ /*
+ 'width: 7em' gives more inline-size
+ than needed or required by each
+ overlapping-test-green <div>s.
+ If an implementation goes wrong
+ and makes one of
+ overlapping-test-green <div>s
+ wider than 4em, then we will see
+ red.
+ */
+ }
+
+ div#overlapped-reference-red
+ {
+ background-color: red;
+ height: 4em;
+ position: absolute;
+ width: 4em;
+ z-index: -1;
+ }
+
+ div.overlapping-test-green
+ {
+ background: linear-gradient(to right, green 4em, red 3em);
+ /*
+ If one of the overlapping-test-green <div>s become wider
+ than 4em, then we will see the part beyond 4em of this
+ linear-gradient background which is red.
+ https://www.w3.org/TR/css-images-3/#linear-gradients
+ */
+ float: left;
+ /*
+ [
+ max-content inline size:
+ The box's "ideal" size in the inline axis. Usually
+ the narrowest inline size it could take while fitting
+ around its contents if none of the soft wrap
+ opportunities within the box were taken.
+ ]
+ https://www.w3.org/TR/css-sizing-3/#max-content-inline-size
+ */
+ white-space: pre-wrap;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="wrapper">
+
+ <div id="overlapped-reference-red"></div>
+
+ <div class="overlapping-test-green">A </div>
+
+ <div class="overlapping-test-green"> G </div>
+
+ <div class="overlapping-test-green"> M </div>
+
+ <div class="overlapping-test-green"> Z</div>
+
+ </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-018.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-018.html
new file mode 100644
index 0000000000..707e19adc0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-018.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: max-content sizing and 'white-space: pre'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="help" href="https://www.w3.org/TR/css-sizing-3/#auto-box-sizes">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-4400">
+ <meta content="When 'white-space' is 'pre', preserved white spaces at the beginning and at the end of the line affect the intrinsic max-content size." name="assert">
+
+ <style>
+ div#wrapper
+ {
+ color: transparent;
+ /*
+ so that background colors can
+ shine through the A, G, M, Z glyphs
+ */
+ font-family: Ahem;
+ font-size: 25px;
+ line-height: 1;
+ width: 7em;
+ /*
+ 'width: 7em' gives more inline-size
+ than needed or required by each
+ overlapping-test-green <div>s.
+ If an implementation goes wrong
+ and makes one of
+ overlapping-test-green <div>s
+ wider than 4em, then we will see
+ red.
+ */
+ }
+
+ div#overlapped-reference-red
+ {
+ background-color: red;
+ height: 4em;
+ position: absolute;
+ width: 4em;
+ z-index: -1;
+ }
+
+ div.overlapping-test-green
+ {
+ background: linear-gradient(to right, green 4em, red 3em);
+ /*
+ If one of the overlapping-test-green <div>s become wider
+ than 4em, then we will see the part beyond 4em of this
+ linear-gradient background which is red.
+ https://www.w3.org/TR/css-images-3/#linear-gradients
+ */
+ float: left;
+ /*
+ [
+ max-content inline size:
+ The box's "ideal" size in the inline axis. Usually
+ the narrowest inline size it could take while fitting
+ around its contents if none of the soft wrap
+ opportunities within the box were taken.
+ ]
+ https://www.w3.org/TR/css-sizing-3/#max-content-inline-size
+ */
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="wrapper">
+
+ <div id="overlapped-reference-red"></div>
+
+ <div class="overlapping-test-green">A </div>
+
+ <div class="overlapping-test-green"> G </div>
+
+ <div class="overlapping-test-green"> M </div>
+
+ <div class="overlapping-test-green"> Z</div>
+
+ </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-019.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-019.html
new file mode 100644
index 0000000000..d7b9edf812
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-019.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: min-content sizing and 'white-space: pre-line'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="When 'white-space' is 'pre-line', sequence of white spaces are collapsed into 1 white space, the tabs are converted into a single white space and then the white spaces at the end of the line are removed." name="assert">
+
+ <style>
+ div
+ {
+ color: transparent;
+ /*
+ so that background-color can
+ shine through the A, G, M glyphs
+ */
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ width: 0;
+ /*
+ This will trigger
+ min-content size
+ for div#min-sized-parent
+ */
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ position: absolute;
+ width: auto;
+ z-index: -1;
+ }
+
+ div#test-overlapping-green
+ {
+ background-color: green;
+ float: left;
+ white-space: pre-line; /* spaces and tabs collapse */
+ width: auto;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="reference-overlapped-red">12<br>3</div>
+
+ <div id="min-sized-parent">
+
+ <div id="test-overlapping-green">A &Tab; &Tab; GM &Tab;</div>
+
+ </div>
+
+ <!--
+
+ The sequence of white spaces
+ are collapsed. The tabs are
+ converted into a single
+ white space character. Then
+ the spaces at the end-of-line
+ are removed. That
+ is by definition of
+ 'white-space: pre-line'.
+
+ The end result is
+ [A
+ GM]
+
+ Since div#test-overlapping-green
+ is floated and since its parent in
+ the flow is 0-width, then the float
+ is min-content sized.
+
+ -->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-020.html b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-020.html
new file mode 100644
index 0000000000..e809db3176
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-intrinsic-size-020.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: min-content sizing and 'white-space: pre-line'</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <meta content="When 'white-space' is 'pre-line', sequence of white spaces are collapsed into 1 white space, the tabs are converted into a single white space and then the white spaces at the end of the line are removed." name="assert">
+
+ <style>
+ div
+ {
+ color: transparent;
+ /*
+ so that background-color can
+ shine through the A, G, M, Z glyphs
+ */
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ width: 0;
+ /*
+ This will trigger
+ min-content size
+ for div#min-sized-parent
+ */
+ }
+
+ div#reference-overlapped-red
+ {
+ background-color: red;
+ position: absolute;
+ width: auto;
+ z-index: -1;
+ }
+
+ div.test-overlapping-green
+ {
+ background-color: green;
+ float: left;
+ white-space: pre-line; /* spaces and tabs collapse */
+ width: auto;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div id="reference-overlapped-red">12<br>3</div>
+
+ <div id="min-sized-parent">
+
+ <div class="test-overlapping-green"> &Tab; &Tab; AG </div>
+
+ <div class="test-overlapping-green"> MZ &Tab; &Tab; </div>
+
+ </div>
+
+ <!--
+
+ The sequence of white spaces
+ are collapsed. The tabs are
+ converted into a single
+ white space character. Then
+ the spaces at the end-of-line
+ are removed. That
+ is by definition of
+ 'white-space: pre-line'.
+
+ The end result is
+ [AG
+ MZ]
+
+ Since div#test-overlapping-green
+ is floated and since its parent in
+ the flow is 0-width, then the float
+ is min-content sized.
+
+ -->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-letter-spacing-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-letter-spacing-001.html
new file mode 100644
index 0000000000..8d8ab401e8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-letter-spacing-001.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8"/>
+<title>CSS Test: letter-spacing is not applied to preserved line-breaks</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"/>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property"/>
+<link rel="match" href="reference/white-space-letter-spacing-001-ref.html"/>
+<style>
+div {
+ font: 16px monospace;
+ float: left;
+ clear: left;
+ border: 1px solid silver;
+ margin: 1em;
+ letter-spacing: .5em;
+}
+.test1 {
+ white-space: pre;
+}
+.test2 {
+ white-space: pre-line;
+}
+.test3 {
+ white-space: pre-wrap;
+}
+.test4 {
+ white-space: break-spaces;
+}
+</style>
+<p>The five boxes below should all look the same:</p>
+<div>Two lines<br>of text</div>
+<div class=test1>Two lines
+of text</div>
+<div class=test2>Two lines
+of text</div>
+<div class=test3>Two lines
+of text</div>
+<div class=test4>Two lines
+of text</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-normal-011.html b/testing/web-platform/tests/css/css-text/white-space/white-space-normal-011.html
new file mode 100644
index 0000000000..1743f58f14
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-normal-011.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: normal' (basic)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-normal-011-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: normal;
+ }
+
+ div#reference
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">Lorem ipsum. Dolor
+ sit&Tab;amet. <br>consectetur</div>
+
+ <div id="reference">Lorem ipsum.
+Dolor sit amet.
+consectetur</div>
+
+<!--
+
+ <div id="test">Lorem ipsum. Dolor
+ ^^^^^^^^
+ 12345678
+
+ sit&Tab;amet. <br>consectetur</div>
+^^^
+123
+
+
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-nowrap-011.html b/testing/web-platform/tests/css/css-text/white-space/white-space-nowrap-011.html
new file mode 100644
index 0000000000..1c11d97093
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-nowrap-011.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: nowrap' (basic)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-nowrap-011-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: nowrap;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically. Only "or sit amet." should be outside of black-bordered rectangles.
+
+ <div id="test">Lorem ipsum. Dolor
+ sit&Tab;amet. <br>consectetur</div>
+
+ <div id="reference">Lorem&nbsp;ipsum.&nbsp;Dolor&nbsp;sit&nbsp;amet.<br>
+consectetur</div>
+
+<!--
+
+
+ <div id="test">Lorem ipsum. Dolor
+ ^^^^^^^^
+ 12345678
+
+ sit&Tab;amet. <br>consectetur</div>
+^^^
+123
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-011.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-011.html
new file mode 100644
index 0000000000..88b9894d13
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-011.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: 'white-space: pre' (basic)</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-pre-011-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: pre;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically. Only "Dolor" should be outside of black-bordered rectangles.
+
+ <div id="test">Lorem ipsum. Dolor
+ sit&Tab;amet. <br>consectetur</div>
+
+ <div id="reference">Lorem&nbsp;ipsum.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.&nbsp;<br>
+consectetur</div>
+
+<!--
+
+ <div id="test">Lorem ipsum. Dolor
+ ^^^^^^^^
+ 12345678
+
+ sit&Tab;amet. <br>consectetur</div>
+^^^
+123
+
+Since 'tab-size' is by default 8,
+since "sit" uses 3 characters
+and since there are 3 white space characters
+before "sit", then
+
+ 8
+-
+ 3
+-
+ 3
+=====
+ 2
+
+then the horizontal tabulation will be use as much space
+as a sequence of 2 preserved white space characters.
+
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-031.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-031.html
new file mode 100644
index 0000000000..c96f51eefa
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-031.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: wrappable ('normal') inline inside a 'white-space: pre' block</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-pre-031-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: pre;
+ }
+
+ span
+ {
+ white-space: normal;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">Lorem ips<span>um. Dolo</span>r
+ sit&Tab;amet.</div>
+
+ <div id="reference">Lorem ipsum. <br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
+
+<!--
+
+ <div id="test">Lorem ipsum. Dolor
+ ^
+ 1
+
+ sit&Tab;amet.</div>
+^^^
+123
+
+Since 'tab-size' is by default 8,
+since "sit" uses 3 characters
+and since there are 3 preserved
+white space characters before "sit",
+
+ 8
+-
+ 3
+-
+ 3
+=====
+ 2
+
+then the horizontal tabulation will use as much space
+as a sequence of 2 preserved white space characters.
+
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-032.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-032.html
new file mode 100644
index 0000000000..7c066b7670
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-032.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: wrappable ('pre-wrap') inline inside a 'white-space: pre' block</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-pre-031-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: pre;
+ }
+
+ span
+ {
+ white-space: pre-wrap;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">Lorem ips<span>um. Dolo</span>r
+ sit&Tab;amet.</div>
+
+ <div id="reference">Lorem ipsum. <br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
+
+<!--
+
+ <div id="test">Lorem ipsum. Dolor
+ ^
+ 1
+
+ sit&Tab;amet.</div>
+^^^
+123
+
+
+Since 'tab-size' is by default 8,
+since "sit" uses 3 characters
+and since there are 3 preserved
+white space characters before "sit",
+
+ 8
+-
+ 3
+-
+ 3
+=====
+ 2
+
+then the horizontal tabulation will be converted
+into a sequence of 2 preserved white space characters.
+
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-034.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-034.html
new file mode 100644
index 0000000000..29bf8a53a6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-034.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: wrappable ('break-spaces') inline inside a 'white-space: pre' block</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-pre-034-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: pre;
+ }
+
+ span
+ {
+ white-space: break-spaces;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">Lorem ips<span>um. Dolo</span>r
+ sit&Tab;amet.</div>
+
+ <div id="reference">Lorem ipsum.&nbsp;&nbsp;&nbsp;&nbsp;<br>
+&nbsp;&nbsp;Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
+
+<!--
+
+ <div id="test">Lorem ipsum. Dolor
+ ^^^^^^
+ 123456
+
+ sit&Tab;amet.</div>
+^^^
+123
+
+
+Since 'tab-size' is by default 8,
+since "sit" uses 3 characters
+and since there are 3 preserved
+white space characters before "sit",
+
+ 8
+-
+ 3
+-
+ 3
+=====
+ 2
+
+then the horizontal tabulation will use as much space
+as a sequence of 2 preserved white space characters.
+
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-035.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-035.html
new file mode 100644
index 0000000000..2723c5ce67
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-035.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: wrappable ('pre-line') inline inside a 'white-space: pre' block</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/white-space-pre-031-ref.html">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ div#test
+ {
+ white-space: pre;
+ }
+
+ span
+ {
+ white-space: pre-line;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">Lorem ips<span>um. Dolo</span>r
+ sit&Tab;amet.</div>
+
+ <div id="reference">Lorem ipsum. <br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit&nbsp;&nbsp;amet.</div>
+
+<!--
+
+ <div id="test">Lorem ipsum. Dolor
+ ^^^^^^
+ 123456
+
+ sit&Tab;amet.</div>
+^^^
+123
+
+
+Since 'tab-size' is by default 8,
+since "sit" uses 3 characters
+and since there are 3 preserved
+white space characters before "sit",
+
+ 8
+-
+ 3
+-
+ 3
+=====
+ 2
+
+then the horizontal tabulation will be converted
+into a sequence of 2 preserved white space characters.
+
+
+ &Tab; == Horizontal tabulation == &#x0009; == &#09;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-051.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-051.html
new file mode 100644
index 0000000000..b6879133cc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-051.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <!--
+ Same as
+
+ http://test.csswg.org/suites/css-text-3_dev/nightly-unstable/html/white-space-mixed-003.htm
+
+ but more compact
+ -->
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ float: left;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#pre
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="pre">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-052.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-052.html
new file mode 100644
index 0000000000..a2f03ef50c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-052.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text: inline starting with a collapsible white space</title>
+
+ <!--
+ Same as
+
+ http://test.csswg.org/suites/css-text-3_dev/nightly-unstable/html/white-space-mixed-003.htm
+
+ but more compact
+ -->
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2">
+ <link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+ <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+
+ <style>
+ div
+ {
+ background-color: red;
+ color: green;
+ display: inline-block;
+ font-family: Ahem;
+ font-size: 50px;
+ line-height: 1;
+ }
+
+ span#pre
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.
+
+ <div><span id="pre">AB&NewLine;</span><span> CD</span></div>
+
+<!--
+
+ &NewLine; == Line feed == &#x000A; == &#0010;
+
+-->
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-001.html
new file mode 100644
index 0000000000..2ceb8d7293
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-001.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: justification with white-space:pre-wrap</title>
+<link rel="author" title="Jonathan Kew" href="jkew@mozilla.com">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#text-align-property">
+<link rel="match" href="reference/white-space-pre-wrap-justify-001-ref.html">
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.test {
+ white-space: pre-wrap;
+ text-align: justify;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=test>one two three four five six seven eight nine ten</div>
+
+<div class=ref>one two three four five six seven eight nine ten</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-002.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-002.html
new file mode 100644
index 0000000000..785ebef227
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-002.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: justification with white-space:pre-wrap</title>
+<link rel="author" title="Jonathan Kew" href="jkew@mozilla.com">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#text-align-property">
+<link rel="match" href="reference/white-space-pre-wrap-justify-002-ref.html">
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.test {
+ white-space: pre-wrap;
+ text-align: justify;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=test>one two three four five six seven eight nine ten</div>
+
+<div class=ref>one two&nbsp; three &nbsp; four five six seven eight nine &nbsp; ten</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-003.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-003.html
new file mode 100644
index 0000000000..a00f9c3818
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-003.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: justification with white-space:pre-wrap</title>
+<link rel="author" title="Jonathan Kew" href="jkew@mozilla.com">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#text-align-property">
+<link rel="match" href="reference/white-space-pre-wrap-justify-003-ref.html">
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.test {
+ white-space: pre-wrap;
+ text-align: justify;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div class=test>one two three
+ four five six seven eight nine ten</div>
+
+<div class=ref>one two&nbsp; three<br>&nbsp; &nbsp;four&nbsp; five&nbsp; six seven &nbsp; eight &nbsp; nine ten</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-004.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-004.html
new file mode 100644
index 0000000000..e1611a3143
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-justify-004.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: justification with white-space:pre-wrap</title>
+<link rel="author" title="Jonathan Kew" href="jkew@mozilla.com">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#text-align-property">
+<link rel="match" href="reference/white-space-pre-wrap-justify-004-ref.html">
+
+<style>
+div {
+ border: 1px solid gray;
+ font: 22px monospace;
+ width: 22ch;
+ margin: 1em;
+}
+.test {
+ white-space: pre-wrap;
+ text-align: justify;
+}
+.ref {
+ white-space: normal;
+ text-align: justify;
+ text-align-last: right;
+}
+</style>
+
+<p>Test passes if the two blocks are rendered identically</p>
+
+<div dir=rtl class=test>one, two, three,
+four, five, six, seven, eight, nine!</div>
+
+<div class=ref>,one, two, three<br>four, five, six, !seven, eight, nine</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-001.html
new file mode 100644
index 0000000000..82fbfbc976
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-001.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: alignement and trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-001-ref.html">
+<meta name="assert" content="Preserved white space with pre-wrap at the end of a line ending with a forced line break conditionally hangs, so it does affect alignment.">
+
+<style>
+div {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
+div:nth-of-type(2) {
+ width: 7ch;
+ text-align: right;
+}
+div:nth-of-type(3),
+div:nth-of-type(4) {
+ width: 9ch;
+ text-align: center;
+}
+</style>
+
+<p>This test passes if the 4 letters below are verticaly aligned.
+
+<div> P</div>
+<div>A </div>
+<div> S </div>
+<div> S </div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-002.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-002.html
new file mode 100644
index 0000000000..f7e0f21f45
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-002.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: intrinsic maximum sizing and alignment of trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-002-ref.html">
+<meta name="assert" content="Preserved white space with white-space is pre-wrap at the end of the line before a forced-break only hangs conditionally, and therefore is included in the max-content size, and taken into account for alignemnt (since it doesn't actually hang in this situation).">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font-size: 20px;
+ font-family: Ahem;
+ line-height: 1em;
+ white-space: pre-wrap;
+}
+span {
+ display: inline-block;
+}
+#s1 { text-align: right; }
+#s2 { text-align: center; }
+#test { color: orange; }
+#ref { color: blue; }
+</style>
+
+<p>This test passes if the orange blocks below are vertically aligned with the blue ones.
+
+<div id=test><span id=s1>X </span><span id=s2> X </span> X X</div>
+<div id=ref>X X X X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-003.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-003.html
new file mode 100644
index 0000000000..def9bcaee3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-003.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: intrinsic minimum sizing of trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-003-ref.html">
+<meta name="assert" content="Preserved white space at the end of soft-wrapped lines is hanged when white-space is pre-wrap, and therefore does not count when computing the (minimum) intrinsic size.">
+
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 25px/1 Ahem;
+ white-space: pre-wrap;
+ width: min-content;
+ color: green;
+ background: red;
+}
+</style>
+
+<p>This test passes if there is a green rectangle and no red.
+
+<div>X X X X</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-004.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-004.html
new file mode 100644
index 0000000000..d2fda889bc
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-004.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: 2ch;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div>XX<span> </span>XX</div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-005.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-005.html
new file mode 100644
index 0000000000..2985233517
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-005.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 10px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+.ref span { color: green; }
+.test {
+ color: green;
+
+ width: 5ch;
+ white-space: pre-wrap;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div class="ref">XX<span>XXX</span><br>X<span>XX</span>X<span>X</span><br><span>XXXXX</span><br><span>XXXXX</span><br><span>XXXXX</span></div>
+<div class="test">XX<span> </span><span>X X </span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-006.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-006.html
new file mode 100644
index 0000000000..07a26151a6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-006.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: 2ch;
+ white-space: pre-wrap;
+ overflow-wrap: break-word;
+}
+span {
+ background: blue;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div>XX<span> </span>XX</div>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-007.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-007.html
new file mode 100644
index 0000000000..ce38da9ca0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-007.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 10px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+.ref span { color: green; }
+.test {
+ color: green;
+
+ width: 5ch;
+ white-space: pre-wrap;
+ overflow-wrap: break-word;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div class="ref">XX<span>XXX</span><br>X<span>XX</span>X<span>X</span><br><span>XXXXX</span><br><span>XXXXX</span><br><span>XXXXX</span></div>
+<div class="test">XX<span> </span><span>X X </span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-008.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-008.html
new file mode 100644
index 0000000000..68f1162249
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-008.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.5. Overflow Wrapping: the overflow-wrap/word-wrap property" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+div {
+ font: 10px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+.ref span { color: green; }
+.test {
+ color: green;
+
+ width: 5ch;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div class="ref">XX<span>XXX</span><br>X<span>XX</span>X<span>X</span><br><span>XXXXX</span><br><span>XXXXX</span><br><span>XXXXX</span></div>
+<div class="test">XX<span> </span><span>X X </span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-010.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-010.html
new file mode 100644
index 0000000000..c8825cfa6c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-010.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-004-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 25px/1 Ahem;
+ color: green;
+ background: red;
+
+ width: 2ch;
+ white-space: pre-wrap;
+ word-break: break-all;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div>XX<span> </span>XX</div>
+
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-011.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-011.html
new file mode 100644
index 0000000000..5e3f5dbdcb
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-011.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-004-ref.html">
+<meta name="assert" content="Preserved white space at the end of a soft-wrapped line is hanged when white-space is pre-wrap.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 10px/1 Ahem;
+}
+.ref {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+.ref span { color: green; }
+.test {
+ color: green;
+
+ width: 5ch;
+ white-space: pre-wrap;
+ word-break: break-all;
+}
+</style>
+
+<p>This test passes if there is a green square and no red.
+<div class="ref">XX<span>XXX</span><br>X<span>XX</span>X<span>X</span><br><span>XXXXX</span><br><span>XXXXX</span><br><span>XXXXX</span></div>
+<div class="test">XX<span> </span><span>X X </span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-012.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-012.html
new file mode 100644
index 0000000000..4235cf6e2c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-012.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-normal">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-012-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-012-ref.html">
+<meta name="assert" content="Previous breaking opportunities are not considered if the overflow is caused by hanging trailing spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 4ch;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX X<span> X</span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-013.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-013.html
new file mode 100644
index 0000000000..df4818c69c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-013.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta http-equiv="content-language" content="en, ja" />
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-normal">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-013-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-013-ref.html">
+<meta name="assert" content="Previous breaking opportunities are not considered if the overflow is caused by hanging trailing spaces.">
+<style>
+div {
+ width: 2em;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
+</style>
+
+<p>This test passes if the line is after the white space, which hangs (blue).
+
+<div>ああ<span>&#x0020;X<span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-014.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-014.html
new file mode 100644
index 0000000000..02e776b82e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-014.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-normal">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-014-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-014-ref.html">
+<meta name="assert" content="Previous breaking opportunities are not considered if the overflow is caused by hanging trailing spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 4ch;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box */
+
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX <span>X </span>X<span>XXX </span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-015.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-015.html
new file mode 100644
index 0000000000..326dcb143e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-015.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" title="4.1.3. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-normal">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-015-ref.html">
+<link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-alt-015-ref.html">
+<meta name="assert" content="Previous breaking opportunities are not considered if the overflow is caused by hanging trailing spaces.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
+<style>
+div {
+ font: 20px/1 Ahem;
+ width: 5ch;
+ white-space: pre-wrap;
+}
+span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box */
+</style>
+
+<p>This test passes if the line is broken after the 2nd white space, which hangs (blue).
+<div>XX X<span>X X</span></div>
+
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-021.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-021.html
new file mode 100644
index 0000000000..1a506540ac
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-021.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: Overflowing hanging spaces should be ink overflow</title>
+
+ <!--
+
+ Issue 4297: [css-text-3] Hanging spaces can't be scrollable overflow
+ https://github.com/w3c/csswg-drafts/issues/4297
+
+ Resolution:
+ Hanging spaces are ink overflow by default.
+ UAs may make them scrollable overflow when
+ they think that would be useful.
+
+ -->
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#hanging">
+ <link rel="help" href="https://www.w3.org/TR/css-overflow-3/#ink">
+ <link rel="match" href="reference/white-space-pre-wrap-trailing-spaces-021-ref.html">
+
+ <meta content="should" name="flags">
+ <meta content="This test checks that overflowing hanging spaces at end of line are treated as ink overflow. The overflowing hanging spaces at end of line should not extend the scrollable overflow area of the tested box. Therefore the no horizontal scrollbar condition of the test." name="assert">
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ line-height: 1.25; /* computes to 40px */
+ margin-bottom: 0.25em;
+ width: 16ch;
+ }
+
+ span
+ {
+ background-color: yellow;
+ }
+
+ div#test
+ {
+ overflow: auto;
+ white-space: pre-wrap;
+ }
+
+ div#reference
+ {
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside each black-bordered rectangle are laid out identically and if each black-bordered rectangle does not generate a horizontal scrollbar.
+
+ <div id="test">Lorem ipsum.<span> </span>Dolor
+ sit amet. <br>consectetur</div>
+
+ <div id="reference">Lorem&nbsp;ipsum.<span>&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
+Dolor<br>
+&nbsp;&nbsp;&nbsp;sit amet. <br>
+consectetur</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-022.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-022.html
new file mode 100644
index 0000000000..95f4361e83
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-022.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="preserved trailing spaces under 'white-space: pre-wrap' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ width: 2ch;
+ height: 100px;
+ font: 50px/1 Ahem;
+ color: green;
+
+ overflow-y: hidden;
+ overflow-x: auto;
+ white-space: pre-wrap;
+ }
+</style>
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div>XX XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-023.html b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-023.html
new file mode 100644
index 0000000000..3986079e62
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-023.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text test: hanging trailing spaces with white-space:pre-wrap</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="assert" content="preserved RTL trailing spaces under 'white-space: pre-wrap' hang and shouldn't cause overflow and activate the horizontal scrollbar.">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+ div {
+ width: 2ch;
+ height: 100px;
+ font: 50px/1 Ahem;
+ color: green;
+
+ overflow-y: hidden;
+ overflow-x: auto;
+ white-space: pre-wrap;
+
+ direction: rtl;
+ }
+</style>
+<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+<div>XX XX</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-trim-discard-inner-001.xht b/testing/web-platform/tests/css/css-text/white-space/white-space-trim-discard-inner-001.xht
new file mode 100644
index 0000000000..e8e53074a9
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-trim-discard-inner-001.xht
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 Test: white-space-trim - discard-inner - basic cases</title>
+ <link rel="author" title="Satoshi Umehara" href="mailto:umehara@est.co.jp" />
+ <link rel="help" title="CSS Text Level 4: 3.2. White Space Trimming: the ‘white-space-trim’ property" href="https://drafts.csswg.org/css-text-4/#white-space-trim" />
+ <link rel="match" href="reference/white-space-trim-discard-inner-001-ref.xht"/>
+ <meta name="assert" content="The UA should discard all white space at the beginning of a block and all white space at the end of a block when white-space-trim is set to discard-inner." />
+ <style type="text/css">
+ <![CDATA[
+ .test span {
+ white-space-trim: discard-inner;
+ }
+ /* the CSS below is not part of the test */
+ div {
+ color: Blue;
+ }
+ ]]>
+ </style>
+ </head>
+ <body>
+ <p>
+ Test passes if each text positions in the first line match the corresponding positions in the second line.
+ </p>
+ <div>
+ <div class="test">
+ [<span> 1 2 </span>]
+ [<span>  3  4  </span>]
+ [<span> 5 6 </span>]
+ [<span>
+
+7
+
+8
+
+</span>]
+ </div>
+ <div>
+ [<span>1 2</span>]
+ [<span>  3  4  </span>]
+ [<span>5 6</span>]
+ [<span>7
+
+8</span>]
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-001.html
new file mode 100644
index 0000000000..88c11f1154
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-001.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<title>CSS Text Test: join controls do not disrupt white-space processing</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
+<!-- NB: The spec doesn't explicitly discuss join controls in this context,
+ but it is self-evident that they should not have any effect on the white-space processing.
+ Their only effect should be on the shaping (if any) of the adjacent characters. -->
+<link rel="match" href="reference/white-space-vs-joiners-001-ref.html">
+<meta name="assert" content="The presence of join controls (ZWJ/ZWNJ) at word edges should not affect white-space processing">
+
+<style>
+p {
+ width: fit-content;
+ border: 2px solid green;
+ font: 24px monospace;
+}
+</style>
+
+<body>
+</body>
+
+<script>
+for (i = 0x200b; i <= 0x200f; ++i) {
+ txt = " "
+ + String.fromCharCode(i)
+ + "This should have no leading or trailing ["
+ + i.toString(16)
+ + "]"
+ + String.fromCharCode(i)
+ + " ";
+ p = document.createElement("p");
+ p.textContent = txt;
+ document.body.appendChild(p);
+}
+</script>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-002.html b/testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-002.html
new file mode 100644
index 0000000000..25470f02f2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-vs-joiners-002.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<title>CSS Text Test: join controls do not disrupt white-space processing</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
+<!-- NB: The spec doesn't explicitly discuss join controls in this context,
+ but it is self-evident that they should not have any effect on the white-space processing.
+ Their only effect should be on the shaping (if any) of the adjacent characters. -->
+<link rel="match" href="reference/white-space-vs-joiners-002-ref.html">
+<meta name="assert" content="The presence of join controls (ZWJ/ZWNJ) at word edges should not affect white-space processing">
+
+<style>
+p {
+ width: min-content;
+ border: 2px solid green;
+ font: 24px monospace;
+}
+</style>
+
+<body>
+ <p>
+ &#x200d;This&#x200d;
+ &#x200d;is&#x200d;
+ &#x200d;a&#x200d;
+ &#x200d;simple&#x200d;
+ &#x200d;test&#x200d;
+ </p>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-wrap-after-nowrap-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-wrap-after-nowrap-001.html
new file mode 100644
index 0000000000..5947c289e8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-wrap-after-nowrap-001.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Break opportunities after nowrap</title>
+<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="match" href="reference/white-space-wrap-after-nowrap-001-ref.html">
+<meta name="assert" content="This test ensures that break opportunities after nowrap can break lines.">
+<style>
+div {
+ width: 10ch;
+ border: 2px solid blue;
+ line-height: 1;
+}
+.ideo > div {
+ width: 1em;
+}
+.normal {
+ white-space: normal;
+}
+.nowrap {
+ white-space: nowrap;
+}
+</style>
+<body>
+ <section>
+ <div><span class="nowrap">12345</span> 67890</div>
+ <div><span class="nowrap">12345</span><span class="normal"> 67890</span></div>
+ <div><span class="nowrap">12345<span class="normal"> 67890</span></span></div>
+ <div class="nowrap">12345<span class="normal"> 67890</span></div>
+
+ <div class="nowrap"><span class="normal"><span class="nowrap">12345</span> </span>67890</div>
+ <div class="nowrap"><span class="normal"><span class="nowrap">12345 </span> </span>67890</div>
+ </section>
+
+ <section class="ideo">
+ <div><span class="nowrap">国</span>国</div>
+ <div><span class="nowrap">国</span><span class="normal">国</span></div>
+ </section>
+</body>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-001.html b/testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-001.html
new file mode 100644
index 0000000000..900e1143f2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-001.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>CSS Text Test: preserved white space with zero font-size</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="match" href="reference/white-space-zero-fontsize-001-ref.html">
+<meta name="assert" content="Forced line break in preserved white space is respected even when font-size is zero">
+<style>
+pre {
+ font-size: 0;
+ float: left;
+ border: 1px solid black;
+ margin: 12px;
+}
+span { font-size: 12px; }
+</style>
+<pre>
+<span>foo</span>
+<span>bar</span>
+</pre>
diff --git a/testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-002.html b/testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-002.html
new file mode 100644
index 0000000000..1b8d3b7eb6
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/white-space-zero-fontsize-002.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>CSS Text Test: preserved white space with zero font-size</title>
+<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="match" href="reference/white-space-zero-fontsize-002-ref.html">
+<meta name="assert" content="Tab in preserved white space is respected even when font-size is zero">
+<style>
+pre {
+ font-size: 0;
+ float: left;
+ border: 1px solid black;
+ margin: 12px;
+ -moz-tab-size: 100px;
+ tab-size: 100px;
+}
+span { font-size: 12px; }
+</style>
+<pre>
+<span>foo</span>&#x9;<span>bar</span>
+</pre>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-001.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-001.html
new file mode 100644
index 0000000000..c1ba7a4d8f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-001.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: inline' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-001-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: inline' is tested." name="assert">
+
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#wrapper, div#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 4ch;
+ }
+
+ div#test
+ {
+ display: inline;
+ white-space: break-spaces;
+ }
+
+ div#reference
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="wrapper"><div id="test">123 8</div></div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+
+ <div id="reference">123
+ 8</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-002.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-002.html
new file mode 100644
index 0000000000..5af3c8187d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-002.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: block' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-001-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: block' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 4ch;
+ }
+
+ div#test
+ {
+ display: block;
+ white-space: break-spaces;
+ }
+
+ div#reference
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+
+ <div id="reference">123
+ 8</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-003.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-003.html
new file mode 100644
index 0000000000..738d7f646f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-003.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: list-item' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-003-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: list-item' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#test, li#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 4ch;
+ }
+
+ div#test
+ {
+ display: list-item;
+ margin-left: 40px;
+ white-space: break-spaces;
+ }
+
+ li#reference
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles (both preceded with a small filled disc) are laid out identically.
+
+ <div id="test">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+
+ <ul><li id="reference">123
+ 8</ul>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-005.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-005.html
new file mode 100644
index 0000000000..d8f13d3181
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-005.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: inline-block' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-001-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: inline-block' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 4ch;
+ }
+
+ div#test
+ {
+ display: inline-block;
+ white-space: break-spaces;
+ }
+
+ div#reference
+ {
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+
+ <div id="reference">123
+ 8</div>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-006.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-006.html
new file mode 100644
index 0000000000..a022698683
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-006.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#test, table#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 4ch;
+ }
+
+ div#test
+ {
+ display: table;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ }
+
+ table#reference
+ {
+ border-spacing: 0px;
+ white-space: pre;
+ }
+
+ td
+ {
+ padding: 0px;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+
+ <table id="reference"><tr><td>123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-007.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-007.html
new file mode 100644
index 0000000000..e51e6c908e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-007.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: inline-table' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: inline-table' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#test, table
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ margin-bottom: 0.25em;
+ width: 4ch;
+ }
+
+ div#test
+ {
+ display: inline-table;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ }
+
+ table#reference
+ {
+ border-spacing: 0px;
+ white-space: pre;
+ }
+
+ td
+ {
+ padding: 0px;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="test">
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+
+ <table id="reference"><tr><td>123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-008.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-008.html
new file mode 100644
index 0000000000..1901516990
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-008.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table-row-group' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table-row-group' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#cell, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-row-group;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ width: 4ch;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test">
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+ </div>
+
+ <table><tbody><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-009.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-009.html
new file mode 100644
index 0000000000..248c56a683
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-009.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table-header-group' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table-header-group' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#cell, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-header-group;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ width: 4ch;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test">
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+ </div>
+
+ <table><thead><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-010.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-010.html
new file mode 100644
index 0000000000..ae88b706e3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-010.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table-footer-group' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table-footer-group' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#cell, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-footer-group;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ width: 4ch;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test">
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+ </div>
+
+ <table><tfoot><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-011.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-011.html
new file mode 100644
index 0000000000..f68b57825a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-011.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table-row' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table-row' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#cell, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-row;
+ white-space: break-spaces;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ width: 4ch;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+
+ <table><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-012.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-012.html
new file mode 100644
index 0000000000..2e708727f7
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-012.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' does not apply to 'display: table-column-group' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-012-ref.html">
+
+ <meta content="In this test, we verify that 'white-space: break-spaces' does not apply to element with 'display: table-column-group'." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#cell, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-column-group;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test"></div>
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+
+ <table><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-013.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-013.html
new file mode 100644
index 0000000000..1c2cf9fc0b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-013.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' does not apply to 'display: table-column' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-012-ref.html">
+
+ <meta content="In this test, we verify that 'white-space: break-spaces' does not apply to element with 'display: table-column'." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#cell, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-column;
+ white-space: break-spaces;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#cell
+ {
+ display: table-cell;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: normal;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test"></div>
+ <div id="row">
+ <div id="cell">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+
+ <table><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-014.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-014.html
new file mode 100644
index 0000000000..6a4858487f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-014.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table-cell' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-006-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table-cell' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#test, td#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#row
+ {
+ display: table-row;
+ }
+
+ div#test
+ {
+ display: table-cell;
+ white-space: break-spaces;
+ }
+
+ table
+ {
+ border-spacing: 0px;
+ margin-top: 0.5em;
+ }
+
+ td#reference
+ {
+ padding: 0px;
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="row">
+ <div id="test">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+ </div>
+
+ <table><tr><td id="reference">123
+ 8</table>
diff --git a/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-015.html b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-015.html
new file mode 100644
index 0000000000..fbcca34a22
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/white-space/ws-break-spaces-applies-to-015.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Text Test: 'white-space: break-spaces' applies to 'display: table-caption' element</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+ <link rel="match" href="reference/ws-break-spaces-applies-to-001-ref.html">
+
+ <meta content="When 'white-space' is 'break-spaces', then new lines, sequence of white spaces and tabs are preserved and text can wrap, just like pre-wrap, but sequence of preserved white space always takes up space, including at the end of the line and line breaking opportunity exists after every preserved white space character, including between white space characters. In this test, 'display: table-caption' is tested." name="assert">
+
+ <!--
+
+ Testing of 'white-space: break-spaces':
+
+ ws-break-spaces-applies-to-001: display: inline
+
+ ws-break-spaces-applies-to-002: display: block
+
+ ws-break-spaces-applies-to-003: display: list-item
+
+ ws-break-spaces-applies-to-005: display: inline-block
+
+ ws-break-spaces-applies-to-006: display: table
+
+ ws-break-spaces-applies-to-007: display: inline-table
+
+ ws-break-spaces-applies-to-008: display: table-row-group
+
+ ws-break-spaces-applies-to-009: display: table-header-group
+
+ ws-break-spaces-applies-to-010: display: table-footer-group
+
+ ws-break-spaces-applies-to-011: display: table-row
+
+ ws-break-spaces-applies-to-012: display: table-column-group
+
+ ws-break-spaces-applies-to-013: display: table-column
+
+ ws-break-spaces-applies-to-014: display: table-cell
+
+ ws-break-spaces-applies-to-015: display: table-caption
+
+ -->
+
+ <style>
+ div#test, caption#reference
+ {
+ border: black solid 2px;
+ font-family: monospace;
+ font-size: 32px;
+ width: 4ch;
+ }
+
+ div#table
+ {
+ display: table;
+ }
+
+ div#test
+ {
+ display: table-caption;
+ white-space: break-spaces;
+ }
+
+ table
+ {
+ margin-top: 0.5em;
+ }
+
+ caption#reference
+ {
+ text-align: left;
+ white-space: pre;
+ }
+ </style>
+
+ <p>Test passes if the characters inside of each black-bordered rectangles are laid out identically.
+
+ <div id="table">
+ <div id="test">123 8</div>
+ <!-- 45678 -->
+ <!-- will wrap here ^ -->
+ </div>
+
+ <table><caption id="reference">123
+ 8</table>