OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "PluginDocument.h" | 26 #include "PluginDocument.h" |
27 | 27 |
28 #include "DocumentLoader.h" | 28 #include "DocumentLoader.h" |
29 #include "Frame.h" | 29 #include "Frame.h" |
30 #include "FrameLoaderClient.h" | 30 #include "FrameLoaderClient.h" |
| 31 #include "FrameView.h" |
31 #include "HTMLEmbedElement.h" | 32 #include "HTMLEmbedElement.h" |
32 #include "HTMLHtmlElement.h" | 33 #include "HTMLHtmlElement.h" |
33 #include "HTMLNames.h" | 34 #include "HTMLNames.h" |
34 #include "MainResourceLoader.h" | 35 #include "MainResourceLoader.h" |
35 #include "NodeList.h" | 36 #include "NodeList.h" |
36 #include "Page.h" | 37 #include "Page.h" |
37 #include "RawDataDocumentParser.h" | 38 #include "RawDataDocumentParser.h" |
38 #include "RenderEmbeddedObject.h" | 39 #include "RenderEmbeddedObject.h" |
39 #include "Settings.h" | 40 #include "Settings.h" |
40 | 41 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 Frame* frame = document()->frame(); | 110 Frame* frame = document()->frame(); |
110 if (!frame) | 111 if (!frame) |
111 return; | 112 return; |
112 Settings* settings = frame->settings(); | 113 Settings* settings = frame->settings(); |
113 if (!settings || !frame->loader()->subframeLoader()->allowPlugins(NotAboutTo
InstantiatePlugin)) | 114 if (!settings || !frame->loader()->subframeLoader()->allowPlugins(NotAboutTo
InstantiatePlugin)) |
114 return; | 115 return; |
115 | 116 |
116 document()->updateLayout(); | 117 document()->updateLayout(); |
117 | 118 |
| 119 // Below we assume that renderer->widget() to have been created by |
| 120 // document()->updateLayout(). However, in some cases, updateLayout() will |
| 121 // recurse too many times and delay its post-layout tasks (such as creating |
| 122 // the widget). Here we kick off the pending post-layout tasks so that we |
| 123 // can synchronously redirect data to the plugin. |
| 124 frame->view()->flushAnyPendingPostLayoutTasks(); |
| 125 |
118 if (RenderPart* renderer = m_embedElement->renderPart()) { | 126 if (RenderPart* renderer = m_embedElement->renderPart()) { |
119 if (Widget* widget = renderer->widget()) { | 127 if (Widget* widget = renderer->widget()) { |
120 frame->loader()->client()->redirectDataToPlugin(widget); | 128 frame->loader()->client()->redirectDataToPlugin(widget); |
121 // In a plugin document, the main resource is the plugin. If we have
a null widget, that means | 129 // In a plugin document, the main resource is the plugin. If we have
a null widget, that means |
122 // the loading of the plugin was cancelled, which gives us a null ma
inResourceLoader(), so we | 130 // the loading of the plugin was cancelled, which gives us a null ma
inResourceLoader(), so we |
123 // need to have this call in a null check of the widget or of mainRe
sourceLoader(). | 131 // need to have this call in a null check of the widget or of mainRe
sourceLoader(). |
124 frame->loader()->activeDocumentLoader()->mainResourceLoader()->setSh
ouldBufferData(false); | 132 frame->loader()->activeDocumentLoader()->mainResourceLoader()->setSh
ouldBufferData(false); |
125 } | 133 } |
126 } | 134 } |
127 | 135 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // PluginDocument::cancelManualPluginLoad should only be called once, but th
ere are issues | 175 // PluginDocument::cancelManualPluginLoad should only be called once, but th
ere are issues |
168 // with how many times we call beforeload on object elements. <rdar://proble
m/8441094>. | 176 // with how many times we call beforeload on object elements. <rdar://proble
m/8441094>. |
169 if (!shouldLoadPluginManually()) | 177 if (!shouldLoadPluginManually()) |
170 return; | 178 return; |
171 | 179 |
172 frame()->loader()->activeDocumentLoader()->mainResourceLoader()->cancel(); | 180 frame()->loader()->activeDocumentLoader()->mainResourceLoader()->cancel(); |
173 setShouldLoadPluginManually(false); | 181 setShouldLoadPluginManually(false); |
174 } | 182 } |
175 | 183 |
176 } | 184 } |
OLD | NEW |