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

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: Merge with trunk. 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..ce5a764f175597aa76b5ac7d60af000973cdd96f 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(
@@ -486,7 +488,8 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
web_view_(frame->view()),
expected_pages_count_(0),
use_browser_overlays_(true),
- finished_(false) {
+ finished_(false),
+ should_print_backgrounds_(print_params.should_print_backgrounds) {
WebKit::WebPrintParams webkit_print_params;
ComputeWebKitPrintParamsInDesiredDpi(print_params, &webkit_print_params);
@@ -507,6 +510,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 +549,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 +560,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 +1357,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