зеркало из https://github.com/mozilla/gecko-dev.git
Bug 276079 - add layout support for CSS text-justify property. r=xidorn
MozReview-Commit-ID: Kiwu8UNfbSj --HG-- extra : rebase_source : 7673c42f8d401832437b0bb891f87aa22acabe15
This commit is contained in:
Родитель
33b63777fa
Коммит
ec96d9f267
|
@ -6974,7 +6974,8 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
|||
nscoord aLetterSpacing)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
if (aLetterSpacing != 0) {
|
||||
if (aLetterSpacing != 0 ||
|
||||
aStyleText->mTextJustify == StyleTextJustify::InterCharacter) {
|
||||
result |= gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES;
|
||||
}
|
||||
if (aStyleText->mControlCharacterVisibility == NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN) {
|
||||
|
|
|
@ -2964,10 +2964,17 @@ nsTextFrame::GetTrimmedOffsets(const nsTextFragment* aFrag,
|
|||
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)
|
||||
{
|
||||
NS_ASSERTION(aPos >= 0, "negative position?!");
|
||||
|
||||
StyleTextJustify justifyStyle = aTextStyle->mTextJustify;
|
||||
if (justifyStyle == StyleTextJustify::None) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char16_t ch = aFrag->CharAt(aPos);
|
||||
if (ch == '\n' || ch == '\t' || ch == '\r') {
|
||||
return true;
|
||||
|
@ -2980,6 +2987,14 @@ static bool IsJustifiableCharacter(const nsTextFragment* aFrag, int32_t aPos,
|
|||
return !nsTextFrameUtils::IsSpaceCombiningSequenceTail(
|
||||
aFrag->Get2b() + aPos + 1, aFrag->GetLength() - (aPos + 1));
|
||||
}
|
||||
|
||||
if (justifyStyle == StyleTextJustify::InterCharacter) {
|
||||
return true;
|
||||
} else if (justifyStyle == StyleTextJustify::InterWord) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// text-justify: auto
|
||||
if (ch < 0x2150u) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3310,7 +3325,7 @@ PropertyProvider::ComputeJustification(
|
|||
gfxSkipCharsIterator iter = run.GetPos();
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
uint32_t offset = originalOffset + i;
|
||||
if (!IsJustifiableCharacter(mFrag, offset, isCJ)) {
|
||||
if (!IsJustifiableCharacter(mTextStyle, mFrag, offset, isCJ)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче