diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 00:15:21 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 00:15:21 +0000 |
commit | d69d322dcd9d2ace6b0f27d958db6894d1cfb080 (patch) | |
tree | 46bf39a09da4838796163b09be4053e229ca7e67 /printing/page_setup.cc | |
parent | 1eec5ca7adc5b5ac202af117a95d2e3e96831e20 (diff) | |
download | chromium_src-d69d322dcd9d2ace6b0f27d958db6894d1cfb080.zip chromium_src-d69d322dcd9d2ace6b0f27d958db6894d1cfb080.tar.gz chromium_src-d69d322dcd9d2ace6b0f27d958db6894d1cfb080.tar.bz2 |
For no margins, or printable area margins, don't factor in the header/footer size.
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/8328001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105973 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/page_setup.cc')
-rw-r--r-- | printing/page_setup.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/printing/page_setup.cc b/printing/page_setup.cc index 2411f6f..b870323e 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). |