| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/animation/DocumentTimeline.h" | 32 #include "core/animation/DocumentTimeline.h" |
| 33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
| 34 #include "core/dom/shadow/ComposedTreeWalker.h" | 34 #include "core/dom/shadow/ComposedTreeWalker.h" |
| 35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
| 36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 38 #include "core/loader/FrameLoadRequest.h" | 38 #include "core/loader/FrameLoadRequest.h" |
| 39 #include "core/page/Chrome.h" | 39 #include "core/page/Chrome.h" |
| 40 #include "core/rendering/style/RenderStyle.h" | 40 #include "core/rendering/style/RenderStyle.h" |
| 41 #include "core/rendering/svg/RenderSVGRoot.h" | 41 #include "core/rendering/svg/RenderSVGRoot.h" |
| 42 #include "core/svg/SVGDocument.h" | 42 #include "core/svg/SVGDocumentExtensions.h" |
| 43 #include "core/svg/SVGFEImageElement.h" | 43 #include "core/svg/SVGFEImageElement.h" |
| 44 #include "core/svg/SVGImageElement.h" | 44 #include "core/svg/SVGImageElement.h" |
| 45 #include "core/svg/SVGSVGElement.h" | 45 #include "core/svg/SVGSVGElement.h" |
| 46 #include "core/svg/animation/SMILTimeContainer.h" | 46 #include "core/svg/animation/SMILTimeContainer.h" |
| 47 #include "core/svg/graphics/SVGImageChromeClient.h" | 47 #include "core/svg/graphics/SVGImageChromeClient.h" |
| 48 #include "platform/LengthFunctions.h" | 48 #include "platform/LengthFunctions.h" |
| 49 #include "platform/geometry/IntRect.h" | 49 #include "platform/geometry/IntRect.h" |
| 50 #include "platform/graphics/GraphicsContextStateSaver.h" | 50 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 51 #include "platform/graphics/ImageBuffer.h" | 51 #include "platform/graphics/ImageBuffer.h" |
| 52 #include "platform/graphics/ImageObserver.h" | 52 #include "platform/graphics/ImageObserver.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 bool SVGImage::currentFrameHasSingleSecurityOrigin() const | 86 bool SVGImage::currentFrameHasSingleSecurityOrigin() const |
| 87 { | 87 { |
| 88 if (!m_page) | 88 if (!m_page) |
| 89 return true; | 89 return true; |
| 90 | 90 |
| 91 LocalFrame* frame = m_page->mainFrame(); | 91 LocalFrame* frame = m_page->mainFrame(); |
| 92 | 92 |
| 93 RELEASE_ASSERT(frame->document()->loadEventFinished()); | 93 RELEASE_ASSERT(frame->document()->loadEventFinished()); |
| 94 | 94 |
| 95 SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement()
; | 95 SVGSVGElement* rootElement = frame->document()->accessSVGExtensions().rootEl
ement(); |
| 96 if (!rootElement) | 96 if (!rootElement) |
| 97 return true; | 97 return true; |
| 98 | 98 |
| 99 // Don't allow foreignObject elements or images that are not known to be | 99 // Don't allow foreignObject elements or images that are not known to be |
| 100 // single-origin since these can leak cross-origin information. | 100 // single-origin since these can leak cross-origin information. |
| 101 ComposedTreeWalker walker(rootElement); | 101 ComposedTreeWalker walker(rootElement); |
| 102 while (Node* node = walker.get()) { | 102 while (Node* node = walker.get()) { |
| 103 if (isSVGForeignObjectElement(*node)) | 103 if (isSVGForeignObjectElement(*node)) |
| 104 return false; | 104 return false; |
| 105 if (isSVGImageElement(*node)) { | 105 if (isSVGImageElement(*node)) { |
| 106 if (!toSVGImageElement(*node).currentFrameHasSingleSecurityOrigin()) | 106 if (!toSVGImageElement(*node).currentFrameHasSingleSecurityOrigin()) |
| 107 return false; | 107 return false; |
| 108 } else if (isSVGFEImageElement(*node)) { | 108 } else if (isSVGFEImageElement(*node)) { |
| 109 if (!toSVGFEImageElement(*node).currentFrameHasSingleSecurityOrigin(
)) | 109 if (!toSVGFEImageElement(*node).currentFrameHasSingleSecurityOrigin(
)) |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 walker.next(); | 112 walker.next(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Because SVG image rendering disallows external resources and links, these | 115 // Because SVG image rendering disallows external resources and links, these |
| 116 // images effectively are restricted to a single security origin. | 116 // images effectively are restricted to a single security origin. |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 | 119 |
| 120 static SVGSVGElement* svgRootElement(Page* page) | 120 static SVGSVGElement* svgRootElement(Page* page) |
| 121 { | 121 { |
| 122 if (!page) | 122 if (!page) |
| 123 return 0; | 123 return 0; |
| 124 LocalFrame* frame = page->mainFrame(); | 124 LocalFrame* frame = page->mainFrame(); |
| 125 return toSVGDocument(frame->document())->rootElement(); | 125 return frame->document()->accessSVGExtensions().rootElement(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void SVGImage::setContainerSize(const IntSize& size) | 128 void SVGImage::setContainerSize(const IntSize& size) |
| 129 { | 129 { |
| 130 if (!usesContainerSize()) | 130 if (!usesContainerSize()) |
| 131 return; | 131 return; |
| 132 | 132 |
| 133 SVGSVGElement* rootElement = svgRootElement(m_page.get()); | 133 SVGSVGElement* rootElement = svgRootElement(m_page.get()); |
| 134 if (!rootElement) | 134 if (!rootElement) |
| 135 return; | 135 return; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 return m_page; | 411 return m_page; |
| 412 } | 412 } |
| 413 | 413 |
| 414 String SVGImage::filenameExtension() const | 414 String SVGImage::filenameExtension() const |
| 415 { | 415 { |
| 416 return "svg"; | 416 return "svg"; |
| 417 } | 417 } |
| 418 | 418 |
| 419 } | 419 } |
| OLD | NEW |