Closed Bug 1238964 Opened 8 years ago Closed 8 years ago

Printing via parent doesn't handle paper sizes correctly.

Categories

(Core :: Security: Process Sandboxing, defect)

46 Branch
All
Windows
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: bobowen, Assigned: bobowen)

References

Details

Attachments

(2 files, 1 obsolete file)

This was found when I landed bug 1156742, so printing via parent had to be disabled.

The paper size wasn't getting passed down to the content process as I thought.
By chance the profiles I'd used for testing worked.

I've broken this out into a separate bug so I can land the fix separately for testing first.
Then I'll re-land the default print via parent pref in bug 115742, which got reopened.

I have a patch, but I want to do some extra tidying in some related code as well.
Summary: Printing via parent doesn't handling paper sizes correctly. → Printing via parent doesn't handle paper sizes correctly.
This also holds the resolution in the print settings, so that we can start to
remove the access to the native Windows print devices in the child process.
Attachment #8709035 - Flags: review?(roc)
This also corrects what I think are long standing issues with the mapping to and
from print settings on Windows.
Firstly it only uses the DEVMODE flags to decide what should get stored, in the
old code if paper size was not set, it would then use that possibly invalid
paper size to map to length and width. Paper setting prefs are mapped back if
they were stored or if they have been manually set to something sane.
Secondly it corrects the calculation that was used to convert from millimeters
to tenths of millimeters.
It also gets rid of the paperSizeType field, which was only used on Windows and
doesn't actually make sense according to the DEVMODE documentation as the
dmPaperLength and dmPaperWidth fields override the dmPaperSize, but can in
theory be specified at the same time.
Attachment #8709037 - Flags: review?(roc)
Comment on attachment 8709035 [details] [diff] [review]
Part 1: Hold new printable page sizes in print nsIPrintSettingsWin

Sorry roc, hadn't noticed you were out ... jimm's graciously stepped in. :-)
Attachment #8709035 - Flags: review?(roc) → review?(jmathies)
This also corrects what I think are long standing issues with the mapping to and
from print settings on Windows.
Firstly it only uses the DEVMODE flags to decide what should get stored, in the
old code if paper size was not set, it would then use that possibly invalid
paper size to map to length and width. Paper setting prefs are mapped back if
they were stored or if they have been manually set to something sane.
Secondly it corrects the calculation that was used to convert from millimeters
to tenths of millimeters.
It also gets rid of the paperSizeType field, which was only used on Windows and
doesn't actually make sense according to the DEVMODE documentation as the
dmPaperLength and dmPaperWidth fields override the dmPaperSize, but can in
theory be specified at the same time.
Attachment #8709502 - Flags: review?(jmathies)
Attachment #8709037 - Attachment is obsolete: true
Attachment #8709037 - Flags: review?(roc)
Comment on attachment 8709035 [details] [diff] [review]
Part 1: Hold new printable page sizes in print nsIPrintSettingsWin

Review of attachment 8709035 [details] [diff] [review]:
-----------------------------------------------------------------

::: embedding/components/printingui/win/nsPrintDialogUtil.cpp
@@ +985,5 @@
>      // Unlock DeviceNames
>      ::GlobalUnlock(prntdlg.hDevNames);
>  
>      // Transfer the settings from the native data to the PrintSettings
>      LPDEVMODEW devMode = (LPDEVMODEW)::GlobalLock(prntdlg.hDevMode);

would you mind filing a 'good first bug' on creating a mozilla version of ScopedHGlobal and using it in this print code?
Attachment #8709035 - Flags: review?(jmathies) → review+
Comment on attachment 8709502 [details] [diff] [review]
Part 2: Move separate DEVMODE to nsIPrintSettings copying into nsPrintSettingsWin

Review of attachment 8709502 [details] [diff] [review]:
-----------------------------------------------------------------

nice.
Attachment #8709502 - Flags: review?(jmathies) → review+
https://hg.mozilla.org/mozilla-central/rev/e7d43e96b14c
https://hg.mozilla.org/mozilla-central/rev/fb4737474a9c
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Blocks: 1242456
These changes causes build failure with my environment(Win7 64bit, VS2015 64bit).

widget/windows/nsDeviceContextSpecWin.cpp(477): error C2664: 'HDC CreateICW(LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW *)': cannot convert argument 2 from 'const char16_t *' to 'LPCWSTR'
Depends on: 1242952
(In reply to Toshihiro Yamada from comment #11)
> These changes causes build failure with my environment(Win7 64bit, VS2015
> 64bit).
> 
> widget/windows/nsDeviceContextSpecWin.cpp(477): error C2664: 'HDC
> CreateICW(LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW *)': cannot convert
> argument 2 from 'const char16_t *' to 'LPCWSTR'

Thanks, I've filed bug 1242952 and will fix as soon as I can.
Depends on: 1242295
Depends on: 1257825
Depends on: 1260413
Depends on: 1271348
Depends on: 1271900
Depends on: 1280159
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: