Skip to content

Commit

Permalink
Fix ellipsis position for RTL elements
Browse files Browse the repository at this point in the history
In ShapeResult::OffsetToFit() when the size to fit
matches result.origin_x we were returning
the left_character_index only if Direction() was RTL.
However if line_direction is RTL we also want that index.

With this change css/css-ui/text-overflow-028.html starts to pass
on Linus and Windows, we add new tests here too
(the RTL ones were failing before this patch).

BUG=1063319
TEST=css/css-overflow/text-overflow-ellipsis-001.html
TEST=css/css-overflow/text-overflow-ellipsis-rtl-001.html
TEST=css/css-overflow/text-overflow-ellipsis-vertical-001.html
TEST=css/css-overflow/text-overflow-ellipsis-vertical-ltr-001.html

Change-Id: Idbaed07a63d4ec6335e722b7fb7b4e91f4076564
  • Loading branch information
mrego authored and chromium-wpt-export-bot committed Mar 21, 2020
1 parent f2c1dfe commit 6680fe5
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 0 deletions.
14 changes: 14 additions & 0 deletions css/css-overflow/reference/text-overflow-ellipsis-001-ref.html
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis reference file</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>pppX</div>
15 changes: 15 additions & 0 deletions css/css-overflow/reference/text-overflow-ellipsis-rtl-001-ref.html
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis reference file</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
white-space: pre;
}
</style>
<p>The test passes if it matches the reference.</p>
<div> ppp</div>
<div>pppp</div>
<div>Xppp</div>
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis reference file</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
height: 400px;
display: inline-block;
writing-mode: vertical-lr;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>pppX</div>
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis reference file</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
height: 400px;
display: inline-block;
writing-mode: vertical-lr;
direction: rtl;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>Xppp</div>
21 changes: 21 additions & 0 deletions css/css-overflow/text-overflow-ellipsis-001.html
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#ellipsis-scrolling">
<link rel="match" href="reference/text-overflow-ellipsis-001-ref.html">
<meta name="assert" content="Check that ellipsis is placed on the right position on the container boundaries in elements with 'text-overflow: ellipsis'.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
width: 400px;
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>ppppp</div>
22 changes: 22 additions & 0 deletions css/css-overflow/text-overflow-ellipsis-rtl-001.html
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis RTL</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#ellipsis-scrolling">
<link rel="match" href="reference/text-overflow-ellipsis-rtl-001-ref.html">
<meta name="assert" content="Check that ellipsis is placed on the right position on the container boundaries in elements with 'text-overflow: ellipsis' in RTL.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
width: 400px;
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;
direction: rtl;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>ppppp</div>
23 changes: 23 additions & 0 deletions css/css-overflow/text-overflow-ellipsis-vertical-001.html
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis vertical</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#ellipsis-scrolling">
<link rel="match" href="reference/text-overflow-ellipsis-vertical-001-ref.html">
<meta name="assert" content="Check that ellipsis is placed on the right position on the container boundaries in elements with 'text-overflow: ellipsis' in vertical writing mode.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
height: 400px;
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
writing-mode: vertical-lr;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>ppppp</div>
24 changes: 24 additions & 0 deletions css/css-overflow/text-overflow-ellipsis-vertical-rtl-001.html
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Overflow: text-overflow: ellipsis vertical RTL</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#ellipsis-scrolling">
<link rel="match" href="reference/text-overflow-ellipsis-vertical-rtl-001-ref.html">
<meta name="assert" content="Check that ellipsis is placed on the right position on the container boundaries in elements with 'text-overflow: ellipsis' in vertical writing mode and RTL.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 100px/1 Ahem;
height: 400px;
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
writing-mode: vertical-lr;
direction: rtl;
}
</style>
<p>The test passes if it matches the reference.</p>
<div>ppp</div>
<div>pppp</div>
<div>ppppp</div>

0 comments on commit 6680fe5

Please sign in to comment.