Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Issue 7647010: Print preview page selection should not require a rerendering of draft pages. (Closed)

Created:
9 years, 4 months ago by kmadhusu
Modified:
9 years, 3 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., arv (Not doing code reviews), darin-cc_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

Print preview page selection should not require a rerendering of draft pages. On page selection, regenerate the complete document with the selection, but preserve the existing draft pages and simply display a subset of them. Added a new param |clear all preview data| to |PrintHostMsg_DidGetPreviewPageCount|. BUG=84383 TEST=print preview works after code changes. Please refer to try bot results in Patch 12 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98926

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : Fix win browser_test failures. #

Total comments: 2

Patch Set 4 : Rebased with trunk code #

Patch Set 5 : Fixed merge conflicts #

Patch Set 6 : Fixed merge conflicts #

Patch Set 7 : '' #

Patch Set 8 : Merge + fix conflicts #

Patch Set 9 : sample working code #

Patch Set 10 : '' #

Patch Set 11 : '' #

Patch Set 12 : '' #

Total comments: 25

Patch Set 13 : Fix test failures + Addressed review comments. #

Patch Set 14 : Fixed comment #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+477 lines, -138 lines) Patch
M chrome/browser/printing/print_preview_data_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/printing/print_preview_data_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +17 lines, -0 lines 0 comments Download
M chrome/browser/printing/print_preview_message_handler.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/printing/print_preview_message_handler.cc View 1 2 3 4 5 6 7 4 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/resources/print_preview/page_settings.js View 4 chunks +11 lines, -5 lines 0 comments Download
M chrome/browser/resources/print_preview/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 11 chunks +109 lines, -17 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +27 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_ui.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/common/print_messages.h View 1 2 3 4 5 6 7 2 chunks +4 lines, -1 line 0 comments Download
M chrome/renderer/mock_printer.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/renderer/mock_printer.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M chrome/renderer/mock_render_thread.cc View 1 2 3 4 5 6 7 2 chunks +24 lines, -2 lines 0 comments Download
M chrome/renderer/print_web_view_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +22 lines, -8 lines 0 comments Download
M chrome/renderer/print_web_view_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 chunks +71 lines, -31 lines 4 comments Download
M chrome/renderer/print_web_view_helper_browsertest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +60 lines, -3 lines 2 comments Download
M chrome/renderer/print_web_view_helper_linux.cc View 1 2 3 4 5 6 7 2 chunks +17 lines, -7 lines 0 comments Download
M chrome/renderer/print_web_view_helper_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +54 lines, -36 lines 0 comments Download
M chrome/renderer/print_web_view_helper_win.cc View 1 2 3 4 5 6 7 2 chunks +21 lines, -9 lines 0 comments Download
M chrome/test/data/webui/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +10 lines, -9 lines 0 comments Download
M printing/print_job_constants.h View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M printing/print_job_constants.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
kmadhusu
9 years, 4 months ago (2011-08-16 00:33:01 UTC) #1
vandebo (ex-Chrome)
LGTM
9 years, 4 months ago (2011-08-16 16:41:48 UTC) #2
Chris Guillory
http://codereview.chromium.org/7647010/diff/4001/chrome/renderer/mock_printer.cc File chrome/renderer/mock_printer.cc (right): http://codereview.chromium.org/7647010/diff/4001/chrome/renderer/mock_printer.cc#newcode105 chrome/renderer/mock_printer.cc:105: memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); Looking at this further I think ...
9 years, 4 months ago (2011-08-16 20:08:53 UTC) #3
kmadhusu
http://codereview.chromium.org/7647010/diff/4001/chrome/renderer/mock_printer.cc File chrome/renderer/mock_printer.cc (right): http://codereview.chromium.org/7647010/diff/4001/chrome/renderer/mock_printer.cc#newcode105 chrome/renderer/mock_printer.cc:105: memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); On 2011/08/16 20:08:53, Chris Guillory wrote: ...
9 years, 4 months ago (2011-08-16 20:53:21 UTC) #4
kmadhusu
vandebo: Please review the latest patch.
9 years, 3 months ago (2011-08-29 16:52:10 UTC) #5
vandebo (ex-Chrome)
LGTM with comments. http://codereview.chromium.org/7647010/diff/31001/chrome/browser/printing/print_preview_data_service.h File chrome/browser/printing/print_preview_data_service.h (right): http://codereview.chromium.org/7647010/diff/31001/chrome/browser/printing/print_preview_data_service.h#newcode44 chrome/browser/printing/print_preview_data_service.h:44: bool IsDraftPagesAvailable(const std::string& preview_ui_addr_str, This API ...
9 years, 3 months ago (2011-08-29 18:21:56 UTC) #6
kmadhusu
Fixed nits and browser test failures. http://codereview.chromium.org/7647010/diff/31001/chrome/browser/printing/print_preview_data_service.h File chrome/browser/printing/print_preview_data_service.h (right): http://codereview.chromium.org/7647010/diff/31001/chrome/browser/printing/print_preview_data_service.h#newcode44 chrome/browser/printing/print_preview_data_service.h:44: bool IsDraftPagesAvailable(const std::string& ...
9 years, 3 months ago (2011-08-30 17:27:00 UTC) #7
vandebo (ex-Chrome)
LGTM http://codereview.chromium.org/7647010/diff/31001/chrome/renderer/print_web_view_helper_mac.mm File chrome/renderer/print_web_view_helper_mac.mm (right): http://codereview.chromium.org/7647010/diff/31001/chrome/renderer/print_web_view_helper_mac.mm#newcode80 chrome/renderer/print_web_view_helper_mac.mm:80: // If the page needs to be in ...
9 years, 3 months ago (2011-08-30 21:18:42 UTC) #8
Lei Zhang
http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_view_helper.cc File chrome/renderer/print_web_view_helper.cc (right): http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_view_helper.cc#newcode1372 chrome/renderer/print_web_view_helper.cc:1372: for (int i = 0; i < total_page_count_; i++) ...
9 years, 3 months ago (2011-09-01 05:16:51 UTC) #9
kmadhusu
9 years, 3 months ago (2011-09-01 20:21:16 UTC) #10
http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_v...
File chrome/renderer/print_web_view_helper.cc (right):

http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_v...
chrome/renderer/print_web_view_helper.cc:1372: for (int i = 0; i <
total_page_count_; i++)
On 2011/09/01 05:16:51, Lei Zhang wrote:
> nit: ++i here and below.

will submit a new CL to address this.

http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_v...
chrome/renderer/print_web_view_helper.cc:1375: int pages_index = 0;
On 2011/09/01 05:16:51, Lei Zhang wrote:
> So if I understand this correctly, if the user opens a 1000 page document,
then
> immediately selects page 2, we'll generate a metafile for page 2, and then go
> back and generate the other 999 pages immediately, rather than on-demand?

Yes. We generate 999 draft pages only if required. If the browser has all the
required draft pages then we will generate only the complete metafile for the
selected page range.

http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_v...
File chrome/renderer/print_web_view_helper_browsertest.cc (right):

http://codereview.chromium.org/7647010/diff/30008/chrome/renderer/print_web_v...
chrome/renderer/print_web_view_helper_browsertest.cc:394:
TEST_F(PrintWebViewHelperPreviewTest, OnPrintPreviewForSelectedPages) {
On 2011/09/01 05:16:51, Lei Zhang wrote:
> You should add a test case using kLongPageHTML. Testing seleting page 1 on a 1
> page document is not very interesting.

This test is to verify that we generate only the complete metafile and not the
draft metafile. I dont think it will make a difference if the initiator page is
long.

Powered by Google App Engine
This is Rietveld 408576698