Changeset 74229 in webkit


Ignore:
Timestamp:
Dec 16, 2010, 7:36:48 PM (15 years ago)
Author:
tonikitoo@webkit.org
Message:

2010-12-05 Antonio Gomes <agomes@rim.com>

Reviewed by Ariya Hidayat.

[Qt] Fix caret browsing navigation mode
https://bugs.webkit.org/show_bug.cgi?id=50536

WebKit/qt:

Caret browsing can consume editing commands even when the start
of current selection is not a editable content. r69582 missed this
case because caret browsing feature testing is very poor today.

This commit reintroduces part of the removed code in r69582 but
guarded by a isCaretBrowsingEnabled() check. No regression found.

  • WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::handleKeyboardEvent):

LayoutTests:

/platform/gtk/editing/selection/caret-mode-paragraph-keys-navigation.html
is one of the few tests actually tests the caret browsing feature.
Patch makes the test not Gtk+ specific, and Qt now passes on it.

  • editing/selection/caret-mode-paragraph-keys-navigation-expected.txt: Renamed from LayoutTests/platform/gtk/editing/selection/caret-mode-paragraph-keys-navigation-expected.tx t.
  • editing/selection/caret-mode-paragraph-keys-navigation.html: Renamed from LayoutTests/platform/gtk/editing/selection/caret-mode-paragraph-keys-navigation.html.
  • fast/events/multiline-link-arrow-navigation.html:
Location:
trunk
Files:
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r74225 r74229  
     12010-12-05  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Ariya Hidayat.
     4
     5        [Qt] Fix caret browsing navigation mode
     6        https://bugs.webkit.org/show_bug.cgi?id=50536
     7
     8        /platform/gtk/editing/selection/caret-mode-paragraph-keys-navigation.html
     9        is one of the few tests actually tests the caret browsing feature.
     10        Patch makes the test not Gtk+ specific, and Qt now passes on it.
     11
     12        * editing/selection/caret-mode-paragraph-keys-navigation-expected.txt: Renamed from LayoutTests/platform/gtk/editing/selection/caret-mode-paragraph-keys-navigation-expected.txt.
     13        * editing/selection/caret-mode-paragraph-keys-navigation.html: Renamed from LayoutTests/platform/gtk/editing/selection/caret-mode-paragraph-keys-navigation.html.
     14        * fast/events/multiline-link-arrow-navigation.html:
     15
    1162010-12-16  Yong Li  <yoli@rim.com>
    217
  • trunk/LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation-expected.txt

    r74228 r74229  
    1 This tests that keys navigation through a paragraph work as expected when in caret mode, also with shift and ctrl modifiers.
     1This tests that arrow keys navigate through a paragraph as expected when in caret browsing mode, also with shift and ctrl modifiers.
    22
    33This tests that keys navigation through a paragraph work as expected when in caret mode, also with shift and ctrl modifiers.
     
    1313PASS getSelection().baseOffset is 15
    1414PASS getSelection().extentOffset is 17
    15 PASS getSelection().baseOffset is 20
     15PASS getSelection().baseOffset is 21
    1616PASS getSelection().baseOffset is 16
    1717PASS getSelection().baseOffset is 16
    18 PASS getSelection().extentOffset is 31
    19 PASS getSelection().baseOffset is 21
    20 PASS getSelection().baseOffset is 0
    21 PASS getSelection().extentOffset is 0
    22 PASS getSelection().baseOffset is 124
    23 PASS getSelection().extentOffset is 124
    24 PASS getSelection().baseOffset is 124
    25 PASS getSelection().extentOffset is 0
     18PASS getSelection().extentOffset is 26
     19PASS getSelection().baseOffset is 22
    2620PASS successfullyParsed is true
    2721
  • trunk/LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html

    r74228 r74229  
    66var successfullyParsed = false;
    77</script>
    8 <script src="../../../../fast/js/resources/js-test-pre.js"></script>
     8<script src="../../fast/js/resources/js-test-pre.js"></script>
    99</head>
    1010<body>
    11 <p id="target">This tests that keys navigation through a paragraph work as expected when in caret mode, also with shift and ctrl modifiers.</p>
     11<p id="target">This tests that arrow keys navigate through a paragraph as expected when in caret browsing mode, also with shift and ctrl modifiers.</p>
    1212<p id="description"></p>
    1313<div id="console"></div>
     
    4242  // check left/right arrows + Ctrl
    4343  eventSender.keyDown("rightArrow", ["ctrlKey"]);
    44   shouldBe("getSelection().baseOffset", "20");
     44  shouldBe("getSelection().baseOffset", "21");
    4545  eventSender.keyDown("leftArrow", ["ctrlKey"]);
    4646  shouldBe("getSelection().baseOffset", "16");
     
    5050  eventSender.keyDown("rightArrow", ["ctrlKey", "shiftKey"]);
    5151  shouldBe("getSelection().baseOffset", "16");
    52   shouldBe("getSelection().extentOffset", "31");
     52  shouldBe("getSelection().extentOffset", "26");
    5353  eventSender.keyDown("leftArrow", ["ctrlKey"]);
    54   shouldBe("getSelection().baseOffset", "21");
    55 
    56   // check home/end keys both for caret and range selections
    57   eventSender.keyDown("home");
    58   shouldBe("getSelection().baseOffset", "0");
    59   shouldBe("getSelection().extentOffset", "0");
    60   eventSender.keyDown("end");
    61   shouldBe("getSelection().baseOffset", "124");
    62   shouldBe("getSelection().extentOffset", "124");
    63   eventSender.keyDown("home", ["shiftKey"]);
    64   shouldBe("getSelection().baseOffset", "124");
    65   shouldBe("getSelection().extentOffset", "0");
     54  shouldBe("getSelection().baseOffset", "22");
    6655}
    6756
    6857successfullyParsed = true;
    6958</script>
    70 <script src="../../../../fast/js/resources/js-test-post.js"></script>
     59<script src="../../fast/js/resources/js-test-post.js"></script>
    7160</body>
    7261</html>
  • trunk/LayoutTests/platform/mac/Skipped

    r73454 r74229  
    278278# Very flaky: https://bugs.webkit.org/show_bug.cgi?id=49182
    279279animations/stop-animation-on-suspend.html
     280
     281# DRT does not support toggling caret browsing on / off
     282LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html
  • trunk/LayoutTests/platform/win/Skipped

    r73987 r74229  
    11031103fast/loader/user-stylesheet-fast-path.html
    11041104
     1105# DRT does not support toggling caret browsing on / off
     1106LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html
  • trunk/WebKit/qt/ChangeLog

    r74220 r74229  
     12010-12-05  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Ariya Hidayat.
     4
     5        [Qt] Fix caret browsing navigation mode
     6        https://bugs.webkit.org/show_bug.cgi?id=50536
     7
     8        Caret browsing can consume editing commands even when the start
     9        of current selection is not a editable content. r69582 missed this
     10        case because caret browsing feature testing is very poor today.
     11
     12        This commit reintroduces part of the removed code in r69582 but
     13        guarded by a isCaretBrowsingEnabled() check. No regression found.
     14
     15        * WebCoreSupport/EditorClientQt.cpp:
     16        (WebCore::EditorClientQt::handleKeyboardEvent):
     17
    1182010-12-16  Ariya Hidayat  <ariya@sencha.com>
    219
  • trunk/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r73867 r74229  
    350350{
    351351    Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
    352     if (!frame || !frame->document()->focusedNode())
     352    if (!frame)
    353353        return;
    354354
     
    375375            }
    376376        }
     377
    377378#ifndef QT_NO_SHORTCUT
    378379        QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
     
    467468        }
    468469    } else {
     470        if (m_page->handle()->page->settings()->caretBrowsingEnabled()) {
     471            switch (kevent->windowsVirtualKeyCode()) {
     472            case VK_LEFT:
     473                if (kevent->shiftKey() && kevent->ctrlKey())
     474                    frame->editor()->command("MoveWordBackwardAndModifySelection").execute();
     475                else if (kevent->shiftKey())
     476                    frame->editor()->command("MoveLeftAndModifySelection").execute();
     477                else if (kevent->ctrlKey())
     478                    frame->editor()->command("MoveWordBackward").execute();
     479                else
     480                    frame->editor()->command("MoveLeft").execute();
     481                break;
     482            case VK_RIGHT:
     483                if (kevent->shiftKey() && kevent->ctrlKey())
     484                    frame->editor()->command("MoveWordForwardAndModifySelection").execute();
     485                else if (kevent->shiftKey())
     486                    frame->editor()->command("MoveRightAndModifySelection").execute();
     487                else if (kevent->ctrlKey())
     488                    frame->editor()->command("MoveWordForward").execute();
     489                else
     490                    frame->editor()->command("MoveRight").execute();
     491                break;
     492            case VK_UP:
     493                if (kevent->shiftKey())
     494                    frame->editor()->command("MoveUpAndModifySelection").execute();
     495                else
     496                    frame->editor()->command("MoveUp").execute();
     497                break;
     498            case VK_DOWN:
     499                if (kevent->shiftKey())
     500                    frame->editor()->command("MoveDownAndModifySelection").execute();
     501                else
     502                    frame->editor()->command("MoveDown").execute();
     503                break;
     504            case VK_PRIOR: // PageUp
     505                frame->editor()->command("MovePageUp").execute();
     506                break;
     507            case VK_NEXT: // PageDown
     508                frame->editor()->command("MovePageDown").execute();
     509                break;
     510            case VK_HOME:
     511                if (kevent->shiftKey())
     512                    frame->editor()->command("MoveToBeginningOfLineAndModifySelection").execute();
     513                else
     514                    frame->editor()->command("MoveToBeginningOfLine").execute();
     515                break;
     516            case VK_END:
     517                if (kevent->shiftKey())
     518                    frame->editor()->command("MoveToEndOfLineAndModifySelection").execute();
     519                else
     520                    frame->editor()->command("MoveToEndOfLine").execute();
     521                break;
     522            default:
     523                break;
     524            }
     525        }
    469526#ifndef QT_NO_SHORTCUT
    470527        if (kevent->qtEvent() == QKeySequence::Copy)
Note: See TracChangeset for help on using the changeset viewer.