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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 11818062: Adds option to enable CSS backgrounds for printing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sets should-print-backgrounds setting via print job workers. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | printing/print_job_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper.cc
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index 250ed0fe08332ccc047bedc25deecb241afcb0c4..e7861f4aba6c749591ae908f4066c6f4384a0f66 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -109,7 +109,9 @@ bool PrintMsg_Print_Params_IsEqual(
oldParams.params.title == newParams.params.title &&
oldParams.params.url == newParams.params.url &&
std::equal(oldParams.pages.begin(), oldParams.pages.end(),
- newParams.pages.begin());
+ newParams.pages.begin()) &&
+ oldParams.params.should_print_backgrounds ==
+ newParams.params.should_print_backgrounds;
}
PrintMsg_Print_Params GetCssPrintParams(
@@ -494,6 +496,8 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
prev_scroll_offset_ = web_frame->scrollOffset();
prev_view_size_ = web_view_->size();
+ should_print_backgrounds_ = print_params.should_print_backgrounds;
Lei Zhang 2013/01/11 00:30:04 You can just put this in the initializer list.
Toscano 2013/01/11 01:41:05 Done.
+
StartPrinting(webkit_print_params);
}
@@ -507,6 +511,8 @@ void PrepareFrameAndViewForPrint::UpdatePrintParams(
WebKit::WebPrintParams webkit_print_params;
ComputeWebKitPrintParamsInDesiredDpi(print_params, &webkit_print_params);
+ should_print_backgrounds_ = print_params.should_print_backgrounds;
+
if (webkit_print_params.printContentArea ==
web_print_params_.printContentArea &&
webkit_print_params.printableArea == web_print_params_.printableArea &&
@@ -544,6 +550,8 @@ void PrepareFrameAndViewForPrint::StartPrinting(
expected_pages_count_ = frame_->printBegin(web_print_params_,
node_to_print_,
&use_browser_overlays_);
+
+ web_view_->settings()->setShouldPrintBackgrounds(should_print_backgrounds_);
}
void PrepareFrameAndViewForPrint::FinishPrinting() {
@@ -553,6 +561,7 @@ void PrepareFrameAndViewForPrint::FinishPrinting() {
web_view_->resize(prev_view_size_);
if (WebKit::WebFrame* web_frame = web_view_->mainFrame())
web_frame->setScrollOffset(prev_scroll_offset_);
+ web_view_->settings()->setShouldPrintBackgrounds(false);
}
}
@@ -1349,6 +1358,7 @@ bool PrintWebViewHelper::UpdatePrintSettings(
print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings));
Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(),
settings.params.document_cookie));
+
return true;
}
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698