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

[css-text-3] Tests for percentage text indent #11373

Merged
merged 3 commits into from
Oct 8, 2018
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang=en>
<meta charset="utf-8">
<title>CSS Text Test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<style>
div { padding-left: 50px; }
</style>

<p>Test passes if there is a single black X below and no red.
<div>X</div>
27 changes: 27 additions & 0 deletions css/css-text/text-indent/text-indent-percentage-002.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang=en>
<meta charset="utf-8">
<title>CSS Text Test: text-indent percentage resolution basis</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-indent-property">
<meta name="flags" content="">
<link rel="match" href="reference/text-indent-percentage-002-ref.html">
<meta name="assert" content="Percentages in text-indent refer to width of the element's content box">
<style>
section { position: absolute; }
section, div {
border-right: 10px solid white;
margin-right: 10px;
padding-right: 10px;
}
div {
box-sizing: border-box;
width: 120px;
}
.test div { text-indent: 50%; color: red; }
.ref div { text-indent: 50px; }
</style>

<p>Test passes if there is a single black X below and no red.
<section class=test><div>X</div></section>
<section class=ref><div>X</div></section>
27 changes: 27 additions & 0 deletions css/css-text/text-indent/text-indent-percentage-003.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang=en>
<meta charset="utf-8">
<title>CSS Text Test: text-indent percentage resolution basis</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-indent-property">
<meta name="flags" content="">
<link rel="match" href="reference/text-indent-percentage-002-ref.html">
<meta name="assert" content="Percentages in text-indent refer to width of the element's content box">
<style>
section { position: absolute; }
section, div {
border-right: 10px solid white;
margin-right: 10px;
padding-right: 10px;
}
div {
box-sizing: border-box;
width: 120px;
}
.test div { text-indent: 50%; color: red; overflow: hidden; } /* overflow:hidden should not make any difference, but it does in some browsers */
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a bug on file for whichever browser this is referring to?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the browser is Gecko looking at the test locally. I'm not sure what's going on there. I'd file and cc @MatsPalmgren who is looking at fixing calc().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I planned to file the bug after the test got approved, but @MatsPalmgren did it first

.ref div { text-indent: 50px; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Could a test for calc(px + %) be added if it's not too much of a hassle? That's a case that gecko gets wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How is that: d25a341 ?

</style>

<p>Test passes if there is a single black X below and no red.
<section class=test><div>X</div></section>
<section class=ref><div>X</div></section>
27 changes: 27 additions & 0 deletions css/css-text/text-indent/text-indent-percentage-004.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang=en>
<meta charset="utf-8">
<title>CSS Text Test: text-indent percentage resolution basis, in a calc expressiong</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-indent-property">
<meta name="flags" content="">
<link rel="match" href="reference/text-indent-percentage-002-ref.html">
<meta name="assert" content="Percentages in text-indent refer to width of the element's content box, when used in a calc expression">
<style>
section { position: absolute; }
section, div {
border-right: 10px solid white;
margin-right: 10px;
padding-right: 10px;
}
div {
box-sizing: border-box;
width: 120px;
}
.test div { text-indent: calc(25px + 25%); color: red; }
.ref div { text-indent: 50px; }
</style>

<p>Test passes if there is a single black X below and no red.
<section class=test><div>X</div></section>
<section class=ref><div>X</div></section>