2011-01-02 Antonio Gomes <agomes@rim.com>
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jan 2011 16:04:08 +0000 (16:04 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jan 2011 16:04:08 +0000 (16:04 +0000)
commit1535e79ed844d041b5b5d9533130b4fad8963398
tree97231e4dd1a6ae6e2716974e5649978385d8998f
parentdc08be71de9e6e42240639ad5a82fd6311ca84ac
2011-01-02  Antonio Gomes  <agomes@rim.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] Refactor EditorClientQt::handleKeyboardEvent
        https://bugs.webkit.org/show_bug.cgi?id=51306

        EditorClientQt::handleKeyboardEvent relies on QWebPagePrivate::editorActionForKeyEvent()
        to handle all editor commands that have a QAction associted with it.
        In practice, that covers most of editor commands (as one can see in editorCommandWebActions,
        in qwebpage.cpp). However, there are some key down events that are associated to no QAction
        or need special handling when features like spatial navigation or
        caret browsing are enabled. Currently, these cases are being handled with confusing
        and nested if/else switch's statements in EditorClientQt::handleKeyboardEvent(),
        and the code is hardly readable.

        This patch introduces a mapping hash for those cases, simplifying much
        the code. Basically, nested switches statements mixed with if/else's were
        refactored, and early returns were added right after an event gets consumed
        by the Editor.

        Since it is a refactor only patch, there is no funcionality change at
        all, and then no new tests are being added.

        * WebCoreSupport/EditorClientQt.cpp:
        (WebCore::interpretKeyEvent):
        (WebCore::EditorClientQt::handleKeyboardEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/EditorClientQt.cpp