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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 printContext.begin(pageRect.width(), pageRect.height()); | 196 printContext.begin(pageRect.width(), pageRect.height()); |
197 | 197 |
198 LayoutBoxModelObject* box = enclosingBoxModelObject(element->layoutObject())
; | 198 LayoutBoxModelObject* box = enclosingBoxModelObject(element->layoutObject())
; |
199 if (!box) | 199 if (!box) |
200 return -1; | 200 return -1; |
201 | 201 |
202 FloatSize scaledPageSize = pageSizeInPixels; | 202 FloatSize scaledPageSize = pageSizeInPixels; |
203 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width(
)); | 203 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width(
)); |
204 printContext.computePageRectsWithPageSize(scaledPageSize); | 204 printContext.computePageRectsWithPageSize(scaledPageSize); |
205 | 205 |
206 int top = box->pixelSnappedOffsetTop(); | 206 int top = box->pixelSnappedOffsetTop(box->offsetParent()); |
207 int left = box->pixelSnappedOffsetLeft(); | 207 int left = box->pixelSnappedOffsetLeft(box->offsetParent()); |
208 size_t pageNumber = 0; | 208 size_t pageNumber = 0; |
209 for (; pageNumber < printContext.pageCount(); pageNumber++) { | 209 for (; pageNumber < printContext.pageCount(); pageNumber++) { |
210 const IntRect& page = printContext.pageRect(pageNumber); | 210 const IntRect& page = printContext.pageRect(pageNumber); |
211 if (page.x() <= left && left < page.maxX() && page.y() <= top && top < p
age.maxY()) | 211 if (page.x() <= left && left < page.maxX() && page.y() <= top && top < p
age.maxY()) |
212 return pageNumber; | 212 return pageNumber; |
213 } | 213 } |
214 return -1; | 214 return -1; |
215 } | 215 } |
216 | 216 |
217 void PrintContext::collectLinkedDestinations(Node* node) | 217 void PrintContext::collectLinkedDestinations(Node* node) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 return printContext.pageCount(); | 315 return printContext.pageCount(); |
316 } | 316 } |
317 | 317 |
318 DEFINE_TRACE(PrintContext) | 318 DEFINE_TRACE(PrintContext) |
319 { | 319 { |
320 visitor->trace(m_frame); | 320 visitor->trace(m_frame); |
321 visitor->trace(m_linkedDestinations); | 321 visitor->trace(m_linkedDestinations); |
322 } | 322 } |
323 | 323 |
324 } // namespace blink | 324 } // namespace blink |
OLD | NEW |