| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 19 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 20 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 "core/html/PluginDocument.h" | 25 #include "core/html/PluginDocument.h" |
| 26 | 26 |
| 27 #include "bindings/core/v8/ExceptionState.h" | 27 #include "bindings/core/v8/ExceptionState.h" |
| 28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
| 29 #include "core/dom/RawDataDocumentParser.h" | 29 #include "core/dom/RawDataDocumentParser.h" |
| 30 #include "core/frame/FrameOrPlugin.h" |
| 30 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
| 31 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 32 #include "core/frame/LocalFrameClient.h" | 33 #include "core/frame/LocalFrameClient.h" |
| 33 #include "core/frame/UseCounter.h" | 34 #include "core/frame/UseCounter.h" |
| 34 #include "core/html/HTMLBodyElement.h" | 35 #include "core/html/HTMLBodyElement.h" |
| 35 #include "core/html/HTMLEmbedElement.h" | 36 #include "core/html/HTMLEmbedElement.h" |
| 36 #include "core/html/HTMLHtmlElement.h" | 37 #include "core/html/HTMLHtmlElement.h" |
| 37 #include "core/html/HTMLPlugInElement.h" | 38 #include "core/html/HTMLPlugInElement.h" |
| 38 #include "core/layout/LayoutEmbeddedObject.h" | 39 #include "core/layout/LayoutEmbeddedObject.h" |
| 39 #include "core/loader/DocumentLoader.h" | 40 #include "core/loader/DocumentLoader.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 embed_element_->setAttribute(srcAttr, | 113 embed_element_->setAttribute(srcAttr, |
| 113 AtomicString(GetDocument()->Url().GetString())); | 114 AtomicString(GetDocument()->Url().GetString())); |
| 114 embed_element_->setAttribute(typeAttr, GetDocument()->Loader()->MimeType()); | 115 embed_element_->setAttribute(typeAttr, GetDocument()->Loader()->MimeType()); |
| 115 body->AppendChild(embed_element_); | 116 body->AppendChild(embed_element_); |
| 116 if (IsStopped()) { | 117 if (IsStopped()) { |
| 117 // Possibly detached by a mutation event listener installed in | 118 // Possibly detached by a mutation event listener installed in |
| 118 // runScriptsAtDocumentElementAvailable. | 119 // runScriptsAtDocumentElementAvailable. |
| 119 return; | 120 return; |
| 120 } | 121 } |
| 121 | 122 |
| 122 ToPluginDocument(GetDocument())->SetPluginNode(embed_element_.Get()); | 123 ToPluginDocument(GetDocument())->SetPluginNode(embed_element_); |
| 123 | 124 |
| 124 GetDocument()->UpdateStyleAndLayout(); | 125 GetDocument()->UpdateStyleAndLayout(); |
| 125 | 126 |
| 126 // We need the plugin to load synchronously so we can get the PluginView | 127 // We need the plugin to load synchronously so we can get the PluginView |
| 127 // below so flush the layout tasks now instead of waiting on the timer. | 128 // below so flush the layout tasks now instead of waiting on the timer. |
| 128 frame->View()->FlushAnyPendingPostLayoutTasks(); | 129 frame->View()->FlushAnyPendingPostLayoutTasks(); |
| 129 // Focus the plugin here, as the line above is where the plugin is created. | 130 // Focus the plugin here, as the line above is where the plugin is created. |
| 130 if (frame->IsMainFrame()) { | 131 if (frame->IsMainFrame()) { |
| 131 embed_element_->focus(); | 132 embed_element_->focus(); |
| 132 if (IsStopped()) { | 133 if (IsStopped()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 UseCounter::Count(*this, UseCounter::kPluginDocument); | 170 UseCounter::Count(*this, UseCounter::kPluginDocument); |
| 170 if (!IsInMainFrame()) | 171 if (!IsInMainFrame()) |
| 171 UseCounter::Count(*this, UseCounter::kPluginDocumentInFrame); | 172 UseCounter::Count(*this, UseCounter::kPluginDocumentInFrame); |
| 172 } | 173 } |
| 173 | 174 |
| 174 DocumentParser* PluginDocument::CreateParser() { | 175 DocumentParser* PluginDocument::CreateParser() { |
| 175 return PluginDocumentParser::Create(this); | 176 return PluginDocumentParser::Create(this); |
| 176 } | 177 } |
| 177 | 178 |
| 178 PluginView* PluginDocument::GetPluginView() { | 179 PluginView* PluginDocument::GetPluginView() { |
| 179 return plugin_node_ && IsHTMLPlugInElement(plugin_node_) | 180 return plugin_node_ ? plugin_node_->OwnedPlugin() : nullptr; |
| 180 ? ToHTMLPlugInElement(plugin_node_)->Plugin() | |
| 181 : nullptr; | |
| 182 } | |
| 183 | |
| 184 Node* PluginDocument::PluginNode() { | |
| 185 return plugin_node_.Get(); | |
| 186 } | 181 } |
| 187 | 182 |
| 188 void PluginDocument::Shutdown() { | 183 void PluginDocument::Shutdown() { |
| 189 // Release the plugin node so that we don't have a circular reference. | 184 // Release the plugin node so that we don't have a circular reference. |
| 190 plugin_node_ = nullptr; | 185 plugin_node_ = nullptr; |
| 191 HTMLDocument::Shutdown(); | 186 HTMLDocument::Shutdown(); |
| 192 } | 187 } |
| 193 | 188 |
| 194 DEFINE_TRACE(PluginDocument) { | 189 DEFINE_TRACE(PluginDocument) { |
| 195 visitor->Trace(plugin_node_); | 190 visitor->Trace(plugin_node_); |
| 196 HTMLDocument::Trace(visitor); | 191 HTMLDocument::Trace(visitor); |
| 197 } | 192 } |
| 198 | 193 |
| 199 } // namespace blink | 194 } // namespace blink |
| OLD | NEW |