Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 2781613002: PDF Viewer pinch zoom: Update state for zoom in following a zoom out. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> // for min/max() 10 #include <algorithm> // for min/max()
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 491
492 if (pinch_phase == PINCH_UPDATE_ZOOM_OUT || pinch_phase == PINCH_END) { 492 if (pinch_phase == PINCH_UPDATE_ZOOM_OUT || pinch_phase == PINCH_END) {
493 // We reraster on pinch zoom out in order to solve the invalid regions 493 // We reraster on pinch zoom out in order to solve the invalid regions
494 // that appear after zooming out. 494 // that appear after zooming out.
495 // On pinch end the scale is again 1.f and we request a reraster 495 // On pinch end the scale is again 1.f and we request a reraster
496 // in the new position. 496 // in the new position.
497 paint_manager_.ClearTransform(); 497 paint_manager_.ClearTransform();
498 last_bitmap_smaller_ = false; 498 last_bitmap_smaller_ = false;
499 needs_reraster_ = true; 499 needs_reraster_ = true;
500
501 // If we're zooming out, we need to update |starting_scroll_offset_| and
502 // |initial_zoom_ratio_|, in case the user continues the gesture by
503 // zooming in.
504 starting_scroll_offset_ = scroll_offset;
bokan 2017/03/28 14:26:26 These two variables are the offset/zoom since last
Kevin McNee 2017/03/28 22:55:26 So it turns out that |initial_zoom_ratio_| is redu
505 initial_zoom_ratio_ = zoom_ratio;
500 } 506 }
501 507
502 // Bound the input parameters. 508 // Bound the input parameters.
503 zoom = std::max(kMinZoom, zoom); 509 zoom = std::max(kMinZoom, zoom);
504 SetZoom(zoom); 510 SetZoom(zoom);
505 scroll_offset = BoundScrollOffsetToDocument(scroll_offset); 511 scroll_offset = BoundScrollOffsetToDocument(scroll_offset);
506 engine_->ScrolledToXPosition(scroll_offset.x() * device_scale_); 512 engine_->ScrolledToXPosition(scroll_offset.x() * device_scale_);
507 engine_->ScrolledToYPosition(scroll_offset.y() * device_scale_); 513 engine_->ScrolledToYPosition(scroll_offset.y() * device_scale_);
508 } else if (type == kJSGetPasswordCompleteType && 514 } else if (type == kJSGetPasswordCompleteType &&
509 dict.Get(pp::Var(kJSPassword)).is_string()) { 515 dict.Get(pp::Var(kJSPassword)).is_string()) {
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 const pp::FloatPoint& scroll_offset) { 1656 const pp::FloatPoint& scroll_offset) {
1651 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1657 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1652 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1658 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1653 float min_y = -top_toolbar_height_; 1659 float min_y = -top_toolbar_height_;
1654 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1660 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1655 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); 1661 float y = std::max(std::min(scroll_offset.y(), max_y), min_y);
1656 return pp::FloatPoint(x, y); 1662 return pp::FloatPoint(x, y);
1657 } 1663 }
1658 1664
1659 } // namespace chrome_pdf 1665 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698