| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 while (object && !object->isBoxModelObject()) | 202 while (object && !object->isBoxModelObject()) |
| 203 object = object->parent(); | 203 object = object->parent(); |
| 204 if (!object) | 204 if (!object) |
| 205 return 0; | 205 return 0; |
| 206 return toRenderBoxModelObject(object); | 206 return toRenderBoxModelObject(object); |
| 207 } | 207 } |
| 208 | 208 |
| 209 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
zeInPixels) | 209 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
zeInPixels) |
| 210 { | 210 { |
| 211 // Make sure the element is not freed during the layout. | 211 // Make sure the element is not freed during the layout. |
| 212 RefPtrWillBeRawPtr<Element> elementRef(element); | 212 RefPtrWillBeRawPtr<Element> protect(element); |
| 213 element->document().updateLayout(); | 213 element->document().updateLayout(); |
| 214 | 214 |
| 215 RenderBoxModelObject* box = enclosingBoxModelObject(element->renderer()); | 215 RenderBoxModelObject* box = enclosingBoxModelObject(element->renderer()); |
| 216 if (!box) | 216 if (!box) |
| 217 return -1; | 217 return -1; |
| 218 | 218 |
| 219 LocalFrame* frame = element->document().frame(); | 219 LocalFrame* frame = element->document().frame(); |
| 220 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); | 220 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); |
| 221 PrintContext printContext(frame); | 221 PrintContext printContext(frame); |
| 222 printContext.begin(pageRect.width(), pageRect.height()); | 222 printContext.begin(pageRect.width(), pageRect.height()); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 printContext.spoolPage(graphicsContext, pageIndex, pageWidth); | 373 printContext.spoolPage(graphicsContext, pageIndex, pageWidth); |
| 374 graphicsContext.restore(); | 374 graphicsContext.restore(); |
| 375 | 375 |
| 376 currentHeight += pageSizeInPixels.height() + 1; | 376 currentHeight += pageSizeInPixels.height() + 1; |
| 377 } | 377 } |
| 378 | 378 |
| 379 graphicsContext.restore(); | 379 graphicsContext.restore(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 } | 382 } |
| OLD | NEW |