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

Unified Diff: printing/page_setup.cc

Issue 8328001: For no margins, or printable area margins, don't factor in the header/footer size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 9 years, 2 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/page_setup.h ('k') | printing/print_settings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/page_setup.cc
diff --git a/printing/page_setup.cc b/printing/page_setup.cc
index 2411f6fb98954107b1a8e48453ec31ab1718edca..b870323e04cc3c7180faaf1e798de0d251818ddb 100644
--- a/printing/page_setup.cc
+++ b/printing/page_setup.cc
@@ -76,19 +76,19 @@ void PageSetup::Init(const gfx::Size& physical_size,
printable_area_ = printable_area;
text_height_ = text_height;
- CalculateSizesWithinRect(printable_area_);
+ CalculateSizesWithinRect(printable_area_, text_height_);
}
void PageSetup::SetRequestedMargins(const PageMargins& requested_margins) {
requested_margins_ = requested_margins;
if (printable_area_.width() && printable_area_.height())
- CalculateSizesWithinRect(printable_area_);
+ CalculateSizesWithinRect(printable_area_, text_height_);
}
void PageSetup::ForceRequestedMargins(const PageMargins& requested_margins) {
requested_margins_ = requested_margins;
if (physical_size_.width() && physical_size_.height())
- CalculateSizesWithinRect(gfx::Rect(physical_size_));
+ CalculateSizesWithinRect(gfx::Rect(physical_size_), 0);
}
void PageSetup::FlipOrientation() {
@@ -104,7 +104,8 @@ void PageSetup::FlipOrientation() {
}
}
-void PageSetup::CalculateSizesWithinRect(const gfx::Rect& bounds) {
+void PageSetup::CalculateSizesWithinRect(const gfx::Rect& bounds,
+ int text_height) {
// Calculate the effective margins. The tricky part.
effective_margins_.header = std::max(requested_margins_.header,
bounds.y());
@@ -115,14 +116,14 @@ void PageSetup::CalculateSizesWithinRect(const gfx::Rect& bounds) {
bounds.x());
effective_margins_.top = std::max(std::max(requested_margins_.top,
bounds.y()),
- effective_margins_.header + text_height_);
+ effective_margins_.header + text_height);
effective_margins_.right = std::max(requested_margins_.right,
physical_size_.width() -
bounds.right());
effective_margins_.bottom =
std::max(std::max(requested_margins_.bottom,
physical_size_.height() - bounds.bottom()),
- effective_margins_.footer + text_height_);
+ effective_margins_.footer + text_height);
// Calculate the overlay area. If the margins are excessive, the overlay_area
// size will be (0, 0).
« no previous file with comments | « printing/page_setup.h ('k') | printing/print_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698