Bug 77197 - [GTK] Handle printing errors in WebKit2
Summary: [GTK] Handle printing errors in WebKit2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on: 79120
Blocks: 75544
  Show dependency treegraph
 
Reported: 2012-01-27 02:28 PST by Carlos Garcia Campos
Modified: 2012-03-14 10:57 PDT (History)
3 users (show)

See Also:


Attachments
Patch (34.58 KB, patch)
2012-02-21 09:32 PST, Carlos Garcia Campos
gustavo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2012-01-27 02:28:16 PST
Printing errors should be sent from the web process to the ui process in the callback used by DrawPagesForPrinting message.
Comment 1 Carlos Garcia Campos 2012-02-21 09:32:32 PST
Created attachment 127987 [details]
Patch
Comment 2 WebKit Commit Bot 2012-02-23 19:39:41 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Gustavo Noronha (kov) 2012-03-14 10:00:26 PDT
Comment on attachment 127987 [details]
Patch

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

OK, looks good to me!

> Source/WebKit2/UIProcess/API/gtk/WebKitError.h:112
> + * @WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE: There are no pages to print

Nit: Invalid page ranges could include pages that exist, so perhaps saying there are no pages is not the most conceptually correct here. Go for Invalid page range?

> Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp:207
> +     * finishes after an error and #WebKitPrintOperation::finished signal is emitted
> +     * after this one.

Suggestion: replace the last sentence with just The #WebKitPrintOperation::finished signal is emitted after this one.

> Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp:102
> +        if (strcmp(gtk_printer_get_name(printer), "Print to File"))

Hrm. Something just popped on my mind. Does gtk_printer_get_name() return the localized string? I guess all of us run our systems in English, but be good to make this robust.
Comment 4 Carlos Garcia Campos 2012-03-14 10:05:41 PDT
(In reply to comment #3)
> (From update of attachment 127987 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=127987&action=review
> 
> OK, looks good to me!

Thanks for reviewing it!

> > Source/WebKit2/UIProcess/API/gtk/WebKitError.h:112
> > + * @WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE: There are no pages to print
> 
> Nit: Invalid page ranges could include pages that exist, so perhaps saying there are no pages is not the most conceptually correct here. Go for Invalid page range?

Invalid page range sounds good to me.

> > Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp:207
> > +     * finishes after an error and #WebKitPrintOperation::finished signal is emitted
> > +     * after this one.
> 
> Suggestion: replace the last sentence with just The #WebKitPrintOperation::finished signal is emitted after this one.

Ok.

> > Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp:102
> > +        if (strcmp(gtk_printer_get_name(printer), "Print to File"))
> 
> Hrm. Something just popped on my mind. Does gtk_printer_get_name() return the localized string? I guess all of us run our systems in English, but be good to make this robust.

Yes, it returned the localized string, but gtk_test_init() resets the locale to C for that reason, making sure unit tests always run with the C locale. My system locale is ES indeed, and test work without problems :-)
Comment 5 Carlos Garcia Campos 2012-03-14 10:57:20 PDT
Committed r110714: <http://trac.webkit.org/changeset/110714>