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

Side by Side Diff: pdf/instance.cc

Issue 802083002: Selecting 'alt+left arrow' key in PDF does not move to previous url page. similarly 'alt+right arro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 6 years 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/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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 return true; 525 return true;
526 526
527 // Left/Right arrows should scroll to the beginning of the Prev/Next page if 527 // Left/Right arrows should scroll to the beginning of the Prev/Next page if
528 // there is no horizontal scroll bar. 528 // there is no horizontal scroll bar.
529 // If fit-to-height, PgDown/PgUp should scroll to the beginning of the 529 // If fit-to-height, PgDown/PgUp should scroll to the beginning of the
530 // Prev/Next page. Spacebar / shift+spacebar should do the same. 530 // Prev/Next page. Spacebar / shift+spacebar should do the same.
531 if (v_scrollbar_.get() && event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN) { 531 if (v_scrollbar_.get() && event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN) {
532 pp::KeyboardInputEvent keyboard_event(event); 532 pp::KeyboardInputEvent keyboard_event(event);
533 bool no_h_scrollbar = !h_scrollbar_.get(); 533 bool no_h_scrollbar = !h_scrollbar_.get();
534 uint32_t key_code = keyboard_event.GetKeyCode(); 534 uint32_t key_code = keyboard_event.GetKeyCode();
535 bool page_down = no_h_scrollbar && key_code == ui::VKEY_RIGHT; 535 bool is_modifiers = keyboard_event.GetModifiers() != 0;
raymes 2014/12/15 05:51:00 could you rename is_modifiers to has_modifiers?
536 bool page_up = no_h_scrollbar && key_code == ui::VKEY_LEFT; 536 bool page_down =
537 no_h_scrollbar && !is_modifiers && key_code == ui::VKEY_RIGHT;
538 bool page_up = no_h_scrollbar && !is_modifiers && key_code == ui::VKEY_LEFT;
537 if (zoom_mode_ == ZOOM_FIT_TO_PAGE) { 539 if (zoom_mode_ == ZOOM_FIT_TO_PAGE) {
538 bool has_shift = 540 bool has_shift =
539 keyboard_event.GetModifiers() & PP_INPUTEVENT_MODIFIER_SHIFTKEY; 541 keyboard_event.GetModifiers() & PP_INPUTEVENT_MODIFIER_SHIFTKEY;
540 bool key_is_space = key_code == ui::VKEY_SPACE; 542 bool key_is_space = key_code == ui::VKEY_SPACE;
541 page_down |= key_is_space || key_code == ui::VKEY_NEXT; 543 page_down |= key_is_space || key_code == ui::VKEY_NEXT;
542 page_up |= (key_is_space && has_shift) || (key_code == ui::VKEY_PRIOR); 544 page_up |= (key_is_space && has_shift) || (key_code == ui::VKEY_PRIOR);
543 } 545 }
544 if (page_down) { 546 if (page_down) {
545 int page = engine_->GetFirstVisiblePage(); 547 int page = engine_->GetFirstVisiblePage();
546 if (page == -1) 548 if (page == -1)
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 return instance_->HasScriptableMethod(name, exception); 2801 return instance_->HasScriptableMethod(name, exception);
2800 } 2802 }
2801 2803
2802 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2804 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2803 const std::vector<pp::Var>& args, 2805 const std::vector<pp::Var>& args,
2804 pp::Var* exception) { 2806 pp::Var* exception) {
2805 return instance_->CallScriptableMethod(method, args, exception); 2807 return instance_->CallScriptableMethod(method, args, exception);
2806 } 2808 }
2807 2809
2808 } // namespace chrome_pdf 2810 } // 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