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 = {
}
return;
case 219: // left bracket.
this.plugin_.postMessage({
type: 'rotateCounterclockwise',
});
if (e.ctrlKey) {
this.plugin_.postMessage({
type: 'rotateCounterclockwise',
});
}
return;
case 221: // right bracket.
this.plugin_.postMessage({
type: 'rotateClockwise',
});
if (e.ctrlKey) {
this.plugin_.postMessage({
type: 'rotateClockwise',
});
}
return;
}
},
......
......@@ -587,21 +587,26 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
}
}
if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN &&
event.GetModifiers() & kDefaultKeyModifier) {
if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN) {
pp::KeyboardInputEvent keyboard_event(event);
switch (keyboard_event.GetKeyCode()) {
case 'A':
engine_->SelectAll();
return true;
case ui::VKEY_OEM_4:
// Left bracket.
engine_->RotateCounterclockwise();
return true;
case ui::VKEY_OEM_6:
// Right bracket.
engine_->RotateClockwise();
return true;
const uint32 modifier = event.GetModifiers();
if (modifier & kDefaultKeyModifier) {
switch (keyboard_event.GetKeyCode()) {
case 'A':
engine_->SelectAll();
return true;
}
} else if (modifier & PP_INPUTEVENT_MODIFIER_CONTROLKEY) {
switch (keyboard_event.GetKeyCode()) {
case ui::VKEY_OEM_4:
// Left bracket.
engine_->RotateCounterclockwise();
return true;
case ui::VKEY_OEM_6:
// Right bracket.
engine_->RotateClockwise();
return true;
}
}
}
......
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