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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const char kChromeExtension[] = | 47 const char kChromeExtension[] = |
48 "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"; | 48 "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"; |
49 | 49 |
50 // Dictionary Value key names for the document accessibility info | 50 // Dictionary Value key names for the document accessibility info |
51 const char kAccessibleNumberOfPages[] = "numberOfPages"; | 51 const char kAccessibleNumberOfPages[] = "numberOfPages"; |
52 const char kAccessibleLoaded[] = "loaded"; | 52 const char kAccessibleLoaded[] = "loaded"; |
53 const char kAccessibleCopyable[] = "copyable"; | 53 const char kAccessibleCopyable[] = "copyable"; |
54 | 54 |
55 // PDF background colors. | 55 // PDF background colors. |
56 const uint32 kBackgroundColor = 0xFFCCCCCC; | 56 const uint32 kBackgroundColor = 0xFFCCCCCC; |
57 const uint32 kBackgroundColorMaterial = 0xFF424242; | 57 const uint32 kBackgroundColorMaterial = 0xFF525659; |
58 | 58 |
59 // Constants used in handling postMessage() messages. | 59 // Constants used in handling postMessage() messages. |
60 const char kType[] = "type"; | 60 const char kType[] = "type"; |
61 // Viewport message arguments. (Page -> Plugin). | 61 // Viewport message arguments. (Page -> Plugin). |
62 const char kJSViewportType[] = "viewport"; | 62 const char kJSViewportType[] = "viewport"; |
63 const char kJSXOffset[] = "xOffset"; | 63 const char kJSXOffset[] = "xOffset"; |
64 const char kJSYOffset[] = "yOffset"; | 64 const char kJSYOffset[] = "yOffset"; |
65 const char kJSZoom[] = "zoom"; | 65 const char kJSZoom[] = "zoom"; |
66 // Stop scrolling message (Page -> Plugin) | 66 // Stop scrolling message (Page -> Plugin) |
67 const char kJSStopScrollingType[] = "stopScrolling"; | 67 const char kJSStopScrollingType[] = "stopScrolling"; |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1407 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
1408 const pp::FloatPoint& scroll_offset) { | 1408 const pp::FloatPoint& scroll_offset) { |
1409 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1409 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
1410 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1410 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
1411 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1411 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
1412 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1412 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
1413 return pp::FloatPoint(x, y); | 1413 return pp::FloatPoint(x, y); |
1414 } | 1414 } |
1415 | 1415 |
1416 } // namespace chrome_pdf | 1416 } // namespace chrome_pdf |
OLD | NEW |