Bug 1360135 Get rid of nsPrintData::mSelectedPO because it's unused r?dholbert
MozReview-Commit-ID: 3nG5ZPXOsvq
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -19,25 +19,34 @@
#define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
static mozilla::LazyLogModule gPrintingLog("printing");
#define PR_PL(_p1) MOZ_LOG(gPrintingLog, mozilla::LogLevel::Debug, _p1);
//---------------------------------------------------
//-- nsPrintData Class Impl
//---------------------------------------------------
-nsPrintData::nsPrintData(ePrintDataType aType) :
- mType(aType), mDebugFilePtr(nullptr), mSelectedPO(nullptr),
- mPrintDocList(0), mIsIFrameSelected(false),
- mIsParentAFrameSet(false), mOnStartSent(false),
- mIsAborted(false), mPreparingForPrint(false), mDocWasToBeDestroyed(false),
- mShrinkToFit(false), mPrintFrameType(nsIPrintSettings::kFramesAsIs),
- mNumPrintablePages(0), mNumPagesPrinted(0),
- mShrinkRatio(1.0), mOrigDCScale(1.0), mPPEventListeners(nullptr),
- mBrandName(nullptr)
+nsPrintData::nsPrintData(ePrintDataType aType)
+ : mType(aType)
+ , mDebugFilePtr(nullptr)
+ , mPrintDocList(0)
+ , mIsIFrameSelected(false)
+ , mIsParentAFrameSet(false)
+ , mOnStartSent(false)
+ , mIsAborted(false)
+ , mPreparingForPrint(false)
+ , mDocWasToBeDestroyed(false)
+ , mShrinkToFit(false)
+ , mPrintFrameType(nsIPrintSettings::kFramesAsIs)
+ , mNumPrintablePages(0)
+ , mNumPagesPrinted(0)
+ , mShrinkRatio(1.0)
+ , mOrigDCScale(1.0)
+ , mPPEventListeners(nullptr)
+ , mBrandName(nullptr)
{
nsCOMPtr<nsIStringBundle> brandBundle;
nsCOMPtr<nsIStringBundleService> svc =
mozilla::services::GetStringBundleService();
if (svc) {
svc->CreateBundle( "chrome://branding/locale/brand.properties", getter_AddRefs( brandBundle ) );
if (brandBundle) {
brandBundle->GetStringFromName(u"brandShortName", &mBrandName );
--- a/layout/printing/nsPrintData.h
+++ b/layout/printing/nsPrintData.h
@@ -55,17 +55,16 @@ public:
void DoOnStatusChange(nsresult aStatus);
ePrintDataType mType; // the type of data this is (Printing or Print Preview)
RefPtr<nsDeviceContext> mPrintDC;
FILE *mDebugFilePtr; // a file where information can go to when printing
mozilla::UniquePtr<nsPrintObject> mPrintObject;
- nsPrintObject* mSelectedPO; // This is a non-owning pointer.
nsCOMArray<nsIWebProgressListener> mPrintProgressListeners;
nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams;
nsCOMPtr<nsPIDOMWindowOuter> mCurrentFocusWin; // cache a pointer to the currently focused window
// Array of non-owning pointers to all the nsPrintObjects owned by this
// nsPrintData. This includes this->mPrintObject, as well as all of its
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -3261,17 +3261,16 @@ nsPrintEngine::FindPrintObjectByDOMWin(n
nsresult
nsPrintEngine::EnablePOsForPrinting()
{
// Guarantee that mPrt and the objects it owns won't be deleted.
RefPtr<nsPrintData> printData = mPrt;
// NOTE: All POs have been "turned off" for printing
// this is where we decided which POs get printed.
- printData->mSelectedPO = nullptr;
if (!printData->mPrintSettings) {
return NS_ERROR_FAILURE;
}
printData->mPrintFrameType = nsIPrintSettings::kNoFrames;
printData->mPrintSettings->GetPrintFrameType(&printData->mPrintFrameType);
@@ -3333,17 +3332,16 @@ nsPrintEngine::EnablePOsForPrinting()
if (printRangeType == nsIPrintSettings::kRangeSelection) {
// If the currentFocusDOMWin can'r be null if something is selected
if (printData->mCurrentFocusWin) {
// Find the selected IFrame
nsPrintObject* po =
FindPrintObjectByDOMWin(printData->mPrintObject.get(),
printData->mCurrentFocusWin);
if (po) {
- printData->mSelectedPO = po;
// Makes sure all of its children are be printed "AsIs"
SetPrintAsIs(po);
// Now, only enable this POs (the selected PO) and all of its children
SetPrintPO(po, true);
// check to see if we have a range selection,
// as oppose to a insert selection
@@ -3386,17 +3384,16 @@ nsPrintEngine::EnablePOsForPrinting()
if (printRangeType == nsIPrintSettings::kRangeSelection) {
// If the currentFocusDOMWin can'r be null if something is selected
if (printData->mCurrentFocusWin) {
// Find the selected IFrame
nsPrintObject* po =
FindPrintObjectByDOMWin(printData->mPrintObject.get(),
printData->mCurrentFocusWin);
if (po) {
- printData->mSelectedPO = po;
// Makes sure all of its children are be printed "AsIs"
SetPrintAsIs(po);
// Now, only enable this POs (the selected PO) and all of its children
SetPrintPO(po, true);
// check to see if we have a range selection,
// as oppose to a insert selection
@@ -3432,17 +3429,16 @@ nsPrintEngine::EnablePOsForPrinting()
// children to be printed
if (printData->mPrintFrameType == nsIPrintSettings::kSelectedFrame) {
if ((printData->mIsParentAFrameSet && printData->mCurrentFocusWin) ||
printData->mIsIFrameSelected) {
nsPrintObject* po =
FindPrintObjectByDOMWin(printData->mPrintObject.get(),
printData->mCurrentFocusWin);
if (po) {
- printData->mSelectedPO = po;
// NOTE: Calling this sets the "po" and
// we don't want to do this for documents that have no children,
// because then the "DoEndPage" gets called and it shouldn't
if (po->mKids.Length() > 0) {
// Makes sure that itself, and all of its children are printed "AsIs"
SetPrintAsIs(po);
}