зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1117227 part 5 - Render ellipsis in correct orientation. r=jfkthame
--HG-- extra : source : 4766d98091b93c120d41a5118406d82a38d9ff62
This commit is contained in:
Родитель
3d4aa499c8
Коммит
ff400fb4a5
|
@ -2573,10 +2573,13 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext,
|
|||
}
|
||||
|
||||
gfxTextRun *
|
||||
gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
|
||||
gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
|
||||
LazyReferenceContextGetter& aRefContextGetter)
|
||||
{
|
||||
MOZ_ASSERT(!(aFlags & ~TEXT_ORIENT_MASK),
|
||||
"flags here should only be used to specify orientation");
|
||||
if (mCachedEllipsisTextRun &&
|
||||
(mCachedEllipsisTextRun->GetFlags() & TEXT_ORIENT_MASK) == aFlags &&
|
||||
mCachedEllipsisTextRun->GetAppUnitsPerDevUnit() == aAppUnitsPerDevPixel) {
|
||||
return mCachedEllipsisTextRun;
|
||||
}
|
||||
|
@ -2596,7 +2599,7 @@ gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
|
|||
};
|
||||
gfxTextRun* textRun =
|
||||
MakeTextRun(ellipsis.get(), ellipsis.Length(), ¶ms,
|
||||
TEXT_IS_PERSISTENT, nullptr);
|
||||
aFlags | TEXT_IS_PERSISTENT, nullptr);
|
||||
if (!textRun) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -878,10 +878,10 @@ public:
|
|||
};
|
||||
// The gfxFontGroup keeps ownership of this textrun.
|
||||
// It is only guaranteed to exist until the next call to GetEllipsisTextRun
|
||||
// (which might use a different appUnitsPerDev value) for the font group,
|
||||
// or until UpdateUserFonts is called, or the fontgroup is destroyed.
|
||||
// (which might use a different appUnitsPerDev value or flags) for the font
|
||||
// group, or until UpdateUserFonts is called, or the fontgroup is destroyed.
|
||||
// Get it/use it/forget it :) - don't keep a reference that might go stale.
|
||||
gfxTextRun* GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
|
||||
gfxTextRun* GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
|
||||
LazyReferenceContextGetter& aRefContextGetter);
|
||||
|
||||
// helper method for resolving generic font families
|
||||
|
@ -1042,7 +1042,7 @@ protected:
|
|||
gfxTextPerfMetrics *mTextPerf;
|
||||
|
||||
// Cache a textrun representing an ellipsis (useful for CSS text-overflow)
|
||||
// at a specific appUnitsPerDevPixel size
|
||||
// at a specific appUnitsPerDevPixel size and orientation
|
||||
nsAutoPtr<gfxTextRun> mCachedEllipsisTextRun;
|
||||
|
||||
// cache the most recent pref font to avoid general pref font lookup
|
||||
|
|
|
@ -6472,42 +6472,42 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
return result | GetTextRunOrientFlagsForStyle(aStyleContext);
|
||||
}
|
||||
|
||||
/* static */ uint32_t
|
||||
nsLayoutUtils::GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext)
|
||||
{
|
||||
WritingMode wm(aStyleContext);
|
||||
if (wm.IsVertical()) {
|
||||
switch (aStyleContext->StyleVisibility()->mTextOrientation) {
|
||||
case NS_STYLE_TEXT_ORIENTATION_MIXED:
|
||||
result |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED;
|
||||
break;
|
||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED;
|
||||
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
||||
result |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
break;
|
||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
|
||||
// This should depend on writing mode vertical-lr vs vertical-rl,
|
||||
// but until we support SIDEWAYS_LEFT, we'll treat this the same
|
||||
// as SIDEWAYS_RIGHT and simply fall through.
|
||||
/*
|
||||
if (wm.IsVerticalLR()) {
|
||||
result |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
|
||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
|
||||
} else {
|
||||
result |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT:
|
||||
result |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||
break;
|
||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_LEFT:
|
||||
// Not yet supported, so fall through to the default (error) case.
|
||||
/*
|
||||
result |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
|
||||
break;
|
||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
|
||||
*/
|
||||
default:
|
||||
NS_NOTREACHED("unknown text-orientation");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
|
|
@ -1923,6 +1923,11 @@ public:
|
|||
const nsStyleText* aStyleText,
|
||||
nscoord aLetterSpacing);
|
||||
|
||||
/**
|
||||
* Get orientation flags for textrun construction.
|
||||
*/
|
||||
static uint32_t GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext);
|
||||
|
||||
/**
|
||||
* Takes two rectangles whose origins must be the same, and computes
|
||||
* the difference between their union and their intersection as two
|
||||
|
|
|
@ -49,7 +49,9 @@ GetEllipsisTextRun(nsIFrame* aFrame)
|
|||
nsLayoutUtils::FontSizeInflationFor(aFrame));
|
||||
LazyReferenceRenderingContextGetterFromFrame lazyRefContextGetter(aFrame);
|
||||
return fm->GetThebesFontGroup()->GetEllipsisTextRun(
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel(), lazyRefContextGetter);
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
nsLayoutUtils::GetTextRunOrientFlagsForStyle(aFrame->StyleContext()),
|
||||
lazyRefContextGetter);
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
|
|
Загрузка…
Ссылка в новой задаче