gecko-dev/widget/CommandList.h
Masayuki Nakano af6a1c5d37 Bug 1403759 - part 2: Handle edit/selection commands like insertNewline: in TextInputHandler::HandleCommand() r=m_kato
Let's make TextInputHandler::HandleCommand() handle other
commands which are caused by Backspace, Delete, Tab, ArrowUp,
ArrowDown, ArrowRight, ArrowLeft, PageUp, PageDown, Home, End
and Escape keys with various modifiers.

This patch makes Korean users can do most key operation in
editor even with composing Hangul character.

Note that this patch has a hack for cancelOperation: command.
The command is typically fired for Escape key press.  However,
it's also fired for Command + Period.  Unfortunately, this
behavior is really odd if subclass of NSResponder implements
|void cancelOperation:(id)sender|.  If it's implemented,
Cocoa doesn't call its |void keyDown:(NSEvent)theEvent|.
Instead, it calls only |void doCommandBySelector:(SEL)aSelector|
and |void cancelOperation:(id)sender| when Command + Period is
pressed.  Therefore, we cannot dispatch keydown nor keypress
event for this key combination if we implement it.  Therefore,
this patch doesn't implement the method but handle it in
doCommandBySelector even though the super class of ChildView
cannot handle the command with this path.

MozReview-Commit-ID: 4hS23SiwNJv

--HG--
extra : rebase_source : 38ac1ea494b5f786ecd5c9327efbacd460b59faf
2017-12-02 14:53:10 +09:00

63 lines
3.5 KiB
C

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Define NS_DEFINE_COMMAND(aName, aCommandStr) before including this.
* @param aName The name useful in C++ of the command.
* @param aCommandStr The command string in JS.
*
* Define NS_DEFINE_COMMAND_NO_EXEC_COMMAND(aName) before including this.
* @param aName The name useful in C++ of the command.
*/
NS_DEFINE_COMMAND(BeginLine, cmd_beginLine)
NS_DEFINE_COMMAND(CharNext, cmd_charNext)
NS_DEFINE_COMMAND(CharPrevious, cmd_charPrevious)
NS_DEFINE_COMMAND(Copy, cmd_copy)
NS_DEFINE_COMMAND(Cut, cmd_cut)
NS_DEFINE_COMMAND(Delete, cmd_delete)
NS_DEFINE_COMMAND(DeleteCharBackward, cmd_deleteCharBackward)
NS_DEFINE_COMMAND(DeleteCharForward, cmd_deleteCharForward)
NS_DEFINE_COMMAND(DeleteToBeginningOfLine, cmd_deleteToBeginningOfLine)
NS_DEFINE_COMMAND(DeleteToEndOfLine, cmd_deleteToEndOfLine)
NS_DEFINE_COMMAND(DeleteWordBackward, cmd_deleteWordBackward)
NS_DEFINE_COMMAND(DeleteWordForward, cmd_deleteWordForward)
NS_DEFINE_COMMAND(EndLine, cmd_endLine)
NS_DEFINE_COMMAND(InsertParagraph, cmd_insertParagraph)
NS_DEFINE_COMMAND(InsertLineBreak, cmd_insertLineBreak)
NS_DEFINE_COMMAND(LineNext, cmd_lineNext)
NS_DEFINE_COMMAND(LinePrevious, cmd_linePrevious)
NS_DEFINE_COMMAND(MoveBottom, cmd_moveBottom)
NS_DEFINE_COMMAND(MovePageDown, cmd_movePageDown)
NS_DEFINE_COMMAND(MovePageUp, cmd_movePageUp)
NS_DEFINE_COMMAND(MoveTop, cmd_moveTop)
NS_DEFINE_COMMAND(Paste, cmd_paste)
NS_DEFINE_COMMAND(ScrollBottom, cmd_scrollBottom)
NS_DEFINE_COMMAND(ScrollLineDown, cmd_scrollLineDown)
NS_DEFINE_COMMAND(ScrollLineUp, cmd_scrollLineUp)
NS_DEFINE_COMMAND(ScrollPageDown, cmd_scrollPageDown)
NS_DEFINE_COMMAND(ScrollPageUp, cmd_scrollPageUp)
NS_DEFINE_COMMAND(ScrollTop, cmd_scrollTop)
NS_DEFINE_COMMAND(SelectAll, cmd_selectAll)
NS_DEFINE_COMMAND(SelectBeginLine, cmd_selectBeginLine)
NS_DEFINE_COMMAND(SelectBottom, cmd_selectBottom)
NS_DEFINE_COMMAND(SelectCharNext, cmd_selectCharNext)
NS_DEFINE_COMMAND(SelectCharPrevious, cmd_selectCharPrevious)
NS_DEFINE_COMMAND(SelectEndLine, cmd_selectEndLine)
NS_DEFINE_COMMAND(SelectLineNext, cmd_selectLineNext)
NS_DEFINE_COMMAND(SelectLinePrevious, cmd_selectLinePrevious)
NS_DEFINE_COMMAND(SelectPageDown, cmd_selectPageDown)
NS_DEFINE_COMMAND(SelectPageUp, cmd_selectPageUp)
NS_DEFINE_COMMAND(SelectTop, cmd_selectTop)
NS_DEFINE_COMMAND(SelectWordNext, cmd_selectWordNext)
NS_DEFINE_COMMAND(SelectWordPrevious, cmd_selectWordPrevious)
NS_DEFINE_COMMAND(WordNext, cmd_wordNext)
NS_DEFINE_COMMAND(WordPrevious, cmd_wordPrevious)
NS_DEFINE_COMMAND_NO_EXEC_COMMAND(CancelOperation)
NS_DEFINE_COMMAND_NO_EXEC_COMMAND(Complete)
NS_DEFINE_COMMAND_NO_EXEC_COMMAND(InsertBacktab)
NS_DEFINE_COMMAND_NO_EXEC_COMMAND(InsertTab)