summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-12-22 09:04:02 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-12-22 09:04:02 -0800
commita97ec8dc9418097df452c6423c191065a7ca4617 (patch)
tree1d93b1d3e360a8ff60dd852f8bbe9fbcbec0c003
parentf74dcfcf001849096a95496a8cd30bed25e79757 (diff)
parent0de27439a6217b7edfe6636a6740e0a260e5513a (diff)
downloadframeworks_base-a97ec8dc9418097df452c6423c191065a7ca4617.zip
frameworks_base-a97ec8dc9418097df452c6423c191065a7ca4617.tar.gz
frameworks_base-a97ec8dc9418097df452c6423c191065a7ca4617.tar.bz2
Merge "Create a better placeholder for YT videos when flash is not installed."
-rw-r--r--core/res/assets/webkit/youtube.html16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/res/assets/webkit/youtube.html b/core/res/assets/webkit/youtube.html
index 289f8cf..d808bcf 100644
--- a/core/res/assets/webkit/youtube.html
+++ b/core/res/assets/webkit/youtube.html
@@ -38,19 +38,29 @@
// All images are loaded, so display them.
// (Note that the images are loaded from javascript, so might load
// after document.onload fires)
- ctx.drawImage(background, 0, 0, width, height);
+
playWidth = play.width;
playHeight = play.height;
logoWidth = logo.width;
logoHeight = logo.height;
var ratio = 1;
// If the page is smaller than it 'should' be in either dimension
- // we scale the play button and logo according to the dimension that
- // has been shrunk the most.
+ // we scale the background, play button and logo according to the
+ // dimension that has been shrunk the most.
if (width / height > defWidth / defHeight && height < defHeight) {
ratio = height / defHeight;
+ // Stretch the background in this dimension only.
+ backgroundHeight = background.height / ratio;
+ ctx.drawImage(background, 0, 0, background.width, background.height,
+ 0, (height - backgroundHeight) / 2, width, backgroundHeight);
} else if (width / height < defWidth / defHeight && width < defWidth) {
ratio = width / defWidth;
+ backgroundWidth = background.width / ratio;
+ ctx.drawImage(background, 0, 0, background.width, background.height,
+ (width - backgroundWidth) / 2, 0, backgroundWidth, height);
+ } else {
+ // In this case stretch the background in both dimensions to fill the space.
+ ctx.drawImage(background, 0, 0, width, height);
}
playWidth *= ratio;
playHeight *= ratio;