Bug 1516407 [wpt PR 14668] - [css-text] Add "anywhere" equivalents to "break-word" tests, a=testonly
authorFlorian Rivoal <git@florian.rivoal.net>
Thu, 31 Jan 2019 15:16:39 +0000
changeset 457677 4140085c0d14860edeb2e8c84b5d9d17dc4e548c
parent 457676 3712891f953527bd37e8905cb56078658be705ff
child 457678 ae2ffb0336d89c86110fbed1d1182f80b1080ebc
push id111763
push userjames@hoppipolla.co.uk
push dateThu, 07 Feb 2019 22:12:57 +0000
treeherdermozilla-inbound@c983e907bbfd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1516407, 14668
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1516407 [wpt PR 14668] - [css-text] Add "anywhere" equivalents to "break-word" tests, a=testonly Automatic update from web-platform-tests [css-text] Add "anywhere" equivalents to "break-word" tests -- wpt-commits: cd31531b419737b67c3201f89eaa1406afe27948 wpt-pr: 14668
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-002.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-004.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-005.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-fit-content-001.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-001.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: anywhere</title>
+<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
+<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/overflow-wrap-break-word-001-ref.html">
+<meta name="assert" content="sequences of nbsp characters that would cause overflow are expected to be broken when overflow-wrap is anywhere">
+<style>
+div {
+  position: relative;
+  width: 100px;
+  height: 100px;
+  font-family: Ahem;
+  color: red;
+  overflow-wrap: anywhere;
+  font-size: 25px;
+  line-height: 27px;
+}
+div::after{
+  content: "";
+  position: absolute;
+  top: 0; left: 0; bottom: 0; right: 0;
+  background: green;
+}
+</style>
+<body>
+  <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X</div>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-002.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: anywhere + 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/#valdef-overflow-wrap-anywhere">
+<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/overflow-wrap-break-word-002-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">
+<style>
+div {
+  white-space: break-spaces;
+  overflow-wrap: anywhere;
+  font-family: monospace;
+  width: 5ch;
+  line-height: 1;
+  overflow: hidden;
+  height: 1em;
+}
+</style>
+
+<p>This test passes if there is nothing below this sentence.
+<div> FAIL <div>
+<!--
+white-space:break-spaces should cause the spaces at the end of the line to be preserved.
+Since there is an allowed break point between the first space and the F,
+that's where the line should wrap,
+not between the L and the subsequent space.
+-->
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap:anywhere + 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/#valdef-overflow-wrap-anywhere">
+<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/overflow-wrap-break-word-003-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">
+<style>
+div {
+  white-space: break-spaces;
+  overflow-wrap: anywhere;
+  font-family: monospace;
+  width: 4ch;
+  line-height: 1;
+  overflow: hidden;
+  height: 2em;
+}
+</style>
+
+<p>This test passes if the word FAIL does not appear below.
+<div>PASS FAIL<div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-004.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: anywhere</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-overflow-wrap-anywhere">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/overflow-wrap-break-word-001-ref.html">
+<meta name="assert" content="A Single leading white-space constitutes a soft breaking opportunity, honoring the 'white-space: pre-wrap' property, that must prevent the word to be broken.">
+<style>
+div {
+  position: relative;
+  font-size: 20px;
+  font-family: Ahem;
+  line-height: 1em;
+}
+.red {
+  position: absolute;
+  background: green;
+  color: red;
+  width: 100px;
+  height: 100px;
+  z-index: -1;
+}
+.test {
+  color: green;
+  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"><br>XXXXX</div>
+  <div class="test"> XXXXX </div>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-005.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: anywhere</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-overflow-wrap-anywhere">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/overflow-wrap-break-word-001-ref.html">
+<meta name="assert" content="A Single leading white-space constitutes a soft breaking opportunity, honoring the 'white-space: pre-wrap' property, that must prevent the word to be broken.">
+<style>
+div {
+  position: relative;
+  font-size: 20px;
+  font-family: Ahem;
+  line-height: 1em;
+}
+.fail {
+  position: absolute;
+  color: red;
+  z-index: -1;
+}
+span { color: green; }
+.test {
+  color: green;
+  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="fail">XXX<span>XX<br></span><span>XXXXX<br></span>XXXXX<br>XXXX<span>X<br></span><span>XXXXX</span></div>
+  <div class="test">XXX
+ XXXXXXXXX</div>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-fit-content-001.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: anywhere with fit-content</title>
+<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com">
+<link rel="help" href="http://www.w3.org/TR/css-text-3/#overflow-wrap-property">
+<meta name="flags" content="">
+<link rel="match" href="reference/overflow-wrap-break-word-fit-content-001.html">
+<meta name="assert" content="The 'overflow-wrap: anywhere' must not break non-BMP characters (which might be represented as surrogate pairs internally)">
+<style>
+.test {
+  display: inline-block;
+  overflow-wrap: anywhere;
+  font-size: 20px;
+  line-height: 1;
+  margin-bottom: .2em;
+}
+</style>
+<body>
+<div id="log"></div>
+<p class="instructions">Tests pass if all lines do not wrap.
+<div><div class="test">&#x1D70B;</div></div>
+<div><div class="test">𝜋</div></div>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-001.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>CSS Text Test: overflow-wrap: anywhere</title>
+<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<link rel="match" href="reference/overflow-wrap-break-word-span-001-ref.html">
+<meta name="assert" content="Test when the `anywhere` value is applied to an inline element.">
+<style>
+div {
+  font-size: 10px;
+  line-height: 1;
+  width: 8ch;
+}
+span {
+  word-wrap: anywhere;
+}
+</style>
+<div>12345<span>67890</span></div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-span-002.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>CSS Text Test: overflow-wrap: anywhere</title>
+<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-anywhere">
+<meta name="assert" content="Test when the `anywhere` value is applied to an inline element.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/check-layout-th.js"></script><style>
+div {
+  font-size: 10px;
+  line-height: 1;
+  width: 5ch;
+}
+span {
+  word-wrap: anywhere;
+}
+</style>
+<div id=container data-expected-height=20>12345678<span>90</span></div>
+
+<script>
+checkLayout('#container')
+</script>