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

Unified Diff: pdf/instance.cc

Issue 431303002: PDF: Handle the space bar key like page down. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/instance.cc
diff --git a/pdf/instance.cc b/pdf/instance.cc
index c796cd5588c103d8299890d5c4a7a26a4cb742c9..8cc24252683d499bfa3ad5ec913197345b34ef3d 100644
--- a/pdf/instance.cc
+++ b/pdf/instance.cc
@@ -500,16 +500,16 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
// Prev/Next page.
if (v_scrollbar_.get() && event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN) {
pp::KeyboardInputEvent keyboard_event(event);
+ bool is_fit_to_page = zoom_mode_ == ZOOM_FIT_TO_PAGE;
+ bool no_h_scrollbar = !h_scrollbar_.get();
+ uint32_t key_code = keyboard_event.GetKeyCode();
bool page_down =
- (!h_scrollbar_.get() &&
- keyboard_event.GetKeyCode() == ui::VKEY_RIGHT) ||
- (zoom_mode_ == ZOOM_FIT_TO_PAGE &&
- keyboard_event.GetKeyCode() == ui::VKEY_NEXT);
+ (no_h_scrollbar && key_code == ui::VKEY_RIGHT) ||
+ (is_fit_to_page &&
+ (key_code == ui::VKEY_NEXT || key_code == ui::VKEY_SPACE));
bool page_up =
- (!h_scrollbar_.get() &&
- keyboard_event.GetKeyCode() == ui::VKEY_LEFT) ||
- (zoom_mode_ == ZOOM_FIT_TO_PAGE &&
- keyboard_event.GetKeyCode() == ui::VKEY_PRIOR);
+ (no_h_scrollbar && key_code == ui::VKEY_LEFT) ||
+ (is_fit_to_page && key_code == ui::VKEY_PRIOR);
Peter Kasting 2014/08/01 07:23:08 You also need to treat shift-space as page up. (T
Lei Zhang 2014/08/01 19:41:21 Neat. Never knew you can do that. Onwards to patch
if (page_down) {
int page = engine_->GetFirstVisiblePage();
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698