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

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

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix tests build Created 7 years, 3 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 | Annotate | Revision Log
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 PluginView* pluginView() const; 67 PluginView* pluginView() const;
68 68
69 RefPtr<HTMLEmbedElement> m_embedElement; 69 RefPtr<HTMLEmbedElement> m_embedElement;
70 }; 70 };
71 71
72 void PluginDocumentParser::createDocumentStructure() 72 void PluginDocumentParser::createDocumentStructure()
73 { 73 {
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/chan geset/87566 75 // and assert were added for the security bug in http://trac.webkit.org/chan geset/87566
76 ASSERT(document());
76 RELEASE_ASSERT(document()->loader()); 77 RELEASE_ASSERT(document()->loader());
77 78
78 Frame* frame = document()->frame(); 79 Frame* frame = document()->frame();
79 if (!frame) 80 if (!frame)
80 return; 81 return;
81 82
82 // FIXME: Why does this check settings? 83 // FIXME: Why does this check settings?
83 if (!frame->settings() || !frame->loader()->allowPlugins(NotAboutToInstantia tePlugin)) 84 if (!frame->settings() || !frame->loader()->allowPlugins(NotAboutToInstantia tePlugin))
84 return; 85 return;
85 86
86 RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(document()); 87 RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*document());
87 rootElement->insertedByParser(); 88 rootElement->insertedByParser();
88 document()->appendChild(rootElement); 89 document()->appendChild(rootElement);
89 frame->loader()->dispatchDocumentElementAvailable(); 90 frame->loader()->dispatchDocumentElementAvailable();
90 91
91 RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(document()); 92 RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document());
92 body->setAttribute(marginwidthAttr, "0"); 93 body->setAttribute(marginwidthAttr, "0");
93 body->setAttribute(marginheightAttr, "0"); 94 body->setAttribute(marginheightAttr, "0");
94 body->setAttribute(styleAttr, "background-color: rgb(38,38,38)"); 95 body->setAttribute(styleAttr, "background-color: rgb(38,38,38)");
95 rootElement->appendChild(body); 96 rootElement->appendChild(body);
96 97
97 m_embedElement = HTMLEmbedElement::create(document()); 98 m_embedElement = HTMLEmbedElement::create(*document());
98 m_embedElement->setAttribute(widthAttr, "100%"); 99 m_embedElement->setAttribute(widthAttr, "100%");
99 m_embedElement->setAttribute(heightAttr, "100%"); 100 m_embedElement->setAttribute(heightAttr, "100%");
100 m_embedElement->setAttribute(nameAttr, "plugin"); 101 m_embedElement->setAttribute(nameAttr, "plugin");
101 m_embedElement->setAttribute(srcAttr, document()->url().string()); 102 m_embedElement->setAttribute(srcAttr, document()->url().string());
102 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); 103 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType());
103 body->appendChild(m_embedElement); 104 body->appendChild(m_embedElement);
104 105
105 toPluginDocument(document())->setPluginNode(m_embedElement.get()); 106 toPluginDocument(document())->setPluginNode(m_embedElement.get());
106 107
107 document()->updateLayout(); 108 document()->updateLayout();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // with how many times we call beforeload on object elements. <rdar://proble m/8441094>. 190 // with how many times we call beforeload on object elements. <rdar://proble m/8441094>.
190 if (!shouldLoadPluginManually()) 191 if (!shouldLoadPluginManually())
191 return; 192 return;
192 193
193 DocumentLoader* documentLoader = frame()->loader()->activeDocumentLoader(); 194 DocumentLoader* documentLoader = frame()->loader()->activeDocumentLoader();
194 documentLoader->cancelMainResourceLoad(ResourceError::cancelledError(documen tLoader->request().url())); 195 documentLoader->cancelMainResourceLoad(ResourceError::cancelledError(documen tLoader->request().url()));
195 setShouldLoadPluginManually(false); 196 setShouldLoadPluginManually(false);
196 } 197 }
197 198
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698