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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // of the image would be if we were drawing without clipping, and transl
ate accordingly. | 296 // of the image would be if we were drawing without clipping, and transl
ate accordingly. |
297 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr
cRect.height()); | 297 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr
cRect.height()); |
298 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.
location().y() * scale.height()); | 298 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.
location().y() * scale.height()); |
299 FloatPoint destOffset = dstRect.location() - topLeftOffset; | 299 FloatPoint destOffset = dstRect.location() - topLeftOffset; |
300 AffineTransform transform = AffineTransform::translation(destOffset.x(),
destOffset.y()); | 300 AffineTransform transform = AffineTransform::translation(destOffset.x(),
destOffset.y()); |
301 transform.scale(scale.width(), scale.height()); | 301 transform.scale(scale.width(), scale.height()); |
302 TransformRecorder transformRecorder(recordingContext, displayItemClient(
), transform); | 302 TransformRecorder transformRecorder(recordingContext, displayItemClient(
), transform); |
303 | 303 |
304 FrameView* view = frameView(); | 304 FrameView* view = frameView(); |
305 view->resize(containerSize()); | 305 view->resize(containerSize()); |
306 if (!m_url.isEmpty()) | 306 |
307 view->scrollToFragment(m_url); | 307 // Always call scrollToFragment, even if the url is empty, because |
| 308 // there may have been a previous url/fragment that needs to be reset. |
| 309 view->scrollToFragment(m_url); |
| 310 |
308 view->updateLayoutAndStyleForPainting(); | 311 view->updateLayoutAndStyleForPainting(); |
309 view->paint(&recordingContext, enclosingIntRect(srcRect)); | 312 view->paint(&recordingContext, enclosingIntRect(srcRect)); |
310 ASSERT(!view->needsLayout()); | 313 ASSERT(!view->needsLayout()); |
311 } | 314 } |
312 | 315 |
313 if (displayItemList) | 316 if (displayItemList) |
314 displayItemList->replay(&recordingContext); | 317 displayItemList->replay(&recordingContext); |
315 RefPtr<const SkPicture> recording = recordingContext.endRecording(); | 318 RefPtr<const SkPicture> recording = recordingContext.endRecording(); |
316 context->drawPicture(recording.get()); | 319 context->drawPicture(recording.get()); |
317 | 320 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 461 |
459 return m_page; | 462 return m_page; |
460 } | 463 } |
461 | 464 |
462 String SVGImage::filenameExtension() const | 465 String SVGImage::filenameExtension() const |
463 { | 466 { |
464 return "svg"; | 467 return "svg"; |
465 } | 468 } |
466 | 469 |
467 } | 470 } |
OLD | NEW |