зеркало из https://github.com/mozilla/gecko-dev.git
Bug 889219. Part 4: Stop heap-allocating nsSharedPageData::mHeadFootFont. r=mats
--HG-- extra : rebase_source : beaa74d12c905b4737ab3b6e736f8e5ad90942bb
This commit is contained in:
Родитель
4514c1413f
Коммит
afa626c307
|
@ -578,7 +578,7 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
|||
|
||||
// Get the FontMetrics to determine width.height of strings
|
||||
nsRefPtr<nsFontMetrics> fontMet;
|
||||
pc->DeviceContext()->GetMetricsFor(*mPD->mHeadFootFont, nullptr,
|
||||
pc->DeviceContext()->GetMetricsFor(mPD->mHeadFootFont, nullptr,
|
||||
pc->GetUserFontSet(),
|
||||
*getter_AddRefs(fontMet));
|
||||
|
||||
|
|
|
@ -56,20 +56,6 @@ GetLayoutPrintingLog()
|
|||
#define PR_PL(_p1)
|
||||
#endif
|
||||
|
||||
// This object a shared by all the nsPageFrames
|
||||
// parented to a SimplePageSequenceFrame
|
||||
nsSharedPageData::nsSharedPageData() :
|
||||
mHeadFootFont(nullptr),
|
||||
mPageContentXMost(0),
|
||||
mPageContentSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsSharedPageData::~nsSharedPageData()
|
||||
{
|
||||
delete mHeadFootFont;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
|
@ -92,9 +78,9 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(nsStyleContext* aContext) :
|
|||
// XXX Unsafe to assume successful allocation
|
||||
mPageData = new nsSharedPageData();
|
||||
mPageData->mHeadFootFont =
|
||||
new nsFont(*PresContext()->GetDefaultFont(kGenericFont_serif,
|
||||
aContext->StyleFont()->mLanguage));
|
||||
mPageData->mHeadFootFont->size = nsPresContext::CSSPointsToAppUnits(10);
|
||||
*PresContext()->GetDefaultFont(kGenericFont_serif,
|
||||
aContext->StyleFont()->mLanguage);
|
||||
mPageData->mHeadFootFont.size = nsPresContext::CSSPointsToAppUnits(10);
|
||||
|
||||
nsresult rv;
|
||||
mPageData->mPrintOptions = do_GetService(sPrintOptionsContractID, &rv);
|
||||
|
|
|
@ -19,15 +19,20 @@
|
|||
// It lives while the nsSimplePageSequenceFrame lives
|
||||
class nsSharedPageData {
|
||||
public:
|
||||
nsSharedPageData();
|
||||
~nsSharedPageData();
|
||||
// This object a shared by all the nsPageFrames
|
||||
// parented to a SimplePageSequenceFrame
|
||||
nsSharedPageData() :
|
||||
mPageContentXMost(0),
|
||||
mPageContentSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsString mDateTimeStr;
|
||||
nsFont * mHeadFootFont;
|
||||
nsString mPageNumFormat;
|
||||
nsString mPageNumAndTotalsFormat;
|
||||
nsString mDocTitle;
|
||||
nsString mDocURL;
|
||||
nsFont mHeadFootFont;
|
||||
|
||||
nsSize mReflowSize;
|
||||
nsMargin mReflowMargin;
|
||||
|
|
Загрузка…
Ссылка в новой задаче