| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 , m_linkedDestinationsValid(false) | 47 , m_linkedDestinationsValid(false) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 PrintContext::~PrintContext() | 51 PrintContext::~PrintContext() |
| 52 { | 52 { |
| 53 if (m_isPrinting) | 53 if (m_isPrinting) |
| 54 end(); | 54 end(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
ht, float footerHeight, float userScaleFactor, float& outPageHeight, bool allowH
orizontalTiling) | 57 void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
ht, float footerHeight, float userScaleFactor, float& outPageHeight) |
| 58 { | 58 { |
| 59 m_pageRects.clear(); | 59 m_pageRects.clear(); |
| 60 outPageHeight = 0; | 60 outPageHeight = 0; |
| 61 | 61 |
| 62 if (!m_frame->document() || !m_frame->view() || !m_frame->document()->render
View()) | 62 if (!m_frame->document() || !m_frame->view() || !m_frame->document()->render
View()) |
| 63 return; | 63 return; |
| 64 | 64 |
| 65 if (userScaleFactor <= 0) { | 65 if (userScaleFactor <= 0) { |
| 66 WTF_LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor); | 66 WTF_LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor); |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 | 69 |
| 70 RenderView* view = m_frame->document()->renderView(); | 70 RenderView* view = m_frame->document()->renderView(); |
| 71 const IntRect& documentRect = view->documentRect(); | 71 const IntRect& documentRect = view->documentRect(); |
| 72 FloatSize pageSize = m_frame->resizePageRectsKeepingRatio(FloatSize(printRec
t.width(), printRect.height()), FloatSize(documentRect.width(), documentRect.hei
ght())); | 72 FloatSize pageSize = m_frame->resizePageRectsKeepingRatio(FloatSize(printRec
t.width(), printRect.height()), FloatSize(documentRect.width(), documentRect.hei
ght())); |
| 73 float pageWidth = pageSize.width(); | 73 float pageWidth = pageSize.width(); |
| 74 float pageHeight = pageSize.height(); | 74 float pageHeight = pageSize.height(); |
| 75 | 75 |
| 76 outPageHeight = pageHeight; // this is the height of the page adjusted by ma
rgins | 76 outPageHeight = pageHeight; // this is the height of the page adjusted by ma
rgins |
| 77 pageHeight -= headerHeight + footerHeight; | 77 pageHeight -= headerHeight + footerHeight; |
| 78 | 78 |
| 79 if (pageHeight <= 0) { | 79 if (pageHeight <= 0) { |
| 80 WTF_LOG_ERROR("pageHeight has bad value %.2f", pageHeight); | 80 WTF_LOG_ERROR("pageHeight has bad value %.2f", pageHeight); |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 | 83 |
| 84 computePageRectsWithPageSizeInternal(FloatSize(pageWidth / userScaleFactor,
pageHeight / userScaleFactor), allowHorizontalTiling); | 84 computePageRectsWithPageSizeInternal(FloatSize(pageWidth / userScaleFactor,
pageHeight / userScaleFactor), false); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void PrintContext::computePageRectsWithPageSize(const FloatSize& pageSizeInPixel
s, bool allowHorizontalTiling) | 87 void PrintContext::computePageRectsWithPageSize(const FloatSize& pageSizeInPixel
s, bool allowHorizontalTiling) |
| 88 { | 88 { |
| 89 m_pageRects.clear(); | 89 m_pageRects.clear(); |
| 90 computePageRectsWithPageSizeInternal(pageSizeInPixels, allowHorizontalTiling
); | 90 computePageRectsWithPageSizeInternal(pageSizeInPixels, allowHorizontalTiling
); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PrintContext::computePageRectsWithPageSizeInternal(const FloatSize& pageSiz
eInPixels, bool allowInlineDirectionTiling) | 93 void PrintContext::computePageRectsWithPageSizeInternal(const FloatSize& pageSiz
eInPixels, bool allowInlineDirectionTiling) |
| 94 { | 94 { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 void PrintContext::trace(Visitor* visitor) | 318 void PrintContext::trace(Visitor* visitor) |
| 319 { | 319 { |
| 320 #if ENABLE(OILPAN) | 320 #if ENABLE(OILPAN) |
| 321 visitor->trace(m_linkedDestinations); | 321 visitor->trace(m_linkedDestinations); |
| 322 #endif | 322 #endif |
| 323 } | 323 } |
| 324 | 324 |
| 325 } | 325 } |
| OLD | NEW |