| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 SVGImage::~SVGImage() { | 72 SVGImage::~SVGImage() { |
| 73 if (m_page) { | 73 if (m_page) { |
| 74 // Store m_page in a local variable, clearing m_page, so that | 74 // Store m_page in a local variable, clearing m_page, so that |
| 75 // SVGImageChromeClient knows we're destructed. | 75 // SVGImageChromeClient knows we're destructed. |
| 76 Page* currentPage = m_page.release(); | 76 Page* currentPage = m_page.release(); |
| 77 // Break both the loader and view references to the frame | 77 // Break both the loader and view references to the frame |
| 78 currentPage->willBeDestroyed(); | 78 currentPage->willBeDestroyed(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Verify that page teardown destroyed the Chrome | 81 // Verify that page teardown destroyed the Chrome |
| 82 ASSERT(!m_chromeClient || !m_chromeClient->image()); | 82 DCHECK(!m_chromeClient || !m_chromeClient->image()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool SVGImage::isInSVGImage(const Node* node) { | 85 bool SVGImage::isInSVGImage(const Node* node) { |
| 86 ASSERT(node); | 86 DCHECK(node); |
| 87 | 87 |
| 88 Page* page = node->document().page(); | 88 Page* page = node->document().page(); |
| 89 if (!page) | 89 if (!page) |
| 90 return false; | 90 return false; |
| 91 | 91 |
| 92 return page->chromeClient().isSVGImageChromeClient(); | 92 return page->chromeClient().isSVGImageChromeClient(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool SVGImage::currentFrameHasSingleSecurityOrigin() const { | 95 bool SVGImage::currentFrameHasSingleSecurityOrigin() const { |
| 96 if (!m_page) | 96 if (!m_page) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(rootElement->layoutObject()); | 139 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(rootElement->layoutObject()); |
| 140 if (!layoutObject) | 140 if (!layoutObject) |
| 141 return IntSize(); | 141 return IntSize(); |
| 142 | 142 |
| 143 // If a container size is available it has precedence. | 143 // If a container size is available it has precedence. |
| 144 IntSize containerSize = layoutObject->containerSize(); | 144 IntSize containerSize = layoutObject->containerSize(); |
| 145 if (!containerSize.isEmpty()) | 145 if (!containerSize.isEmpty()) |
| 146 return containerSize; | 146 return containerSize; |
| 147 | 147 |
| 148 // Assure that a container size is always given for a non-identity zoom level. | 148 // Assure that a container size is always given for a non-identity zoom level. |
| 149 ASSERT(layoutObject->style()->effectiveZoom() == 1); | 149 DCHECK_EQ(layoutObject->style()->effectiveZoom(), 1); |
| 150 | 150 |
| 151 // No set container size; use concrete object size. | 151 // No set container size; use concrete object size. |
| 152 return m_intrinsicSize; | 152 return m_intrinsicSize; |
| 153 } | 153 } |
| 154 | 154 |
| 155 static float resolveWidthForRatio(float height, | 155 static float resolveWidthForRatio(float height, |
| 156 const FloatSize& intrinsicRatio) { | 156 const FloatSize& intrinsicRatio) { |
| 157 return height * intrinsicRatio.width() / intrinsicRatio.height(); | 157 return height * intrinsicRatio.width() / intrinsicRatio.height(); |
| 158 } | 158 } |
| 159 | 159 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), | 414 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), |
| 415 srcRect.location().y() * scale.height()); | 415 srcRect.location().y() * scale.height()); |
| 416 FloatPoint destOffset = dstRect.location() - topLeftOffset; | 416 FloatPoint destOffset = dstRect.location() - topLeftOffset; |
| 417 AffineTransform transform = | 417 AffineTransform transform = |
| 418 AffineTransform::translation(destOffset.x(), destOffset.y()); | 418 AffineTransform::translation(destOffset.x(), destOffset.y()); |
| 419 transform.scale(scale.width(), scale.height()); | 419 transform.scale(scale.width(), scale.height()); |
| 420 TransformRecorder transformRecorder(builder.context(), builder, transform); | 420 TransformRecorder transformRecorder(builder.context(), builder, transform); |
| 421 | 421 |
| 422 view->updateAllLifecyclePhasesExceptPaint(); | 422 view->updateAllLifecyclePhasesExceptPaint(); |
| 423 view->paint(builder.context(), CullRect(enclosingIntRect(srcRect))); | 423 view->paint(builder.context(), CullRect(enclosingIntRect(srcRect))); |
| 424 ASSERT(!view->needsLayout()); | 424 DCHECK(!view->needsLayout()); |
| 425 } | 425 } |
| 426 | 426 |
| 427 { | 427 { |
| 428 PaintCanvasAutoRestore ar(canvas, false); | 428 PaintCanvasAutoRestore ar(canvas, false); |
| 429 if (drawNeedsLayer(flags)) { | 429 if (drawNeedsLayer(flags)) { |
| 430 SkRect layerRect = dstRect; | 430 SkRect layerRect = dstRect; |
| 431 canvas->saveLayer(&layerRect, &flags); | 431 canvas->saveLayer(&layerRect, &flags); |
| 432 } | 432 } |
| 433 sk_sp<PaintRecord> recording = builder.endRecording(); | 433 sk_sp<PaintRecord> recording = builder.endRecording(); |
| 434 canvas->drawPicture(recording.get()); | 434 canvas->drawPicture(recording.get()); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 658 } |
| 659 | 659 |
| 660 return m_page ? SizeAvailable : SizeUnavailable; | 660 return m_page ? SizeAvailable : SizeUnavailable; |
| 661 } | 661 } |
| 662 | 662 |
| 663 String SVGImage::filenameExtension() const { | 663 String SVGImage::filenameExtension() const { |
| 664 return "svg"; | 664 return "svg"; |
| 665 } | 665 } |
| 666 | 666 |
| 667 } // namespace blink | 667 } // namespace blink |
| OLD | NEW |