Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added line-breaking-013 and reference test #13027

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions css/css-text/line-breaking/line-breaking-013.xht
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: atomic inlines are treated as ideographic characters for line-breaking</title>
<meta charset="utf-8" />
<link rel="author" title="Mike Bremford" href="http://bfo.com/" />
<link rel="help" href="https://www.w3.org/TR/css-text-3/#line-break-details" />
<meta name="assert" content="Atomic inlines are treated as ideographic characters for line-breaking" />
<link rel="match" href="reference/line-breaking-013-ref.xht" />
<style>
p {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styling the <p> doesn't seem essential for the test. I suggest dropping it to simplify, and to avoid misleading people into thinking that it might matter somehow.

margin: 2em 0 0.5em 0;
}
img {
width: 1em;
height: 1em;
}
.ib {
display: inline-block;
width: 1em;
height: 1em;
background-color: green;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use the color green unless its presence (together with the absence of red) means that the test passes.

As this is not the case here, you can use blue just like the inline image. If you want to maintain a distinction, orange is also commonly used as a color which does not by itself imply passing of failing.

}
.test {
margin: 0 0 1em 0;
line-height: 1.25;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line-height and vertical align don't seem essential for the test. I suggest dropping them to simplify, and to avoid misleading people into thinking that they might matter somehow.

vertical-align: bottom;
}
.test span {
background-color: #EEE;
font-size: 32px;
display: inline-block;
margin-right: 1em;
vertical-align: top;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vertical-align doesn't seem essential for the test. I suggest dropping it to simplify, and to avoid misleading people into thinking that it might matter somehow.

}
.c1 span {
width: 3em;
}
.c2 span {
width: 3em;
word-break: keep-all;
}
</style>
</head>
<body>
<!--
Test rationale: section 5.1 of css-text-3 states:

"The line breaking behavior of a replaced element or other atomic inline is equivalent
to an ideographic character (Unicode linebreaking class ID [UAX14]), and additionally,
for Web-compatibility, introduces a soft wrap opportunity between itself and any
adjacent U+00A0 NO-BREAK SPACE character."

-->

<!-- First block - a breakpoint is normally allowed between an alphabetic character and an ideographic character -->
<p>Block one: test passes if the first character on line two is "d"</p>
<div class="test c1">
<span>a b c<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/>d e f</span>
<span>a b c<div class="ib"></div>d e f</span>
<span>a b c国d e f</span>
</div>

<!-- Second block - a breakpoint is normally disallowed between a numeric prefix like "+" and an ideographic character -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UAX14 disallows breaks between numeric prefixes and ideograph, but following this rule is not strictly required by css-text. Some of the UAX14 rules are explicitly invoked and must be honored, but for the rest, css-text treats UAX14 more as a general guideline / starting point than as strict rules to be followed.

So I don't think this "block two" part of the text is wrong, but it also doesn't rise to the level of an RFC2119 “MUST”.

As this test is split into several files, those that correspond to "block two" should have <meta name="flags" content="should"> in the headers, as well as an additional <link rel="help" href="… pointing to the relevant section of UAX14.

<p>Block two: test passes if the first character on line two is "+"</p>
<div class="test c1">
<span>a b +<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/>d e</span>
<span>a b +<div class="ib"></div>d e</span>
<span>a b +国d e</span>
</div>

<!-- Third block: word-break: keep-all removes the break opportunity between an alphabetic and an ideographic characters -->
<div class="test c2">
<p>Block three: test passes if the first character on line two is "c"</p>
<span>a b c<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/>d e</span>
<span>a b c<div class="ib"></div>d e</span>
<span>a b c国d e</span>
</div>

<!-- Fourth block: a breakpoint is explicitly allowed between an atomic inline and an NBSP, whereas it's disallowed for ideographic characters -->
<div class="test c2">
<p>Block four: test passes if the first characters on line two<br/>
are "d", "d" and "c" (there may be a space before a "d")</p>
<span>ab c<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/>&#xa0;d e</span>
<span>ab c<div class="ib"></div>&#xa0;d e</span>
<span>ab c国&#xa0;d e</span>
</div>

</body>
</html>
87 changes: 87 additions & 0 deletions css/css-text/line-breaking/reference/line-breaking-013-ref.xht
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>CSS Test: atomic inlines are treated as ideographic characters for line-breaking</title>
<link rel="author" title="Mike Bremford" href="http://bfo.com/" />
<style>
p {
margin: 2em 0 0.5em 0;
}
img {
width: 1em;
height: 1em;
}
.ib {
display: inline-block;
width: 1em;
height: 1em;
background-color: green;
}
.test {
margin: 0 0 1em 0;
line-height: 1.25;
vertical-align: bottom;
}
.test span {
background-color: #EEE;
font-size: 32px;
display: inline-block;
margin-right: 1em;
vertical-align: top;
}
.c1 span {
width: 3em;
}
.c2 span {
width: 3em;
word-break: keep-all;
}
</style>
</head>
<body>
<!--
Test rationale: section 5.1 of css-text-3 states:

"The line breaking behavior of a replaced element or other atomic inline is equivalent
to an ideographic character (Unicode linebreaking class ID [UAX14]), and additionally,
for Web-compatibility, introduces a soft wrap opportunity between itself and any
adjacent U+00A0 NO-BREAK SPACE character."

-->

<!-- First block - a breakpoint is normally allowed between an alphabetic character and an ideographic character -->
<p>Block one: test passes if the first character on line two is "d"</p>
<div class="test c1">
<span>a b c<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/><br/>d e f</span>
<span>a b c<div class="ib"></div><br/>d e f</span>
<span>a b c国<br/>d e f</span>
</div>

<!-- Second block - a breakpoint is normally disallowed between a numeric prefix like "+" and an ideographic character -->
<p>Block two: test passes if the first character on line two is "+"</p>
<div class="test c1">
<span>a b <br/>+<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/>d e</span>
<span>a b <br/>+<div class="ib"></div>d e</span>
<span>a b <br/>+国d e</span>
</div>

<!-- Third block: word-break: keep-all removes the break opportunity between an alphabetic and an ideographic characters -->
<div class="test c2">
<p>Block three: test passes if the first character on line two is "c"</p>
<span>a b <br/>c<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/>d e</span>
<span>a b <br/>c<div class="ib"></div>d e</span>
<span>a b <br/>c国d e</span>
</div>

<!-- Fourth block: a breakpoint is explicitly allowed between an atomic inline and an NBSP, whereas it's disallowed for ideographic characters -->
<div class="test c2">
<p>Block four: test passes if the first characters on line two<br/>
are "d", "d" and "c" (there may be a space before a "d")</p>
<span>ab c<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=="/><br/>&#xa0;d e</span>
<span>ab c<div class="ib"></div><br/>&#xa0;d e</span>
<span>ab <br/>c国&#xa0;d e</span>
</div>

</body>
</html>