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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | printing/pdf_metafile_skia.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/printing/print_web_view_helper.h" 5 #include "chrome/renderer/printing/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 #endif // defined(ENABLE_PRINT_PREVIEW) 526 #endif // defined(ENABLE_PRINT_PREVIEW)
527 527
528 // static - Not anonymous so that platform implementations can use it. 528 // static - Not anonymous so that platform implementations can use it.
529 float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, 529 float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
530 int page_number, 530 int page_number,
531 const gfx::Rect& canvas_area, 531 const gfx::Rect& canvas_area,
532 const gfx::Rect& content_area, 532 const gfx::Rect& content_area,
533 double scale_factor, 533 double scale_factor,
534 blink::WebCanvas* canvas) { 534 blink::WebCanvas* canvas) {
535 SkAutoCanvasRestore auto_restore(canvas, true); 535 SkAutoCanvasRestore auto_restore(canvas, true);
536 canvas->translate((content_area.x() - canvas_area.x()) / scale_factor, 536 if (content_area != canvas_area) {
537 (content_area.y() - canvas_area.y()) / scale_factor); 537 canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
538 (content_area.y() - canvas_area.y()) / scale_factor);
539 SkRect clip_rect(
540 SkRect::MakeXYWH(content_area.origin().x() / scale_factor,
541 content_area.origin().y() / scale_factor,
542 content_area.size().width() / scale_factor,
543 content_area.size().height() / scale_factor));
544 SkIRect clip_int_rect;
545 clip_rect.roundOut(&clip_int_rect);
546 SkRegion clip_region(clip_int_rect);
547 canvas->setClipRegion(clip_region);
548 }
538 return frame->printPage(page_number, canvas); 549 return frame->printPage(page_number, canvas);
539 } 550 }
540 551
541 // Class that calls the Begin and End print functions on the frame and changes 552 // Class that calls the Begin and End print functions on the frame and changes
542 // the size of the view temporarily to support full page printing.. 553 // the size of the view temporarily to support full page printing..
543 class PrepareFrameAndViewForPrint : public blink::WebViewClient, 554 class PrepareFrameAndViewForPrint : public blink::WebViewClient,
544 public blink::WebFrameClient { 555 public blink::WebFrameClient {
545 public: 556 public:
546 PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params, 557 PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params,
547 blink::WebLocalFrame* frame, 558 blink::WebLocalFrame* frame,
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 blink::WebConsoleMessage::LevelWarning, message)); 2055 blink::WebConsoleMessage::LevelWarning, message));
2045 return false; 2056 return false;
2046 } 2057 }
2047 2058
2048 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2059 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2049 // Reset counter on successful print. 2060 // Reset counter on successful print.
2050 count_ = 0; 2061 count_ = 0;
2051 } 2062 }
2052 2063
2053 } // namespace printing 2064 } // namespace printing
OLDNEW
« 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