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

Side by Side Diff: third_party/WebKit/Source/core/page/PrintContext.cpp

Issue 1558503003: Internals: throw an exception when page height or width is 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 IntRect pageRect(pageLogicalLeft, pageLogicalTop, pageLogicalWidth, page LogicalHeight); 143 IntRect pageRect(pageLogicalLeft, pageLogicalTop, pageLogicalWidth, page LogicalHeight);
144 if (!isHorizontal) 144 if (!isHorizontal)
145 pageRect = pageRect.transposedRect(); 145 pageRect = pageRect.transposedRect();
146 m_pageRects.append(pageRect); 146 m_pageRects.append(pageRect);
147 147
148 } 148 }
149 } 149 }
150 150
151 void PrintContext::begin(float width, float height) 151 void PrintContext::begin(float width, float height)
152 { 152 {
153 ASSERT(width > 0);
154 ASSERT(height > 0);
155
153 // This function can be called multiple times to adjust printing parameters without going back to screen mode. 156 // This function can be called multiple times to adjust printing parameters without going back to screen mode.
154 m_isPrinting = true; 157 m_isPrinting = true;
155 158
156 FloatSize originalPageSize = FloatSize(width, height); 159 FloatSize originalPageSize = FloatSize(width, height);
157 FloatSize minLayoutSize = m_frame->resizePageRectsKeepingRatio(originalPageS ize, FloatSize(width * printingMinimumShrinkFactor, height * printingMinimumShri nkFactor)); 160 FloatSize minLayoutSize = m_frame->resizePageRectsKeepingRatio(originalPageS ize, FloatSize(width * printingMinimumShrinkFactor, height * printingMinimumShri nkFactor));
158 161
159 // This changes layout, so callers need to make sure that they don't paint t o screen while in printing mode. 162 // This changes layout, so callers need to make sure that they don't paint t o screen while in printing mode.
160 m_frame->setPrinting(true, minLayoutSize, originalPageSize, printingMaximumS hrinkFactor / printingMinimumShrinkFactor); 163 m_frame->setPrinting(true, minLayoutSize, originalPageSize, printingMaximumS hrinkFactor / printingMinimumShrinkFactor);
161 } 164 }
162 165
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 314
312 DEFINE_TRACE(PrintContext) 315 DEFINE_TRACE(PrintContext)
313 { 316 {
314 #if ENABLE(OILPAN) 317 #if ENABLE(OILPAN)
315 visitor->trace(m_frame); 318 visitor->trace(m_frame);
316 visitor->trace(m_linkedDestinations); 319 visitor->trace(m_linkedDestinations);
317 #endif 320 #endif
318 } 321 }
319 322
320 } 323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698