| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 | 286 |
| 287 void SVGImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dst
Rect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) | 287 void SVGImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dst
Rect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) |
| 288 { | 288 { |
| 289 if (!m_page) | 289 if (!m_page) |
| 290 return; | 290 return; |
| 291 | 291 |
| 292 FrameView* view = frameView(); | 292 FrameView* view = frameView(); |
| 293 view->resize(containerSize()); | 293 view->resize(containerSize()); |
| 294 | 294 |
| 295 // Always call scrollToFragment, even if the url is empty, because | 295 // Always call processUrlFragment, even if the url is empty, because |
| 296 // there may have been a previous url/fragment that needs to be reset. | 296 // there may have been a previous url/fragment that needs to be reset. |
| 297 view->scrollToFragment(m_url); | 297 view->processUrlFragment(m_url); |
| 298 | 298 |
| 299 SkPictureBuilder imagePicture(dstRect); | 299 SkPictureBuilder imagePicture(dstRect); |
| 300 { | 300 { |
| 301 ClipRecorder clipRecorder(imagePicture.context(), *this, DisplayItem::Cl
ipNodeImage, LayoutRect(enclosingIntRect(dstRect))); | 301 ClipRecorder clipRecorder(imagePicture.context(), *this, DisplayItem::Cl
ipNodeImage, LayoutRect(enclosingIntRect(dstRect))); |
| 302 | 302 |
| 303 // We can only draw the entire frame, clipped to the rect we want. So co
mpute where the top left | 303 // We can only draw the entire frame, clipped to the rect we want. So co
mpute where the top left |
| 304 // of the image would be if we were drawing without clipping, and transl
ate accordingly. | 304 // of the image would be if we were drawing without clipping, and transl
ate accordingly. |
| 305 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr
cRect.height()); | 305 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr
cRect.height()); |
| 306 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.
location().y() * scale.height()); | 306 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.
location().y() * scale.height()); |
| 307 FloatPoint destOffset = dstRect.location() - topLeftOffset; | 307 FloatPoint destOffset = dstRect.location() - topLeftOffset; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 return m_page; | 484 return m_page; |
| 485 } | 485 } |
| 486 | 486 |
| 487 String SVGImage::filenameExtension() const | 487 String SVGImage::filenameExtension() const |
| 488 { | 488 { |
| 489 return "svg"; | 489 return "svg"; |
| 490 } | 490 } |
| 491 | 491 |
| 492 } | 492 } |
| OLD | NEW |