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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 12474: Reverting 5974. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 12 years 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
« no previous file with comments | « chrome/browser/printing/print_job_unittest.cc ('k') | chrome/test/unit/unit_tests.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // Safari uses: 765 & 1224. Margins aren't exactly the same either. 446 // Safari uses: 765 & 1224. Margins aren't exactly the same either.
447 // Scale = 2.222 for MDI printer. 447 // Scale = 2.222 for MDI printer.
448 int pages; 448 int pages;
449 if (!frame->SetPrintingMode(true, 449 if (!frame->SetPrintingMode(true,
450 minLayoutWidth, 450 minLayoutWidth,
451 maxLayoutWidth, 451 maxLayoutWidth,
452 &printed_document_width_)) { 452 &printed_document_width_)) {
453 NOTREACHED(); 453 NOTREACHED();
454 pages = 0; 454 pages = 0;
455 } else { 455 } else {
456 DCHECK_GT(printed_document_width_, 0);
456 // Force to recalculate the height, otherwise it reuse the current window 457 // Force to recalculate the height, otherwise it reuse the current window
457 // height as the default. 458 // height as the default.
458 float effective_shrink = printed_document_width_ / paper_width; 459 float effective_shrink = printed_document_width_ / paper_width;
459 gfx::Size page_size(printed_document_width_, 460 gfx::Size page_size(printed_document_width_,
460 static_cast<int>(paper_height * effective_shrink) - 1); 461 static_cast<int>(paper_height * effective_shrink) - 1);
461 WebView* view = frame->GetView(); 462 WebView* view = frame->GetView();
462 if (view) { 463 if (view) {
463 // Hack around an issue where if the current view height is higher than 464 // Hack around an issue where if the current view height is higher than
464 // the page height, empty pages will be printed even if the bottom of the 465 // the page height, empty pages will be printed even if the bottom of the
465 // web page is empty. 466 // web page is empty.
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 template_resource_id)); 2728 template_resource_id));
2728 2729
2729 if (template_html.empty()) { 2730 if (template_html.empty()) {
2730 NOTREACHED() << "unable to load template. ID: " << template_resource_id; 2731 NOTREACHED() << "unable to load template. ID: " << template_resource_id;
2731 return ""; 2732 return "";
2732 } 2733 }
2733 // "t" is the id of the templates root node. 2734 // "t" is the id of the templates root node.
2734 return jstemplate_builder::GetTemplateHtml( 2735 return jstemplate_builder::GetTemplateHtml(
2735 template_html, &error_strings, "t"); 2736 template_html, &error_strings, "t");
2736 } 2737 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job_unittest.cc ('k') | chrome/test/unit/unit_tests.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698