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

Side by Side Diff: Source/core/html/shadow/PluginPlaceholderElement.js

Issue 516273002: Move plugin placeholder style to CSS, and allow it to bypass main world CSP. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: gn Created 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 installClass('PluginPlaceholderElement', function(PluginPlaceholderElementProtot ype) { 7 installClass('PluginPlaceholderElement', function(PluginPlaceholderElementProtot ype) {
8 PluginPlaceholderElementPrototype.createCallback = function() { 8 PluginPlaceholderElementPrototype.createCallback = function() {
9 // Produces DOM roughly equivalent to the following HTML: 9 // Produces DOM roughly equivalent to the following HTML:
10 // 10 //
11 // <div id="plugin-placeholder"> 11 // <div id="plugin-placeholder">
12 // <div id="plugin-placeholder-content"> 12 // <div id="plugin-placeholder-content">
13 // <div id="plugin-placeholder-message"></div> 13 // <div id="plugin-placeholder-message"></div>
14 // </div> 14 // </div>
15 // </div> 15 // </div>
16 //
17 // FIXME: Move style out of script and into CSS.
18 16
19 this.id = 'plugin-placeholder'; 17 this.id = 'plugin-placeholder';
20 this.style.width = '100%'; 18
21 this.style.height = '100%'; 19 var styleElement = document.createElement('style');
22 this.style.overflow = 'hidden'; 20 styleElement.textContent = this.styleSource;
23 this.style.display = 'flex';
24 this.style.alignItems = 'center';
25 this.style.backgroundColor = 'gray';
26 this.style.font = '12px -webkit-control';
27 21
28 var contentElement = document.createElement('div'); 22 var contentElement = document.createElement('div');
29 contentElement.id = 'plugin-placeholder-content'; 23 contentElement.id = 'plugin-placeholder-content';
30 contentElement.style.textAlign = 'center';
31 contentElement.style.margin = 'auto';
32 24
33 var messageElement = document.createElement('div'); 25 var messageElement = document.createElement('div');
34 messageElement.id = 'plugin-placeholder-message'; 26 messageElement.id = 'plugin-placeholder-message';
35 27
36 contentElement.appendChild(messageElement); 28 contentElement.appendChild(messageElement);
29 this.appendChild(styleElement);
37 this.appendChild(contentElement); 30 this.appendChild(contentElement);
38 31
39 this.messageElement = messageElement; 32 this.messageElement = messageElement;
40 }; 33 };
41 34
42 Object.defineProperty(PluginPlaceholderElementPrototype, 'message', { 35 Object.defineProperty(PluginPlaceholderElementPrototype, 'message', {
43 get: function() { return this.messageElement.innerHTML; }, 36 get: function() { return this.messageElement.innerHTML; },
44 set: function(html) { this.messageElement.innerHTML = html; }, 37 set: function(html) { this.messageElement.innerHTML = html; },
45 }); 38 });
46 }); 39 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698