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

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: 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 return; // Possibly detached by a mutation event listener installed in
dcheng 2016/10/05 22:29:17 Nit: own line, maybe? (Also surprised that check-
Nico 2016/10/05 22:35:17 Done.
102 // runScriptsAtDocumentElementAvailable.
101 103
102 m_embedElement = HTMLEmbedElement::create(*document()); 104 m_embedElement = HTMLEmbedElement::create(*document());
103 m_embedElement->setAttribute(widthAttr, "100%"); 105 m_embedElement->setAttribute(widthAttr, "100%");
104 m_embedElement->setAttribute(heightAttr, "100%"); 106 m_embedElement->setAttribute(heightAttr, "100%");
105 m_embedElement->setAttribute(nameAttr, "plugin"); 107 m_embedElement->setAttribute(nameAttr, "plugin");
106 m_embedElement->setAttribute(idAttr, "plugin"); 108 m_embedElement->setAttribute(idAttr, "plugin");
107 m_embedElement->setAttribute(srcAttr, 109 m_embedElement->setAttribute(srcAttr,
108 AtomicString(document()->url().getString())); 110 AtomicString(document()->url().getString()));
109 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); 111 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType());
110 body->appendChild(m_embedElement); 112 body->appendChild(m_embedElement);
111 if (isStopped()) 113 if (isStopped())
112 return; // Possibly detached by a mutation event listener installed in runS criptsAtDocumentElementAvailable. 114 return; // Possibly detached by a mutation event listener installed in
115 // runScriptsAtDocumentElementAvailable.
113 116
114 toPluginDocument(document())->setPluginNode(m_embedElement.get()); 117 toPluginDocument(document())->setPluginNode(m_embedElement.get());
115 118
116 document()->updateStyleAndLayout(); 119 document()->updateStyleAndLayout();
117 120
118 // We need the plugin to load synchronously so we can get the PluginView 121 // 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. 122 // below so flush the layout tasks now instead of waiting on the timer.
120 frame->view()->flushAnyPendingPostLayoutTasks(); 123 frame->view()->flushAnyPendingPostLayoutTasks();
121 // Focus the plugin here, as the line above is where the plugin is created. 124 // Focus the plugin here, as the line above is where the plugin is created.
122 if (frame->isMainFrame()) { 125 if (frame->isMainFrame()) {
123 m_embedElement->focus(); 126 m_embedElement->focus();
124 if (isStopped()) 127 if (isStopped())
125 return; // Possibly detached by a focus event listener installed in runSc riptsAtDocumentElementAvailable. 128 return; // Possibly detached by a focus event listener installed in
129 // runScriptsAtDocumentElementAvailable.
126 } 130 }
127 131
128 if (PluginView* view = pluginView()) 132 if (PluginView* view = pluginView())
129 view->didReceiveResponse(document()->loader()->response()); 133 view->didReceiveResponse(document()->loader()->response());
130 } 134 }
131 135
132 void PluginDocumentParser::appendBytes(const char* data, size_t length) { 136 void PluginDocumentParser::appendBytes(const char* data, size_t length) {
133 if (!m_embedElement) { 137 if (!m_embedElement) {
134 createDocumentStructure(); 138 createDocumentStructure();
135 if (isStopped()) 139 if (isStopped())
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 m_pluginNode = nullptr; 193 m_pluginNode = nullptr;
190 HTMLDocument::shutdown(); 194 HTMLDocument::shutdown();
191 } 195 }
192 196
193 DEFINE_TRACE(PluginDocument) { 197 DEFINE_TRACE(PluginDocument) {
194 visitor->trace(m_pluginNode); 198 visitor->trace(m_pluginNode);
195 HTMLDocument::trace(visitor); 199 HTMLDocument::trace(visitor);
196 } 200 }
197 201
198 } // namespace blink 202 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698