| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (!m_frame->document() || !m_frame->view() || | 60 if (!m_frame->document() || !m_frame->view() || |
| 61 m_frame->document()->layoutViewItem().isNull()) | 61 m_frame->document()->layoutViewItem().isNull()) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 if (userScaleFactor <= 0) { | 64 if (userScaleFactor <= 0) { |
| 65 DLOG(ERROR) << "userScaleFactor has bad value " << userScaleFactor; | 65 DLOG(ERROR) << "userScaleFactor has bad value " << userScaleFactor; |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 | 68 |
| 69 LayoutViewItem view = m_frame->document()->layoutViewItem(); | 69 LayoutViewItem view = m_frame->document()->layoutViewItem(); |
| 70 const IntRect& documentRect = view.documentRect(); | 70 const IntRect& documentRect0 = view.documentRect(); |
| 71 IntSize layout1Rect = view.layoutSize(IncludeScrollbars); |
| 72 IntRect documentRect(documentRect0.location(), layout1Rect); |
| 73 |
| 71 FloatSize pageSize = m_frame->resizePageRectsKeepingRatio( | 74 FloatSize pageSize = m_frame->resizePageRectsKeepingRatio( |
| 72 FloatSize(printRect.width(), printRect.height()), | 75 FloatSize(printRect.width(), printRect.height()), |
| 73 FloatSize(documentRect.width(), documentRect.height())); | 76 FloatSize(documentRect.width(), documentRect.height())); |
| 74 float pageWidth = pageSize.width(); | 77 float pageWidth = pageSize.width(); |
| 75 float pageHeight = pageSize.height(); | 78 float pageHeight = pageSize.height(); |
| 76 | 79 |
| 77 outPageHeight = | 80 outPageHeight = |
| 78 pageHeight; // this is the height of the page adjusted by margins | 81 pageHeight; // this is the height of the page adjusted by margins |
| 79 pageHeight -= headerHeight + footerHeight; | 82 pageHeight -= headerHeight + footerHeight; |
| 80 | 83 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 94 } | 97 } |
| 95 | 98 |
| 96 void PrintContext::computePageRectsWithPageSizeInternal( | 99 void PrintContext::computePageRectsWithPageSizeInternal( |
| 97 const FloatSize& pageSizeInPixels) { | 100 const FloatSize& pageSizeInPixels) { |
| 98 if (!m_frame->document() || !m_frame->view() || | 101 if (!m_frame->document() || !m_frame->view() || |
| 99 m_frame->document()->layoutViewItem().isNull()) | 102 m_frame->document()->layoutViewItem().isNull()) |
| 100 return; | 103 return; |
| 101 | 104 |
| 102 LayoutViewItem view = m_frame->document()->layoutViewItem(); | 105 LayoutViewItem view = m_frame->document()->layoutViewItem(); |
| 103 | 106 |
| 104 IntRect docRect = view.documentRect(); | 107 IntRect docRect0 = view.documentRect(); |
| 108 IntRect viewRect(view.viewRect()); |
| 109 IntSize layoutRect = view.layoutSize(); |
| 110 IntSize layout1Rect = view.layoutSize(IncludeScrollbars); |
| 111 IntRect docRect(docRect0.location(), layout1Rect); |
| 105 | 112 |
| 106 int pageWidth = pageSizeInPixels.width(); | 113 int pageWidth = pageSizeInPixels.width(); |
| 107 // We scaled with floating point arithmetic and need to ensure results like | 114 // We scaled with floating point arithmetic and need to ensure results like |
| 108 // 13329.99 are treated as 13330 so that we don't mistakenly assign an extra | 115 // 13329.99 are treated as 13330 so that we don't mistakenly assign an extra |
| 109 // page for the stray pixel. | 116 // page for the stray pixel. |
| 110 int pageHeight = pageSizeInPixels.height() + LayoutUnit::epsilon(); | 117 int pageHeight = pageSizeInPixels.height() + LayoutUnit::epsilon(); |
| 111 | 118 |
| 112 bool isHorizontal = view.style()->isHorizontalWritingMode(); | 119 bool isHorizontal = view.style()->isHorizontalWritingMode(); |
| 113 | 120 |
| 114 int docLogicalHeight = isHorizontal ? docRect.height() : docRect.width(); | 121 int docLogicalHeight = isHorizontal ? docRect.height() : docRect.width(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 printContext.computePageRectsWithPageSize(scaledPageSize); | 349 printContext.computePageRectsWithPageSize(scaledPageSize); |
| 343 return printContext.pageCount(); | 350 return printContext.pageCount(); |
| 344 } | 351 } |
| 345 | 352 |
| 346 DEFINE_TRACE(PrintContext) { | 353 DEFINE_TRACE(PrintContext) { |
| 347 visitor->trace(m_frame); | 354 visitor->trace(m_frame); |
| 348 visitor->trace(m_linkedDestinations); | 355 visitor->trace(m_linkedDestinations); |
| 349 } | 356 } |
| 350 | 357 |
| 351 } // namespace blink | 358 } // namespace blink |
| OLD | NEW |