diff options
author | halcanary <halcanary@google.com> | 2015-01-08 09:03:22 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-08 17:04:06 +0000 |
commit | 5c2d68a04c4f5ce03f941656ad940b938dbf9f64 (patch) | |
tree | 3be3226542e3d7f33470a351397b9ceef8e6c593 /chrome/renderer/printing/print_web_view_helper.cc | |
parent | a5de1667737547bf54f80f8491226091ab19ee28 (diff) | |
download | chromium_src-5c2d68a04c4f5ce03f941656ad940b938dbf9f64.zip chromium_src-5c2d68a04c4f5ce03f941656ad940b938dbf9f64.tar.gz chromium_src-5c2d68a04c4f5ce03f941656ad940b938dbf9f64.tar.bz2 |
Revert of Remove calls to deprecated SkPDFDevice and SkPDFDocuemnt. (patchset #6 id:140001 of https://codereview.chromium.org/821703005/)
Reason for revert:
A bisect proved that this change caused
https://code.google.com/p/chromium/issues/detail?id=446729
Original issue's description:
> Remove calls to deprecated SkPDFDevice and SkPDFDocuemnt.
>
> This relands http://crrev.com/694213002
>
> In the PdfMetafileSkia class, Instead of storing a
> SkPDFDocument, store a vector of pages as
> SkPictures. This allows access to individual at any
> time. When FinishDocument() is called, use the
> SkDocument API to print all pages to PDF.
>
> In PrintWebViewHelper::RenderPageContent, skip clipping
> content to content area, since Windows printing prints
> content just outside of the content area, as noted in
> http://crbug.com/434079 .
>
> BUG=278148
>
> Committed: https://crrev.com/18387e7ebb0eae6e4944e841d63ea058adab6e11
> Cr-Commit-Position: refs/heads/master@{#310032}
TBR=vitalybuka@chromium.org,reed@google.com,danakj@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=278148
BUG=446729
Review URL: https://codereview.chromium.org/788053006
Cr-Commit-Position: refs/heads/master@{#310517}
Diffstat (limited to 'chrome/renderer/printing/print_web_view_helper.cc')
-rw-r--r-- | chrome/renderer/printing/print_web_view_helper.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc index e98d896..369348c 100644 --- a/chrome/renderer/printing/print_web_view_helper.cc +++ b/chrome/renderer/printing/print_web_view_helper.cc @@ -506,8 +506,19 @@ float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, 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); } |