diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js index 18b008da3d6ddb..0616c8df40ab1d 100644 --- a/chrome/browser/resources/pdf/pdf.js +++ b/chrome/browser/resources/pdf/pdf.js @@ -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; } }, diff --git a/pdf/instance.cc b/pdf/instance.cc index 6a68400d6ee4e1..a71d071ba9cb7f 100644 --- a/pdf/instance.cc +++ b/pdf/instance.cc @@ -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; + } } }