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

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

Issue 1413603004: Delay embed-element focus until after plugin creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 m_embedElement = HTMLEmbedElement::create(*document()); 102 m_embedElement = HTMLEmbedElement::create(*document());
103 m_embedElement->setAttribute(widthAttr, "100%"); 103 m_embedElement->setAttribute(widthAttr, "100%");
104 m_embedElement->setAttribute(heightAttr, "100%"); 104 m_embedElement->setAttribute(heightAttr, "100%");
105 m_embedElement->setAttribute(nameAttr, "plugin"); 105 m_embedElement->setAttribute(nameAttr, "plugin");
106 m_embedElement->setAttribute(idAttr, "plugin"); 106 m_embedElement->setAttribute(idAttr, "plugin");
107 m_embedElement->setAttribute(srcAttr, AtomicString(document()->url().string( ))); 107 m_embedElement->setAttribute(srcAttr, AtomicString(document()->url().string( )));
108 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); 108 m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType());
109 body->appendChild(m_embedElement); 109 body->appendChild(m_embedElement);
110 110
111 toPluginDocument(document())->setPluginNode(m_embedElement.get()); 111 toPluginDocument(document())->setPluginNode(m_embedElement.get());
112 m_embedElement->focus();
113 112
114 document()->updateLayout(); 113 document()->updateLayout();
115 114
116 // We need the plugin to load synchronously so we can get the PluginView 115 // We need the plugin to load synchronously so we can get the PluginView
117 // below so flush the layout tasks now instead of waiting on the timer. 116 // below so flush the layout tasks now instead of waiting on the timer.
118 frame->view()->flushAnyPendingPostLayoutTasks(); 117 frame->view()->flushAnyPendingPostLayoutTasks();
118 // Focus the plugin here, as the line above is where the plugin is created.
119 m_embedElement->focus();
119 120
120 if (PluginView* view = pluginView()) 121 if (PluginView* view = pluginView())
121 view->didReceiveResponse(document()->loader()->response()); 122 view->didReceiveResponse(document()->loader()->response());
122 } 123 }
123 124
124 void PluginDocumentParser::appendBytes(const char* data, size_t length) 125 void PluginDocumentParser::appendBytes(const char* data, size_t length)
125 { 126 {
126 if (!m_embedElement) 127 if (!m_embedElement)
127 createDocumentStructure(); 128 createDocumentStructure();
128 129
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 HTMLDocument::detach(context); 188 HTMLDocument::detach(context);
188 } 189 }
189 190
190 DEFINE_TRACE(PluginDocument) 191 DEFINE_TRACE(PluginDocument)
191 { 192 {
192 visitor->trace(m_pluginNode); 193 visitor->trace(m_pluginNode);
193 HTMLDocument::trace(visitor); 194 HTMLDocument::trace(visitor);
194 } 195 }
195 196
196 } 197 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698