mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1257121 part 4 - Use return value rather than out param to return font metrics. r=jfkthame
MozReview-Commit-ID: 6xrHYbgHGVd --HG-- extra : rebase_source : 4d0cea24689588d8a1daa1869502e31ac7c3dc56
This commit is contained in:
parent
8acf32453c
commit
60bcaa5c0b
@ -460,8 +460,8 @@ bool
|
||||
TextAttrsMgr::FontFamilyTextAttr::
|
||||
GetFontFamily(nsIFrame* aFrame, nsString& aFamily)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), 1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, 1.0f);
|
||||
|
||||
gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
|
||||
gfxFont* font = fontGroup->GetFirstValidFont();
|
||||
@ -618,8 +618,8 @@ TextAttrsMgr::FontWeightTextAttr::
|
||||
{
|
||||
// nsFont::width isn't suitable here because it's necessary to expose real
|
||||
// value of font weight (used font might not have some font weight values).
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), 1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, 1.0f);
|
||||
|
||||
gfxFontGroup *fontGroup = fm->GetThebesFontGroup();
|
||||
gfxFont *font = fontGroup->GetFirstValidFont();
|
||||
|
@ -179,8 +179,8 @@ sdnTextAccessible::get_fontFamily(BSTR __RPC_FAR* aFontFamily)
|
||||
if (!frame)
|
||||
return E_FAIL;
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fm), 1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(frame, 1.0f);
|
||||
|
||||
const nsString& name =
|
||||
fm->GetThebesFontGroup()->GetFirstValidFont()->GetName();
|
||||
|
@ -2468,13 +2468,12 @@ public:
|
||||
|
||||
virtual float GetExLength() const override
|
||||
{
|
||||
RefPtr<nsFontMetrics> fontMetrics;
|
||||
nsDeviceContext* dc = mPresContext->DeviceContext();
|
||||
nsFontMetrics::Params params;
|
||||
params.language = mFontLanguage;
|
||||
params.explicitLanguage = mExplicitLanguage;
|
||||
params.textPerf = mPresContext->GetTextPerfMetrics();
|
||||
dc->GetMetricsFor(mFont, params, *getter_AddRefs(fontMetrics));
|
||||
RefPtr<nsFontMetrics> fontMetrics = dc->GetMetricsFor(mFont, params);
|
||||
return NSAppUnitsToFloatPixels(fontMetrics->XHeight(),
|
||||
nsPresContext::AppUnitsPerCSSPixel());
|
||||
}
|
||||
@ -3236,9 +3235,8 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
||||
params.explicitLanguage = fontStyle->mExplicitLanguage;
|
||||
params.userFontSet = c->GetUserFontSet();
|
||||
params.textPerf = c->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> metrics;
|
||||
c->DeviceContext()->GetMetricsFor(resizedFont, params,
|
||||
*getter_AddRefs(metrics));
|
||||
RefPtr<nsFontMetrics> metrics =
|
||||
c->DeviceContext()->GetMetricsFor(resizedFont, params);
|
||||
|
||||
gfxFontGroup* newFontGroup = metrics->GetThebesFontGroup();
|
||||
CurrentState().fontGroup = newFontGroup;
|
||||
|
@ -1453,22 +1453,14 @@ ContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
|
||||
rect.x = posInFrame.x;
|
||||
rect.y = posInFrame.y;
|
||||
|
||||
nscoord fontHeight = 0;
|
||||
RefPtr<nsFontMetrics> fontMetrics;
|
||||
rv = nsLayoutUtils::
|
||||
GetInflatedFontMetricsForFrame(frame, getter_AddRefs(fontMetrics));
|
||||
if (NS_WARN_IF(!fontMetrics)) {
|
||||
// If we cannot get font height, use frame size instead.
|
||||
fontHeight = isVertical ? frame->GetSize().width : frame->GetSize().height;
|
||||
} else {
|
||||
fontHeight = fontMetrics->MaxAscent() + fontMetrics->MaxDescent();
|
||||
}
|
||||
RefPtr<nsFontMetrics> fontMetrics =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(frame);
|
||||
if (isVertical) {
|
||||
rect.width = fontHeight;
|
||||
rect.width = fontMetrics->MaxHeight();
|
||||
rect.height = caretRect.height;
|
||||
} else {
|
||||
rect.width = caretRect.width;
|
||||
rect.height = fontHeight;
|
||||
rect.height = fontMetrics->MaxHeight();
|
||||
}
|
||||
|
||||
rv = ConvertToRootRelativeOffset(frame, rect);
|
||||
|
@ -2513,8 +2513,8 @@ EventStateManager::GetScrollAmount(nsPresContext* aPresContext,
|
||||
if (!rootFrame) {
|
||||
return nsSize(0, 0);
|
||||
}
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(rootFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(rootFrame);
|
||||
NS_ENSURE_TRUE(fm, nsSize(0, 0));
|
||||
return nsSize(fm->AveCharWidth(), fm->MaxHeight());
|
||||
}
|
||||
|
@ -340,9 +340,8 @@ SVGContentUtils::GetFontXHeight(nsStyleContext *aStyleContext)
|
||||
nsPresContext *presContext = aStyleContext->PresContext();
|
||||
MOZ_ASSERT(presContext, "NULL pres context in GetFontXHeight");
|
||||
|
||||
RefPtr<nsFontMetrics> fontMetrics;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
|
||||
getter_AddRefs(fontMetrics));
|
||||
RefPtr<nsFontMetrics> fontMetrics =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext);
|
||||
|
||||
if (!fontMetrics) {
|
||||
// ReportToConsole
|
||||
|
@ -64,9 +64,8 @@ public:
|
||||
void Init(nsDeviceContext* aContext);
|
||||
void Destroy();
|
||||
|
||||
nsresult GetMetricsFor(const nsFont& aFont,
|
||||
const nsFontMetrics::Params& aParams,
|
||||
nsFontMetrics*& aMetrics);
|
||||
already_AddRefed<nsFontMetrics> GetMetricsFor(
|
||||
const nsFont& aFont, const nsFontMetrics::Params& aParams);
|
||||
|
||||
void FontMetricsDeleted(const nsFontMetrics* aFontMetrics);
|
||||
void Compact();
|
||||
@ -122,10 +121,9 @@ nsFontCache::Observe(nsISupports*, const char* aTopic, const char16_t*)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
already_AddRefed<nsFontMetrics>
|
||||
nsFontCache::GetMetricsFor(const nsFont& aFont,
|
||||
const nsFontMetrics::Params& aParams,
|
||||
nsFontMetrics*& aMetrics)
|
||||
const nsFontMetrics::Params& aParams)
|
||||
{
|
||||
nsIAtom* language = aParams.language ? aParams.language
|
||||
: mLocaleLanguage.get();
|
||||
@ -133,10 +131,9 @@ nsFontCache::GetMetricsFor(const nsFont& aFont,
|
||||
// First check our cache
|
||||
// start from the end, which is where we put the most-recent-used element
|
||||
|
||||
nsFontMetrics* fm;
|
||||
int32_t n = mFontMetrics.Length() - 1;
|
||||
for (int32_t i = n; i >= 0; --i) {
|
||||
fm = mFontMetrics[i];
|
||||
nsFontMetrics* fm = mFontMetrics[i];
|
||||
if (fm->Font().Equals(aFont) &&
|
||||
fm->GetUserFontSet() == aParams.userFontSet &&
|
||||
fm->Language() == language &&
|
||||
@ -147,8 +144,7 @@ nsFontCache::GetMetricsFor(const nsFont& aFont,
|
||||
mFontMetrics.AppendElement(fm);
|
||||
}
|
||||
fm->GetThebesFontGroup()->UpdateUserFonts();
|
||||
NS_ADDREF(aMetrics = fm);
|
||||
return NS_OK;
|
||||
return do_AddRef(Move(fm));
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,14 +152,11 @@ nsFontCache::GetMetricsFor(const nsFont& aFont,
|
||||
|
||||
nsFontMetrics::Params params = aParams;
|
||||
params.language = language;
|
||||
fm = new nsFontMetrics(aFont, params, mContext);
|
||||
NS_ADDREF(fm);
|
||||
RefPtr<nsFontMetrics> fm = new nsFontMetrics(aFont, params, mContext);
|
||||
// the mFontMetrics list has the "head" at the end, because append
|
||||
// is cheaper than insert
|
||||
mFontMetrics.AppendElement(fm);
|
||||
aMetrics = fm;
|
||||
NS_ADDREF(aMetrics);
|
||||
return NS_OK;
|
||||
mFontMetrics.AppendElement(do_AddRef(fm.get()).take());
|
||||
return fm.forget();
|
||||
}
|
||||
|
||||
void
|
||||
@ -227,10 +220,9 @@ nsDeviceContext::~nsDeviceContext()
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
already_AddRefed<nsFontMetrics>
|
||||
nsDeviceContext::GetMetricsFor(const nsFont& aFont,
|
||||
const nsFontMetrics::Params& aParams,
|
||||
nsFontMetrics*& aMetrics)
|
||||
const nsFontMetrics::Params& aParams)
|
||||
{
|
||||
if (!mFontCache) {
|
||||
mFontCache = new nsFontCache();
|
||||
@ -238,7 +230,7 @@ nsDeviceContext::GetMetricsFor(const nsFont& aFont,
|
||||
mFontCache->Init(this);
|
||||
}
|
||||
|
||||
return mFontCache->GetMetricsFor(aFont, aParams, aMetrics);
|
||||
return mFontCache->GetMetricsFor(aFont, aParams);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -113,12 +113,9 @@ public:
|
||||
* Get the nsFontMetrics that describe the properties of
|
||||
* an nsFont.
|
||||
* @param aFont font description to obtain metrics for
|
||||
* @param aMetrics out parameter for font metrics
|
||||
* @return error status
|
||||
*/
|
||||
nsresult GetMetricsFor(const nsFont& aFont,
|
||||
const nsFontMetrics::Params& aParams,
|
||||
nsFontMetrics*& aMetrics);
|
||||
already_AddRefed<nsFontMetrics> GetMetricsFor(
|
||||
const nsFont& aFont, const nsFontMetrics::Params& aParams);
|
||||
|
||||
/**
|
||||
* Notification when a font metrics instance created for this device is
|
||||
|
@ -525,8 +525,8 @@ IsElementClickableAndReadable(nsIFrame* aFrame, WidgetGUIEvent* aEvent, const Ev
|
||||
}
|
||||
|
||||
if (testFontSize) {
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame);
|
||||
if (fm && fm->EmHeight() > 0 && // See bug 1171731
|
||||
(pc->AppUnitsToGfxUnits(fm->EmHeight()) * cumulativeResolution) < limitReadableSize) {
|
||||
return false;
|
||||
|
@ -321,8 +321,8 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
|
||||
"We should not be in the middle of reflow");
|
||||
nscoord baseline = frame->GetCaretBaseline();
|
||||
nscoord ascent = 0, descent = 0;
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame);
|
||||
NS_ASSERTION(fm, "We should be able to get the font metrics");
|
||||
if (fm) {
|
||||
ascent = fm->MaxAscent();
|
||||
|
@ -4024,19 +4024,14 @@ nsLayoutUtils::ComputeObjectDestRect(const nsRect& aConstraintRect,
|
||||
return nsRect(imageTopLeftPt, concreteObjectSize);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame,
|
||||
nsFontMetrics** aFontMetrics,
|
||||
float aInflation)
|
||||
already_AddRefed<nsFontMetrics>
|
||||
nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame, float aInflation)
|
||||
{
|
||||
return nsLayoutUtils::GetFontMetricsForStyleContext(aFrame->StyleContext(),
|
||||
aFontMetrics,
|
||||
aInflation);
|
||||
return GetFontMetricsForStyleContext(aFrame->StyleContext(), aInflation);
|
||||
}
|
||||
|
||||
nsresult
|
||||
already_AddRefed<nsFontMetrics>
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
|
||||
nsFontMetrics** aFontMetrics,
|
||||
float aInflation)
|
||||
{
|
||||
nsPresContext* pc = aStyleContext->PresContext();
|
||||
@ -4059,13 +4054,12 @@ nsLayoutUtils::GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
|
||||
// which would be lossy. Fortunately, in such cases, aInflation is
|
||||
// guaranteed to be 1.0f.
|
||||
if (aInflation == 1.0f) {
|
||||
return pc->DeviceContext()->GetMetricsFor(styleFont->mFont, params,
|
||||
*aFontMetrics);
|
||||
return pc->DeviceContext()->GetMetricsFor(styleFont->mFont, params);
|
||||
}
|
||||
|
||||
nsFont font = styleFont->mFont;
|
||||
font.size = NSToCoordRound(font.size * aInflation);
|
||||
return pc->DeviceContext()->GetMetricsFor(font, params, *aFontMetrics);
|
||||
return pc->DeviceContext()->GetMetricsFor(font, params);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
@ -8492,8 +8486,8 @@ nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame,
|
||||
WritingMode aLineWM,
|
||||
WritingMode aFrameWM)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame);
|
||||
|
||||
if (fm) {
|
||||
// Compute final height of the frame.
|
||||
|
@ -1222,47 +1222,36 @@ public:
|
||||
/**
|
||||
* Get the font metrics corresponding to the frame's style data.
|
||||
* @param aFrame the frame
|
||||
* @param aFontMetrics the font metrics result
|
||||
* @param aSizeInflation number to multiply font size by
|
||||
* @return success or failure code
|
||||
*/
|
||||
static nsresult GetFontMetricsForFrame(const nsIFrame* aFrame,
|
||||
nsFontMetrics** aFontMetrics,
|
||||
float aSizeInflation);
|
||||
static already_AddRefed<nsFontMetrics> GetFontMetricsForFrame(
|
||||
const nsIFrame* aFrame, float aSizeInflation);
|
||||
|
||||
static nsresult GetInflatedFontMetricsForFrame(const nsIFrame* aFrame,
|
||||
nsFontMetrics** aFontMetrics)
|
||||
static already_AddRefed<nsFontMetrics>
|
||||
GetInflatedFontMetricsForFrame(const nsIFrame* aFrame)
|
||||
{
|
||||
return GetFontMetricsForFrame(aFrame, aFontMetrics,
|
||||
FontSizeInflationFor(aFrame));
|
||||
return GetFontMetricsForFrame(aFrame, FontSizeInflationFor(aFrame));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font metrics corresponding to the given style data.
|
||||
* @param aStyleContext the style data
|
||||
* @param aFontMetrics the font metrics result
|
||||
* @param aSizeInflation number to multiply font size by
|
||||
* @return success or failure code
|
||||
*/
|
||||
static nsresult GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
|
||||
nsFontMetrics** aFontMetrics,
|
||||
float aSizeInflation = 1.0f);
|
||||
static already_AddRefed<nsFontMetrics> GetFontMetricsForStyleContext(
|
||||
nsStyleContext* aStyleContext, float aSizeInflation = 1.0f);
|
||||
|
||||
/**
|
||||
* Get the font metrics of emphasis marks corresponding to the given
|
||||
* style data. The result is same as GetFontMetricsForStyleContext
|
||||
* except that the font size is scaled down to 50%.
|
||||
* @param aStyleContext the style data
|
||||
* @param aFontMetrics the font metrics result
|
||||
* @param aInflation number to multiple font size by
|
||||
* @return success or failure code
|
||||
*/
|
||||
static nsresult GetFontMetricsOfEmphasisMarks(nsStyleContext* aStyleContext,
|
||||
nsFontMetrics** aFontMetrics,
|
||||
float aInflation)
|
||||
static already_AddRefed<nsFontMetrics> GetFontMetricsOfEmphasisMarks(
|
||||
nsStyleContext* aStyleContext, float aInflation)
|
||||
{
|
||||
return GetFontMetricsForStyleContext(aStyleContext, aFontMetrics,
|
||||
aInflation * 0.5f);
|
||||
return GetFontMetricsForStyleContext(aStyleContext, aInflation * 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10344,9 +10344,8 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
||||
nsFontMetrics::Params params;
|
||||
params.language = nsGkAtoms::x_western;
|
||||
params.textPerf = aPresContext->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
aPresContext->DeviceContext()->
|
||||
GetMetricsFor(font, params, *getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
aPresContext->DeviceContext()->GetMetricsFor(font, params);
|
||||
|
||||
char buf[16];
|
||||
int len = snprintf_literal(buf, "%d", counter->mCount);
|
||||
|
@ -1551,16 +1551,9 @@ nsListControlFrame::IsLeftButton(nsIDOMEvent* aMouseEvent)
|
||||
nscoord
|
||||
nsListControlFrame::CalcFallbackRowBSize(float aFontSizeInflation)
|
||||
{
|
||||
nscoord rowBSize = 0;
|
||||
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
|
||||
aFontSizeInflation);
|
||||
if (fontMet) {
|
||||
rowBSize = fontMet->MaxHeight();
|
||||
}
|
||||
|
||||
return rowBSize;
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, aFontSizeInflation);
|
||||
return fontMet->MaxHeight();
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
@ -230,10 +230,8 @@ nsMeterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
||||
const LogicalSize& aPadding,
|
||||
bool aShrinkWrap)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this,
|
||||
getter_AddRefs(fontMet), 1.0f),
|
||||
LogicalSize(aWM));
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
|
||||
const WritingMode wm = GetWritingMode();
|
||||
LogicalSize autoSize(wm);
|
||||
@ -251,9 +249,8 @@ nsMeterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
||||
nscoord
|
||||
nsMeterFrame::GetMinISize(nsRenderingContext *aRenderingContext)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
NS_ENSURE_SUCCESS(
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f), 0);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
|
||||
nscoord minISize = fontMet->Font().size; // 1em
|
||||
|
||||
|
@ -257,9 +257,8 @@ nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
||||
nscoord
|
||||
nsProgressFrame::GetMinISize(nsRenderingContext *aRenderingContext)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
NS_ENSURE_SUCCESS(
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f), 0);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
|
||||
nscoord minISize = fontMet->Font().size; // 1em
|
||||
|
||||
|
@ -155,11 +155,8 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
|
||||
nscoord charWidth = 0;
|
||||
nscoord charMaxAdvance = 0;
|
||||
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsresult rv =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
|
||||
aFontSizeInflation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, aFontSizeInflation);
|
||||
|
||||
lineHeight =
|
||||
nsHTMLReflowState::CalcLineHeight(GetContent(), StyleContext(),
|
||||
@ -523,9 +520,8 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
|
||||
lineHeight = nsHTMLReflowState::CalcLineHeight(GetContent(), StyleContext(),
|
||||
NS_AUTOHEIGHT, inflation);
|
||||
}
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
|
||||
inflation);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
|
||||
// now adjust for our borders and padding
|
||||
aDesiredSize.SetBlockStartAscent(
|
||||
nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight,
|
||||
|
@ -746,11 +746,9 @@ MathMLTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
||||
params.explicitLanguage = styles[0]->mExplicitLanguage;
|
||||
params.userFontSet = pc->GetUserFontSet();
|
||||
params.textPerf = pc->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> metrics;
|
||||
pc->DeviceContext()->GetMetricsFor(font, params, *getter_AddRefs(metrics));
|
||||
if (metrics) {
|
||||
newFontGroup = metrics->GetThebesFontGroup();
|
||||
}
|
||||
RefPtr<nsFontMetrics> metrics =
|
||||
pc->DeviceContext()->GetMetricsFor(font, params);
|
||||
newFontGroup = metrics->GetThebesFontGroup();
|
||||
}
|
||||
|
||||
if (!newFontGroup) {
|
||||
|
@ -49,8 +49,8 @@ private:
|
||||
static gfxTextRun*
|
||||
GetEllipsisTextRun(nsIFrame* aFrame)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame);
|
||||
LazyReferenceRenderingDrawTargetGetterFromFrame lazyRefDrawTargetGetter(aFrame);
|
||||
return fm->GetThebesFontGroup()->GetEllipsisTextRun(
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
@ -255,8 +255,8 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx,
|
||||
gfxTextRun::DrawParams(aCtx->ThebesContext()));
|
||||
}
|
||||
} else {
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(mFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(mFrame);
|
||||
nsLayoutUtils::DrawString(mFrame, *fm, aCtx, mStyle->mString.get(),
|
||||
mStyle->mString.Length(), pt);
|
||||
}
|
||||
@ -808,8 +808,8 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame)
|
||||
} else {
|
||||
nsRenderingContext rc(
|
||||
aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext());
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame);
|
||||
mISize = nsLayoutUtils::AppUnitWidthOfStringBidi(mStyle->mString, aFrame,
|
||||
*fm, rc);
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
||||
// We also do this in strict mode because BR should act like a
|
||||
// normal inline frame. That line-height is used is important
|
||||
// here for cases where the line-height is less than 1.
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||
if (fm) {
|
||||
nscoord logicalHeight = aReflowState.CalcLineHeight();
|
||||
finalSize.BSize(wm) = logicalHeight;
|
||||
|
@ -505,9 +505,9 @@ nsBlockFrame::GetCaretBaseline() const
|
||||
return bp.top + firstLine->mFirstChild->GetCaretBaseline();
|
||||
}
|
||||
}
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), inflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
|
||||
nscoord lineHeight =
|
||||
nsHTMLReflowState::CalcLineHeight(GetContent(), StyleContext(),
|
||||
contentRect.height, inflation);
|
||||
@ -2625,8 +2625,8 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||
|
||||
nscoord minAscent =
|
||||
nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight,
|
||||
|
@ -304,7 +304,6 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
ColorPattern color(ToDeviceColor(
|
||||
nsLayoutUtils::GetColor(this, eCSSProperty_color)));
|
||||
|
||||
@ -412,8 +411,8 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
||||
aRenderingContext.ThebesContext()->SetColor(
|
||||
Color::FromABGR(nsLayoutUtils::GetColor(this, eCSSProperty_color)));
|
||||
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
GetFontSizeInflation());
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, GetFontSizeInflation());
|
||||
nsAutoString text;
|
||||
GetListItemText(text);
|
||||
WritingMode wm = GetWritingMode();
|
||||
@ -535,9 +534,8 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
|
||||
|
||||
const nsStyleList* myList = StyleList();
|
||||
nscoord ascent;
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, aFontSizeInflation);
|
||||
|
||||
RemoveStateBits(BULLET_FRAME_IMAGE_LOADING);
|
||||
|
||||
@ -892,9 +890,8 @@ nsBulletFrame::GetLogicalBaseline(WritingMode aWritingMode) const
|
||||
if (GetStateBits() & BULLET_FRAME_IMAGE_LOADING) {
|
||||
ascent = BSize(aWritingMode);
|
||||
} else {
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
GetFontSizeInflation());
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, GetFontSizeInflation());
|
||||
CounterStyle* listStyleType = StyleList()->GetCounterStyle();
|
||||
switch (listStyleType->GetStyle()) {
|
||||
case NS_STYLE_LIST_STYLE_NONE:
|
||||
|
@ -3904,8 +3904,8 @@ ScrollFrameHelper::ScrollSnap(const nsPoint &aDestination,
|
||||
nsSize
|
||||
ScrollFrameHelper::GetLineScrollAmount() const
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(mOuter, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(mOuter);
|
||||
NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
|
||||
static nscoord sMinLineScrollAmountInPixels = -1;
|
||||
if (sMinLineScrollAmountInPixels < 0) {
|
||||
|
@ -2693,10 +2693,8 @@ ComputeLineHeight(nsStyleContext* aStyleContext,
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
|
||||
getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm = nsLayoutUtils::
|
||||
GetFontMetricsForStyleContext(aStyleContext, aFontSizeInflation);
|
||||
return GetNormalLineHeight(fm);
|
||||
}
|
||||
|
||||
|
@ -1130,8 +1130,8 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
||||
// Set font and color
|
||||
aRenderingContext.ThebesContext()->
|
||||
SetColor(Color::FromABGR(StyleColor()->mColor));
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||
|
||||
// Format the text to display within the formatting rect
|
||||
|
||||
|
@ -1680,9 +1680,8 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
|
||||
static nscoord
|
||||
GetBSizeOfEmphasisMarks(nsIFrame* aSpanFrame, float aInflation)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsOfEmphasisMarks(
|
||||
aSpanFrame->StyleContext(), getter_AddRefs(fm), aInflation);
|
||||
RefPtr<nsFontMetrics> fm = nsLayoutUtils::
|
||||
GetFontMetricsOfEmphasisMarks(aSpanFrame->StyleContext(), aInflation);
|
||||
return fm->MaxHeight();
|
||||
}
|
||||
|
||||
@ -1774,11 +1773,10 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
||||
nsIFrame* spanFrame = spanFramePFD->mFrame;
|
||||
|
||||
// Get the parent frame's font for all of the frames in this span
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
float inflation =
|
||||
GetInflationForBlockDirAlignment(spanFrame, mInflationMinFontSize);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(spanFrame, getter_AddRefs(fm),
|
||||
inflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(spanFrame, inflation);
|
||||
|
||||
bool preMode = mStyleText->WhiteSpaceIsSignificant();
|
||||
|
||||
|
@ -633,9 +633,8 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
||||
nsFontMetrics::Params params;
|
||||
params.userFontSet = pc->GetUserFontSet();
|
||||
params.textPerf = pc->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
pc->DeviceContext()->GetMetricsFor(mPD->mHeadFootFont, params,
|
||||
*getter_AddRefs(fontMet));
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
pc->DeviceContext()->GetMetricsFor(mPD->mHeadFootFont, params);
|
||||
|
||||
nscoord ascent = 0;
|
||||
nscoord visibleHeight = 0;
|
||||
|
@ -1814,12 +1814,8 @@ GetFontGroupForFrame(nsIFrame* aFrame, float aFontSizeInflation,
|
||||
if (aOutFontMetrics)
|
||||
*aOutFontMetrics = nullptr;
|
||||
|
||||
RefPtr<nsFontMetrics> metrics;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(metrics),
|
||||
aFontSizeInflation);
|
||||
|
||||
if (!metrics)
|
||||
return nullptr;
|
||||
RefPtr<nsFontMetrics> metrics =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, aFontSizeInflation);
|
||||
|
||||
if (aOutFontMetrics) {
|
||||
*aOutFontMetrics = metrics;
|
||||
@ -5168,9 +5164,8 @@ nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider)
|
||||
return nsRect();
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsOfEmphasisMarks(
|
||||
StyleContext(), getter_AddRefs(fm), GetFontSizeInflation());
|
||||
RefPtr<nsFontMetrics> fm = nsLayoutUtils::
|
||||
GetFontMetricsOfEmphasisMarks(StyleContext(), GetFontSizeInflation());
|
||||
EmphasisMarkInfo* info = new EmphasisMarkInfo;
|
||||
info->textRun =
|
||||
GenerateTextRunForEmphasisMarks(this, fm, aWM, styleText);
|
||||
@ -6946,9 +6941,8 @@ nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext,
|
||||
|
||||
nsRect givenRect = aRect;
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
GetFontSizeInflation());
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, GetFontSizeInflation());
|
||||
gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
|
||||
gfxFont* firstFont = fontGroup->GetFirstValidFont();
|
||||
WritingMode wm = GetWritingMode();
|
||||
|
@ -996,9 +996,8 @@ nsMathMLChar::SetFontFamily(nsPresContext* aPresContext,
|
||||
params.explicitLanguage = styleFont->mExplicitLanguage;
|
||||
params.userFontSet = aPresContext->GetUserFontSet();
|
||||
params.textPerf = aPresContext->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
aPresContext->DeviceContext()->
|
||||
GetMetricsFor(font, params, *getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
aPresContext->DeviceContext()->GetMetricsFor(font, params);
|
||||
// Set the font if it is an unicode table
|
||||
// or if the same family name has been found
|
||||
gfxFont *firstFont = fm->GetThebesFontGroup()->GetFirstValidFont();
|
||||
@ -1537,9 +1536,8 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
|
||||
params.explicitLanguage = styleFont->mExplicitLanguage;
|
||||
params.userFontSet = aPresContext->GetUserFontSet();
|
||||
params.textPerf = aPresContext->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
aPresContext->DeviceContext()->
|
||||
GetMetricsFor(font, params, *getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
aPresContext->DeviceContext()->GetMetricsFor(font, params);
|
||||
uint32_t len = uint32_t(mData.Length());
|
||||
nsAutoPtr<gfxTextRun> textRun;
|
||||
textRun = fm->GetThebesFontGroup()->
|
||||
|
@ -49,8 +49,8 @@ nsMathMLContainerFrame::ReflowError(DrawTarget* aDrawTarget,
|
||||
|
||||
///////////////
|
||||
// Set font
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||
|
||||
// bounding metrics
|
||||
nsAutoString errorMsg; errorMsg.AssignLiteral("invalid-markup");
|
||||
@ -92,8 +92,8 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
{
|
||||
// Set color and font ...
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm), 1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(mFrame, 1.0f);
|
||||
|
||||
nsPoint pt = ToReferenceFrame();
|
||||
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
@ -232,10 +232,8 @@ nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
|
||||
}
|
||||
else if (eCSSUnit_XHeight == unit) {
|
||||
aPresContext->SetUsesExChUnits(true);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
|
||||
getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm = nsLayoutUtils::
|
||||
GetFontMetricsForStyleContext(aStyleContext, aFontSizeInflation);
|
||||
nscoord xHeight = fm->XHeight();
|
||||
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)xHeight);
|
||||
}
|
||||
|
@ -198,9 +198,8 @@ public:
|
||||
nscoord& aSubDrop,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, aFontSizeInflation);
|
||||
GetSubDrop(fm, aSubDrop);
|
||||
}
|
||||
|
||||
@ -209,9 +208,8 @@ public:
|
||||
nscoord& aSupDrop,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, aFontSizeInflation);
|
||||
GetSupDrop(fm, aSupDrop);
|
||||
}
|
||||
|
||||
|
@ -173,8 +173,8 @@ nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget,
|
||||
mBoundingMetrics += childSize.mBoundingMetrics;
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||
nscoord ascent = fm->MaxAscent();
|
||||
nscoord descent = fm->MaxDescent();
|
||||
|
||||
|
@ -344,9 +344,8 @@ nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
GetRuleThickness(aDrawTarget, fm, mRuleThickness);
|
||||
if (mRuleThickness < onePixel) {
|
||||
mRuleThickness = onePixel;
|
||||
|
@ -223,9 +223,8 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
int32_t i;
|
||||
const nsStyleFont* font = StyleFont();
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
nscoord axisHeight, em;
|
||||
GetAxisHeight(aReflowState.rendContext->GetDrawTarget(), fm, axisHeight);
|
||||
GetEmHeight(fm, em);
|
||||
@ -612,9 +611,8 @@ nsMathMLmfencedFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingCon
|
||||
nsPresContext* presContext = PresContext();
|
||||
const nsStyleFont* font = StyleFont();
|
||||
float fontSizeInflation = nsLayoutUtils:: FontSizeInflationFor(this);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
nscoord em;
|
||||
GetEmHeight(fm, em);
|
||||
|
||||
|
@ -218,9 +218,8 @@ nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
|
||||
nscoord defaultRuleThickness, axisHeight;
|
||||
nscoord oneDevPixel = fm->AppUnitsPerDevPixel();
|
||||
|
@ -185,9 +185,8 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
|
||||
|
||||
// get x-height (an ex)
|
||||
const nsStyleFont* font = aFrame->StyleFont();
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(baseFrame, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(baseFrame, aFontSizeInflation);
|
||||
|
||||
nscoord xHeight = fm->XHeight();
|
||||
|
||||
|
@ -362,9 +362,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
// Cache the default values of lspace and rspace.
|
||||
// since these values are relative to the 'em' unit, convert to twips now
|
||||
nscoord em;
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
GetEmHeight(fm, em);
|
||||
|
||||
mEmbellishData.leadingSpace = NSToCoordRound(lspace * em);
|
||||
@ -619,9 +618,8 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
|
||||
// get the axis height;
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
nscoord axisHeight, height;
|
||||
GetAxisHeight(aDrawTarget, fm, axisHeight);
|
||||
|
||||
|
@ -225,10 +225,9 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
////////////
|
||||
// Prepare the radical symbol and the overline bar
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
|
||||
nscoord ruleThickness, leading, psi;
|
||||
GetRadicalParameters(fm, StyleFont()->mMathDisplay ==
|
||||
@ -382,9 +381,8 @@ nsMathMLmrootFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingConte
|
||||
fontSizeInflation);
|
||||
|
||||
nscoord dxSqr;
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
GetRadicalXOffsets(indexWidth, sqrWidth, fm, nullptr, &dxSqr);
|
||||
|
||||
nscoord width = dxSqr + sqrWidth + baseWidth;
|
||||
|
@ -506,9 +506,8 @@ ParseSpacingAttribute(nsMathMLmtableFrame* aFrame, nsIAtom* aAttribute)
|
||||
nscoord value2;
|
||||
// Set defaults
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(aFrame);
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, fontSizeInflation);
|
||||
if (nsGkAtoms::rowspacing_ == aAttribute) {
|
||||
value = kDefaultRowspacingEx * fm->XHeight();
|
||||
value2 = 0;
|
||||
@ -882,8 +881,8 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
case eAlign_axis:
|
||||
default: {
|
||||
// XXX should instead use style data from the row of reference here ?
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
||||
nscoord axisHeight;
|
||||
GetAxisHeight(aReflowState.rendContext->GetDrawTarget(), fm, axisHeight);
|
||||
if (rowFrame) {
|
||||
|
@ -398,9 +398,8 @@ nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
////////////////////
|
||||
// Place Children
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
|
||||
nscoord xHeight = fm->XHeight();
|
||||
nscoord oneDevPixel = fm->AppUnitsPerDevPixel();
|
||||
|
@ -34,10 +34,8 @@ StyleContextContainsFont(nsStyleContext* aStyleContext,
|
||||
|
||||
// family name is in the fontlist, check to see if the font group
|
||||
// associated with the frame includes the specific userfont
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
|
||||
getter_AddRefs(fm),
|
||||
1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext, 1.0f);
|
||||
|
||||
if (fm->GetThebesFontGroup()->ContainsUserFont(aFont)) {
|
||||
return true;
|
||||
|
@ -335,10 +335,7 @@ GetMetricsFor(nsPresContext* aPresContext,
|
||||
params.userFontSet =
|
||||
aUseUserFontSet ? aPresContext->GetUserFontSet() : nullptr;
|
||||
params.textPerf = aPresContext->GetTextPerfMetrics();
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
aPresContext->DeviceContext()->
|
||||
GetMetricsFor(font, params, *getter_AddRefs(fm));
|
||||
return fm.forget();
|
||||
return aPresContext->DeviceContext()->GetMetricsFor(font, params);
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,8 +197,8 @@ nsListBoxBodyFrame::Init(nsIContent* aContent,
|
||||
scrollbarFrame->SetScrollbarMediatorContent(GetContent());
|
||||
}
|
||||
}
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), 1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
mRowHeight = fm->MaxHeight();
|
||||
}
|
||||
|
||||
@ -728,9 +728,8 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(styleContext,
|
||||
getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(styleContext);
|
||||
|
||||
nscoord textWidth =
|
||||
nsLayoutUtils::AppUnitWidthOfStringBidi(value, this, *fm,
|
||||
|
@ -458,8 +458,8 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||
} while (0 != decorMask &&
|
||||
(f = nsLayoutUtils::GetParentOrPlaceholderFor(f)));
|
||||
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
fontMet->SetVertical(wm.IsVertical());
|
||||
fontMet->SetTextOrientation(StyleVisibility()->mTextOrientation);
|
||||
|
||||
@ -633,8 +633,8 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
|
||||
return 0;
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), 1.0f);
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
|
||||
// see if the text will completely fit in the width given
|
||||
nscoord titleWidth =
|
||||
@ -969,8 +969,8 @@ nsTextBoxFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
|
||||
nsRect scrollBounds(nsPoint(0, 0), GetSize());
|
||||
nsRect textRect = mTextDrawRect;
|
||||
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
nsBoundingMetrics metrics =
|
||||
fontMet->GetInkBoundsForVisualOverflow(mCroppedTitle.get(),
|
||||
mCroppedTitle.Length(),
|
||||
@ -1030,8 +1030,8 @@ nsTextBoxFrame::GetTextSize(nsRenderingContext& aRenderingContext,
|
||||
const nsString& aString,
|
||||
nsSize& aSize, nscoord& aAscent)
|
||||
{
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f);
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
|
||||
aSize.height = fontMet->MaxHeight();
|
||||
aSize.width =
|
||||
nsLayoutUtils::AppUnitWidthOfStringBidi(aString, this, *fontMet,
|
||||
|
@ -1249,9 +1249,8 @@ nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const n
|
||||
// we add in borders and padding to the text dimension and give that back.
|
||||
nsStyleContext* textContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecelltext);
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||
getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext);
|
||||
nscoord height = fm->MaxHeight();
|
||||
|
||||
nsMargin textMargin;
|
||||
@ -1621,9 +1620,8 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
|
||||
|
||||
AdjustForBorderPadding(textContext, textRect);
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||
getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext);
|
||||
AdjustForCellText(cellText, aRowIndex, aColumn, rc, *fm, textRect);
|
||||
|
||||
if (aX >= textRect.x && aX < textRect.x + textRect.width)
|
||||
@ -1749,9 +1747,8 @@ nsTreeBodyFrame::GetCellWidth(int32_t aRow, nsTreeColumn* aCol,
|
||||
// Get the borders and padding for the text.
|
||||
GetBorderPadding(textContext, bp);
|
||||
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||
getter_AddRefs(fm));
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext);
|
||||
// Get the width of the text itself
|
||||
nscoord width = nsLayoutUtils::AppUnitWidthOfStringBidi(cellText, this, *fm,
|
||||
*aRenderingContext);
|
||||
@ -3730,9 +3727,8 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
|
||||
textRect.Deflate(bp);
|
||||
|
||||
// Compute our text size.
|
||||
RefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||
getter_AddRefs(fontMet));
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext);
|
||||
|
||||
nscoord height = fontMet->MaxHeight();
|
||||
nscoord baseline = fontMet->MaxAscent();
|
||||
|
Loading…
Reference in New Issue
Block a user