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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 9699040: PrintPreview: Hide/Show the header footer option based on print frame margins. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 8 years, 9 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
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 5352be313bf617cb8c791af05d0d9de614a5b17c..87adb3b84dedb8370ff84e79c7ababd0bb4e9177 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -873,14 +873,27 @@ bool PrintWebViewHelper::CreatePreviewDocument() {
ComputePageLayoutInPointsForCss(print_preview_context_.frame(), 0,
print_params, ignore_css_margins_,
fit_to_page_, NULL, &default_page_layout);
+
if (!old_print_pages_params_.get() ||
!PageLayoutIsEqual(*old_print_pages_params_, *print_pages_params_)) {
bool has_page_size_style = PrintingFrameHasPageSizeStyle(
print_preview_context_.frame(),
print_preview_context_.total_page_count());
+ int dpi = GetDPI(&print_params);
+ gfx::Rect printable_area_in_points(
+ ConvertUnit(print_pages_params_->params.printable_area.x(),
+ dpi, printing::kPointsPerInch),
+ ConvertUnit(print_pages_params_->params.printable_area.y(),
+ dpi, printing::kPointsPerInch),
+ ConvertUnit(print_pages_params_->params.printable_area.width(),
+ dpi, printing::kPointsPerInch),
+ ConvertUnit(print_pages_params_->params.printable_area.height(),
+ dpi, printing::kPointsPerInch));
+
// Margins: Send default page layout to browser process.
Send(new PrintHostMsg_DidGetDefaultPageLayout(routing_id(),
default_page_layout,
+ printable_area_in_points,
has_page_size_style));
}

Powered by Google App Engine
This is Rietveld 408576698