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/instance.h" | 5 #include "pdf/instance.h" |
6 | 6 |
7 #include <algorithm> // for min() | 7 #include <algorithm> // for min() |
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 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2419 int32 doc_height = static_cast<int>(document_size_.height() * zoom_); | 2419 int32 doc_height = static_cast<int>(document_size_.height() * zoom_); |
2420 pp::Point origin( | 2420 pp::Point origin( |
2421 plugin_size_.width() - page_indicator_.rect().width() - | 2421 plugin_size_.width() - page_indicator_.rect().width() - |
2422 GetScaled(GetScrollbarReservedThickness()), | 2422 GetScaled(GetScrollbarReservedThickness()), |
2423 page_indicator_.GetYPosition(engine_->GetVerticalScrollbarYPosition(), | 2423 page_indicator_.GetYPosition(engine_->GetVerticalScrollbarYPosition(), |
2424 doc_height, plugin_size_.height())); | 2424 doc_height, plugin_size_.height())); |
2425 page_indicator_.MoveTo(origin, invalidate); | 2425 page_indicator_.MoveTo(origin, invalidate); |
2426 } | 2426 } |
2427 | 2427 |
2428 void Instance::SetZoom(ZoomMode zoom_mode, double scale) { | 2428 void Instance::SetZoom(ZoomMode zoom_mode, double scale) { |
2429 // If same zoom level, don't do anything. | |
wjmaclean
2014/10/08 14:14:33
You might modify this comment to indicate that, in
raymes
2014/10/08 17:23:55
// If the zoom level doesn't change it means that
Nikhil
2014/10/09 06:36:19
Done.
| |
2430 if (scale == zoom_) | |
2431 return; | |
2432 | |
2429 double old_zoom = zoom_; | 2433 double old_zoom = zoom_; |
2430 | 2434 |
2431 zoom_mode_ = zoom_mode; | 2435 zoom_mode_ = zoom_mode; |
2432 if (zoom_mode_ == ZOOM_SCALE) | 2436 if (zoom_mode_ == ZOOM_SCALE) |
2433 zoom_ = scale; | 2437 zoom_ = scale; |
2434 UpdateZoomScale(); | 2438 UpdateZoomScale(); |
2435 | 2439 |
2436 engine_->ZoomUpdated(zoom_ * device_scale_); | 2440 engine_->ZoomUpdated(zoom_ * device_scale_); |
2437 OnGeometryChanged(old_zoom, device_scale_); | 2441 OnGeometryChanged(old_zoom, device_scale_); |
2438 | 2442 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2739 return instance_->HasScriptableMethod(name, exception); | 2743 return instance_->HasScriptableMethod(name, exception); |
2740 } | 2744 } |
2741 | 2745 |
2742 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2746 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2743 const std::vector<pp::Var>& args, | 2747 const std::vector<pp::Var>& args, |
2744 pp::Var* exception) { | 2748 pp::Var* exception) { |
2745 return instance_->CallScriptableMethod(method, args, exception); | 2749 return instance_->CallScriptableMethod(method, args, exception); |
2746 } | 2750 } |
2747 | 2751 |
2748 } // namespace chrome_pdf | 2752 } // namespace chrome_pdf |
OLD | NEW |