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

Side by Side Diff: third_party/WebKit/Source/core/html/PluginDocument.cpp

Issue 2384273007: reflow comments in core/html/*.{cpp,h},core/html/imports (Closed)
Patch Set: comments Created 4 years, 2 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
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 void createDocumentStructure(); 66 void createDocumentStructure();
67 67
68 PluginView* pluginView() const; 68 PluginView* pluginView() const;
69 69
70 Member<HTMLEmbedElement> m_embedElement; 70 Member<HTMLEmbedElement> m_embedElement;
71 }; 71 };
72 72
73 void PluginDocumentParser::createDocumentStructure() { 73 void PluginDocumentParser::createDocumentStructure() {
74 // FIXME: Assert we have a loader to figure out why the original null checks 74 // FIXME: Assert we have a loader to figure out why the original null checks
75 // and assert were added for the security bug in http://trac.webkit.org/change set/87566 75 // and assert were added for the security bug in
76 // http://trac.webkit.org/changeset/87566
76 DCHECK(document()); 77 DCHECK(document());
77 RELEASE_ASSERT(document()->loader()); 78 RELEASE_ASSERT(document()->loader());
78 79
79 LocalFrame* frame = document()->frame(); 80 LocalFrame* frame = document()->frame();
80 if (!frame) 81 if (!frame)
81 return; 82 return;
82 83
83 // FIXME: Why does this check settings? 84 // FIXME: Why does this check settings?
84 if (!frame->settings() || 85 if (!frame->settings() ||
85 !frame->loader().allowPlugins(NotAboutToInstantiatePlugin)) 86 !frame->loader().allowPlugins(NotAboutToInstantiatePlugin))
86 return; 87 return;
87 88
88 HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*document()); 89 HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*document());
89 document()->appendChild(rootElement); 90 document()->appendChild(rootElement);
90 rootElement->insertedByParser(); 91 rootElement->insertedByParser();
91 if (isStopped()) 92 if (isStopped())
92 return; // runScriptsAtDocumentElementAvailable can detach the frame. 93 return; // runScriptsAtDocumentElementAvailable can detach the frame.
93 94
94 HTMLBodyElement* body = HTMLBodyElement::create(*document()); 95 HTMLBodyElement* body = HTMLBodyElement::create(*document());
95 body->setAttribute(styleAttr, 96 body->setAttribute(styleAttr,
96 "background-color: rgb(38,38,38); height: 100%; width: " 97 "background-color: rgb(38,38,38); height: 100%; width: "
97 "100%; overflow: hidden; margin: 0"); 98 "100%; overflow: hidden; margin: 0");
98 rootElement->appendChild(body); 99 rootElement->appendChild(body);
99 if (isStopped()) 100 if (isStopped()) {
100 return; // Possibly detached by a mutation event listener installed in runS criptsAtDocumentElementAvailable. 101 // Possibly detached by a mutation event listener installed in
102 // runScriptsAtDocumentElementAvailable.
103 return;
104 }
101 105
102 m_embedElement = HTMLEmbedElement::create(*document()); 106 m_embedElement = HTMLEmbedElement::create(*document());
103 m_embedElement->setAttribute(widthAttr, "100%"); 107 m_embedElement->setAttribute(widthAttr, "100%");
104 m_embedElement->setAttribute(heightAttr, "100%"); 108 m_embedElement->setAttribute(heightAttr, "100%");
105 m_embedElement->setAttribute(nameAttr, "plugin"); 109 m_embedElement->setAttribute(nameAttr, "plugin");
106 m_embedElement->setAttribute(idAttr, "plugin"); 110 m_embedElement->setAttribute(idAttr, "plugin");
107 m_embedElement->setAttribute(srcAttr, 111 m_embedElement->setAttribute(srcAttr,
108 AtomicString(document()->url().getString())); 112 AtomicString(document()->url().getString()));
109 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); 113 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType());
110 body->appendChild(m_embedElement); 114 body->appendChild(m_embedElement);
111 if (isStopped()) 115 if (isStopped()) {
112 return; // Possibly detached by a mutation event listener installed in runS criptsAtDocumentElementAvailable. 116 // Possibly detached by a mutation event listener installed in
117 // runScriptsAtDocumentElementAvailable.
118 return;
119 }
113 120
114 toPluginDocument(document())->setPluginNode(m_embedElement.get()); 121 toPluginDocument(document())->setPluginNode(m_embedElement.get());
115 122
116 document()->updateStyleAndLayout(); 123 document()->updateStyleAndLayout();
117 124
118 // We need the plugin to load synchronously so we can get the PluginView 125 // We need the plugin to load synchronously so we can get the PluginView
119 // below so flush the layout tasks now instead of waiting on the timer. 126 // below so flush the layout tasks now instead of waiting on the timer.
120 frame->view()->flushAnyPendingPostLayoutTasks(); 127 frame->view()->flushAnyPendingPostLayoutTasks();
121 // Focus the plugin here, as the line above is where the plugin is created. 128 // Focus the plugin here, as the line above is where the plugin is created.
122 if (frame->isMainFrame()) { 129 if (frame->isMainFrame()) {
123 m_embedElement->focus(); 130 m_embedElement->focus();
124 if (isStopped()) 131 if (isStopped()) {
125 return; // Possibly detached by a focus event listener installed in runSc riptsAtDocumentElementAvailable. 132 // Possibly detached by a mutation event listener installed in
133 // runScriptsAtDocumentElementAvailable.
134 return;
135 }
126 } 136 }
127 137
128 if (PluginView* view = pluginView()) 138 if (PluginView* view = pluginView())
129 view->didReceiveResponse(document()->loader()->response()); 139 view->didReceiveResponse(document()->loader()->response());
130 } 140 }
131 141
132 void PluginDocumentParser::appendBytes(const char* data, size_t length) { 142 void PluginDocumentParser::appendBytes(const char* data, size_t length) {
133 if (!m_embedElement) { 143 if (!m_embedElement) {
134 createDocumentStructure(); 144 createDocumentStructure();
135 if (isStopped()) 145 if (isStopped())
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 m_pluginNode = nullptr; 199 m_pluginNode = nullptr;
190 HTMLDocument::shutdown(); 200 HTMLDocument::shutdown();
191 } 201 }
192 202
193 DEFINE_TRACE(PluginDocument) { 203 DEFINE_TRACE(PluginDocument) {
194 visitor->trace(m_pluginNode); 204 visitor->trace(m_pluginNode);
195 HTMLDocument::trace(visitor); 205 HTMLDocument::trace(visitor);
196 } 206 }
197 207
198 } // namespace blink 208 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp ('k') | third_party/WebKit/Source/core/html/RadioNodeList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698