| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/loader/FrameLoaderClient.h" | 38 #include "core/loader/FrameLoaderClient.h" |
| 39 #include "core/plugins/PluginView.h" | 39 #include "core/plugins/PluginView.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 using namespace HTMLNames; | 43 using namespace HTMLNames; |
| 44 | 44 |
| 45 // FIXME: Share more code with MediaDocumentParser. | 45 // FIXME: Share more code with MediaDocumentParser. |
| 46 class PluginDocumentParser : public RawDataDocumentParser { | 46 class PluginDocumentParser : public RawDataDocumentParser { |
| 47 public: | 47 public: |
| 48 static PassRefPtrWillBeRawPtr<PluginDocumentParser> create(PluginDocument* d
ocument) | 48 static RawPtr<PluginDocumentParser> create(PluginDocument* document) |
| 49 { | 49 { |
| 50 return adoptRefWillBeNoop(new PluginDocumentParser(document)); | 50 return new PluginDocumentParser(document); |
| 51 } | 51 } |
| 52 | 52 |
| 53 DEFINE_INLINE_VIRTUAL_TRACE() | 53 DEFINE_INLINE_VIRTUAL_TRACE() |
| 54 { | 54 { |
| 55 visitor->trace(m_embedElement); | 55 visitor->trace(m_embedElement); |
| 56 RawDataDocumentParser::trace(visitor); | 56 RawDataDocumentParser::trace(visitor); |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 PluginDocumentParser(Document* document) | 60 PluginDocumentParser(Document* document) |
| 61 : RawDataDocumentParser(document) | 61 : RawDataDocumentParser(document) |
| 62 , m_embedElement(nullptr) | 62 , m_embedElement(nullptr) |
| 63 { | 63 { |
| 64 } | 64 } |
| 65 | 65 |
| 66 void appendBytes(const char*, size_t) override; | 66 void appendBytes(const char*, size_t) override; |
| 67 | 67 |
| 68 void finish() override; | 68 void finish() override; |
| 69 | 69 |
| 70 void createDocumentStructure(); | 70 void createDocumentStructure(); |
| 71 | 71 |
| 72 PluginView* pluginView() const; | 72 PluginView* pluginView() const; |
| 73 | 73 |
| 74 RefPtrWillBeMember<HTMLEmbedElement> m_embedElement; | 74 Member<HTMLEmbedElement> m_embedElement; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 void PluginDocumentParser::createDocumentStructure() | 77 void PluginDocumentParser::createDocumentStructure() |
| 78 { | 78 { |
| 79 // FIXME: Assert we have a loader to figure out why the original null checks | 79 // FIXME: Assert we have a loader to figure out why the original null checks |
| 80 // and assert were added for the security bug in http://trac.webkit.org/chan
geset/87566 | 80 // and assert were added for the security bug in http://trac.webkit.org/chan
geset/87566 |
| 81 ASSERT(document()); | 81 ASSERT(document()); |
| 82 RELEASE_ASSERT(document()->loader()); | 82 RELEASE_ASSERT(document()->loader()); |
| 83 | 83 |
| 84 LocalFrame* frame = document()->frame(); | 84 LocalFrame* frame = document()->frame(); |
| 85 if (!frame) | 85 if (!frame) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 // FIXME: Why does this check settings? | 88 // FIXME: Why does this check settings? |
| 89 if (!frame->settings() || !frame->loader().allowPlugins(NotAboutToInstantiat
ePlugin)) | 89 if (!frame->settings() || !frame->loader().allowPlugins(NotAboutToInstantiat
ePlugin)) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*d
ocument()); | 92 RawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*document()); |
| 93 rootElement->insertedByParser(); | 93 rootElement->insertedByParser(); |
| 94 document()->appendChild(rootElement); | 94 document()->appendChild(rootElement); |
| 95 frame->loader().dispatchDocumentElementAvailable(); | 95 frame->loader().dispatchDocumentElementAvailable(); |
| 96 frame->loader().runScriptsAtDocumentElementAvailable(); | 96 frame->loader().runScriptsAtDocumentElementAvailable(); |
| 97 if (isStopped()) | 97 if (isStopped()) |
| 98 return; // runScriptsAtDocumentElementAvailable can detach the frame. | 98 return; // runScriptsAtDocumentElementAvailable can detach the frame. |
| 99 | 99 |
| 100 RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document
()); | 100 RawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document()); |
| 101 body->setAttribute(styleAttr, "background-color: rgb(38,38,38); height: 100%
; width: 100%; overflow: hidden; margin: 0"); | 101 body->setAttribute(styleAttr, "background-color: rgb(38,38,38); height: 100%
; width: 100%; overflow: hidden; margin: 0"); |
| 102 rootElement->appendChild(body); | 102 rootElement->appendChild(body); |
| 103 if (isStopped()) | 103 if (isStopped()) |
| 104 return; // Possibly detached by a mutation event listener installed in r
unScriptsAtDocumentElementAvailable. | 104 return; // Possibly detached by a mutation event listener installed in r
unScriptsAtDocumentElementAvailable. |
| 105 | 105 |
| 106 m_embedElement = HTMLEmbedElement::create(*document()); | 106 m_embedElement = HTMLEmbedElement::create(*document()); |
| 107 m_embedElement->setAttribute(widthAttr, "100%"); | 107 m_embedElement->setAttribute(widthAttr, "100%"); |
| 108 m_embedElement->setAttribute(heightAttr, "100%"); | 108 m_embedElement->setAttribute(heightAttr, "100%"); |
| 109 m_embedElement->setAttribute(nameAttr, "plugin"); | 109 m_embedElement->setAttribute(nameAttr, "plugin"); |
| 110 m_embedElement->setAttribute(idAttr, "plugin"); | 110 m_embedElement->setAttribute(idAttr, "plugin"); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return 0; | 161 return 0; |
| 162 } | 162 } |
| 163 | 163 |
| 164 PluginDocument::PluginDocument(const DocumentInit& initializer) | 164 PluginDocument::PluginDocument(const DocumentInit& initializer) |
| 165 : HTMLDocument(initializer, PluginDocumentClass) | 165 : HTMLDocument(initializer, PluginDocumentClass) |
| 166 { | 166 { |
| 167 setCompatibilityMode(QuirksMode); | 167 setCompatibilityMode(QuirksMode); |
| 168 lockCompatibilityMode(); | 168 lockCompatibilityMode(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 PassRefPtrWillBeRawPtr<DocumentParser> PluginDocument::createParser() | 171 RawPtr<DocumentParser> PluginDocument::createParser() |
| 172 { | 172 { |
| 173 return PluginDocumentParser::create(this); | 173 return PluginDocumentParser::create(this); |
| 174 } | 174 } |
| 175 | 175 |
| 176 Widget* PluginDocument::pluginWidget() | 176 Widget* PluginDocument::pluginWidget() |
| 177 { | 177 { |
| 178 if (m_pluginNode && m_pluginNode->layoutObject()) { | 178 if (m_pluginNode && m_pluginNode->layoutObject()) { |
| 179 ASSERT(m_pluginNode->layoutObject()->isEmbeddedObject()); | 179 ASSERT(m_pluginNode->layoutObject()->isEmbeddedObject()); |
| 180 return toLayoutEmbeddedObject(m_pluginNode->layoutObject())->widget(); | 180 return toLayoutEmbeddedObject(m_pluginNode->layoutObject())->widget(); |
| 181 } | 181 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 194 HTMLDocument::detach(context); | 194 HTMLDocument::detach(context); |
| 195 } | 195 } |
| 196 | 196 |
| 197 DEFINE_TRACE(PluginDocument) | 197 DEFINE_TRACE(PluginDocument) |
| 198 { | 198 { |
| 199 visitor->trace(m_pluginNode); | 199 visitor->trace(m_pluginNode); |
| 200 HTMLDocument::trace(visitor); | 200 HTMLDocument::trace(visitor); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |