diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 95f5b1aa9a5..4eb9190c17c 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -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; -} diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index 73706d8f5f6..d8c0ef436b7 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -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 mThebes; - nsRefPtr mFontMetrics; }; #endif // NSRENDERINGCONTEXT__H__ diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 6a8b270f2f8..0567cb0d6d7 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -7276,7 +7276,6 @@ nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame, nsRefPtr 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. diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index a697a80e1c6..771d07f268b 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -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(), diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index efb8ac290a7..1d512356d7a 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -239,7 +239,6 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx, nsRefPtr 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 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()); diff --git a/layout/generic/nsBRFrame.cpp b/layout/generic/nsBRFrame.cpp index 51f8a47375d..0077ee9f52a 100644 --- a/layout/generic/nsBRFrame.cpp +++ b/layout/generic/nsBRFrame.cpp @@ -119,7 +119,6 @@ BRFrame::Reflow(nsPresContext* aPresContext, nsRefPtr 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; diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 3268071d29a..8539001f309 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -2514,7 +2514,6 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), nsLayoutUtils::FontSizeInflationFor(this)); - aState.mReflowState.rendContext->SetFont(fm); // FIXME: needed? nscoord minAscent = nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight); diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index fa8ddccdb46..153ad918834 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -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()); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 1981966784a..2d273ef8904 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1082,7 +1082,6 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext, nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), nsLayoutUtils::FontSizeInflationFor(this)); - aRenderingContext.SetFont(fm); // Format the text to display within the formatting rect diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index b1fdeecd9a3..349c9c42901 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -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(); diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 8a80ff56fe4..09bbd2560c9 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -605,8 +605,6 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext, pc->GetTextPerfMetrics(), *getter_AddRefs(fontMet)); - aRenderingContext.SetFont(fontMet); - nscoord ascent = 0; nscoord visibleHeight = 0; if (fontMet) { diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index 224d0ed9f17..255e69a271e 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -53,7 +53,6 @@ nsMathMLContainerFrame::ReflowError(nsRenderingContext& aRenderingContext, // Set font nsRefPtr 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 fm; nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm)); - aCtx->SetFont(fm); nsPoint pt = ToReferenceFrame(); int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp index 100c07854a3..ee0b6050cb0 100644 --- a/layout/mathml/nsMathMLFrame.cpp +++ b/layout/mathml/nsMathMLFrame.cpp @@ -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 = diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index ed1d8969dc5..2066bde0e2c 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -345,7 +345,6 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext, nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - aRenderingContext.SetFont(fm); GetRuleThickness(aRenderingContext, fm, mRuleThickness); if (mRuleThickness < onePixel) { mRuleThickness = onePixel; diff --git a/layout/mathml/nsMathMLmfencedFrame.cpp b/layout/mathml/nsMathMLmfencedFrame.cpp index 28d7b425a52..ddea67ec24a 100644 --- a/layout/mathml/nsMathMLmfencedFrame.cpp +++ b/layout/mathml/nsMathMLmfencedFrame.cpp @@ -221,7 +221,6 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext, const nsStyleFont* font = StyleFont(); nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - aReflowState.rendContext->SetFont(fm); nscoord axisHeight, em; GetAxisHeight(*aReflowState.rendContext, fm, axisHeight); GetEmHeight(fm, em); diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 59579dfc72b..37abae5a5ad 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -216,7 +216,6 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext, nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - aRenderingContext.SetFont(fm); nscoord defaultRuleThickness, axisHeight; nscoord oneDevPixel = fm->AppUnitsPerDevPixel(); diff --git a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp index 048ccfd8b31..1b15fff231f 100644 --- a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp +++ b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp @@ -185,7 +185,6 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext, const nsStyleFont* font = aFrame->StyleFont(); nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(baseFrame, getter_AddRefs(fm)); - aRenderingContext.SetFont(fm); nscoord xHeight = fm->XHeight(); diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp index 6b55a20093d..018f3490637 100644 --- a/layout/mathml/nsMathMLmoFrame.cpp +++ b/layout/mathml/nsMathMLmoFrame.cpp @@ -611,7 +611,6 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext, // get the axis height; nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - aRenderingContext.SetFont(fm); nscoord axisHeight, height; GetAxisHeight(aRenderingContext, fm, axisHeight); diff --git a/layout/mathml/nsMathMLmrootFrame.cpp b/layout/mathml/nsMathMLmrootFrame.cpp index 8a43be05e0b..d5b899cc682 100644 --- a/layout/mathml/nsMathMLmrootFrame.cpp +++ b/layout/mathml/nsMathMLmrootFrame.cpp @@ -225,7 +225,6 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext, nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - renderingContext.SetFont(fm); nscoord ruleThickness, leading, psi; GetRadicalParameters(fm, StyleFont()->mMathDisplay == diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index 2c5cd43dd48..0125399f31a 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -857,7 +857,6 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext, // XXX should instead use style data from the row of reference here ? nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - aReflowState.rendContext->SetFont(fm); nscoord axisHeight; GetAxisHeight(*aReflowState.rendContext, fm, axisHeight); if (rowFrame) { diff --git a/layout/mathml/nsMathMLmunderoverFrame.cpp b/layout/mathml/nsMathMLmunderoverFrame.cpp index ec6f9a1db2c..3b4e8864b9e 100644 --- a/layout/mathml/nsMathMLmunderoverFrame.cpp +++ b/layout/mathml/nsMathMLmunderoverFrame.cpp @@ -396,7 +396,6 @@ nsMathMLmunderoverFrame::Place(nsRenderingContext& aRenderingContext, nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - aRenderingContext.SetFont(fm); nscoord xHeight = fm->XHeight(); nscoord oneDevPixel = fm->AppUnitsPerDevPixel(); diff --git a/layout/xul/nsListBoxBodyFrame.cpp b/layout/xul/nsListBoxBodyFrame.cpp index 3da0275d50d..d4053199aa6 100644 --- a/layout/xul/nsListBoxBodyFrame.cpp +++ b/layout/xul/nsListBoxBodyFrame.cpp @@ -725,7 +725,6 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState) nsRefPtr fm; nsLayoutUtils::GetFontMetricsForStyleContext(styleContext, getter_AddRefs(fm)); - rendContext->SetFont(fm); nscoord textWidth = nsLayoutUtils::GetStringWidth(this, rendContext, *fm, diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index 6e5b32c9705..dc01d3236f6 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -501,9 +501,6 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext, nsRefPtr 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 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 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()); diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 74064576743..ca1d0c1dafc 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -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 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 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);