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 14 matching lines...) Expand all Loading... |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 | 29 |
30 #include "core/svg/graphics/SVGImage.h" | 30 #include "core/svg/graphics/SVGImage.h" |
31 | 31 |
32 #include "core/animation/AnimationTimeline.h" | 32 #include "core/animation/AnimationTimeline.h" |
33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
34 #include "core/dom/shadow/ComposedTreeTraversal.h" | 34 #include "core/dom/shadow/ComposedTreeTraversal.h" |
35 #include "core/fetch/ResourceFetcher.h" | |
36 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
37 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
38 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 38 #include "core/style/ComputedStyle.h" |
39 #include "core/layout/svg/LayoutSVGRoot.h" | 39 #include "core/layout/svg/LayoutSVGRoot.h" |
40 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
41 #include "core/paint/CompositingRecorder.h" | 41 #include "core/paint/CompositingRecorder.h" |
42 #include "core/paint/FloatClipRecorder.h" | 42 #include "core/paint/FloatClipRecorder.h" |
43 #include "core/paint/TransformRecorder.h" | 43 #include "core/paint/TransformRecorder.h" |
44 #include "core/style/ComputedStyle.h" | |
45 #include "core/svg/SVGDocumentExtensions.h" | 44 #include "core/svg/SVGDocumentExtensions.h" |
46 #include "core/svg/SVGFEImageElement.h" | 45 #include "core/svg/SVGFEImageElement.h" |
47 #include "core/svg/SVGImageElement.h" | 46 #include "core/svg/SVGImageElement.h" |
48 #include "core/svg/SVGSVGElement.h" | 47 #include "core/svg/SVGSVGElement.h" |
49 #include "core/svg/animation/SMILTimeContainer.h" | 48 #include "core/svg/animation/SMILTimeContainer.h" |
50 #include "core/svg/graphics/SVGImageChromeClient.h" | 49 #include "core/svg/graphics/SVGImageChromeClient.h" |
51 #include "platform/EventDispatchForbiddenScope.h" | 50 #include "platform/EventDispatchForbiddenScope.h" |
52 #include "platform/LengthFunctions.h" | 51 #include "platform/LengthFunctions.h" |
53 #include "platform/TraceEvent.h" | 52 #include "platform/TraceEvent.h" |
54 #include "platform/geometry/IntRect.h" | 53 #include "platform/geometry/IntRect.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 { | 91 { |
93 ASSERT(node); | 92 ASSERT(node); |
94 | 93 |
95 Page* page = node->document().page(); | 94 Page* page = node->document().page(); |
96 if (!page) | 95 if (!page) |
97 return false; | 96 return false; |
98 | 97 |
99 return page->chromeClient().isSVGImageChromeClient(); | 98 return page->chromeClient().isSVGImageChromeClient(); |
100 } | 99 } |
101 | 100 |
102 void SVGImage::assertSubresourcesLoaded() const | |
103 { | |
104 RELEASE_ASSERT(m_page); | |
105 LocalFrame* frame = toLocalFrame(m_page->mainFrame()); | |
106 RELEASE_ASSERT(frame->document()->fetcher()->requestCount() == 0); | |
107 } | |
108 | |
109 bool SVGImage::currentFrameHasSingleSecurityOrigin() const | 101 bool SVGImage::currentFrameHasSingleSecurityOrigin() const |
110 { | 102 { |
111 if (!m_page) | 103 if (!m_page) |
112 return true; | 104 return true; |
113 | 105 |
114 LocalFrame* frame = toLocalFrame(m_page->mainFrame()); | 106 LocalFrame* frame = toLocalFrame(m_page->mainFrame()); |
115 assertSubresourcesLoaded(); | 107 |
| 108 RELEASE_ASSERT(frame->document()->loadEventFinished()); |
116 | 109 |
117 SVGSVGElement* rootElement = frame->document()->accessSVGExtensions().rootEl
ement(); | 110 SVGSVGElement* rootElement = frame->document()->accessSVGExtensions().rootEl
ement(); |
118 if (!rootElement) | 111 if (!rootElement) |
119 return true; | 112 return true; |
120 | 113 |
121 // Don't allow foreignObject elements or images that are not known to be | 114 // Don't allow foreignObject elements or images that are not known to be |
122 // single-origin since these can leak cross-origin information. | 115 // single-origin since these can leak cross-origin information. |
123 for (Node* node = rootElement; node; node = ComposedTreeTraversal::next(*nod
e)) { | 116 for (Node* node = rootElement; node; node = ComposedTreeTraversal::next(*nod
e)) { |
124 if (isSVGForeignObjectElement(*node)) | 117 if (isSVGForeignObjectElement(*node)) |
125 return false; | 118 return false; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 515 |
523 return m_page; | 516 return m_page; |
524 } | 517 } |
525 | 518 |
526 String SVGImage::filenameExtension() const | 519 String SVGImage::filenameExtension() const |
527 { | 520 { |
528 return "svg"; | 521 return "svg"; |
529 } | 522 } |
530 | 523 |
531 } | 524 } |
OLD | NEW |