Bug 1268347 - Forbid break opportunities inside horizontal-in-vertical. r?jfkthame
MozReview-Commit-ID: K8ao3D0IE93
--- a/layout/reftests/w3c-css/submitted/writing-modes-3/reftest.list
+++ b/layout/reftests/w3c-css/submitted/writing-modes-3/reftest.list
@@ -1,10 +1,12 @@
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
== text-combine-upright-compression-004.html text-combine-upright-compression-004-ref.html
== text-combine-upright-compression-005.html text-combine-upright-compression-005-ref.html
== text-combine-upright-compression-005a.html text-combine-upright-compression-005-ref.html
== text-combine-upright-compression-006.html text-combine-upright-compression-006-ref.html
== text-combine-upright-compression-006a.html text-combine-upright-compression-006-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/writing-modes-3/text-combine-upright-break-inside-001-ref.html
@@ -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>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/writing-modes-3/text-combine-upright-break-inside-001.html
@@ -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>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/writing-modes-3/text-combine-upright-break-inside-001a.html
@@ -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>
--- a/layout/style/nsStyleStructInlines.h
+++ b/layout/style/nsStyleStructInlines.h
@@ -43,24 +43,26 @@ nsStyleText::GetTextShadow() const
return mTextShadow;
}
bool
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
nsStyleText::WordCanWrap(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
return WordCanWrapStyle() && !aContextFrame->IsSVGText();
}