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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*d ocument()); |
93 rootElement->insertedByParser(); | 93 rootElement->insertedByParser(); |
94 document()->appendChild(rootElement); | 94 document()->appendChild(rootElement); |
95 frame->loader().dispatchDocumentElementAvailable(); | 95 frame->loader().dispatchDocumentElementAvailable(); |
96 if (isStopped()) | |
97 return; | |
96 | 98 |
97 RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document ()); | 99 RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document ()); |
98 body->setAttribute(styleAttr, "background-color: rgb(38,38,38); height: 100% ; width: 100%; overflow: hidden; margin: 0"); | 100 body->setAttribute(styleAttr, "background-color: rgb(38,38,38); height: 100% ; width: 100%; overflow: hidden; margin: 0"); |
99 rootElement->appendChild(body); | 101 rootElement->appendChild(body); |
102 if (isStopped()) | |
esprehn
2016/02/17 01:43:47
huh?
| |
103 return; | |
100 | 104 |
101 m_embedElement = HTMLEmbedElement::create(*document()); | 105 m_embedElement = HTMLEmbedElement::create(*document()); |
102 m_embedElement->setAttribute(widthAttr, "100%"); | 106 m_embedElement->setAttribute(widthAttr, "100%"); |
103 m_embedElement->setAttribute(heightAttr, "100%"); | 107 m_embedElement->setAttribute(heightAttr, "100%"); |
104 m_embedElement->setAttribute(nameAttr, "plugin"); | 108 m_embedElement->setAttribute(nameAttr, "plugin"); |
105 m_embedElement->setAttribute(idAttr, "plugin"); | 109 m_embedElement->setAttribute(idAttr, "plugin"); |
106 m_embedElement->setAttribute(srcAttr, AtomicString(document()->url().string( ))); | 110 m_embedElement->setAttribute(srcAttr, AtomicString(document()->url().string( ))); |
107 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); | 111 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); |
108 body->appendChild(m_embedElement); | 112 body->appendChild(m_embedElement); |
113 if (isStopped()) | |
esprehn
2016/02/17 01:43:47
how does inserting the body run script internally?
| |
114 return; | |
109 | 115 |
110 toPluginDocument(document())->setPluginNode(m_embedElement.get()); | 116 toPluginDocument(document())->setPluginNode(m_embedElement.get()); |
111 | 117 |
112 document()->updateLayout(); | 118 document()->updateLayout(); |
113 | 119 |
114 // We need the plugin to load synchronously so we can get the PluginView | 120 // We need the plugin to load synchronously so we can get the PluginView |
115 // below so flush the layout tasks now instead of waiting on the timer. | 121 // below so flush the layout tasks now instead of waiting on the timer. |
116 frame->view()->flushAnyPendingPostLayoutTasks(); | 122 frame->view()->flushAnyPendingPostLayoutTasks(); |
117 // Focus the plugin here, as the line above is where the plugin is created. | 123 // Focus the plugin here, as the line above is where the plugin is created. |
118 if (frame->isMainFrame()) | 124 if (frame->isMainFrame()) { |
119 m_embedElement->focus(); | 125 m_embedElement->focus(); |
126 if (isStopped()) | |
esprehn
2016/02/17 01:43:47
huh? What happens inside focus?
robwu
2016/02/22 00:15:02
It synchronously dispatches the focus event. A pot
| |
127 return; | |
128 } | |
120 | 129 |
121 if (PluginView* view = pluginView()) | 130 if (PluginView* view = pluginView()) |
122 view->didReceiveResponse(document()->loader()->response()); | 131 view->didReceiveResponse(document()->loader()->response()); |
123 } | 132 } |
124 | 133 |
125 void PluginDocumentParser::appendBytes(const char* data, size_t length) | 134 void PluginDocumentParser::appendBytes(const char* data, size_t length) |
126 { | 135 { |
127 if (!m_embedElement) | 136 if (!m_embedElement) { |
128 createDocumentStructure(); | 137 createDocumentStructure(); |
138 if (isStopped()) | |
139 return; | |
140 } | |
129 | 141 |
130 if (!length) | 142 if (!length) |
131 return; | 143 return; |
132 if (PluginView* view = pluginView()) | 144 if (PluginView* view = pluginView()) |
133 view->didReceiveData(data, length); | 145 view->didReceiveData(data, length); |
134 } | 146 } |
135 | 147 |
136 void PluginDocumentParser::finish() | 148 void PluginDocumentParser::finish() |
137 { | 149 { |
138 m_embedElement = nullptr; | 150 m_embedElement = nullptr; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 HTMLDocument::detach(context); | 193 HTMLDocument::detach(context); |
182 } | 194 } |
183 | 195 |
184 DEFINE_TRACE(PluginDocument) | 196 DEFINE_TRACE(PluginDocument) |
185 { | 197 { |
186 visitor->trace(m_pluginNode); | 198 visitor->trace(m_pluginNode); |
187 HTMLDocument::trace(visitor); | 199 HTMLDocument::trace(visitor); |
188 } | 200 } |
189 | 201 |
190 } // namespace blink | 202 } // namespace blink |
OLD | NEW |