Bug 33537

Summary: [Windows] More Complete Print Implementation
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
Extend and improve example print implementation darin: review+

Description Brent Fulgham 2010-01-12 09:47:23 PST
Provide a slightly more complete (and correct) implementation of printing in the WinLauncher example program.

This change includes the following:

1.  Print the pages only one time.  Current loop starts at page 0, which tells the print spooler to print all pages.  Then it prints the pages individually.  This results in double printing into the device context, which can create weird print output.

2.  Provide a header and footer implementation that is slightly more useful (showing page numbers and a separating line.)
Comment 1 Brent Fulgham 2010-01-12 09:56:58 PST
Created attachment 46380 [details]
Extend and improve example print implementation
Comment 2 WebKit Review Bot 2010-01-12 09:59:29 PST
Attachment 46380 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
Last 3072 characters of output:
Launcher/PrintWebUIDelegate.cpp:164:  Extra space after ( in function call  [whitespace/parens] [4]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:165:  Declaration has space between type name and * in IWebView *webView  [whitespace/declaration] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:166:  Declaration has space between type name and * in RECT *rect  [whitespace/declaration] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:171:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:174:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:176:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:177:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:179:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:180:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:180:  Should have a space between // and comment  [whitespace/comments] [4]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:181:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:183:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:184:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:185:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:186:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:187:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:188:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:190:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:191:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:193:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
WebKitTools/WinLauncher/PrintWebUIDelegate.cpp:196:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 59
Comment 3 Darin Adler 2010-01-12 11:01:12 PST
Comment on attachment 46380 [details]
Extend and improve example print implementation

> +    //rect->right -= MARGIN; 
> +    //rect->bottom -= MARGIN;

Why leave commented-out code in?

> +   HDC dc = ::GetDC (0);
> +
> +   TEXTMETRIC textMetric;
> +   ::GetTextMetrics (dc, &textMetric);
> +   ::ReleaseDC (0, dc);

Spaces before parentheses here, not usually our style.

Looks OK, rs=me
Comment 4 Brent Fulgham 2010-01-12 12:34:55 PST
Landed in http://trac.webkit.org/changeset/53154.
Comment 5 Brent Fulgham 2010-01-12 12:35:26 PST
(In reply to comment #3)
> (From update of attachment 46380 [details])
> > +    //rect->right -= MARGIN; 
> > +    //rect->bottom -= MARGIN;
> 
> Why leave commented-out code in?

Mistake!  Removed.

> > +   HDC dc = ::GetDC (0);
> > +
> > +   TEXTMETRIC textMetric;
> > +   ::GetTextMetrics (dc, &textMetric);
> > +   ::ReleaseDC (0, dc);
> 
> Spaces before parentheses here, not usually our style.

Fixed.

> Looks OK, rs=me

Landed.  Thanks for the review.