Bug 1268347 - Forbid break opportunities inside horizontal-in-vertical. r=jfkthame

MozReview-Commit-ID: K8ao3D0IE93

--HG--
extra : rebase_source : dbdd0ec230181468cacd6aec83dcf12275bd2815
This commit is contained in:
Xidorn Quan 2016-05-03 14:39:24 +10:00
parent e78be5f934
commit 67093c6823
5 changed files with 77 additions and 2 deletions

View File

@ -1,5 +1,7 @@
default-preferences pref(layout.css.text-combine-upright.enabled,true)
== text-combine-upright-break-inside-001.html text-combine-upright-break-inside-001-ref.html
== text-combine-upright-break-inside-001a.html text-combine-upright-break-inside-001-ref.html
== text-combine-upright-compression-001.html text-combine-upright-compression-001-ref.html
== text-combine-upright-compression-002.html text-combine-upright-compression-002-ref.html
== text-combine-upright-compression-003.html text-combine-upright-compression-003-ref.html

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>CSS Reference: text-combine-upright, no line break</title>
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
<link rel="stylesheet" href="support/tcy.css">
<style>
.test { writing-mode: vertical-rl; }
.test > p { height: 3em; margin: 0 5em; }
.tcy, .fake-tcy { color: transparent; }
</style>
</head>
<body>
<p>Test passes if the two columns are identical.</p>
<div class="test">
<p style="white-space: nowrap">XXXXX<span class="fake-tcy">X</span>XXXXX</p>
<p style="white-space: nowrap">XXXXX<span class="fake-tcy">X</span>XXXXX</p>
</div>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>CSS Test: text-combine-upright, whitespace inside tcy with insufficient line space</title>
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#text-combine-layout">
<link rel="match" href="text-combine-upright-break-inside-001-ref.html">
<meta name="assert" content="line should never be broken inside text-combine-upright text node">
<link rel="stylesheet" href="support/tcy.css">
<style>
.test { writing-mode: vertical-rl; }
.test > p { height: 3em; margin: 0 5em; }
.tcy, .fake-tcy { color: transparent; }
</style>
</head>
<body>
<p>Test passes if the two columns are identical.</p>
<div class="test">
<p>XXXXX<span class="tcy">X X</span>XXXXX</p>
<p style="white-space: nowrap">XXXXX<span class="fake-tcy">X</span>XXXXX</p>
</div>
</body>
</html>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>CSS Test: text-combine-upright, white-space: pre with new line</title>
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#text-combine-layout">
<link rel="match" href="text-combine-upright-break-inside-001-ref.html">
<meta name="assert" content="line should never be broken inside text-combine-upright text node">
<link rel="stylesheet" href="support/tcy.css">
<style>
.test { writing-mode: vertical-rl; }
.test > p { height: 3em; margin: 0 5em; }
.tcy { white-space: pre; }
.tcy, .fake-tcy { color: transparent; }
</style>
</head>
<body>
<p>Test passes if the two columns are identical.</p>
<div class="test">
<p>XXXXX<span class="tcy">X
X</span>XXXXX</p>
<p style="white-space: nowrap">XXXXX<span class="fake-tcy">X</span>XXXXX</p>
</div>
</body>
</html>

View File

@ -48,14 +48,16 @@ nsStyleText::NewlineIsSignificant(const nsTextFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
return NewlineIsSignificantStyle() &&
!aContextFrame->ShouldSuppressLineBreak();
!aContextFrame->ShouldSuppressLineBreak() &&
!aContextFrame->StyleContext()->IsTextCombined();
}
bool
nsStyleText::WhiteSpaceCanWrap(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
return WhiteSpaceCanWrapStyle() && !aContextFrame->IsSVGText();
return WhiteSpaceCanWrapStyle() && !aContextFrame->IsSVGText() &&
!aContextFrame->StyleContext()->IsTextCombined();
}
bool