mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 04:17:31 +09:00
moebius#90: CSS - implement text-justify property
This commit is contained in:
parent
5677db4b6e
commit
1f262f0d2b
26 changed files with 312 additions and 9 deletions
|
|
@ -3064,6 +3064,7 @@ exports.CSS_PROPERTIES = {
|
||||||
"text-emphasis-style",
|
"text-emphasis-style",
|
||||||
"-webkit-text-fill-color",
|
"-webkit-text-fill-color",
|
||||||
"text-indent",
|
"text-indent",
|
||||||
|
"text-justify",
|
||||||
"text-orientation",
|
"text-orientation",
|
||||||
"text-overflow",
|
"text-overflow",
|
||||||
"text-rendering",
|
"text-rendering",
|
||||||
|
|
@ -3240,6 +3241,7 @@ exports.CSS_PROPERTIES = {
|
||||||
"dialog",
|
"dialog",
|
||||||
"difference",
|
"difference",
|
||||||
"disabled",
|
"disabled",
|
||||||
|
"distribute",
|
||||||
"dotted",
|
"dotted",
|
||||||
"double",
|
"double",
|
||||||
"drag",
|
"drag",
|
||||||
|
|
@ -3299,6 +3301,8 @@ exports.CSS_PROPERTIES = {
|
||||||
"inline-table",
|
"inline-table",
|
||||||
"inset",
|
"inset",
|
||||||
"inside",
|
"inside",
|
||||||
|
"inter-character",
|
||||||
|
"inter-word",
|
||||||
"intersect",
|
"intersect",
|
||||||
"isolate",
|
"isolate",
|
||||||
"italic",
|
"italic",
|
||||||
|
|
@ -8865,6 +8869,23 @@ exports.CSS_PROPERTIES = {
|
||||||
"unset"
|
"unset"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"text-justify": {
|
||||||
|
"isInherited": true,
|
||||||
|
"subproperties": [
|
||||||
|
"text-justify"
|
||||||
|
],
|
||||||
|
"supports": [],
|
||||||
|
"values": [
|
||||||
|
"auto",
|
||||||
|
"distribute",
|
||||||
|
"inherit",
|
||||||
|
"initial",
|
||||||
|
"inter-character",
|
||||||
|
"inter-word",
|
||||||
|
"none",
|
||||||
|
"unset"
|
||||||
|
]
|
||||||
|
},
|
||||||
"text-orientation": {
|
"text-orientation": {
|
||||||
"isInherited": true,
|
"isInherited": true,
|
||||||
"subproperties": [
|
"subproperties": [
|
||||||
|
|
|
||||||
|
|
@ -7013,7 +7013,8 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
||||||
nscoord aLetterSpacing)
|
nscoord aLetterSpacing)
|
||||||
{
|
{
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
if (aLetterSpacing != 0) {
|
if (aLetterSpacing != 0 ||
|
||||||
|
aStyleText->mTextJustify == StyleTextJustify::InterCharacter) {
|
||||||
result |= gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES;
|
result |= gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES;
|
||||||
}
|
}
|
||||||
if (aStyleText->mControlCharacterVisibility == NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN) {
|
if (aStyleText->mControlCharacterVisibility == NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN) {
|
||||||
|
|
|
||||||
|
|
@ -2936,22 +2936,40 @@ nsTextFrame::GetTrimmedOffsets(const nsTextFragment* aFrag,
|
||||||
return offsets;
|
return offsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsJustifiableCharacter(const nsTextFragment* aFrag, int32_t aPos,
|
static bool IsJustifiableCharacter(const nsStyleText* aTextStyle,
|
||||||
|
const nsTextFragment* aFrag, int32_t aPos,
|
||||||
bool aLangIsCJ)
|
bool aLangIsCJ)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aPos >= 0, "negative position?!");
|
NS_ASSERTION(aPos >= 0, "negative position?!");
|
||||||
|
|
||||||
|
StyleTextJustify justifyStyle = aTextStyle->mTextJustify;
|
||||||
|
if (justifyStyle == StyleTextJustify::None) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char16_t ch = aFrag->CharAt(aPos);
|
char16_t ch = aFrag->CharAt(aPos);
|
||||||
if (ch == '\n' || ch == '\t' || ch == '\r')
|
if (ch == '\n' || ch == '\t' || ch == '\r') {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (ch == ' ' || ch == CH_NBSP) {
|
if (ch == ' ' || ch == CH_NBSP) {
|
||||||
// Don't justify spaces that are combined with diacriticals
|
// Don't justify spaces that are combined with diacriticals
|
||||||
if (!aFrag->Is2b())
|
if (!aFrag->Is2b()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return !nsTextFrameUtils::IsSpaceCombiningSequenceTail(
|
return !nsTextFrameUtils::IsSpaceCombiningSequenceTail(
|
||||||
aFrag->Get2b() + aPos + 1, aFrag->GetLength() - (aPos + 1));
|
aFrag->Get2b() + aPos + 1, aFrag->GetLength() - (aPos + 1));
|
||||||
}
|
}
|
||||||
if (ch < 0x2150u)
|
|
||||||
|
if (justifyStyle == StyleTextJustify::InterCharacter) {
|
||||||
|
return true;
|
||||||
|
} else if (justifyStyle == StyleTextJustify::InterWord) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// text-justify: auto
|
||||||
|
if (ch < 0x2150u) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (aLangIsCJ) {
|
if (aLangIsCJ) {
|
||||||
if ((0x2150u <= ch && ch <= 0x22ffu) || // Number Forms, Arrows, Mathematical Operators
|
if ((0x2150u <= ch && ch <= 0x22ffu) || // Number Forms, Arrows, Mathematical Operators
|
||||||
(0x2460u <= ch && ch <= 0x24ffu) || // Enclosed Alphanumerics
|
(0x2460u <= ch && ch <= 0x24ffu) || // Enclosed Alphanumerics
|
||||||
|
|
@ -3279,7 +3297,7 @@ PropertyProvider::ComputeJustification(
|
||||||
gfxSkipCharsIterator iter = run.GetPos();
|
gfxSkipCharsIterator iter = run.GetPos();
|
||||||
for (uint32_t i = 0; i < length; ++i) {
|
for (uint32_t i = 0; i < length; ++i) {
|
||||||
uint32_t offset = originalOffset + i;
|
uint32_t offset = originalOffset + i;
|
||||||
if (!IsJustifiableCharacter(mFrag, offset, isCJ)) {
|
if (!IsJustifiableCharacter(mTextStyle, mFrag, offset, isCJ)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ do
|
||||||
else
|
else
|
||||||
echo "Unexpected type $TYPE for $DIRNAME/$TEST"
|
echo "Unexpected type $TYPE for $DIRNAME/$TEST"
|
||||||
fi
|
fi
|
||||||
if grep "rel=\"$REFTYPE\"" "$DIRNAME/$TEST" | head -1 | grep -q "href=\"$REF\""
|
if grep "rel=\(\"$REFTYPE\"\|'$REFTYPE'\)" "$DIRNAME/$TEST" | head -1 | grep -q "href=\(\"$REF\"\|'$REF'\)"
|
||||||
then
|
then
|
||||||
#echo "Good link for $DIRNAME/$TEST"
|
#echo "Good link for $DIRNAME/$TEST"
|
||||||
echo -n
|
echo -n
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,9 @@
|
||||||
== text-align-match-parent-root-ltr.html text-align-match-parent-root-ltr-ref.html
|
== text-align-match-parent-root-ltr.html text-align-match-parent-root-ltr-ref.html
|
||||||
== text-align-match-parent-root-rtl.html text-align-match-parent-root-rtl-ref.html
|
== text-align-match-parent-root-rtl.html text-align-match-parent-root-rtl-ref.html
|
||||||
|
|
||||||
|
pref(layout.css.text-justify.enabled,true) == text-justify-none-001.html text-justify-none-001-ref.html
|
||||||
|
pref(layout.css.text-justify.enabled,true) == text-justify-inter-word-001.html text-justify-inter-word-001-ref.html
|
||||||
|
pref(layout.css.text-justify.enabled,true) == text-justify-inter-character-001.html text-justify-inter-character-001-ref.html
|
||||||
|
pref(layout.css.text-justify.enabled,true) == text-justify-distribute-001.html text-justify-inter-character-001-ref.html
|
||||||
|
|
||||||
== text-word-spacing-001.html text-word-spacing-ref.html
|
== text-word-spacing-001.html text-word-spacing-ref.html
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: distribute</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-justify-property">
|
||||||
|
<link rel='match' href='text-justify-inter-character-001-ref.html'>
|
||||||
|
<meta name="assert" content="text-justify:distribute means justification adjusts spacing between each pair of adjacent typographic character units.">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
.test {
|
||||||
|
text-align-last: justify;
|
||||||
|
text-justify: distribute;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en" class="test">XX</p>
|
||||||
|
<p lang="ja" class="test">文字</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: inter-character</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en">X<span class="right">X</span></p>
|
||||||
|
<p lang="ja">文<span class="right">字</span></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: inter-character</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-justify-property">
|
||||||
|
<link rel='match' href='text-justify-inter-character-001-ref.html'>
|
||||||
|
<meta name="assert" content="text-justify:inter-character means justification adjusts spacing between each pair of adjacent typographic character units.">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
.test {
|
||||||
|
text-align-last: justify;
|
||||||
|
text-justify: inter-character;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en" class="test">XX</p>
|
||||||
|
<p lang="ja" class="test">文字</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: inter-word</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en">Latin<span class="right">text</span></p>
|
||||||
|
<p lang="ja">日本<span class="right">文字</span></p>
|
||||||
|
<p lang="th">อักษรไทย<span class="right">อักษรไทย</span></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: inter-word</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-justify-property">
|
||||||
|
<link rel='match' href='text-justify-inter-word-001-ref.html'>
|
||||||
|
<meta name="assert" content="text-justify:inter-word means justification adjusts spacing at word separators only.">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
.test {
|
||||||
|
text-align-last: justify;
|
||||||
|
text-justify: inter-word;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en" class="test">Latin text</p>
|
||||||
|
<p lang="ja" class="test">日本 文字</p>
|
||||||
|
<p lang="th" class="test">อักษรไทย อักษรไทย</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: none</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en">Latin text</p>
|
||||||
|
<p lang="ja">日本 文字</p>
|
||||||
|
<p lang="th">อักษรไทย อักษรไทย</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>CSS Text 7.4. Justification Method: text-justify: none</title>
|
||||||
|
<link rel="author" title="Chun-Min (Jeremy) Chen" href="mailto:jeremychen@mozilla.com">
|
||||||
|
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-justify-property">
|
||||||
|
<link rel='match' href='text-justify-none-001-ref.html'>
|
||||||
|
<meta name="assert" content="text-justify:none means justification is disabled: there are no justification opportunities within the text.">
|
||||||
|
<style type='text/css'>
|
||||||
|
p {
|
||||||
|
font-size: 1.5em;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
margin-right: 310px;
|
||||||
|
}
|
||||||
|
.test {
|
||||||
|
text-align-last: justify;
|
||||||
|
text-justify: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p lang="en" class="test">Latin text</p>
|
||||||
|
<p lang="ja" class="test">日本 文字</p>
|
||||||
|
<p lang="th" class="test">อักษรไทย อักษรไทย</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -238,6 +238,7 @@ CSS_KEY(disc, disc)
|
||||||
CSS_KEY(disclosure-closed, disclosure_closed)
|
CSS_KEY(disclosure-closed, disclosure_closed)
|
||||||
CSS_KEY(disclosure-open, disclosure_open)
|
CSS_KEY(disclosure-open, disclosure_open)
|
||||||
CSS_KEY(discretionary-ligatures, discretionary_ligatures)
|
CSS_KEY(discretionary-ligatures, discretionary_ligatures)
|
||||||
|
CSS_KEY(distribute, distribute)
|
||||||
CSS_KEY(dot, dot)
|
CSS_KEY(dot, dot)
|
||||||
CSS_KEY(dotted, dotted)
|
CSS_KEY(dotted, dotted)
|
||||||
CSS_KEY(double, double)
|
CSS_KEY(double, double)
|
||||||
|
|
@ -333,7 +334,8 @@ CSS_KEY(inline-start, inline_start)
|
||||||
CSS_KEY(inline-table, inline_table)
|
CSS_KEY(inline-table, inline_table)
|
||||||
CSS_KEY(inset, inset)
|
CSS_KEY(inset, inset)
|
||||||
CSS_KEY(inside, inside)
|
CSS_KEY(inside, inside)
|
||||||
// CSS_KEY(inter-character, inter_character) // TODO see bug 1055672
|
CSS_KEY(inter-character, inter_character)
|
||||||
|
CSS_KEY(inter-word, inter_word)
|
||||||
CSS_KEY(interpolatematrix, interpolatematrix)
|
CSS_KEY(interpolatematrix, interpolatematrix)
|
||||||
CSS_KEY(intersect, intersect)
|
CSS_KEY(intersect, intersect)
|
||||||
CSS_KEY(isolate, isolate)
|
CSS_KEY(isolate, isolate)
|
||||||
|
|
|
||||||
|
|
@ -4027,6 +4027,17 @@ CSS_PROP_TEXT(
|
||||||
nullptr,
|
nullptr,
|
||||||
offsetof(nsStyleText, mTextIndent),
|
offsetof(nsStyleText, mTextIndent),
|
||||||
eStyleAnimType_Coord)
|
eStyleAnimType_Coord)
|
||||||
|
CSS_PROP_TEXT(
|
||||||
|
text-justify,
|
||||||
|
text_justify,
|
||||||
|
TextJustify,
|
||||||
|
CSS_PROPERTY_PARSE_VALUE |
|
||||||
|
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
|
||||||
|
"layout.css.text-justify.enabled",
|
||||||
|
VARIANT_HK,
|
||||||
|
kTextJustifyKTable,
|
||||||
|
CSS_PROP_NO_OFFSET,
|
||||||
|
eStyleAnimType_Discrete)
|
||||||
CSS_PROP_VISIBILITY(
|
CSS_PROP_VISIBILITY(
|
||||||
text-orientation,
|
text-orientation,
|
||||||
text_orientation,
|
text_orientation,
|
||||||
|
|
|
||||||
|
|
@ -2035,6 +2035,17 @@ KTableEntry nsCSSProps::kTextAlignLastKTable[] = {
|
||||||
{ eCSSKeyword_UNKNOWN, -1 }
|
{ eCSSKeyword_UNKNOWN, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const KTableEntry nsCSSProps::kTextJustifyKTable[] = {
|
||||||
|
{ eCSSKeyword_none, StyleTextJustify::None },
|
||||||
|
{ eCSSKeyword_auto, StyleTextJustify::Auto },
|
||||||
|
{ eCSSKeyword_inter_word, StyleTextJustify::InterWord },
|
||||||
|
{ eCSSKeyword_inter_character, StyleTextJustify::InterCharacter },
|
||||||
|
// For legacy reasons, UAs must also support the keyword "distribute" with
|
||||||
|
// the exact same meaning and behavior as "inter-character".
|
||||||
|
{ eCSSKeyword_distribute, StyleTextJustify::InterCharacter },
|
||||||
|
{ eCSSKeyword_UNKNOWN, -1 }
|
||||||
|
};
|
||||||
|
|
||||||
const KTableEntry nsCSSProps::kTextCombineUprightKTable[] = {
|
const KTableEntry nsCSSProps::kTextCombineUprightKTable[] = {
|
||||||
{ eCSSKeyword_none, NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE },
|
{ eCSSKeyword_none, NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE },
|
||||||
{ eCSSKeyword_all, NS_STYLE_TEXT_COMBINE_UPRIGHT_ALL },
|
{ eCSSKeyword_all, NS_STYLE_TEXT_COMBINE_UPRIGHT_ALL },
|
||||||
|
|
|
||||||
|
|
@ -869,6 +869,7 @@ public:
|
||||||
static const KTableEntry kTextEmphasisPositionKTable[];
|
static const KTableEntry kTextEmphasisPositionKTable[];
|
||||||
static const KTableEntry kTextEmphasisStyleFillKTable[];
|
static const KTableEntry kTextEmphasisStyleFillKTable[];
|
||||||
static const KTableEntry kTextEmphasisStyleShapeKTable[];
|
static const KTableEntry kTextEmphasisStyleShapeKTable[];
|
||||||
|
static const KTableEntry kTextJustifyKTable[];
|
||||||
static const KTableEntry kTextOrientationKTable[];
|
static const KTableEntry kTextOrientationKTable[];
|
||||||
static const KTableEntry kTextOverflowKTable[];
|
static const KTableEntry kTextOverflowKTable[];
|
||||||
static const KTableEntry kTextTransformKTable[];
|
static const KTableEntry kTextTransformKTable[];
|
||||||
|
|
|
||||||
|
|
@ -3874,6 +3874,16 @@ nsComputedDOMStyle::DoGetTextIndent()
|
||||||
return val.forget();
|
return val.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<CSSValue>
|
||||||
|
nsComputedDOMStyle::DoGetTextJustify()
|
||||||
|
{
|
||||||
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
|
val->SetIdent(
|
||||||
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mTextJustify,
|
||||||
|
nsCSSProps::kTextJustifyKTable));
|
||||||
|
return val.forget();
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<CSSValue>
|
already_AddRefed<CSSValue>
|
||||||
nsComputedDOMStyle::DoGetTextOrientation()
|
nsComputedDOMStyle::DoGetTextOrientation()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -421,6 +421,7 @@ private:
|
||||||
already_AddRefed<CSSValue> DoGetTextEmphasisPosition();
|
already_AddRefed<CSSValue> DoGetTextEmphasisPosition();
|
||||||
already_AddRefed<CSSValue> DoGetTextEmphasisStyle();
|
already_AddRefed<CSSValue> DoGetTextEmphasisStyle();
|
||||||
already_AddRefed<CSSValue> DoGetTextIndent();
|
already_AddRefed<CSSValue> DoGetTextIndent();
|
||||||
|
already_AddRefed<CSSValue> DoGetTextJustify();
|
||||||
already_AddRefed<CSSValue> DoGetTextOrientation();
|
already_AddRefed<CSSValue> DoGetTextOrientation();
|
||||||
already_AddRefed<CSSValue> DoGetTextOverflow();
|
already_AddRefed<CSSValue> DoGetTextOverflow();
|
||||||
already_AddRefed<CSSValue> DoGetTextTransform();
|
already_AddRefed<CSSValue> DoGetTextTransform();
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,7 @@ COMPUTED_STYLE_PROP(text_emphasis_color, TextEmphasisColor)
|
||||||
COMPUTED_STYLE_PROP(text_emphasis_position, TextEmphasisPosition)
|
COMPUTED_STYLE_PROP(text_emphasis_position, TextEmphasisPosition)
|
||||||
COMPUTED_STYLE_PROP(text_emphasis_style, TextEmphasisStyle)
|
COMPUTED_STYLE_PROP(text_emphasis_style, TextEmphasisStyle)
|
||||||
COMPUTED_STYLE_PROP(text_indent, TextIndent)
|
COMPUTED_STYLE_PROP(text_indent, TextIndent)
|
||||||
|
COMPUTED_STYLE_PROP(text_justify, TextJustify)
|
||||||
COMPUTED_STYLE_PROP(text_orientation, TextOrientation)
|
COMPUTED_STYLE_PROP(text_orientation, TextOrientation)
|
||||||
COMPUTED_STYLE_PROP(text_overflow, TextOverflow)
|
COMPUTED_STYLE_PROP(text_overflow, TextOverflow)
|
||||||
COMPUTED_STYLE_PROP(text_shadow, TextShadow)
|
COMPUTED_STYLE_PROP(text_shadow, TextShadow)
|
||||||
|
|
|
||||||
|
|
@ -1414,6 +1414,7 @@ struct SetEnumValueHelper
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd)
|
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
|
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
|
||||||
|
DEFINE_ENUM_CLASS_SETTER(StyleTextJustify, None, InterCharacter)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu)
|
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText)
|
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText)
|
||||||
DEFINE_ENUM_CLASS_SETTER(StyleUserInput, None, Auto)
|
DEFINE_ENUM_CLASS_SETTER(StyleUserInput, None, Auto)
|
||||||
|
|
@ -4783,6 +4784,12 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||||
SETCOORD_UNSET_INHERIT,
|
SETCOORD_UNSET_INHERIT,
|
||||||
aContext, mPresContext, conditions);
|
aContext, mPresContext, conditions);
|
||||||
|
|
||||||
|
// text-justify: enum, inherit, initial
|
||||||
|
SetValue(*aRuleData->ValueForTextJustify(), text->mTextJustify, conditions,
|
||||||
|
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
|
||||||
|
parentText->mTextJustify,
|
||||||
|
StyleTextJustify::Auto);
|
||||||
|
|
||||||
// text-transform: enum, inherit, initial
|
// text-transform: enum, inherit, initial
|
||||||
SetValue(*aRuleData->ValueForTextTransform(), text->mTextTransform, conditions,
|
SetValue(*aRuleData->ValueForTextTransform(), text->mTextTransform, conditions,
|
||||||
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
|
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,14 @@ enum class StyleShapeSourceType : uint8_t {
|
||||||
Box,
|
Box,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// text-justify
|
||||||
|
enum class StyleTextJustify : uint8_t {
|
||||||
|
None,
|
||||||
|
Auto,
|
||||||
|
InterWord,
|
||||||
|
InterCharacter,
|
||||||
|
};
|
||||||
|
|
||||||
// user-focus
|
// user-focus
|
||||||
enum class StyleUserFocus : uint8_t {
|
enum class StyleUserFocus : uint8_t {
|
||||||
None,
|
None,
|
||||||
|
|
|
||||||
|
|
@ -3788,6 +3788,7 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
|
||||||
, mTextAlignLast(NS_STYLE_TEXT_ALIGN_AUTO)
|
, mTextAlignLast(NS_STYLE_TEXT_ALIGN_AUTO)
|
||||||
, mTextAlignTrue(false)
|
, mTextAlignTrue(false)
|
||||||
, mTextAlignLastTrue(false)
|
, mTextAlignLastTrue(false)
|
||||||
|
, mTextJustify(StyleTextJustify::Auto)
|
||||||
, mTextTransform(NS_STYLE_TEXT_TRANSFORM_NONE)
|
, mTextTransform(NS_STYLE_TEXT_TRANSFORM_NONE)
|
||||||
, mWhiteSpace(NS_STYLE_WHITESPACE_NORMAL)
|
, mWhiteSpace(NS_STYLE_WHITESPACE_NORMAL)
|
||||||
, mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
|
, mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
|
||||||
|
|
@ -3824,6 +3825,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
|
||||||
, mTextAlignLast(aSource.mTextAlignLast)
|
, mTextAlignLast(aSource.mTextAlignLast)
|
||||||
, mTextAlignTrue(false)
|
, mTextAlignTrue(false)
|
||||||
, mTextAlignLastTrue(false)
|
, mTextAlignLastTrue(false)
|
||||||
|
, mTextJustify(aSource.mTextJustify)
|
||||||
, mTextTransform(aSource.mTextTransform)
|
, mTextTransform(aSource.mTextTransform)
|
||||||
, mWhiteSpace(aSource.mWhiteSpace)
|
, mWhiteSpace(aSource.mWhiteSpace)
|
||||||
, mWordBreak(aSource.mWordBreak)
|
, mWordBreak(aSource.mWordBreak)
|
||||||
|
|
@ -3885,6 +3887,7 @@ nsStyleText::CalcDifference(const nsStyleText& aNewData) const
|
||||||
(mTextSizeAdjust != aNewData.mTextSizeAdjust) ||
|
(mTextSizeAdjust != aNewData.mTextSizeAdjust) ||
|
||||||
(mLetterSpacing != aNewData.mLetterSpacing) ||
|
(mLetterSpacing != aNewData.mLetterSpacing) ||
|
||||||
(mLineHeight != aNewData.mLineHeight) ||
|
(mLineHeight != aNewData.mLineHeight) ||
|
||||||
|
(mTextJustify != aNewData.mTextJustify) ||
|
||||||
(mTextIndent != aNewData.mTextIndent) ||
|
(mTextIndent != aNewData.mTextIndent) ||
|
||||||
(mWordSpacing != aNewData.mWordSpacing) ||
|
(mWordSpacing != aNewData.mWordSpacing) ||
|
||||||
(mTabSize != aNewData.mTabSize)) {
|
(mTabSize != aNewData.mTabSize)) {
|
||||||
|
|
|
||||||
|
|
@ -2071,6 +2071,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
|
||||||
uint8_t mTextAlignLast; // [inherited] see nsStyleConsts.h
|
uint8_t mTextAlignLast; // [inherited] see nsStyleConsts.h
|
||||||
bool mTextAlignTrue : 1; // [inherited] see nsStyleConsts.h
|
bool mTextAlignTrue : 1; // [inherited] see nsStyleConsts.h
|
||||||
bool mTextAlignLastTrue : 1; // [inherited] see nsStyleConsts.h
|
bool mTextAlignLastTrue : 1; // [inherited] see nsStyleConsts.h
|
||||||
|
mozilla::StyleTextJustify mTextJustify; // [inherited]
|
||||||
uint8_t mTextTransform; // [inherited] see nsStyleConsts.h
|
uint8_t mTextTransform; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mWhiteSpace; // [inherited] see nsStyleConsts.h
|
uint8_t mWhiteSpace; // [inherited] see nsStyleConsts.h
|
||||||
uint8_t mWordBreak; // [inherited] see nsStyleConsts.h
|
uint8_t mWordBreak; // [inherited] see nsStyleConsts.h
|
||||||
|
|
|
||||||
|
|
@ -5694,6 +5694,17 @@ if (IsCSSPropertyPrefEnabled("layout.css.text-combine-upright.enabled")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsCSSPropertyPrefEnabled("layout.css.text-justify.enabled")) {
|
||||||
|
gCSSProperties["text-justify"] = {
|
||||||
|
domProp: "textJustify",
|
||||||
|
inherited: true,
|
||||||
|
type: CSS_TYPE_LONGHAND,
|
||||||
|
initial_values: [ "auto" ],
|
||||||
|
other_values: [ "none", "inter-word", "inter-character", "distribute" ],
|
||||||
|
invalid_values: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCSSPropertyPrefEnabled("svg.paint-order.enabled")) {
|
if (IsCSSPropertyPrefEnabled("svg.paint-order.enabled")) {
|
||||||
gCSSProperties["paint-order"] = {
|
gCSSProperties["paint-order"] = {
|
||||||
domProp: "paintOrder",
|
domProp: "paintOrder",
|
||||||
|
|
|
||||||
|
|
@ -2516,6 +2516,9 @@ pref("layout.css.convertFromNode.enabled", true);
|
||||||
// Is support for CSS "text-align: unsafe X" enabled?
|
// Is support for CSS "text-align: unsafe X" enabled?
|
||||||
pref("layout.css.text-align-unsafe-value.enabled", false);
|
pref("layout.css.text-align-unsafe-value.enabled", false);
|
||||||
|
|
||||||
|
// Is support for CSS text-justify property enabled?
|
||||||
|
pref("layout.css.text-justify.enabled", true);
|
||||||
|
|
||||||
// Is support for CSS "float: inline-{start,end}" and
|
// Is support for CSS "float: inline-{start,end}" and
|
||||||
// "clear: inline-{start,end}" enabled?
|
// "clear: inline-{start,end}" enabled?
|
||||||
#if defined(MOZ_B2G) || !defined(RELEASE_OR_BETA)
|
#if defined(MOZ_B2G) || !defined(RELEASE_OR_BETA)
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,9 @@ user_pref("layout.css.prefixes.device-pixel-ratio-webkit", true);
|
||||||
// Enable CSS shape-outside for testing
|
// Enable CSS shape-outside for testing
|
||||||
user_pref("layout.css.shape-outside.enabled", true);
|
user_pref("layout.css.shape-outside.enabled", true);
|
||||||
|
|
||||||
|
// Enable CSS text-justify for testing
|
||||||
|
user_pref("layout.css.text-justify.enabled", true);
|
||||||
|
|
||||||
// Disable spammy layout warnings because they pollute test logs
|
// Disable spammy layout warnings because they pollute test logs
|
||||||
user_pref("layout.spammy_warnings.enabled", false);
|
user_pref("layout.spammy_warnings.enabled", false);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue