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 24 matching lines...) Expand all Loading... |
35 #include "ppapi/cpp/private/pdf.h" | 35 #include "ppapi/cpp/private/pdf.h" |
36 #include "ppapi/cpp/private/var_private.h" | 36 #include "ppapi/cpp/private/var_private.h" |
37 #include "ppapi/cpp/rect.h" | 37 #include "ppapi/cpp/rect.h" |
38 #include "ppapi/cpp/resource.h" | 38 #include "ppapi/cpp/resource.h" |
39 #include "ppapi/cpp/url_request_info.h" | 39 #include "ppapi/cpp/url_request_info.h" |
40 #include "ppapi/cpp/var_array.h" | 40 #include "ppapi/cpp/var_array.h" |
41 #include "ppapi/cpp/var_dictionary.h" | 41 #include "ppapi/cpp/var_dictionary.h" |
42 #include "ui/events/keycodes/keyboard_codes.h" | 42 #include "ui/events/keycodes/keyboard_codes.h" |
43 #include "v8/include/v8.h" | 43 #include "v8/include/v8.h" |
44 | 44 |
45 #if defined(OS_MACOSX) | |
46 #include "base/mac/mac_util.h" | |
47 #endif | |
48 | |
49 namespace chrome_pdf { | 45 namespace chrome_pdf { |
50 | 46 |
51 const char kChromePrint[] = "chrome://print/"; | 47 const char kChromePrint[] = "chrome://print/"; |
52 const char kChromeExtension[] = | 48 const char kChromeExtension[] = |
53 "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"; | 49 "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"; |
54 | 50 |
55 // Dictionary Value key names for the document accessibility info | 51 // Dictionary Value key names for the document accessibility info |
56 const char kAccessibleNumberOfPages[] = "numberOfPages"; | 52 const char kAccessibleNumberOfPages[] = "numberOfPages"; |
57 const char kAccessibleLoaded[] = "loaded"; | 53 const char kAccessibleLoaded[] = "loaded"; |
58 const char kAccessibleCopyable[] = "copyable"; | 54 const char kAccessibleCopyable[] = "copyable"; |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1392 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
1397 const pp::FloatPoint& scroll_offset) { | 1393 const pp::FloatPoint& scroll_offset) { |
1398 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1394 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
1399 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1395 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
1400 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1396 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
1401 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1397 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
1402 return pp::FloatPoint(x, y); | 1398 return pp::FloatPoint(x, y); |
1403 } | 1399 } |
1404 | 1400 |
1405 } // namespace chrome_pdf | 1401 } // namespace chrome_pdf |
OLD | NEW |