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

Side by Side Diff: pdf/instance.cc

Issue 981843003: Printing: PDFs should only be fit to page if there is a size mismatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pdf169120
Patch Set: rebase Created 5 years, 9 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
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 "pdf/instance.h" 5 #include "pdf/instance.h"
6 6
7 #include <algorithm> // for min() 7 #include <algorithm> // for min()
8 #define _USE_MATH_DEFINES // for M_PI 8 #define _USE_MATH_DEFINES // for M_PI
9 #include <cmath> // for log() and pow() 9 #include <cmath> // for log() and pow()
10 #include <math.h> 10 #include <math.h>
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 return instance_object_; 671 return instance_object_;
672 } 672 }
673 673
674 void Instance::GetPrintPresetOptionsFromDocument( 674 void Instance::GetPrintPresetOptionsFromDocument(
675 PP_PdfPrintPresetOptions_Dev* options) { 675 PP_PdfPrintPresetOptions_Dev* options) {
676 options->is_scaling_disabled = PP_FromBool(IsPrintScalingDisabled()); 676 options->is_scaling_disabled = PP_FromBool(IsPrintScalingDisabled());
677 options->duplex = 677 options->duplex =
678 static_cast<PP_PrivateDuplexMode_Dev>(engine_->GetDuplexType()); 678 static_cast<PP_PrivateDuplexMode_Dev>(engine_->GetDuplexType());
679 options->copies = engine_->GetCopiesToPrint(); 679 options->copies = engine_->GetCopiesToPrint();
680 pp::Size uniform_page_size;
681 options->is_page_size_uniform =
682 PP_FromBool(engine_->GetPageSizeAndUniformity(&uniform_page_size));
683 options->uniform_page_size = PP_Size(uniform_page_size);
680 } 684 }
681 685
682 pp::Var Instance::GetLinkAtPosition(const pp::Point& point) { 686 pp::Var Instance::GetLinkAtPosition(const pp::Point& point) {
683 pp::Point offset_point(point); 687 pp::Point offset_point(point);
684 ScalePoint(device_scale_, &offset_point); 688 ScalePoint(device_scale_, &offset_point);
685 offset_point.set_x(offset_point.x() - available_area_.x()); 689 offset_point.set_x(offset_point.x() - available_area_.x());
686 return engine_->GetLinkAtPosition(offset_point); 690 return engine_->GetLinkAtPosition(offset_point);
687 } 691 }
688 692
689 pp::Var Instance::GetSelectedText(bool html) { 693 pp::Var Instance::GetSelectedText(bool html) {
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 return instance_->HasScriptableMethod(name, exception); 2824 return instance_->HasScriptableMethod(name, exception);
2821 } 2825 }
2822 2826
2823 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2827 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2824 const std::vector<pp::Var>& args, 2828 const std::vector<pp::Var>& args,
2825 pp::Var* exception) { 2829 pp::Var* exception) {
2826 return instance_->CallScriptableMethod(method, args, exception); 2830 return instance_->CallScriptableMethod(method, args, exception);
2827 } 2831 }
2828 2832
2829 } // namespace chrome_pdf 2833 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698