Bug 53466 - Move WebKit2 to printing via API methods
Summary: Move WebKit2 to printing via API methods
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Printing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.6
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 18:22 PST by Alexey Proskuryakov
Modified: 2011-01-31 22:51 PST (History)
3 users (show)

See Also:


Attachments
proposed patch (12.24 KB, patch)
2011-01-31 18:41 PST, Alexey Proskuryakov
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2011-01-31 18:22:08 PST
We don't really need to use private methods. Patch forthcoming.
Comment 1 Alexey Proskuryakov 2011-01-31 18:41:05 PST
Created attachment 80706 [details]
proposed patch
Comment 2 Alexey Proskuryakov 2011-01-31 18:41:55 PST
Sorry that this includes some unrelated fixes which I had to make to meaningfully debug this. These are small and hopefully won't make reviewing much harder.
Comment 3 Maciej Stachowiak 2011-01-31 19:06:56 PST
Comment on attachment 80706 [details]
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=80706&action=review

r=me but see comments

> Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm:114
> +    return [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];

Perhaps it's worth it to encapsulate this dictionary lookup and its comment in a method, so that the  similar calls below could reuse it.

> Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm:123
> +    // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
> +    NSUInteger firstPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
> +    NSUInteger lastPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintLastPage] unsignedIntegerValue];

Aforementioned similar calls.

> Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm:166
> +            if (data) {

Is it possible to change this if block to an early return with the reverse condition?
Comment 4 Alexey Proskuryakov 2011-01-31 21:55:26 PST
> Is it possible to change this if block to an early return with the reverse condition?

It's not, but only because the block encompassed too much code. Fixed now.

Committed <http://trac.webkit.org/changeset/77220>.