mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1088625, part 3 - Remove nsRenderingContext's SetFont, FontMetrics and SetTextRunRTL methods now that no one uses them any more. r=mstange
This commit is contained in:
parent
55c25e7b5c
commit
7ece5bfaca
@ -17,15 +17,3 @@ nsRenderingContext::Init(DrawTarget *aDrawTarget)
|
||||
{
|
||||
Init(new gfxContext(aDrawTarget));
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContext::SetTextRunRTL(bool aIsRTL)
|
||||
{
|
||||
mFontMetrics->SetTextRunRTL(aIsRTL);
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContext::SetFont(nsFontMetrics *aFontMetrics)
|
||||
{
|
||||
mFontMetrics = aFontMetrics;
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ class nsRenderingContext MOZ_FINAL
|
||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
||||
public:
|
||||
nsRenderingContext() {}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsRenderingContext)
|
||||
|
||||
void Init(gfxContext* aThebesContext);
|
||||
@ -40,21 +38,11 @@ public:
|
||||
gfxContext *ThebesContext() { return mThebes; }
|
||||
DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); }
|
||||
|
||||
// Text
|
||||
|
||||
void SetFont(nsFontMetrics *aFontMetrics);
|
||||
nsFontMetrics *FontMetrics() { return mFontMetrics; } // may be null
|
||||
|
||||
void SetTextRunRTL(bool aIsRTL);
|
||||
|
||||
private:
|
||||
// Private destructor, to discourage deletion outside of Release():
|
||||
~nsRenderingContext()
|
||||
{
|
||||
}
|
||||
~nsRenderingContext() {}
|
||||
|
||||
nsRefPtr<gfxContext> mThebes;
|
||||
nsRefPtr<nsFontMetrics> mFontMetrics;
|
||||
};
|
||||
|
||||
#endif // NSRENDERINGCONTEXT__H__
|
||||
|
@ -7276,7 +7276,6 @@ nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame,
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(aFrame);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), inflation);
|
||||
aReflowState.rendContext->SetFont(fm);
|
||||
|
||||
if (fm) {
|
||||
// Compute final height of the frame.
|
||||
|
@ -156,7 +156,6 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
|
||||
aFontSizeInflation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aRenderingContext->SetFont(fontMet);
|
||||
|
||||
lineHeight =
|
||||
nsHTMLReflowState::CalcLineHeight(GetContent(), StyleContext(),
|
||||
|
@ -239,7 +239,6 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx,
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(mFrame));
|
||||
aCtx->SetFont(fm);
|
||||
nsLayoutUtils::DrawString(mFrame, *fm, aCtx, mStyle->mString.get(),
|
||||
mStyle->mString.Length(), pt);
|
||||
}
|
||||
@ -764,7 +763,6 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame)
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(aFrame));
|
||||
rc->SetFont(fm);
|
||||
mWidth = nsLayoutUtils::GetStringWidth(aFrame, rc, *fm,
|
||||
mStyle->mString.get(),
|
||||
mStyle->mString.Length());
|
||||
|
@ -119,7 +119,6 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(this));
|
||||
aReflowState.rendContext->SetFont(fm); // FIXME: maybe not needed?
|
||||
if (fm) {
|
||||
nscoord logicalHeight = aReflowState.CalcLineHeight();
|
||||
finalSize.BSize(wm) = logicalHeight;
|
||||
|
@ -2514,7 +2514,6 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(this));
|
||||
aState.mReflowState.rendContext->SetFont(fm); // FIXME: needed?
|
||||
|
||||
nscoord minAscent =
|
||||
nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight);
|
||||
|
@ -429,7 +429,6 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
GetFontSizeInflation());
|
||||
GetListItemText(text);
|
||||
aRenderingContext.SetFont(fm);
|
||||
nscoord ascent = fm->MaxAscent();
|
||||
aPt.MoveBy(padding.left, padding.top);
|
||||
aPt.y = NSToCoordRound(nsLayoutUtils::GetSnappedBaselineY(
|
||||
@ -602,7 +601,6 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
|
||||
default:
|
||||
GetListItemText(text);
|
||||
finalSize.BSize(wm) = fm->MaxHeight();
|
||||
aRenderingContext->SetFont(fm);
|
||||
finalSize.ISize(wm) =
|
||||
nsLayoutUtils::GetStringWidth(this, aRenderingContext, *fm,
|
||||
text.get(), text.Length());
|
||||
|
@ -1082,7 +1082,6 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(this));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
// Format the text to display within the formatting rect
|
||||
|
||||
|
@ -1590,7 +1590,6 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
||||
GetInflationForBlockDirAlignment(spanFrame, mInflationMinFontSize);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(spanFrame, getter_AddRefs(fm),
|
||||
inflation);
|
||||
mBlockReflowState->rendContext->SetFont(fm);
|
||||
|
||||
bool preMode = mStyleText->WhiteSpaceIsSignificant();
|
||||
|
||||
|
@ -605,8 +605,6 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
||||
pc->GetTextPerfMetrics(),
|
||||
*getter_AddRefs(fontMet));
|
||||
|
||||
aRenderingContext.SetFont(fontMet);
|
||||
|
||||
nscoord ascent = 0;
|
||||
nscoord visibleHeight = 0;
|
||||
if (fontMet) {
|
||||
|
@ -53,7 +53,6 @@ nsMathMLContainerFrame::ReflowError(nsRenderingContext& aRenderingContext,
|
||||
// Set font
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
// bounding metrics
|
||||
nsAutoString errorMsg; errorMsg.AssignLiteral("invalid-markup");
|
||||
@ -97,7 +96,6 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
||||
// Set color and font ...
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));
|
||||
aCtx->SetFont(fm);
|
||||
|
||||
nsPoint pt = ToReferenceFrame();
|
||||
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
@ -172,12 +172,6 @@ nsMathMLFrame::GetRuleThickness(nsRenderingContext& aRenderingContext,
|
||||
nsFontMetrics* aFontMetrics,
|
||||
nscoord& aRuleThickness)
|
||||
{
|
||||
// get the bounding metrics of the overbar char, the rendering context
|
||||
// is assumed to have been set with the font of the current style context
|
||||
NS_ASSERTION(aRenderingContext.FontMetrics()->Font().
|
||||
Equals(aFontMetrics->Font()),
|
||||
"unexpected state");
|
||||
|
||||
nscoord xHeight = aFontMetrics->XHeight();
|
||||
char16_t overBar = 0x00AF;
|
||||
nsBoundingMetrics bm =
|
||||
@ -203,12 +197,6 @@ nsMathMLFrame::GetAxisHeight(nsRenderingContext& aRenderingContext,
|
||||
return;
|
||||
}
|
||||
|
||||
// get the bounding metrics of the minus sign, the rendering context
|
||||
// is assumed to have been set with the font of the current style context
|
||||
NS_ASSERTION(aRenderingContext.FontMetrics()->Font().
|
||||
Equals(aFontMetrics->Font()),
|
||||
"unexpected state");
|
||||
|
||||
nscoord xHeight = aFontMetrics->XHeight();
|
||||
char16_t minus = 0x2212; // not '-', but official Unicode minus sign
|
||||
nsBoundingMetrics bm =
|
||||
|
@ -345,7 +345,6 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
GetRuleThickness(aRenderingContext, fm, mRuleThickness);
|
||||
if (mRuleThickness < onePixel) {
|
||||
mRuleThickness = onePixel;
|
||||
|
@ -221,7 +221,6 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
const nsStyleFont* font = StyleFont();
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aReflowState.rendContext->SetFont(fm);
|
||||
nscoord axisHeight, em;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
GetEmHeight(fm, em);
|
||||
|
@ -216,7 +216,6 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
nscoord defaultRuleThickness, axisHeight;
|
||||
nscoord oneDevPixel = fm->AppUnitsPerDevPixel();
|
||||
|
@ -185,7 +185,6 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
|
||||
const nsStyleFont* font = aFrame->StyleFont();
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(baseFrame, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
nscoord xHeight = fm->XHeight();
|
||||
|
||||
|
@ -611,7 +611,6 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext,
|
||||
// get the axis height;
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
nscoord axisHeight, height;
|
||||
GetAxisHeight(aRenderingContext, fm, axisHeight);
|
||||
|
||||
|
@ -225,7 +225,6 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
renderingContext.SetFont(fm);
|
||||
|
||||
nscoord ruleThickness, leading, psi;
|
||||
GetRadicalParameters(fm, StyleFont()->mMathDisplay ==
|
||||
|
@ -857,7 +857,6 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
// XXX should instead use style data from the row of reference here ?
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aReflowState.rendContext->SetFont(fm);
|
||||
nscoord axisHeight;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
if (rowFrame) {
|
||||
|
@ -396,7 +396,6 @@ nsMathMLmunderoverFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
nscoord xHeight = fm->XHeight();
|
||||
nscoord oneDevPixel = fm->AppUnitsPerDevPixel();
|
||||
|
@ -725,7 +725,6 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(styleContext,
|
||||
getter_AddRefs(fm));
|
||||
rendContext->SetFont(fm);
|
||||
|
||||
nscoord textWidth =
|
||||
nsLayoutUtils::GetStringWidth(this, rendContext, *fm,
|
||||
|
@ -501,9 +501,6 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||
nsRefPtr<nsRenderingContext> refContext =
|
||||
PresContext()->PresShell()->CreateReferenceRenderingContext();
|
||||
|
||||
aRenderingContext.SetFont(fontMet);
|
||||
refContext->SetFont(fontMet);
|
||||
|
||||
CalculateUnderline(*refContext, *fontMet);
|
||||
|
||||
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
|
||||
@ -614,7 +611,6 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext,
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
// see if the text will completely fit in the width given
|
||||
nscoord titleWidth = nsLayoutUtils::GetStringWidth(this, &aRenderingContext,
|
||||
@ -1003,7 +999,6 @@ nsTextBoxFrame::GetTextSize(nsPresContext* aPresContext,
|
||||
nsRefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
|
||||
aSize.height = fontMet->MaxHeight();
|
||||
aRenderingContext.SetFont(fontMet);
|
||||
aSize.width =
|
||||
nsLayoutUtils::GetStringWidth(this, &aRenderingContext, *fontMet,
|
||||
aString.get(), aString.Length());
|
||||
|
@ -1269,7 +1269,6 @@ nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const n
|
||||
GetBorderPadding(textContext, bp);
|
||||
textRect.height += bp.top + bp.bottom;
|
||||
|
||||
rc->SetFont(fm);
|
||||
AdjustForCellText(cellText, aRow, currCol, *rc, *fm, textRect);
|
||||
|
||||
theRect = textRect;
|
||||
@ -1620,8 +1619,6 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||
getter_AddRefs(fm));
|
||||
rc->SetFont(fm);
|
||||
|
||||
AdjustForCellText(cellText, aRowIndex, aColumn, *rc, *fm, textRect);
|
||||
|
||||
if (aX >= textRect.x && aX < textRect.x + textRect.width)
|
||||
@ -1750,8 +1747,6 @@ nsTreeBodyFrame::GetCellWidth(int32_t aRow, nsTreeColumn* aCol,
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||
getter_AddRefs(fm));
|
||||
aRenderingContext->SetFont(fm);
|
||||
|
||||
// Get the width of the text itself
|
||||
nscoord width =
|
||||
nsLayoutUtils::GetStringWidth(this, aRenderingContext, *fm,
|
||||
@ -3615,8 +3610,6 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
|
||||
}
|
||||
|
||||
// Set our font.
|
||||
aRenderingContext.SetFont(fontMet);
|
||||
|
||||
AdjustForCellText(text, aRowIndex, aColumn, aRenderingContext, *fontMet, textRect);
|
||||
textRect.Inflate(bp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user