Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1515963005: SVGImage: check requestCount() to check all subresources are loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: auto-Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/graphics/SVGImage.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 #include "core/animation/AnimationTimeline.h" 30 #include "core/animation/AnimationTimeline.h"
31 #include "core/css/CSSFontSelector.h" 31 #include "core/css/CSSFontSelector.h"
32 #include "core/dom/NodeTraversal.h" 32 #include "core/dom/NodeTraversal.h"
33 #include "core/dom/StyleEngine.h" 33 #include "core/dom/StyleEngine.h"
34 #include "core/dom/shadow/FlatTreeTraversal.h" 34 #include "core/dom/shadow/FlatTreeTraversal.h"
35 #include "core/fetch/ResourceFetcher.h" 35 #include "core/fetch/ResourceFetcher.h"
36 #include "core/frame/Deprecation.h" 36 #include "core/frame/Deprecation.h"
37 #include "core/frame/FrameView.h" 37 #include "core/frame/FrameView.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/style/ComputedStyle.h"
41 #include "core/layout/svg/LayoutSVGRoot.h" 40 #include "core/layout/svg/LayoutSVGRoot.h"
42 #include "core/loader/FrameLoadRequest.h" 41 #include "core/loader/FrameLoadRequest.h"
43 #include "core/paint/FloatClipRecorder.h" 42 #include "core/paint/FloatClipRecorder.h"
44 #include "core/paint/TransformRecorder.h" 43 #include "core/paint/TransformRecorder.h"
44 #include "core/style/ComputedStyle.h"
45 #include "core/svg/SVGDocumentExtensions.h" 45 #include "core/svg/SVGDocumentExtensions.h"
46 #include "core/svg/SVGFEImageElement.h" 46 #include "core/svg/SVGFEImageElement.h"
47 #include "core/svg/SVGImageElement.h" 47 #include "core/svg/SVGImageElement.h"
48 #include "core/svg/SVGSVGElement.h" 48 #include "core/svg/SVGSVGElement.h"
49 #include "core/svg/animation/SMILTimeContainer.h" 49 #include "core/svg/animation/SMILTimeContainer.h"
50 #include "core/svg/graphics/SVGImageChromeClient.h" 50 #include "core/svg/graphics/SVGImageChromeClient.h"
51 #include "platform/EventDispatchForbiddenScope.h" 51 #include "platform/EventDispatchForbiddenScope.h"
52 #include "platform/LengthFunctions.h" 52 #include "platform/LengthFunctions.h"
53 #include "platform/TraceEvent.h" 53 #include "platform/TraceEvent.h"
54 #include "platform/geometry/IntRect.h" 54 #include "platform/geometry/IntRect.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 { 92 {
93 ASSERT(node); 93 ASSERT(node);
94 94
95 Page* page = node->document().page(); 95 Page* page = node->document().page();
96 if (!page) 96 if (!page)
97 return false; 97 return false;
98 98
99 return page->chromeClient().isSVGImageChromeClient(); 99 return page->chromeClient().isSVGImageChromeClient();
100 } 100 }
101 101
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
102 bool SVGImage::currentFrameHasSingleSecurityOrigin() const 109 bool SVGImage::currentFrameHasSingleSecurityOrigin() const
103 { 110 {
104 if (!m_page) 111 if (!m_page)
105 return true; 112 return true;
106 113
107 LocalFrame* frame = toLocalFrame(m_page->mainFrame()); 114 LocalFrame* frame = toLocalFrame(m_page->mainFrame());
108 115 assertSubresourcesLoaded();
109 RELEASE_ASSERT(frame->document()->loadEventFinished());
110 116
111 SVGSVGElement* rootElement = frame->document()->accessSVGExtensions().rootEl ement(); 117 SVGSVGElement* rootElement = frame->document()->accessSVGExtensions().rootEl ement();
112 if (!rootElement) 118 if (!rootElement)
113 return true; 119 return true;
114 120
115 // Don't allow foreignObject elements or images that are not known to be 121 // Don't allow foreignObject elements or images that are not known to be
116 // single-origin since these can leak cross-origin information. 122 // single-origin since these can leak cross-origin information.
117 for (Node* node = rootElement; node; node = FlatTreeTraversal::next(*node)) { 123 for (Node* node = rootElement; node; node = FlatTreeTraversal::next(*node)) {
118 if (isSVGForeignObjectElement(*node)) 124 if (isSVGForeignObjectElement(*node))
119 return false; 125 return false;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 548
543 return m_page; 549 return m_page;
544 } 550 }
545 551
546 String SVGImage::filenameExtension() const 552 String SVGImage::filenameExtension() const
547 { 553 {
548 return "svg"; 554 return "svg";
549 } 555 }
550 556
551 } // namespace blink 557 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/graphics/SVGImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698