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

Side by Side Diff: printing/page_setup.cc

Issue 8054031: Add check to debug issue 96063 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/page_setup.h" 5 #include "printing/page_setup.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 content_area_.set_x(effective_margins_.left); 112 content_area_.set_x(effective_margins_.left);
113 content_area_.set_y(effective_margins_.top); 113 content_area_.set_y(effective_margins_.top);
114 content_area_.set_width(std::max(0, 114 content_area_.set_width(std::max(0,
115 physical_size.width() - 115 physical_size.width() -
116 effective_margins_.right - 116 effective_margins_.right -
117 content_area_.x())); 117 content_area_.x()));
118 content_area_.set_height(std::max(0, 118 content_area_.set_height(std::max(0,
119 physical_size.height() - 119 physical_size.height() -
120 effective_margins_.bottom - 120 effective_margins_.bottom -
121 content_area_.y())); 121 content_area_.y()));
122 // TODO(vandebo) Remove once bug 96063 is resolved.
123 CHECK(content_area_.width() > 0 && content_area_.height() > 0);
Lei Zhang 2011/09/27 23:07:56 How about doing this as two separate checks so you
vandebo (ex-Chrome) 2011/09/27 23:09:44 I can see which one failed by looking at the minid
122 } 124 }
123 125
124 void PageSetup::SetRequestedMargins(const PageMargins& requested_margins) { 126 void PageSetup::SetRequestedMargins(const PageMargins& requested_margins) {
125 requested_margins_ = requested_margins; 127 requested_margins_ = requested_margins;
126 if (physical_size_.width() && physical_size_.height()) 128 if (physical_size_.width() && physical_size_.height())
127 Init(physical_size_, printable_area_, text_height_); 129 Init(physical_size_, printable_area_, text_height_);
128 } 130 }
129 131
130 void PageSetup::FlipOrientation() { 132 void PageSetup::FlipOrientation() {
131 if (physical_size_.width() && physical_size_.height()) { 133 if (physical_size_.width() && physical_size_.height()) {
132 gfx::Size new_size(physical_size_.height(), physical_size_.width()); 134 gfx::Size new_size(physical_size_.height(), physical_size_.width());
133 int new_y = physical_size_.width() - 135 int new_y = physical_size_.width() -
134 (printable_area_.width() + printable_area_.x()); 136 (printable_area_.width() + printable_area_.x());
135 gfx::Rect new_printable_area(printable_area_.y(), 137 gfx::Rect new_printable_area(printable_area_.y(),
136 new_y, 138 new_y,
137 printable_area_.height(), 139 printable_area_.height(),
138 printable_area_.width()); 140 printable_area_.width());
139 Init(new_size, new_printable_area, text_height_); 141 Init(new_size, new_printable_area, text_height_);
140 } 142 }
141 } 143 }
142 144
143 } // namespace printing 145 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698