| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 else | 255 else |
| 256 return window.Call(type, message, default_answer); | 256 return window.Call(type, message, default_answer); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace | 259 } // namespace |
| 260 | 260 |
| 261 OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance) | 261 OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance) |
| 262 : pp::Instance(instance), | 262 : pp::Instance(instance), |
| 263 pp::Find_Private(this), | 263 pp::Find_Private(this), |
| 264 pp::Printing_Dev(this), | 264 pp::Printing_Dev(this), |
| 265 pp::Selection_Dev(this), | |
| 266 cursor_(PP_CURSORTYPE_POINTER), | 265 cursor_(PP_CURSORTYPE_POINTER), |
| 267 zoom_(1.0), | 266 zoom_(1.0), |
| 268 device_scale_(1.0), | 267 device_scale_(1.0), |
| 269 full_(false), | 268 full_(false), |
| 270 paint_manager_(this, this, true), | 269 paint_manager_(this, this, true), |
| 271 first_paint_(true), | 270 first_paint_(true), |
| 272 document_load_state_(LOAD_STATE_LOADING), | 271 document_load_state_(LOAD_STATE_LOADING), |
| 273 preview_document_load_state_(LOAD_STATE_COMPLETE), | 272 preview_document_load_state_(LOAD_STATE_COMPLETE), |
| 274 uma_(this), | 273 uma_(this), |
| 275 told_browser_about_unsupported_feature_(false), | 274 told_browser_about_unsupported_feature_(false), |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 } | 619 } |
| 621 | 620 |
| 622 pp::Var OutOfProcessInstance::GetLinkAtPosition( | 621 pp::Var OutOfProcessInstance::GetLinkAtPosition( |
| 623 const pp::Point& point) { | 622 const pp::Point& point) { |
| 624 pp::Point offset_point(point); | 623 pp::Point offset_point(point); |
| 625 ScalePoint(device_scale_, &offset_point); | 624 ScalePoint(device_scale_, &offset_point); |
| 626 offset_point.set_x(offset_point.x() - available_area_.x()); | 625 offset_point.set_x(offset_point.x() - available_area_.x()); |
| 627 return engine_->GetLinkAtPosition(offset_point); | 626 return engine_->GetLinkAtPosition(offset_point); |
| 628 } | 627 } |
| 629 | 628 |
| 630 pp::Var OutOfProcessInstance::GetSelectedText(bool html) { | |
| 631 if (html) | |
| 632 return pp::Var(); | |
| 633 return engine_->GetSelectedText(); | |
| 634 } | |
| 635 | |
| 636 uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() { | 629 uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() { |
| 637 return engine_->QuerySupportedPrintOutputFormats(); | 630 return engine_->QuerySupportedPrintOutputFormats(); |
| 638 } | 631 } |
| 639 | 632 |
| 640 int32_t OutOfProcessInstance::PrintBegin( | 633 int32_t OutOfProcessInstance::PrintBegin( |
| 641 const PP_PrintSettings_Dev& print_settings) { | 634 const PP_PrintSettings_Dev& print_settings) { |
| 642 // For us num_pages is always equal to the number of pages in the PDF | 635 // For us num_pages is always equal to the number of pages in the PDF |
| 643 // document irrespective of the printable area. | 636 // document irrespective of the printable area. |
| 644 int32_t ret = engine_->GetNumberOfPages(); | 637 int32_t ret = engine_->GetNumberOfPages(); |
| 645 if (!ret) | 638 if (!ret) |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1413 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
| 1421 const pp::FloatPoint& scroll_offset) { | 1414 const pp::FloatPoint& scroll_offset) { |
| 1422 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1415 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1423 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1416 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1424 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1417 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1425 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1418 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
| 1426 return pp::FloatPoint(x, y); | 1419 return pp::FloatPoint(x, y); |
| 1427 } | 1420 } |
| 1428 | 1421 |
| 1429 } // namespace chrome_pdf | 1422 } // namespace chrome_pdf |
| OLD | NEW |