| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void PrintContext::end() | 174 void PrintContext::end() |
| 175 { | 175 { |
| 176 ASSERT(m_isPrinting); | 176 ASSERT(m_isPrinting); |
| 177 m_isPrinting = false; | 177 m_isPrinting = false; |
| 178 m_frame->setPrinting(false, FloatSize(), FloatSize(), 0); | 178 m_frame->setPrinting(false, FloatSize(), FloatSize(), 0); |
| 179 m_linkedDestinations.clear(); | 179 m_linkedDestinations.clear(); |
| 180 m_linkDestinations.clear(); | 180 m_linkDestinations.clear(); |
| 181 m_linkAndLinkedDestinationsValid = false; | 181 m_linkAndLinkedDestinationsValid = false; |
| 182 } | 182 } |
| 183 | 183 |
| 184 static RenderBoxModelObject* enclosingBoxModelObject(RenderObject* object) | 184 static RenderBoxModelObject* enclosingBoxModelObject(LayoutObject* object) |
| 185 { | 185 { |
| 186 | 186 |
| 187 while (object && !object->isBoxModelObject()) | 187 while (object && !object->isBoxModelObject()) |
| 188 object = object->parent(); | 188 object = object->parent(); |
| 189 if (!object) | 189 if (!object) |
| 190 return nullptr; | 190 return nullptr; |
| 191 return toRenderBoxModelObject(object); | 191 return toRenderBoxModelObject(object); |
| 192 } | 192 } |
| 193 | 193 |
| 194 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
zeInPixels) | 194 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
zeInPixels) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 void PrintContext::outputLinkAndLinkedDestinations(GraphicsContext& graphicsCont
ext, Node* node, const IntRect& pageRect) | 251 void PrintContext::outputLinkAndLinkedDestinations(GraphicsContext& graphicsCont
ext, Node* node, const IntRect& pageRect) |
| 252 { | 252 { |
| 253 if (!m_linkAndLinkedDestinationsValid) { | 253 if (!m_linkAndLinkedDestinationsValid) { |
| 254 collectLinkAndLinkedDestinations(node); | 254 collectLinkAndLinkedDestinations(node); |
| 255 m_linkAndLinkedDestinationsValid = true; | 255 m_linkAndLinkedDestinationsValid = true; |
| 256 } | 256 } |
| 257 | 257 |
| 258 for (const auto& entry : m_linkDestinations) { | 258 for (const auto& entry : m_linkDestinations) { |
| 259 RenderObject* renderer = entry.key->renderer(); | 259 LayoutObject* renderer = entry.key->renderer(); |
| 260 if (!renderer) | 260 if (!renderer) |
| 261 continue; | 261 continue; |
| 262 KURL url = entry.value; | 262 KURL url = entry.value; |
| 263 IntRect boundingBox = renderer->absoluteBoundingBoxRect(); | 263 IntRect boundingBox = renderer->absoluteBoundingBoxRect(); |
| 264 if (!pageRect.intersects(boundingBox)) | 264 if (!pageRect.intersects(boundingBox)) |
| 265 continue; | 265 continue; |
| 266 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url,
renderer->document().baseURL())) { | 266 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url,
renderer->document().baseURL())) { |
| 267 String name = url.fragmentIdentifier(); | 267 String name = url.fragmentIdentifier(); |
| 268 ASSERT(renderer->document().findAnchor(name)); | 268 ASSERT(renderer->document().findAnchor(name)); |
| 269 graphicsContext.setURLFragmentForRect(name, boundingBox); | 269 graphicsContext.setURLFragmentForRect(name, boundingBox); |
| 270 } else { | 270 } else { |
| 271 graphicsContext.setURLForRect(url, boundingBox); | 271 graphicsContext.setURLForRect(url, boundingBox); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 for (const auto& entry : m_linkedDestinations) { | 275 for (const auto& entry : m_linkedDestinations) { |
| 276 RenderObject* renderer = entry.value->renderer(); | 276 LayoutObject* renderer = entry.value->renderer(); |
| 277 if (!renderer) | 277 if (!renderer) |
| 278 continue; | 278 continue; |
| 279 IntRect boundingBox = renderer->absoluteBoundingBoxRect(); | 279 IntRect boundingBox = renderer->absoluteBoundingBoxRect(); |
| 280 if (!pageRect.intersects(boundingBox)) | 280 if (!pageRect.intersects(boundingBox)) |
| 281 continue; | 281 continue; |
| 282 IntPoint point = boundingBox.minXMinYCorner(); | 282 IntPoint point = boundingBox.minXMinYCorner(); |
| 283 point.clampNegativeToZero(); | 283 point.clampNegativeToZero(); |
| 284 graphicsContext.addURLTargetAtPoint(entry.key, point); | 284 graphicsContext.addURLTargetAtPoint(entry.key, point); |
| 285 } | 285 } |
| 286 } | 286 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 void PrintContext::trace(Visitor* visitor) | 342 void PrintContext::trace(Visitor* visitor) |
| 343 { | 343 { |
| 344 #if ENABLE(OILPAN) | 344 #if ENABLE(OILPAN) |
| 345 visitor->trace(m_frame); | 345 visitor->trace(m_frame); |
| 346 visitor->trace(m_linkDestinations); | 346 visitor->trace(m_linkDestinations); |
| 347 visitor->trace(m_linkedDestinations); | 347 visitor->trace(m_linkedDestinations); |
| 348 #endif | 348 #endif |
| 349 } | 349 } |
| 350 | 350 |
| 351 } | 351 } |
| OLD | NEW |