COMMIT_MESSAGE (1/2)

 12011-03-01 Mario Sanchez Prada <msanchez@igalia.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [GTK] Elements on the same line should be treated as such by caret navigation
 6 https://bugs.webkit.org/show_bug.cgi?id=25533
 7
 8 New layout test for checking the new editing commands for moving
 9 the caret up and down when in caret browsing (GTK-only so far).
 10
 11 * platform/gtk/editing/selection/caret-mode-vertical-navigation-expected.txt: Added.
 12 * platform/gtk/editing/selection/caret-mode-vertical-navigation.html: Added.
 132011-03-01 Mario Sanchez Prada <msanchez@igalia.com>
 14
 15 Reviewed by NOBODY (OOPS!).
 16
 17 [GTK] Elements on the same line should be treated as such by caret navigation
 18 https://bugs.webkit.org/show_bug.cgi?id=25533
 19
 20 Ensure the caret will move to a vertically coincident position
 21 when moving up and down across different lines.
 22
 23 * editing/EditorCommand.cpp:
 24 (WebCore::isVerticallyCoincident): New, checks if a renderer is
 25 vertically coincident to another one used as reference and a given
 26 X position, when moving up and down in caret browsing mode.
 27 (WebCore::moveCaretVertically): Actually move the caret forward
 28 or backward across different lines, ensuring the final destination
 29 is a rendered vertically coincident with the start point.
 30 (WebCore::executeMoveCaretDown): New, implements the new
 31 "MoveCaretDown" command, used in caret browsing mode only, so far
 32 affecting the GTK port only.
 33 (WebCore::executeMoveCaretDownAndModifySelection): New, implements
 34 the new "MoveCaretDownAndModifySelection" command.
 35 (WebCore::executeMoveCaretUp): New, implements the new
 36 "MoveCaretUp" command.
 37 (WebCore::executeMoveCaretUpAndModifySelection): New, implements
 38 the new "MoveCaretUpAndModifySelection" command.
 39 (WebCore::createCommandMap): Add the new commands needed for the
 40 GTK port, related with up/down movement in caret browsing mode.
 412011-03-01 Mario Sanchez Prada <msanchez@igalia.com>
 42
 43 Reviewed by NOBODY (OOPS!).
 44
 45 [GTK] Elements on the same line should be treated as such by caret navigation
 46 https://bugs.webkit.org/show_bug.cgi?id=25533
 47
 48 Use the new commands for moving up/down in caret browsing mode.
 49
 50 * WebCoreSupport/EditorClientGtk.cpp:
 51 (WebKit::moveCursorCallback): Redefine rawCommand to one of the
 52 new four commands when appropriate.

LayoutTests/ChangeLog

 12011-03-01 Mario Sanchez Prada <msanchez@igalia.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [GTK] Elements on the same line should be treated as such by caret navigation
 6 https://bugs.webkit.org/show_bug.cgi?id=25533
 7
 8 New layout test for checking the new editing commands for moving
 9 the caret up and down when in caret browsing (GTK-only so far).
 10
 11 * platform/gtk/editing/selection/caret-mode-vertical-navigation-expected.txt: Added.
 12 * platform/gtk/editing/selection/caret-mode-vertical-navigation.html: Added.
 13
1142011-02-27 Aparna Nandyal <aparna.nand@wipro.com>
215
316 Reviewed by Antonio Gomes.

LayoutTests/platform/gtk/editing/selection/caret-mode-vertical-navigation-expected.txt

 1EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 7 of DIV > BODY > HTML > #document
 2EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 4EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > P > DIV > BODY > HTML > #document to 3 of #text > P > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 5EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 6EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > P > DIV > BODY > HTML > #document to 3 of #text > P > DIV > BODY > HTML > #document toDOMRange:range from 5 of DIV > BODY > HTML > #document to 5 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 7EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 8EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of DIV > BODY > HTML > #document to 5 of DIV > BODY > HTML > #document toDOMRange:range from 0 of P > DIV > BODY > HTML > #document to 0 of P > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 9EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > P > DIV > BODY > HTML > #document to 3 of #text > P > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 11EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 12EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 13EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 14Col. Header 1 Col. Header 2
 15Row Header 1 One Two
 16Row Header 2 Three Four
 17A paragraph between a 9-cell table and a list of three items.
 18
 19CatDogElephant
 20- Foo
 21- Bar
 22
 23
 24This tests vertical caret navigation works as expected across tables and floating elements.
 25
 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 27
 28
 29PASS getSelection().anchorNode.nodeValue is 'Col. Header 1'
 30PASS getSelection().baseOffset is 5
 31PASS getSelection().anchorNode.nodeValue is 'One'
 32PASS getSelection().baseOffset is 3
 33PASS getSelection().anchorNode.nodeValue is 'Three'
 34PASS getSelection().baseOffset is 5
 35PASS getSelection().anchorNode.nodeValue is 'A paragraph between a 9-cell table and a list of three items.'
 36PASS getSelection().baseOffset is 61
 37PASS getSelection().anchorNode.nodeValue is 'Elephant'
 38PASS getSelection().baseOffset is 0
 39PASS getSelection().anchorNode.nodeValue is 'Row Header 2'
 40PASS getSelection().baseOffset is 6
 41PASS range.startContainer.nodeValue is 'Row Header 1'
 42PASS getSelection().baseOffset is 6
 43PASS range.endContainer.nodeValue is 'Row Header 2'
 44PASS getSelection().extentOffset is 6
 45PASS range.startContainer.nodeValue is 'Row Header 2'
 46PASS getSelection().baseOffset is 6
 47PASS range.endContainer.nodeValue is 'A paragraph between a 9-cell table and a list of three items.'
 48PASS getSelection().extentOffset is 20
 49PASS successfullyParsed is true
 50
 51TEST COMPLETE
 52

LayoutTests/platform/gtk/editing/selection/caret-mode-vertical-navigation.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<style>
 5#floating-list {
 6 list-style: none;
 7 width: 100%;
 8}
 9
 10#floating-list li {
 11 float: left;
 12 padding: 10px;
 13}
 14</style>
 15<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
 16<script>
 17var successfullyParsed = false;
 18</script>
 19<script src="../../../../fast/js/resources/js-test-pre.js"></script>
 20<script src="../editing.js" language="JavaScript" type="text/JavaScript" ></script>
 21</head>
 22<body id="body">
 23<table width="100%">
 24 <tr><th></th><th id="startWithCaretBrowsing">Col. Header 1</th><th>Col. Header 2</th></tr>
 25 <tr><th>Row Header 1</th><td>One</td><td>Two</td></tr>
 26 <tr><th>Row Header 2</th><td>Three</td><td>Four</td></tr>
 27</table>
 28<p id="paragraph">A paragraph between a 9-cell table and a list of three items.</p>
 29<ul id="floating-list">
 30 <li>Cat</li>
 31 <li>Dog</li>
 32 <li>Elephant</li>
 33</ul>
 34<br clear="all" />
 35<div contenteditable>
 36 <span id="startWithoutCaretBrowsing">- Foo</span><br />
 37 <p>- Bar</p><br />
 38</div>
 39<p id="description"></p>
 40<div id="console"></div>
 41<script>
 42description("This tests vertical caret navigation works as expected across tables and floating elements.");
 43
 44function checkWithCaretBrowsing() {
 45
 46 layoutTestController.overridePreference("WebKitEnableCaretBrowsing", true);
 47
 48 // Check down/up arrows.
 49
 50 // Set caret in the second cell of the table.
 51 startPoint = document.getElementById("startWithCaretBrowsing");
 52 window.getSelection().setPosition(startPoint.childNodes.item(0), 5);
 53 shouldBe("getSelection().anchorNode.nodeValue", "'Col. Header 1'");
 54 shouldBe("getSelection().baseOffset", "5");
 55
 56 // Move the caret down to the second row of the table.
 57 eventSender.keyDown("downArrow");
 58 shouldBe("getSelection().anchorNode.nodeValue", "'One'");
 59 shouldBe("getSelection().baseOffset", "3");
 60
 61 // Move the caret down to the third row of the table.
 62 eventSender.keyDown("downArrow");
 63 shouldBe("getSelection().anchorNode.nodeValue", "'Three'");
 64 shouldBe("getSelection().baseOffset", "5");
 65
 66 // Move the caret down to paragraph.
 67 eventSender.keyDown("downArrow");
 68 shouldBe("getSelection().anchorNode.nodeValue", "'A paragraph between a 9-cell table and a list of three items.'");
 69 shouldBe("getSelection().baseOffset", "61");
 70
 71 // Move the caret down to the list of items.
 72 paragraph = document.getElementById("paragraph");
 73 window.getSelection().setPosition(paragraph.childNodes.item(0), 20);
 74 eventSender.keyDown("downArrow");
 75 shouldBe("getSelection().anchorNode.nodeValue", "'Elephant'");
 76 shouldBe("getSelection().baseOffset", "0");
 77
 78 // Move the caret up a couple of lines.
 79 eventSender.keyDown("upArrow");
 80 eventSender.keyDown("upArrow");
 81 shouldBe("getSelection().anchorNode.nodeValue", "'Row Header 2'");
 82 shouldBe("getSelection().baseOffset", "6");
 83
 84 // Check up/down arrows + Shift.
 85
 86 // Selection inside the table.
 87 eventSender.keyDown("upArrow", ["shiftKey"]);
 88 range = getSelection().getRangeAt(0);
 89 shouldBe("range.startContainer.nodeValue", "'Row Header 1'");
 90 shouldBe("getSelection().baseOffset", "6");
 91 shouldBe("range.endContainer.nodeValue", "'Row Header 2'");
 92 shouldBe("getSelection().extentOffset", "6");
 93
 94 // Selection across the table and the paragraph.
 95 eventSender.keyDown("downArrow", ["shiftKey"]);
 96 eventSender.keyDown("downArrow", ["shiftKey"]);
 97 range = getSelection().getRangeAt(0);
 98 shouldBe("range.startContainer.nodeValue", "'Row Header 2'");
 99 shouldBe("getSelection().baseOffset", "6");
 100 shouldBe("range.endContainer.nodeValue", "'A paragraph between a 9-cell table and a list of three items.'");
 101 shouldBe("getSelection().extentOffset", "20");
 102}
 103
 104function checkWithoutCaretBrowsing() {
 105 layoutTestController.dumpEditingCallbacks();
 106 layoutTestController.overridePreference("WebKitEnableCaretBrowsing", false);
 107
 108 // Check MoveDown / MoveUp commands.
 109
 110 // Set caret in the second cell of the table.
 111 startPoint = document.getElementById("startWithoutCaretBrowsing");
 112 window.getSelection().setPosition(startPoint.childNodes.item(0), 3);
 113
 114 // Move down and up across the different lines inside the editable content.
 115 layoutTestController.execCommand("MoveDown");
 116 layoutTestController.execCommand("MoveDown");
 117 layoutTestController.execCommand("MoveUp");
 118 layoutTestController.execCommand("MoveUp");
 119 layoutTestController.execCommand("MoveUp");
 120}
 121
 122if (window.layoutTestController) {
 123 layoutTestController.dumpAsText();
 124
 125 // We need to check with and without caret browsing activated to
 126 // ensure no API breakage has happened with the MoveUp/Down commands.
 127 checkWithCaretBrowsing();
 128 checkWithoutCaretBrowsing();
 129}
 130
 131successfullyParsed = true;
 132</script>
 133<script src="../../../../fast/js/resources/js-test-post.js"></script>
 134</body>
 135</html>

Source/WebCore/ChangeLog

 12011-03-01 Mario Sanchez Prada <msanchez@igalia.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [GTK] Elements on the same line should be treated as such by caret navigation
 6 https://bugs.webkit.org/show_bug.cgi?id=25533
 7
 8 Ensure the caret will move to a vertically coincident position
 9 when moving up and down across different lines.
 10
 11 * editing/EditorCommand.cpp:
 12 (WebCore::isVerticallyCoincident): New, checks if a renderer is
 13 vertically coincident to another one used as reference and a given
 14 X position, when moving up and down in caret browsing mode.
 15 (WebCore::moveCaretVertically): Actually move the caret forward
 16 or backward across different lines, ensuring the final destination
 17 is a rendered vertically coincident with the start point.
 18 (WebCore::executeMoveCaretDown): New, implements the new
 19 "MoveCaretDown" command, used in caret browsing mode only, so far
 20 affecting the GTK port only.
 21 (WebCore::executeMoveCaretDownAndModifySelection): New, implements
 22 the new "MoveCaretDownAndModifySelection" command.
 23 (WebCore::executeMoveCaretUp): New, implements the new
 24 "MoveCaretUp" command.
 25 (WebCore::executeMoveCaretUpAndModifySelection): New, implements
 26 the new "MoveCaretUpAndModifySelection" command.
 27 (WebCore::createCommandMap): Add the new commands needed for the
 28 GTK port, related with up/down movement in caret browsing mode.
 29
1302011-02-27 Patrick Gansterer <paroga@webkit.org>
231
332 Reviewed by Darin Adler.

Source/WebCore/editing/EditorCommand.cpp

4949#include "InsertListCommand.h"
5050#include "KillRing.h"
5151#include "Page.h"
 52#include "RenderBlock.h"
5253#include "RenderBox.h"
5354#include "ReplaceSelectionCommand.h"
5455#include "Scrollbar.h"

@@static bool executeMoveBackwardAndModifySelection(Frame* frame, Event*, EditorCo
615616 return true;
616617}
617618
 619static bool isVerticallyCoincident(VisiblePosition origin, VisiblePosition candidate, int originX, SelectionDirection direction)
 620{
 621 if (origin.isNull() || candidate.isNull())
 622 return false;
 623
 624 RenderObject* originRenderer;
 625 IntRect originRect = origin.localCaretRect(originRenderer);
 626 if (!originRenderer)
 627 return false;
 628
 629 RenderBlock* originBlock = originRenderer->containingBlock();
 630 if (!originBlock)
 631 return false;
 632 FloatPoint originAbsPos = originBlock->localToAbsolute(FloatPoint());
 633
 634 RenderObject* candidateRenderer;
 635 IntRect candidateRect = candidate.localCaretRect(candidateRenderer);
 636 if (!candidateRenderer)
 637 return false;
 638
 639 RenderBlock* candidateBlock = candidateRenderer->containingBlock();
 640 if (!candidateBlock)
 641 return false;
 642 FloatPoint candidateAbsPos = candidateBlock->localToAbsolute(FloatPoint());
 643
 644 // Candidate caret must be in a higher position than origin one when going backward.
 645 if (direction == DirectionBackward
 646 && candidateAbsPos.y() + candidateRect.y() >= originAbsPos.y() + originRect.y())
 647 return false;
 648
 649 // Candidate caret must be in a lower position than origin one when going forward.
 650 if (direction == DirectionForward
 651 && candidateAbsPos.y() + candidateRect.y() + candidateRect.height() <= originAbsPos.y() + originRect.y() + originRect.height())
 652 return false;
 653
 654 // Candidate must be in the same vertical space than origin.
 655 if (candidateAbsPos.x() > originX || originX > candidateAbsPos.x() + candidateBlock->width())
 656 return false;
 657
 658 return true;
 659}
 660
 661static bool moveCaretVertically(Frame* frame, WebCore::SelectionController::EAlteration alteration, SelectionDirection direction)
 662{
 663 SelectionController* selection = frame->selection();
 664 Position pos = selection->extent();
 665 Node* originNode = pos.containerNode();
 666 if (!originNode)
 667 return false;
 668
 669 RenderObject* originRenderer = originNode->renderer();
 670 if (!originRenderer)
 671 return false;
 672
 673 // Get the absolute X coordinate for further comparisons.
 674 VisiblePosition originVisiblePosition(pos, selection->affinity());
 675 int x = originVisiblePosition.isNotNull() ? originVisiblePosition.xOffsetForVerticalNavigation() : 0;
 676
 677 // Repeat command until reaching a valid destination.
 678 Position previousPosition = pos;
 679 while (selection->modify(alteration, direction, LineGranularity, true)) {
 680 Position currentPosition = selection->extent();
 681
 682 // Don't keep looping if new selection has not changed.
 683 if (currentPosition == previousPosition)
 684 return false;
 685
 686 VisiblePosition currentVisiblePosition(currentPosition, selection->affinity());
 687 if (isVerticallyCoincident(originVisiblePosition, currentVisiblePosition, x, direction))
 688 return true;
 689
 690 previousPosition = currentPosition;
 691 };
 692
 693 return false;
 694}
 695
 696static bool executeMoveCaretDown(Frame* frame, Event*, EditorCommandSource, const String&)
 697{
 698 return moveCaretVertically(frame, SelectionController::AlterationMove, DirectionForward);
 699}
 700
 701static bool executeMoveCaretDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
 702{
 703 return moveCaretVertically(frame, SelectionController::AlterationExtend, DirectionForward);
 704}
 705
618706static bool executeMoveDown(Frame* frame, Event*, EditorCommandSource, const String&)
619707{
620708 return frame->selection()->modify(SelectionController::AlterationMove, DirectionForward, LineGranularity, true);

@@static bool executeMoveParagraphForwardAndModifySelection(Frame* frame, Event*,
800888 return true;
801889}
802890
 891static bool executeMoveCaretUp(Frame* frame, Event*, EditorCommandSource, const String&)
 892{
 893 return moveCaretVertically(frame, SelectionController::AlterationMove, DirectionBackward);
 894}
 895
 896static bool executeMoveCaretUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
 897{
 898 return moveCaretVertically(frame, SelectionController::AlterationExtend, DirectionBackward);
 899}
 900
803901static bool executeMoveUp(Frame* frame, Event*, EditorCommandSource, const String&)
804902{
805903 return frame->selection()->modify(SelectionController::AlterationMove, DirectionBackward, LineGranularity, true);

@@static const CommandMap& createCommandMap()
14561554 { "MakeTextWritingDirectionRightToLeft", { executeMakeTextWritingDirectionRightToLeft, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionRightToLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14571555 { "MoveBackward", { executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14581556 { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
1459  { "MoveDown", { executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
1460  { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1557 { "MoveCaretDown", { executeMoveCaretDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1558 { "MoveCaretDownAndModifySelection", { executeMoveCaretDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1559 { "MoveDown", { executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1560 { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14611561 { "MoveForward", { executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14621562 { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14631563 { "MoveLeft", { executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },

@@static const CommandMap& createCommandMap()
14901590 { "MoveToLeftEndOfLineAndModifySelection", { executeMoveToLeftEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14911591 { "MoveToRightEndOfLine", { executeMoveToRightEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14921592 { "MoveToRightEndOfLineAndModifySelection", { executeMoveToRightEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
1493  { "MoveUp", { executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
1494  { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1593 { "MoveCaretUp", { executeMoveCaretUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1594 { "MoveCaretUpAndModifySelection", { executeMoveCaretUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1595 { "MoveUp", { executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 1596 { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14951597 { "MoveWordBackward", { executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14961598 { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
14971599 { "MoveWordForward", { executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },

Source/WebKit/gtk/ChangeLog

 12011-03-01 Mario Sanchez Prada <msanchez@igalia.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [GTK] Elements on the same line should be treated as such by caret navigation
 6 https://bugs.webkit.org/show_bug.cgi?id=25533
 7
 8 Use the new commands for moving up/down in caret browsing mode.
 9
 10 * WebCoreSupport/EditorClientGtk.cpp:
 11 (WebKit::moveCursorCallback): Redefine rawCommand to one of the
 12 new four commands when appropriate.
 13
1142011-02-26 Lukasz Slachciak <l.slachciak@samsung.com>
215
316 Reviewed by Xan Lopez.

Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp

3838#include "Page.h"
3939#include "PasteboardHelperGtk.h"
4040#include "PlatformKeyboardEvent.h"
 41#include "Settings.h"
4142#include "WebKitDOMBinding.h"
4243#include "WebKitDOMCSSStyleDeclarationPrivate.h"
4344#include "WebKitDOMHTMLElementPrivate.h"

@@static const char* const gtkMoveCommands[][4] = {
218219 0, 0 } // Horizontal page movement
219220};
220221
 222static const char* const gtkMoveCaretLinesCommands[4] = {
 223 "MoveCaretUp", "MoveCaretDown",
 224 "MoveCaretUpAndModifySelection", "MoveCaretDownAndModifySelection"
 225};
 226
221227static void moveCursorCallback(GtkWidget* widget, GtkMovementStep step, gint count, gboolean extendSelection, EditorClient* client)
222228{
223229 g_signal_stop_emission_by_name(widget, "move-cursor");

@@static void moveCursorCallback(GtkWidget* widget, GtkMovementStep step, gint cou
232238 if (!rawCommand)
233239 return;
234240
 241 /* Check special case for moving the caret up/down across lines. */
 242 if (step == 3) {
 243 Frame* frame = core(client->webView())->focusController()->focusedOrMainFrame();
 244 Settings* settings = frame ? frame->settings() : 0;
 245 if (settings && settings->caretBrowsingEnabled())
 246 rawCommand = gtkMoveCaretLinesCommands[direction];
 247 }
 248
235249 for (int i = 0; i < abs(count); i++)
236250 client->addPendingEditorCommand(rawCommand);
237251}