OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
3 * Copyright (C) 2007 Apple Inc. | 3 * Copyright (C) 2007 Apple Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 : inline_direction_start - page_logical_width; | 144 : inline_direction_start - page_logical_width; |
145 IntRect page_rect(page_logical_left, page_logical_top, page_logical_width, | 145 IntRect page_rect(page_logical_left, page_logical_top, page_logical_width, |
146 page_logical_height); | 146 page_logical_height); |
147 if (!is_horizontal) | 147 if (!is_horizontal) |
148 page_rect = page_rect.TransposedRect(); | 148 page_rect = page_rect.TransposedRect(); |
149 page_rects_.push_back(page_rect); | 149 page_rects_.push_back(page_rect); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 void PrintContext::BeginPrintMode(float width, float height) { | 153 void PrintContext::BeginPrintMode(float width, float height) { |
154 ASSERT(width > 0); | 154 DCHECK_GT(width, 0); |
155 ASSERT(height > 0); | 155 DCHECK_GT(height, 0); |
156 | 156 |
157 // This function can be called multiple times to adjust printing parameters | 157 // This function can be called multiple times to adjust printing parameters |
158 // without going back to screen mode. | 158 // without going back to screen mode. |
159 is_printing_ = true; | 159 is_printing_ = true; |
160 | 160 |
161 FloatSize original_page_size = FloatSize(width, height); | 161 FloatSize original_page_size = FloatSize(width, height); |
162 FloatSize min_layout_size = frame_->ResizePageRectsKeepingRatio( | 162 FloatSize min_layout_size = frame_->ResizePageRectsKeepingRatio( |
163 original_page_size, FloatSize(width * kPrintingMinimumShrinkFactor, | 163 original_page_size, FloatSize(width * kPrintingMinimumShrinkFactor, |
164 height * kPrintingMinimumShrinkFactor)); | 164 height * kPrintingMinimumShrinkFactor)); |
165 | 165 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 337 } |
338 | 338 |
339 ScopedPrintContext::ScopedPrintContext(LocalFrame* frame) | 339 ScopedPrintContext::ScopedPrintContext(LocalFrame* frame) |
340 : context_(new PrintContext(frame)) {} | 340 : context_(new PrintContext(frame)) {} |
341 | 341 |
342 ScopedPrintContext::~ScopedPrintContext() { | 342 ScopedPrintContext::~ScopedPrintContext() { |
343 context_->EndPrintMode(); | 343 context_->EndPrintMode(); |
344 } | 344 } |
345 | 345 |
346 } // namespace blink | 346 } // namespace blink |
OLD | NEW |