Chromium Code Reviews| 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 (*results)[i].length = pp_results[i].length; | 1086 (*results)[i].length = pp_results[i].length; |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 pp::Memory_Dev memory; | 1089 pp::Memory_Dev memory; |
| 1090 memory.MemFree(pp_results); | 1090 memory.MemFree(pp_results); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void OutOfProcessInstance::DocumentPaintOccurred() { | 1093 void OutOfProcessInstance::DocumentPaintOccurred() { |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 // TODO(alexandrec): PostMessage the bookmark data from here (to the js). | |
|
raymes
2015/01/15 05:40:19
nit do we want this?
Alexandre Carlton
2015/01/16 02:39:08
Removed.
| |
| 1096 void OutOfProcessInstance::DocumentLoadComplete(int page_count) { | 1097 void OutOfProcessInstance::DocumentLoadComplete(int page_count) { |
| 1097 // Clear focus state for OSK. | 1098 // Clear focus state for OSK. |
| 1098 FormTextFieldFocusChange(false); | 1099 FormTextFieldFocusChange(false); |
| 1099 | 1100 |
| 1100 DCHECK(document_load_state_ == LOAD_STATE_LOADING); | 1101 DCHECK(document_load_state_ == LOAD_STATE_LOADING); |
| 1101 document_load_state_ = LOAD_STATE_COMPLETE; | 1102 document_load_state_ = LOAD_STATE_COMPLETE; |
| 1102 UserMetricsRecordAction("PDF.LoadSuccess"); | 1103 UserMetricsRecordAction("PDF.LoadSuccess"); |
| 1103 | 1104 |
| 1104 // Note: If we are in print preview mode the scroll location is retained | 1105 // Note: If we are in print preview mode the scroll location is retained |
| 1105 // across document loads so we don't want to scroll again and override it. | 1106 // across document loads so we don't want to scroll again and override it. |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1402 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1403 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
| 1403 const pp::FloatPoint& scroll_offset) { | 1404 const pp::FloatPoint& scroll_offset) { |
| 1404 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1405 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1405 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1406 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1406 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1407 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1407 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1408 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
| 1408 return pp::FloatPoint(x, y); | 1409 return pp::FloatPoint(x, y); |
| 1409 } | 1410 } |
| 1410 | 1411 |
| 1411 } // namespace chrome_pdf | 1412 } // namespace chrome_pdf |
| OLD | NEW |