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

Unified Diff: Source/core/html/shadow/PluginPlaceholderElement.js

Issue 522783002: Add a custom element to own structure of shadow DOM plugin placeholders. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blink-in-JS Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/shadow/PluginPlaceholderElement.js
diff --git a/Source/core/html/shadow/PluginPlaceholderElement.js b/Source/core/html/shadow/PluginPlaceholderElement.js
new file mode 100644
index 0000000000000000000000000000000000000000..23c0202044bd5e3748dffe38d3665c6238dc719d
--- /dev/null
+++ b/Source/core/html/shadow/PluginPlaceholderElement.js
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+'use strict';
+
+installClass('PluginPlaceholderElement', function(PluginPlaceholderElementPrototype) {
+ PluginPlaceholderElementPrototype.initializePlaceholderElements = function() {
+ // Produces DOM roughly equivalent to the following HTML:
+ //
+ // <div id="plugin-placeholder">
+ // <div id="plugin-placeholder-content">
+ // <div id="plugin-placeholder-message"></div>
+ // </div>
+ // </div>
+ //
+ // FIXME: Move style out of script and into CSS.
haraken 2014/08/31 14:53:34 This is something Blink-in-JS needs to support. Do
jbroman 2014/08/31 16:53:50 The simplest approach for my needs so far (and Phi
haraken 2014/09/01 00:47:38 Yes, I believe this is a right way to go. I'll com
+
+ this.id = 'plugin-placeholder';
+ this.style.width = '100%';
+ this.style.height = '100%';
+ this.style.overflow = 'hidden';
+ this.style.display = 'flex';
+ this.style.alignItems = 'center';
+ this.style.backgroundColor = 'gray';
+ this.style.font = '12px -webkit-control';
+
+ var contentElement = document.createElement('div');
+ contentElement.id = 'plugin-placeholder-content';
+ contentElement.style.textAlign = 'center';
+ contentElement.style.margin = 'auto';
+
+ var messageElement = document.createElement('div');
+ messageElement.id = 'plugin-placeholder-message';
+
+ contentElement.appendChild(messageElement);
+ this.appendChild(contentElement);
+
+ this.messageElement = messageElement;
+ };
+
+ Object.defineProperty(PluginPlaceholderElementPrototype, 'message', {
+ get: function() { return this.messageElement.innerHTML; },
+ set: function(html) { this.messageElement.innerHTML = html; },
haraken 2014/08/31 14:53:34 What happens if |html| contains <script> tags? Isn
jbroman 2014/08/31 16:53:50 It should not be possible for author script to rea
jbroman 2014/08/31 19:00:51 Though now that this is in JavaScript, the possibi
haraken 2014/09/01 00:47:38 I'm not familiar with how the plugin placeholder e
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698