Commit 48fa9730 authored by thestig's avatar thestig Committed by Commit bot

PDF: Change the rotate shortcut keys to ctrl+[] on all platforms.

The default modifier key on Mac is Command, but that conflicts with
the forward and backward keys.

BUG=111232,417902

Review URL: https://codereview.chromium.org/606933002

Cr-Commit-Position: refs/heads/master@{#297033}
parent 49264e03
...@@ -235,14 +235,18 @@ PDFViewer.prototype = { ...@@ -235,14 +235,18 @@ PDFViewer.prototype = {
} }
return; return;
case 219: // left bracket. case 219: // left bracket.
if (e.ctrlKey) {
this.plugin_.postMessage({ this.plugin_.postMessage({
type: 'rotateCounterclockwise', type: 'rotateCounterclockwise',
}); });
}
return; return;
case 221: // right bracket. case 221: // right bracket.
if (e.ctrlKey) {
this.plugin_.postMessage({ this.plugin_.postMessage({
type: 'rotateClockwise', type: 'rotateClockwise',
}); });
}
return; return;
} }
}, },
......
...@@ -587,13 +587,17 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) { ...@@ -587,13 +587,17 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
} }
} }
if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN && if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN) {
event.GetModifiers() & kDefaultKeyModifier) {
pp::KeyboardInputEvent keyboard_event(event); pp::KeyboardInputEvent keyboard_event(event);
const uint32 modifier = event.GetModifiers();
if (modifier & kDefaultKeyModifier) {
switch (keyboard_event.GetKeyCode()) { switch (keyboard_event.GetKeyCode()) {
case 'A': case 'A':
engine_->SelectAll(); engine_->SelectAll();
return true; return true;
}
} else if (modifier & PP_INPUTEVENT_MODIFIER_CONTROLKEY) {
switch (keyboard_event.GetKeyCode()) {
case ui::VKEY_OEM_4: case ui::VKEY_OEM_4:
// Left bracket. // Left bracket.
engine_->RotateCounterclockwise(); engine_->RotateCounterclockwise();
...@@ -604,6 +608,7 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) { ...@@ -604,6 +608,7 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
return true; return true;
} }
} }
}
// Return true for unhandled clicks so the plugin takes focus. // Return true for unhandled clicks so the plugin takes focus.
return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN); return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment