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

Unified Diff: chrome/renderer/printing/print_web_view_helper.cc

Issue 788053006: Revert of Remove calls to deprecated SkPDFDevice and SkPDFDocuemnt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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_metafile_skia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/printing/print_web_view_helper.cc
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc
index f038ed665eab5232fe2a008389d9fdbaf4e358c2..28d4bd6b1f24ef27668c8b3fe43050544d3311b7 100644
--- a/chrome/renderer/printing/print_web_view_helper.cc
+++ b/chrome/renderer/printing/print_web_view_helper.cc
@@ -533,8 +533,19 @@
double scale_factor,
blink::WebCanvas* canvas) {
SkAutoCanvasRestore auto_restore(canvas, true);
- canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
- (content_area.y() - canvas_area.y()) / scale_factor);
+ if (content_area != canvas_area) {
+ canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
+ (content_area.y() - canvas_area.y()) / scale_factor);
+ SkRect clip_rect(
+ SkRect::MakeXYWH(content_area.origin().x() / scale_factor,
+ content_area.origin().y() / scale_factor,
+ content_area.size().width() / scale_factor,
+ content_area.size().height() / scale_factor));
+ SkIRect clip_int_rect;
+ clip_rect.roundOut(&clip_int_rect);
+ SkRegion clip_region(clip_int_rect);
+ canvas->setClipRegion(clip_region);
+ }
return frame->printPage(page_number, canvas);
}
« no previous file with comments | « no previous file | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698