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

Unified Diff: chrome/renderer/print_web_view_helper_linux.cc

Issue 1520014: Linux: fix printing somewhat.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | « no previous file | printing/pdf_ps_metafile_cairo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper_linux.cc
===================================================================
--- chrome/renderer/print_web_view_helper_linux.cc (revision 43766)
+++ chrome/renderer/print_web_view_helper_linux.cc (working copy)
@@ -103,38 +103,19 @@
const gfx::Size& canvas_size,
WebFrame* frame,
printing::NativeMetafile* metafile) {
- // Since WebKit extends the page width depending on the magical shrink
- // factor we make sure the canvas covers the worst case scenario
- // (x2.0 currently). PrintContext will then set the correct clipping region.
- int size_x = static_cast<int>(canvas_size.width() * params.params.max_shrink);
- int size_y = static_cast<int>(canvas_size.height() *
- params.params.max_shrink);
- // Calculate the dpi adjustment.
- float shrink = static_cast<float>(canvas_size.width()) /
- params.params.printable_size.width();
-
- cairo_t* cairo_context = metafile->StartPage(size_x, size_y);
- if (!cairo_context) {
- // TODO(myhuang): We should handle such kind of error further!
- // We already have had DLOG(ERROR) in NativeMetafile::StartPage(),
- // log the error here, too?
+ cairo_t* cairo_context =
+ metafile->StartPage(canvas_size.width(), canvas_size.height());
+ if (!cairo_context)
return;
- }
- skia::VectorCanvas canvas(cairo_context, size_x, size_y);
- float webkit_shrink = frame->printPage(params.page_number, &canvas);
- if (webkit_shrink <= 0) {
- NOTREACHED() << "Printing page " << params.page_number << " failed.";
- } else {
- // Update the dpi adjustment with the "page shrink" calculated in webkit.
- shrink /= webkit_shrink;
- }
+ skia::VectorCanvas canvas(cairo_context,
+ canvas_size.width(), canvas_size.height());
+ frame->printPage(params.page_number, &canvas);
// TODO(myhuang): We should handle transformation for paper margins.
// TODO(myhuang): We should render the header and the footer.
// Done printing. Close the device context to retrieve the compiled metafile.
- if (!metafile->FinishPage(shrink)) {
+ if (!metafile->FinishPage())
NOTREACHED() << "metafile failed";
- }
}
« no previous file with comments | « no previous file | printing/pdf_ps_metafile_cairo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698