| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // This function can be called multiple times to adjust printing parameters | 170 // This function can be called multiple times to adjust printing parameters |
| 171 // without going back to screen mode. | 171 // without going back to screen mode. |
| 172 m_isPrinting = true; | 172 m_isPrinting = true; |
| 173 | 173 |
| 174 FloatSize originalPageSize = FloatSize(width, height); | 174 FloatSize originalPageSize = FloatSize(width, height); |
| 175 FloatSize minLayoutSize = m_frame->resizePageRectsKeepingRatio( | 175 FloatSize minLayoutSize = m_frame->resizePageRectsKeepingRatio( |
| 176 originalPageSize, FloatSize(width * printingMinimumShrinkFactor, | 176 originalPageSize, FloatSize(width * printingMinimumShrinkFactor, |
| 177 height * printingMinimumShrinkFactor)); | 177 height * printingMinimumShrinkFactor)); |
| 178 | 178 |
| 179 m_frame->view()->setDisableScrollAnchoringForPrinting(true); |
| 180 |
| 179 // This changes layout, so callers need to make sure that they don't paint to | 181 // This changes layout, so callers need to make sure that they don't paint to |
| 180 // screen while in printing mode. | 182 // screen while in printing mode. |
| 181 m_frame->setPrinting( | 183 m_frame->setPrinting( |
| 182 true, minLayoutSize, originalPageSize, | 184 true, minLayoutSize, originalPageSize, |
| 183 printingMaximumShrinkFactor / printingMinimumShrinkFactor); | 185 printingMaximumShrinkFactor / printingMinimumShrinkFactor); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void PrintContext::end() { | 188 void PrintContext::end() { |
| 187 ASSERT(m_isPrinting); | 189 ASSERT(m_isPrinting); |
| 188 m_isPrinting = false; | 190 m_isPrinting = false; |
| 189 m_frame->setPrinting(false, FloatSize(), FloatSize(), 0); | 191 m_frame->setPrinting(false, FloatSize(), FloatSize(), 0); |
| 192 m_frame->view()->setDisableScrollAnchoringForPrinting(false); |
| 190 m_linkedDestinations.clear(); | 193 m_linkedDestinations.clear(); |
| 191 m_linkedDestinationsValid = false; | 194 m_linkedDestinationsValid = false; |
| 192 } | 195 } |
| 193 | 196 |
| 194 static LayoutBoxModelObject* enclosingBoxModelObject(LayoutObject* object) { | 197 static LayoutBoxModelObject* enclosingBoxModelObject(LayoutObject* object) { |
| 195 while (object && !object->isBoxModelObject()) | 198 while (object && !object->isBoxModelObject()) |
| 196 object = object->parent(); | 199 object = object->parent(); |
| 197 if (!object) | 200 if (!object) |
| 198 return nullptr; | 201 return nullptr; |
| 199 return toLayoutBoxModelObject(object); | 202 return toLayoutBoxModelObject(object); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 printContext.computePageRectsWithPageSize(scaledPageSize); | 345 printContext.computePageRectsWithPageSize(scaledPageSize); |
| 343 return printContext.pageCount(); | 346 return printContext.pageCount(); |
| 344 } | 347 } |
| 345 | 348 |
| 346 DEFINE_TRACE(PrintContext) { | 349 DEFINE_TRACE(PrintContext) { |
| 347 visitor->trace(m_frame); | 350 visitor->trace(m_frame); |
| 348 visitor->trace(m_linkedDestinations); | 351 visitor->trace(m_linkedDestinations); |
| 349 } | 352 } |
| 350 | 353 |
| 351 } // namespace blink | 354 } // namespace blink |
| OLD | NEW |