Commit a26f4f24 authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1642167. Group kRangeAllPages and kRangeSpecifiedPageRange code in...

Bug 1642167. Group kRangeAllPages and kRangeSpecifiedPageRange code in nsPrintJob::EnablePOsForPrinting. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D77600
parent cc617abe
......@@ -2680,14 +2680,15 @@ nsresult nsPrintJob::EnablePOsForPrinting() {
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
PR_PL(("----\n"));
bool treatAsNonFrameset = !printData->mIsParentAFrameSet ||
printRangeType == nsIPrintSettings::kRangeSelection;
if (treatAsNonFrameset &&
(printRangeType == nsIPrintSettings::kRangeAllPages ||
printRangeType == nsIPrintSettings::kRangeSpecifiedPageRange)) {
if (printRangeType == nsIPrintSettings::kRangeAllPages ||
printRangeType == nsIPrintSettings::kRangeSpecifiedPageRange) {
printData->mPrintObject->EnablePrinting(true);
if (printData->mIsParentAFrameSet) {
printData->mPrintObject->SetPrintAsIs(true);
return NS_OK;
}
// Set the children so they are PrinAsIs
// In this case, the children are probably IFrames
if (printData->mPrintObject->mKids.Length() > 0) {
......@@ -2703,7 +2704,9 @@ nsresult nsPrintJob::EnablePOsForPrinting() {
// This means we are either printed a selected IFrame or
// we are printing the current selection
if (printRangeType == nsIPrintSettings::kRangeSelection) {
MOZ_ASSERT(printRangeType == nsIPrintSettings::kRangeSelection);
// If the currentFocusDOMWin can'r be null if something is selected
if (printData->mCurrentFocusWin) {
// Find the selected IFrame
......@@ -2732,7 +2735,7 @@ nsresult nsPrintJob::EnablePOsForPrinting() {
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
} else if (treatAsNonFrameset) {
} else {
for (uint32_t i = 0; i < printData->mPrintDocList.Length(); i++) {
nsPrintObject* po = printData->mPrintDocList.ElementAt(i);
NS_ASSERTION(po, "nsPrintObject can't be null!");
......@@ -2745,13 +2748,6 @@ nsresult nsPrintJob::EnablePOsForPrinting() {
}
return NS_OK;
}
}
if (printRangeType != nsIPrintSettings::kRangeSelection) {
printData->mPrintObject->SetPrintAsIs(true);
printData->mPrintObject->EnablePrinting(true);
return NS_OK;
}
if ((printData->mIsParentAFrameSet && printData->mCurrentFocusWin) ||
printData->mIsIFrameSelected) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment