| OLD | NEW |
| 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/out_of_process_instance.h" | 5 #include "pdf/out_of_process_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> // for min/max() | 7 #include <algorithm> // for min/max() |
| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 560 |
| 561 pp::Var OutOfProcessInstance::GetLinkAtPosition( | 561 pp::Var OutOfProcessInstance::GetLinkAtPosition( |
| 562 const pp::Point& point) { | 562 const pp::Point& point) { |
| 563 pp::Point offset_point(point); | 563 pp::Point offset_point(point); |
| 564 ScalePoint(device_scale_, &offset_point); | 564 ScalePoint(device_scale_, &offset_point); |
| 565 offset_point.set_x(offset_point.x() - available_area_.x()); | 565 offset_point.set_x(offset_point.x() - available_area_.x()); |
| 566 return engine_->GetLinkAtPosition(offset_point); | 566 return engine_->GetLinkAtPosition(offset_point); |
| 567 } | 567 } |
| 568 | 568 |
| 569 pp::Var OutOfProcessInstance::GetSelectedText(bool html) { | 569 pp::Var OutOfProcessInstance::GetSelectedText(bool html) { |
| 570 if (html || !engine_->HasPermission(PDFEngine::PERMISSION_COPY)) | 570 if (html) |
| 571 return pp::Var(); | 571 return pp::Var(); |
| 572 return engine_->GetSelectedText(); | 572 return engine_->GetSelectedText(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() { | 575 uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() { |
| 576 return engine_->QuerySupportedPrintOutputFormats(); | 576 return engine_->QuerySupportedPrintOutputFormats(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 int32_t OutOfProcessInstance::PrintBegin( | 579 int32_t OutOfProcessInstance::PrintBegin( |
| 580 const PP_PrintSettings_Dev& print_settings) { | 580 const PP_PrintSettings_Dev& print_settings) { |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1382 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
| 1383 const pp::FloatPoint& scroll_offset) { | 1383 const pp::FloatPoint& scroll_offset) { |
| 1384 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1384 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1385 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1385 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1386 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1386 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1387 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1387 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
| 1388 return pp::FloatPoint(x, y); | 1388 return pp::FloatPoint(x, y); |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 } // namespace chrome_pdf | 1391 } // namespace chrome_pdf |
| OLD | NEW |