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

Unified Diff: printing/printed_document_win.cc

Issue 2878022: Add PrintedPage::GetCenteredPageContentRect so Mac and Win can share code. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: remove #include for gtest Created 10 years, 5 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 | « printing/printed_document_mac.cc ('k') | printing/printed_page.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printed_document_win.cc
diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc
index e80ac78a749e6576aef22ee12fa726e08ed514b5..ac5008c98a7698cbe116de9a3f3e977b1cf6fe37 100644
--- a/printing/printed_document_win.cc
+++ b/printing/printed_document_win.cc
@@ -51,17 +51,8 @@ void PrintedDocument::RenderPrintedPage(
const printing::PageSetup& page_setup(
immutable_.settings_.page_setup_device_units());
- gfx::Rect content_area(page.page_content_rect());
- const gfx::Size& physical_size = page_setup.physical_size();
- // http://dev.w3.org/csswg/css3-page/#positioning-page-box
- if (physical_size.width() > page.page_size().width()) {
- int diff = physical_size.width() - page.page_size().width();
- content_area.set_x(content_area.x() + diff / 2);
- }
- if (physical_size.height() > page.page_size().height()) {
- int diff = physical_size.height() - page.page_size().height();
- content_area.set_y(content_area.y() + diff / 2);
- }
+ gfx::Rect content_area;
+ page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area);
// Save the state to make sure the context this function call does not modify
// the device context.
« no previous file with comments | « printing/printed_document_mac.cc ('k') | printing/printed_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698