Print photos in full resolution from the Photo Editor


BUG=None


Review URL: https://chromiumcodereview.appspot.com/10832270

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151697 0039d316-1c4b-4281-b951-d872f2087c98
parent 1be92e0a
...@@ -111,6 +111,43 @@ body { ...@@ -111,6 +111,43 @@ body {
opacity: 0; opacity: 0;
} }
/* Full resolution image is invisible unless printing. */
.gallery > .image-container > canvas.fullres {
display: none;
}
@media print {
/* Do not print anything but the image. */
.gallery > :not(.image-container) {
display: none !important;
}
/* Center the printed image. */
.gallery > .image-container {
-webkit-box-align: center;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
display: -webkit-box;
}
/* Do not print the screen resolution image. */
.gallery > .image-container > canvas.image {
display: none !important;
}
/* Print the full resolution image instead. */
.gallery > .image-container > canvas.fullres {
display: block !important;
max-height: 100%;
max-width: 100%;
}
/* Print video at the center of the page */
.gallery > .image-container > video.image {
position: auto !important;
}
}
/* Toolbar */ /* Toolbar */
.gallery > .toolbar { .gallery > .toolbar {
......
...@@ -495,6 +495,9 @@ ImageView.prototype.prefetch = function(id, url) { ...@@ -495,6 +495,9 @@ ImageView.prototype.prefetch = function(id, url) {
ImageView.prototype.replaceContent_ = function( ImageView.prototype.replaceContent_ = function(
content, opt_reuseScreenCanvas, opt_width, opt_height, opt_preview) { content, opt_reuseScreenCanvas, opt_width, opt_height, opt_preview) {
if (this.contentCanvas_ && this.contentCanvas_.parentNode == this.container_)
this.container_.removeChild(this.contentCanvas_);
if (content.constructor.name == 'HTMLVideoElement') { if (content.constructor.name == 'HTMLVideoElement') {
this.contentCanvas_ = null; this.contentCanvas_ = null;
this.videoElement_ = content; this.videoElement_ = content;
...@@ -526,6 +529,10 @@ ImageView.prototype.replaceContent_ = function( ...@@ -526,6 +529,10 @@ ImageView.prototype.replaceContent_ = function(
this.preview_ = opt_preview; this.preview_ = opt_preview;
// If this is not a thumbnail, cache the content and the screen-scale image. // If this is not a thumbnail, cache the content and the screen-scale image.
if (this.hasValidImage()) { if (this.hasValidImage()) {
// Insert the full resolution canvas into DOM so that it can be printed.
this.container_.appendChild(this.contentCanvas_);
this.contentCanvas_.classList.add('fullres');
this.contentCache_.putItem(this.contentID_, this.contentCanvas_, true); this.contentCache_.putItem(this.contentID_, this.contentCanvas_, true);
this.screenCache_.putItem(this.contentID_, this.screenImage_); this.screenCache_.putItem(this.contentID_, this.screenImage_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment