Changeset 49193 in webkit
- Timestamp:
- Oct 6, 2009 10:24:37 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49191 r49193 1 2009-10-06 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Eric Seidel. 4 5 https://bugs.webkit.org/show_bug.cgi?id=25526 6 [Gtk] Additional support is needed for caret browsing 7 8 Enable caret movement commands also when caret browsing setting is 9 enabled. 10 11 * editing/EditorCommand.cpp: 12 (WebCore::caretBrowsingEnabled): 13 (WebCore::enabledVisibleSelectionOrCaretBrowsing): 14 (WebCore::enabledInEditableTextOrCaretBrowsing): 15 (WebCore::CommandEntry::): 16 * manual-tests/gtk/caret-browsing.html: Added. 17 1 18 2009-10-06 Anton Muhin <antonm@chromium> 2 19 -
trunk/WebCore/editing/EditorCommand.cpp
r47541 r49193 2 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2009 Igalia S.L. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 1097 1098 } 1098 1099 1100 static bool caretBrowsingEnabled(Frame* frame) 1101 { 1102 return frame->settings() && frame->settings()->caretBrowsingEnabled(); 1103 } 1104 1105 static EditorCommandSource dummyEditorCommandSource = static_cast<EditorCommandSource>(0); 1106 1107 static bool enabledVisibleSelectionOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource) 1108 { 1109 // The EditorCommandSource parameter is unused in enabledVisibleSelection, so just pass a dummy variable 1110 return caretBrowsingEnabled(frame) || enabledVisibleSelection(frame, event, dummyEditorCommandSource); 1111 } 1112 1099 1113 static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource) 1100 1114 { … … 1139 1153 { 1140 1154 return frame->editor()->selectionForCommand(event).isContentEditable(); 1155 } 1156 1157 static bool enabledInEditableTextOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource) 1158 { 1159 // The EditorCommandSource parameter is unused in enabledInEditableText, so just pass a dummy variable 1160 return caretBrowsingEnabled(frame) || enabledInEditableText(frame, event, dummyEditorCommandSource); 1141 1161 } 1142 1162 … … 1331 1351 { "MoveBackward", { executeMoveBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1332 1352 { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1333 { "MoveDown", { executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableText , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1334 { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1353 { "MoveDown", { executeMoveDown, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1354 { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1335 1355 { "MoveForward", { executeMoveForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1336 1356 { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1337 { "MoveLeft", { executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableText , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1338 { "MoveLeftAndModifySelection", { executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1357 { "MoveLeft", { executeMoveLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1358 { "MoveLeftAndModifySelection", { executeMoveLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1339 1359 { "MovePageDown", { executeMovePageDown, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1340 1360 { "MovePageDownAndModifySelection", { executeMovePageDownAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1341 1361 { "MovePageUp", { executeMovePageUp, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1342 1362 { "MovePageUpAndModifySelection", { executeMovePageUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1343 { "MoveParagraphBackwardAndModifySelection", { executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1344 { "MoveParagraphForwardAndModifySelection", { executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1345 { "MoveRight", { executeMoveRight, supportedFromMenuOrKeyBinding, enabledInEditableText , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1346 { "MoveRightAndModifySelection", { executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1363 { "MoveParagraphBackwardAndModifySelection", { executeMoveParagraphBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1364 { "MoveParagraphForwardAndModifySelection", { executeMoveParagraphForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1365 { "MoveRight", { executeMoveRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1366 { "MoveRightAndModifySelection", { executeMoveRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1347 1367 { "MoveToBeginningOfDocument", { executeMoveToBeginningOfDocument, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1348 1368 { "MoveToBeginningOfDocumentAndModifySelection", { executeMoveToBeginningOfDocumentAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, … … 1365 1385 { "MoveToRightEndOfLine", { executeMoveToRightEndOfLine, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1366 1386 { "MoveToRightEndOfLineAndModifySelection", { executeMoveToRightEndOfLineAndModifySelection, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1367 { "MoveUp", { executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableText , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1368 { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1387 { "MoveUp", { executeMoveUp, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1388 { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1369 1389 { "MoveWordBackward", { executeMoveWordBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1370 1390 { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1371 1391 { "MoveWordForward", { executeMoveWordForward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1372 1392 { "MoveWordForwardAndModifySelection", { executeMoveWordForwardAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1373 { "MoveWordLeft", { executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableText , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1374 { "MoveWordLeftAndModifySelection", { executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1375 { "MoveWordRight", { executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableText , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1376 { "MoveWordRightAndModifySelection", { executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelection , stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1393 { "MoveWordLeft", { executeMoveWordLeft, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1394 { "MoveWordLeftAndModifySelection", { executeMoveWordLeftAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1395 { "MoveWordRight", { executeMoveWordRight, supportedFromMenuOrKeyBinding, enabledInEditableTextOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1396 { "MoveWordRightAndModifySelection", { executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1377 1397 { "Outdent", { executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1378 1398 { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, -
trunk/WebKit/gtk/ChangeLog
r49190 r49193 1 2009-10-06 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Eric Seidel. 4 5 https://bugs.webkit.org/show_bug.cgi?id=25526 6 [Gtk] Additional support is needed for caret browsing 7 8 Remove special cases for caret browsing, they are now handled in 9 cross-platform code. 10 11 * WebCoreSupport/EditorClientGtk.cpp: 12 (WebKit::EditorClient::handleKeyboardEvent): 13 1 14 2009-10-06 Pavel Feldman <pfeldman@chromium.org> 2 15 -
trunk/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
r48964 r49193 454 454 } 455 455 456 static bool handleCaretBrowsingKeyboardEvent(Frame* frame, const PlatformKeyboardEvent* keyEvent)457 {458 switch (keyEvent->windowsVirtualKeyCode()) {459 case VK_LEFT:460 frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,461 SelectionController::LEFT,462 keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,463 true);464 return true;465 case VK_RIGHT:466 frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,467 SelectionController::RIGHT,468 keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,469 true);470 return true;471 case VK_UP:472 frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,473 SelectionController::BACKWARD,474 keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,475 true);476 return true;477 case VK_DOWN:478 frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,479 SelectionController::FORWARD,480 keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,481 true);482 return true;483 default:484 return false; // Not a caret browswing keystroke, so continue processing.485 }486 }487 488 456 void EditorClient::handleKeyboardEvent(KeyboardEvent* event) 489 457 { … … 497 465 return; 498 466 499 bool caretBrowsing = frame->settings()->caretBrowsingEnabled(); 500 if (caretBrowsing && handleCaretBrowsingKeyboardEvent(frame, platformEvent)) { 501 // This was a caret browsing key event, so prevent it from bubbling up to the DOM. 502 event->setDefaultHandled(); 503 return; 504 } 505 506 // Don't allow editor commands or text insertion for nodes that cannot edit. 507 if (!frame->editor()->canEdit()) 467 // Don't allow editor commands or text insertion for nodes that 468 // cannot edit, unless we are in caret mode. 469 if (!frame->editor()->canEdit() && !(frame->settings() && frame->settings()->caretBrowsingEnabled())) 508 470 return; 509 471
Note: See TracChangeset
for help on using the changeset viewer.