Bug 1360135 Get rid of nsPrintData::mSelectedPO because it's unused r?dholbert draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 10 May 2017 17:25:56 +0900
changeset 580068 7cc6128238179733b9a22d5c34cd6658bbf82839
parent 579879 2c783a7b6d05b4b2b417bc5f21b7e40cbf3df077
child 580242 0af33c971469c19de60ed36f6a7f8b850f19d85a
child 581127 ed9037a80cdcafb2e1678d0896010a23c6f5f7fc
push id59438
push usermasayuki@d-toybox.com
push dateThu, 18 May 2017 05:22:56 +0000
reviewersdholbert
bugs1360135
milestone55.0a1
Bug 1360135 Get rid of nsPrintData::mSelectedPO because it's unused r?dholbert MozReview-Commit-ID: 3nG5ZPXOsvq
layout/printing/nsPrintData.cpp
layout/printing/nsPrintData.h
layout/printing/nsPrintEngine.cpp
--- 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);
         }