Bug 1561168 [wpt PR 17393] - Insert a generated item after preserved spaces following a forced break, a=testonly

Automatic update from web-platform-tests
Insert a generated item after preserved spaces following a forced break

We already had to implement a special logic to deal with leading
preserved white spaces due some optimizations we have in the line
breaking code to give always breaking opportunities before spaces.

However, the presence of forced breaks may cause some of the following
spaces becoming leading preserved spaces in the next line.

This patch applies the same logic we had for such leading spaces at
the text's first line. It also needs to define additional cases in the
function that evaluates the need of adding these generated breaking
opportunity items.

Bug: 976195
Change-Id: If39e7ba8a535c15d33d6021c6cd04da9590b1131
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1667305
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671656}

--

wpt-commits: 9348328991a301000225e6da1010755eceaf1389
wpt-pr: 17393
This commit is contained in:
Javier Fernandez 2019-07-19 14:02:50 +00:00 коммит произвёл James Graham
Родитель a7823b7894
Коммит 150170970b
15 изменённых файлов: 438 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,30 @@
<!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.">
<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>

Просмотреть файл

@ -0,0 +1,30 @@
<!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.">
<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>

Просмотреть файл

@ -0,0 +1,30 @@
<!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.">
<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>

Просмотреть файл

@ -0,0 +1,31 @@
<!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.">
<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>

Просмотреть файл

@ -0,0 +1,31 @@
<!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.">
<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>

Просмотреть файл

@ -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.">
<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
XX</div>

Просмотреть файл

@ -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.">
<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
XX</div>

Просмотреть файл

@ -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.">
<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
XX</div>

Просмотреть файл

@ -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.">
<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
XX</div>

Просмотреть файл

@ -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.">
<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>

Просмотреть файл

@ -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.">
<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>

Просмотреть файл

@ -0,0 +1,30 @@
<!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.">
<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>

Просмотреть файл

@ -0,0 +1,30 @@
<!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.">
<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>

Просмотреть файл

@ -0,0 +1,30 @@
<!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.">
<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>

Просмотреть файл

@ -28,6 +28,10 @@ TRAILING WHITESPACE: webaudio/*
TRAILING WHITESPACE: WebIDL/* TRAILING WHITESPACE: WebIDL/*
TRAILING WHITESPACE: webvtt/* TRAILING WHITESPACE: webvtt/*
TRAILING WHITESPACE: server-timing/resources/parsing/*.sub.headers TRAILING WHITESPACE: server-timing/resources/parsing/*.sub.headers
TRAILING WHITESPACE: css/css-text/white-space/pre-wrap-leading-spaces-006.html
TRAILING WHITESPACE: css/css-text/white-space/pre-wrap-leading-spaces-007.html
TRAILING WHITESPACE: css/css-text/white-space/pre-wrap-leading-spaces-008.html
TRAILING WHITESPACE: css/css-text/white-space/pre-wrap-leading-spaces-009.html
## File types that should never be checked ## ## File types that should never be checked ##