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

Unified Diff: chrome/renderer/resources/plugin_poster.html

Issue 1085993003: Plugin Power Saver: Make posters work right when image is 404 Not Found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0263-plugin-power-saver-heuristic-tests
Patch Set: Created 5 years, 8 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
« no previous file with comments | « chrome/renderer/resources/plugin_placeholders.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/plugin_poster.html
diff --git a/chrome/renderer/resources/plugin_poster.html b/chrome/renderer/resources/plugin_poster.html
index 0a3742a6f92cbc460058ab157445b6d0e95a5a81..29515f23943a2cf2b48526c80461127df0b98f90 100644
--- a/chrome/renderer/resources/plugin_poster.html
+++ b/chrome/renderer/resources/plugin_poster.html
@@ -4,12 +4,12 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<script>
-function notifyDidFinishLoading() {
+window.onload = function() {
if (plugin.didFinishLoading)
plugin.didFinishLoading();
-}
+};
-document.onkeydown = function(e) {
+window.onkeydown = function(e) {
if (e.keyIdentifier == 'Enter' || e.keyIdentifier == 'U+0020') {
plugin.load();
e.preventDefault();
@@ -19,17 +19,17 @@ document.onkeydown = function(e) {
<link rel="stylesheet" href="plugin_placeholders.css"></link>
<style>
#outer {
- position: relative;
border: none;
cursor: pointer;
+ position: relative;
}
#shielding {
background-color: rgba(0, 0, 0, 0.5);
+ height: 100%;
+ left: 0px;
position: absolute;
top: 0px;
- left: 0px;
- height: 100%;
width: 100%;
z-index: 2;
}
@@ -44,14 +44,15 @@ document.onkeydown = function(e) {
#poster {
height: 100%;
+ object-fit: contain;
width: 100%;
z-index: 1;
}
#inner_container {
height: 100%;
- width: 100%;
position: relative;
+ width: 100%;
}
#inner {
@@ -61,8 +62,8 @@ document.onkeydown = function(e) {
<base i18n-values="href:baseurl">
</head>
-<body onload="notifyDidFinishLoading();">
- <div i18n-values="title:name" id="outer" onclick="plugin.load()">
+<body>
+ <div i18n-values="title:name" id="outer">
<img id="poster" i18n-values="srcset:poster">
<div id="shielding">
<div id="inner_container"
@@ -73,5 +74,14 @@ document.onkeydown = function(e) {
</div>
</div>
</div>
+ <script>
Dan Beam 2015/04/22 20:19:17 nit: +\s\s indent, e.g. <script> // start here,
tommycli 2015/04/23 19:01:27 Done.
+ document.getElementById('poster').onerror = function() {
+ this.hidden = true;
+ };
+
+ document.getElementById('outer').onclick = function() {
+ plugin.load();
+ };
Dan Beam 2015/04/22 20:19:17 you may need to defer calling getElementById() unt
Dan Beam 2015/04/22 20:20:36 eh, actually seems fine: http://stackoverflow.com/
+ </script>
</body>
</html>
« no previous file with comments | « chrome/renderer/resources/plugin_placeholders.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698