Bug 1038663 (part 5) - Change GetSpacingFlags(). r=heycam.

Again, this doesn't make sense in isolation, but it will make it easier to
allow for percentage word-spacing in a subsequent patch.

--HG--
extra : rebase_source : 5a120273b4191ae3ac9ae0532e56eb870558d4d6
This commit is contained in:
Nicholas Nethercote 2015-11-05 16:33:37 -08:00
Родитель 12d49e11b3
Коммит 90b8e844aa
1 изменённых файлов: 21 добавлений и 8 удалений

Просмотреть файл

@ -1645,6 +1645,26 @@ WordSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
return 0;
}
// Returns gfxTextRunFactory::TEXT_ENABLE_SPACING if non-standard
// letter-spacing or word-spacing is present.
static uint32_t
GetSpacingFlags(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
{
if (aFrame->IsSVGText()) {
return 0;
}
const nsStyleText* styleText = aFrame->StyleText();
const nsStyleCoord& ls = styleText->mLetterSpacing;
const nsStyleCoord& ws = styleText->mWordSpacing;
bool nonStandardSpacing =
(eStyleUnit_Coord == ls.GetUnit() && ls.GetCoordValue() != 0) ||
(eStyleUnit_Coord == ws.GetUnit() && ws.GetCoordValue() != 0);
return nonStandardSpacing ? gfxTextRunFactory::TEXT_ENABLE_SPACING : 0;
}
bool
BuildTextRunsScanner::ContinueTextRunAcrossFrames(nsTextFrame* aFrame1, nsTextFrame* aFrame2)
{
@ -1796,12 +1816,6 @@ BuildTextRunsScanner::GetNextBreakBeforeFrame(uint32_t* aIndex)
return static_cast<nsTextFrame*>(mLineBreakBeforeFrames.ElementAt(index));
}
static uint32_t
GetSpacingFlags(nscoord spacing)
{
return spacing ? gfxTextRunFactory::TEXT_ENABLE_SPACING : 0;
}
static gfxFontGroup*
GetFontGroupForFrame(nsIFrame* aFrame, float aFontSizeInflation,
nsFontMetrics** aOutFontMetrics = nullptr)
@ -1957,8 +1971,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
if (NS_STYLE_TEXT_TRANSFORM_NONE != textStyle->mTextTransform) {
anyTextTransformStyle = true;
}
textFlags |= GetSpacingFlags(LetterSpacing(f));
textFlags |= GetSpacingFlags(WordSpacing(f));
textFlags |= GetSpacingFlags(f);
nsTextFrameUtils::CompressionMode compression =
GetCSSWhitespaceToCompressionMode(f, textStyle);
if ((enabledJustification || f->ShouldSuppressLineBreak()) &&