Changeset 28717

Show
Ignore:
Timestamp:
12/14/07 12:03:16 (12 months ago)
Author:
darin@apple.com
Message:

WebCore:

Reviewed by Alexey.

Add a few more operations to document.execCommand.

Finished up the transition to the new Editor::Command, including removing
the Editor::execCommand function.

  • WebCore.base.exp: Added Editor::Command::isSupported.
  • editing/Editor.h: Removed execCommand.
  • editing/EditorCommand.cpp: (WebCore::expandSelectionToGranularity): Added. (WebCore::verticalScrollDistance): Added; replaces canScroll. (WebCore::executeDeleteBackward): Added. Moved code here from WebHTMLView. (WebCore::executeDeleteBackwardByDecomposingPreviousCharacter): Ditto. (WebCore::executeDeleteForward): Ditto. (WebCore::executeDeleteToBeginningOfLine): Ditto. (WebCore::executeDeleteToBeginningOfParagraph): Ditto. (WebCore::executeDeleteToEndOfLine): Ditto. (WebCore::executeDeleteToEndOfParagraph): Ditto. (WebCore::executeMovePageDown): Renamed this command to be consistent with all the other Move commands. They all modify the caret. Reimplemented to match the Mac OS X version by removing the explicit scrolling, and letting it be done automatically by code that makes the caret visible. In some cases the old code would scroll twice which was harmless but unnecessary. (WebCore::executeMovePageDownAndModifySelection): Added. Moved code here from WebHTMLView. (WebCore::executeMovePageUp): See MovePageDown above. (WebCore::executeMovePageUpAndModifySelection): Added. Moved code here from WebHTMLView. (WebCore::executeSelectLine): Ditto. (WebCore::executeSelectParagraph): Ditto. (WebCore::executeSelectSentence): Ditto. (WebCore::executeSelectWord): Ditto. (WebCore::executeSwapWithMark): Some small tweaks.
  • page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Changed to use Editor::command() instead of Editor::execCommand(). This code could be changed to use Editor::Command quite a bit more, but I didn't do that this time.
  • Removed some obsolete unused code.
  • page/mac/EventHandlerMac.mm: (WebCore::EventHandler::passMouseDownEventToWidget): Removed the special case code for NSTextView. This was left over from when we used NSTextField and NSTextView for form elements and is no longer used at all.
  • page/mac/WebCoreFrameBridge.h: Removed 20 unused methods that were still on one side of the bridge or another. We really need to find a time to tear down the rest of the bridge, but that's not this patch.
  • page/mac/WebCoreFrameBridge.mm: (-addData:): Changed to get at the _shouldCreateRenderers field directly instead of using a method. (-rangeByAlteringCurrentSelection:SelectionController::direction:SelectionController::granularity:): Took out obsolete comment about matching enums (we use a single enum now and have for some time). (-selectionGranularity): Ditto.

WebKit:

  • StringsNotToBeLocalized.txt: Updated.

WebKit/gtk:

Reviewed by Alexey.

  • WebCoreSupport/EditorClientGtk.cpp: (WebKit::EditorClient::handleKeyboardEvent): Changed to use Editor::command instead of Editor::execCommand.
  • WebView/webkitwebview.cpp: Ditto.

WebKit/mac:

Reviewed by Alexey.

  • Changed a few more editing operations to use WebCore instead of WebKit.
  • Removed some obsolete unused code.
  • WebCoreSupport/WebFrameBridge.h: Moved declarations of methods that are both defined and used on the WebKit side to here. These no longer belong on the bridge and should be moved to the WebFrame class (or elsewhere).
  • WebCoreSupport/WebFrameBridge.mm: Removed some unused methods.
  • WebView/WebFrameView.mm: (+_viewTypesAllowImageTypeOmission:): Fix typo in comment.
  • WebView/WebHTMLView.mm: (-[WebHTMLViewPrivate dealloc]): Removed unused firstResponderTextViewAtMouseDownTime. (-[WebHTMLViewPrivate clear]): Ditto. (-[WebHTMLView _setMouseDownEvent:]): Ditto. (commandNameForSelector): Added special cases for pageDown:, pageDownAndModifySelection:, pageUp:, and pageUpAndModifySelection:, since those names probably aren't specific enough to be used in WebCore (what AppKit calls scrollPageDown: vs. pageDown: needs to be disambiguated with the word "Move"). Added deleteBackward:, deleteBackwardByDecomposingPreviousCharacter:, deleteForward:, deleteToBeginningOfLine:, deleteToBeginningOfParagraph:, deleteToEndOfLine:, deleteToEndOfParagraph:, pageDown:, pageDownAndModifySelection:, pageUp:, pageUpAndModifySelection:, selectLine:, selectParagraph:, selectSentence:, and selectWord: to the list of commands that are forwarded to WebCore. (-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]): Eliminated the long list of operations that we forward to WebCore. Instead, look up any command that WebCore can handle, after any that we handle specially in WebHTMLView. Also fixed a bug where an item that's not a menu item with changeBaseWritingDirection:NSWritingDirectionNatural would end up enabled instead of disabled and streamlined the logic for toggleGrammarChecking:. (-[WebHTMLView mouseDown:]): Removed unused firstResponderTextViewAtMouseDownTime. (-[WebHTMLView becomeFirstResponder]): Removed unused willBecomeFirstResponderForNodeFocus. (-[WebHTMLView resignFirstResponder]): Ditto. (-[WebHTMLView checkSpelling:]): Took unneeded extra initialization of NSSpellChecker.
  • WebView/WebHTMLViewInternal.h: Removed unused willBecomeFirstResponderForNodeFocus, firstResponderTextViewAtMouseDownTime, _textViewWasFirstResponderAtMouseDownTime: and _willMakeFirstResponderForNodeFocus.

WebKit/qt:

Reviewed by Alexey.

  • Api/qwebpage.cpp: (QWebPage::triggerAction): Removed some use of Editor member functions we plan to eventually eliminate. Switch from Editor::execCommand to Editor::command.
  • WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::handleKeyboardEvent): Ditto. Also updated name from MoveUpByPageAndModifyCaret to MovePageUp and from MoveDownByPageAndModifyCaret to MovePageDown.

WebKit/win:

Reviewed by Alexey.

  • WebView.cpp: (WebView::execCommand): Switched from Editor::execCommand to Editor:command. Updated name from MoveUpByPageAndModifyCaret to MovePageUp and from MoveDownByPageAndModifyCaret to MovePageDown. (WebView::copy): Switched from Editor::execCommand to Editor:command. (WebView::cut): Ditto. (WebView::paste): Ditto. (WebView::delete_): Ditto.

WebKit/wx:

Reviewed by Alexey.

  • WebKitSupport/EditorClientWx.cpp: (WebCore::EditorClientWx::handleKeyboardEvent): Switched from Editor::execCommand to Edtor::command.

LayoutTests:

Reviewed by Alexey.

To avoid changing results at this time, I didn't correct the many tests that now have
misleading "this test cannot be run manually" text or references to "NSResponder" or
uneeded instructions for running the test manually. We can do that on a later pass.

  • editing/deleting/5300379.html: Use execCommand instead of doCommand.
  • editing/deleting/delete-to-end-of-paragraph.html: Ditto.
  • editing/deleting/smart-delete-003.html: Ditto.
  • editing/deleting/smart-delete-004.html: Ditto.
  • editing/execCommand/nsresponder-indent.html: Ditto.
  • editing/execCommand/nsresponder-outdent.html: Ditto.
  • editing/selection/4947387.html: Ditto.
  • editing/selection/5195166-1.html: Ditto.
  • editing/selection/5195166-2.html: Ditto.
  • editing/selection/select-line.html: Ditto.
  • editing/selection/selection-actions.html: Ditto.
Location:
trunk
Files:
38 modified

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r28716 r28717  
     12007-12-14  Darin Adler  <darin@apple.com> 
     2 
     3        Reviewed by Alexey. 
     4 
     5        - http://bugs.webkit.org/show_bug.cgi?id=16420 
     6          change regression tests to use document.execCommand instead of textInputController.doCommand 
     7 
     8        To avoid changing results at this time, I didn't correct the many tests that now have 
     9        misleading "this test cannot be run manually" text or references to "NSResponder" or 
     10        uneeded instructions for running the test manually. We can do that on a later pass. 
     11 
     12        * editing/deleting/5300379.html: Use execCommand instead of doCommand. 
     13        * editing/deleting/delete-to-end-of-paragraph.html: Ditto. 
     14        * editing/deleting/smart-delete-003.html: Ditto. 
     15        * editing/deleting/smart-delete-004.html: Ditto. 
     16        * editing/execCommand/nsresponder-indent.html: Ditto. 
     17        * editing/execCommand/nsresponder-outdent.html: Ditto. 
     18        * editing/selection/4947387.html: Ditto. 
     19        * editing/selection/5195166-1.html: Ditto. 
     20        * editing/selection/5195166-2.html: Ditto. 
     21        * editing/selection/select-line.html: Ditto. 
     22        * editing/selection/selection-actions.html: Ditto. 
     23 
    1242007-12-14  Justin Garcia  <justin.garcia@apple.com> 
    225 
  • trunk/LayoutTests/editing/deleting/5300379.html

    r25382 r28717  
    77sel = window.getSelection(); 
    88sel.setPosition(div, 0); 
    9 if (window.layoutTestController) { 
    10     // Test to see if deleteWordBackward: hangs. 
    11     textInputController.doCommand("deleteWordBackward:"); 
    12     document.execCommand("InsertText", false, "Success FAIL"); 
    13     // Delete 'FAIL' with deleteWordBackward: to verify that it's not a no-op. 
    14     textInputController.doCommand("deleteWordBackward:"); 
    15     textInputController.doCommand("deleteBackward:"); 
    16 } else { 
    17     document.execCommand("InsertText", false, "To run this test manually.  Delete all this text and then option-delete.  Safari shouldn't hang."); 
    18 } 
     9// Test to see if DeleteWordBackward hangs. 
     10document.execCommand("DeleteWordBackward"); 
     11document.execCommand("InsertText", false, "Success FAIL"); 
     12// Delete 'FAIL' with DeleteWordBackward to verify that it's not a no-op. 
     13document.execCommand("DeleteWordBackward"); 
     14document.execCommand("DeleteBackward"); 
    1915</script> 
  • trunk/LayoutTests/editing/deleting/delete-to-end-of-paragraph.html

    r25382 r28717  
    1313 
    1414function editingTest() { 
    15     if (window.layoutTestController) { 
    16          
    17         try { 
    18             // test for 4570218 by using double deleteToEndOfParagraph 
    19             textInputController.doCommand("deleteToEndOfParagraph:");     
    20             textInputController.doCommand("deleteToEndOfParagraph:");     
     15    try { 
     16        // test for 4570218 by using double deleteToEndOfParagraph 
     17        document.execCommand("DeleteToEndOfParagraph");     
     18        document.execCommand("DeleteToEndOfParagraph");     
    2119 
    22         } catch (ex) { 
    23             document.write("Exception: " + ex.description); 
    24         } 
    25     } else { 
    26         document.write("(cannot run interactively)"); 
     20    } catch (ex) { 
     21        document.write("Exception: " + ex.description); 
    2722    } 
    2823} 
  • trunk/LayoutTests/editing/deleting/smart-delete-003.html

    r25382 r28717  
    77 
    88<script> 
    9 if (window.layoutTestController) { 
    10     var div = document.getElementById("div"); 
    11     var sel = window.getSelection(); 
    12      
    13     sel.setPosition(div, 0); 
    14     sel.modify("move", "forward", "word"); 
    15     sel.modify("move", "forward", "word"); 
    16     sel.modify("extend", "backward", "word"); 
    17     textInputController.doCommand("deleteBackward:"); 
    18 } 
     9var div = document.getElementById("div"); 
     10var sel = window.getSelection(); 
     11 
     12sel.setPosition(div, 0); 
     13sel.modify("move", "forward", "word"); 
     14sel.modify("move", "forward", "word"); 
     15sel.modify("extend", "backward", "word"); 
     16document.execCommand("DeleteBackward"); 
    1917</script> 
  • trunk/LayoutTests/editing/deleting/smart-delete-004.html

    r25382 r28717  
    77 
    88<script> 
    9 if (window.layoutTestController) { 
    10     var div = document.getElementById("div"); 
    11     var sel = window.getSelection(); 
    12      
    13     sel.setPosition(div, 0); 
    14     sel.modify("move", "forward", "word"); 
    15     sel.modify("move", "forward", "word"); 
    16     sel.modify("extend", "backward", "word"); 
    17     textInputController.doCommand("deleteForward:"); 
    18 } 
     9var div = document.getElementById("div"); 
     10var sel = window.getSelection(); 
     11 
     12sel.setPosition(div, 0); 
     13sel.modify("move", "forward", "word"); 
     14sel.modify("move", "forward", "word"); 
     15sel.modify("extend", "backward", "word"); 
     16document.execCommand("DeleteForward"); 
    1917</script> 
  • trunk/LayoutTests/editing/execCommand/nsresponder-indent.html

    r25382 r28717  
    1212sel.setPosition(div, 0); 
    1313 
    14 textInputController.doCommand("indent:"); 
     14document.execCommand("Indent"); 
    1515</script> 
  • trunk/LayoutTests/editing/execCommand/nsresponder-outdent.html

    r25382 r28717  
    1212sel.setPosition(div, 0); 
    1313 
    14 textInputController.doCommand("outdent:"); 
     14document.execCommand("Outdent"); 
    1515</script> 
  • trunk/LayoutTests/editing/selection/4947387.html

    r25382 r28717  
    44<script> 
    55 
    6 if (window.layoutTestController) { 
    7  
     6if (window.layoutTestController) 
    87    window.layoutTestController.dumpEditingCallbacks(); 
    98     
    10     var div = document.getElementById("div"); 
    11     var text = div.firstChild; 
    12     var sel = window.getSelection(); 
    13      
    14     sel.setPosition(text, text.length); 
    15     textInputController.doCommand("moveToBeginningOfLineAndModifySelection:"); 
    16      
    17     sel.setPosition(text, 0); 
    18     textInputController.doCommand("moveToEndOfLineAndModifySelection:"); 
     9var div = document.getElementById("div"); 
     10var text = div.firstChild; 
     11var sel = window.getSelection(); 
    1912 
    20     sel.setPosition(text, text.length); 
    21     textInputController.doCommand("moveToBeginningOfParagraphAndModifySelection:"); 
    22      
    23     sel.setPosition(text, 0); 
    24     textInputController.doCommand("moveToEndOfParagraphAndModifySelection:"); 
    25 } 
     13sel.setPosition(text, text.length); 
     14document.execCommand("MoveToBeginningOfLineAndModifySelection"); 
     15 
     16sel.setPosition(text, 0); 
     17document.execCommand("MoveToEndOfLineAndModifySelection"); 
     18 
     19sel.setPosition(text, text.length); 
     20document.execCommand("MoveToBeginningOfParagraphAndModifySelection"); 
     21 
     22sel.setPosition(text, 0); 
     23document.execCommand("MoveToEndOfParagraphAndModifySelection"); 
     24 
    2625</script> 
  • trunk/LayoutTests/editing/selection/5195166-1.html

    r25382 r28717  
    1010    li.appendChild(text); 
    1111} 
    12 if (window.layoutTestController) { 
    13     var text = document.getElementById("div").firstChild; 
    14     var selection = window.getSelection(); 
    15      
    16     // FIXME: m_lastChangeWasHorizontalExtension isn't cleared in several places 
    17     // where it should be, when opening a new document for example. 
    18     selection.setPosition(text, 0); 
    19     selection.modify("move", "forward", "character"); 
    20      
    21     selection.setBaseAndExtent(text, 3 + 5, text, 3); 
    22     // Extending this 5 character selection will select 6 characters. 
    23     textInputController.doCommand("moveForwardAndModifySelection:"); 
    24     // Extending it in this way flips the base and the extent. 
    25     if (selection.extentOffset - selection.baseOffset != 6) 
    26         log("Failure: Selection isn't the right size."); 
    27     else 
    28         log ("Success"); 
    29 } else 
    30     log ("Failure: This test cannot be run manually.") 
     12var text = document.getElementById("div").firstChild; 
     13var selection = window.getSelection(); 
     14 
     15// FIXME: m_lastChangeWasHorizontalExtension isn't cleared in several places 
     16// where it should be, when opening a new document for example. 
     17selection.setPosition(text, 0); 
     18selection.modify("move", "forward", "character"); 
     19 
     20selection.setBaseAndExtent(text, 3 + 5, text, 3); 
     21// Extending this 5 character selection will select 6 characters. 
     22document.execCommand("MoveForwardAndModifySelection"); 
     23// Extending it in this way flips the base and the extent. 
     24if (selection.extentOffset - selection.baseOffset != 6) 
     25    log("Failure: Selection isn't the right size."); 
     26else 
     27    log ("Success"); 
    3128</script> 
  • trunk/LayoutTests/editing/selection/5195166-2.html

    r25382 r28717  
    1010    li.appendChild(text); 
    1111} 
    12 if (window.layoutTestController) { 
     12if (window.layoutTestController) 
    1313    window.layoutTestController.dumpEditingCallbacks(); 
    14     var text = document.getElementById("div").firstChild; 
    15     var selection = window.getSelection(); 
    16     selection.setBaseAndExtent(text, 0, text, 0); 
    17     textInputController.doCommand("moveForwardAndModifySelection:"); 
    18     textInputController.doCommand("moveForwardAndModifySelection:"); 
    19     textInputController.doCommand("moveForwardAndModifySelection:"); 
    20     textInputController.doCommand("moveBackwardAndModifySelection:"); 
    21 } else { 
    22     log("Failure: This test cannot be run manually.") 
    23 } 
    24  
     14var text = document.getElementById("div").firstChild; 
     15var selection = window.getSelection(); 
     16selection.setBaseAndExtent(text, 0, text, 0); 
     17document.execCommand("MoveForwardAndModifySelection"); 
     18document.execCommand("MoveForwardAndModifySelection"); 
     19document.execCommand("MoveForwardAndModifySelection"); 
     20document.execCommand("MoveBackwardAndModifySelection"); 
    2521</script> 
  • trunk/LayoutTests/editing/selection/select-line.html

    r25382 r28717  
    1010 
    1111sel.setPosition(div, 0); 
    12 if (window.layoutTestController) 
    13     textInputController.doCommand("selectLine:"); 
     12document.execCommand("SelectLine"); 
    1413</script> 
  • trunk/LayoutTests/editing/selection/selection-actions.html

    r25382 r28717  
    2525    eventSender.mouseUp(); 
    2626     
    27     textInputController.doCommand("moveBackward:"); 
    28     textInputController.doCommand("moveBackwardAndModifySelection:"); 
    29     textInputController.doCommand("moveDown:"); 
    30     textInputController.doCommand("moveDownAndModifySelection:"); 
    31     textInputController.doCommand("moveForward:"); 
    32     textInputController.doCommand("moveForwardAndModifySelection:"); 
    33     textInputController.doCommand("moveLeft:"); 
    34     textInputController.doCommand("moveLeftAndModifySelection:"); 
    35     textInputController.doCommand("moveRight:"); 
    36     textInputController.doCommand("moveRightAndModifySelection:"); 
    37     textInputController.doCommand("moveToBeginningOfDocument:"); 
    38     textInputController.doCommand("moveToBeginningOfLine:"); 
    39     textInputController.doCommand("moveToBeginningOfParagraph:"); 
    40     textInputController.doCommand("moveToEndOfDocument:"); 
    41     textInputController.doCommand("moveToEndOfLine:"); 
    42     textInputController.doCommand("moveToEndOfParagraph:"); 
    43     textInputController.doCommand("moveUp:"); 
    44     textInputController.doCommand("moveUpAndModifySelection:"); 
    45     textInputController.doCommand("moveWordBackward:"); 
    46     textInputController.doCommand("moveWordBackwardAndModifySelection:"); 
    47     textInputController.doCommand("moveWordForward:"); 
    48     textInputController.doCommand("moveWordForwardAndModifySelection:"); 
    49     textInputController.doCommand("moveWordLeft:"); 
    50     textInputController.doCommand("moveWordRight:"); 
    51     textInputController.doCommand("moveWordRightAndModifySelection:"); 
    52     textInputController.doCommand("moveWordLeftAndModifySelection:"); 
    53     textInputController.doCommand("pageDown:"); 
    54     textInputController.doCommand("pageUp:"); 
    55     textInputController.doCommand("selectLine:"); 
    56     textInputController.doCommand("selectParagraph:"); 
    57     textInputController.doCommand("selectWord:"); 
     27    document.execCommand("MoveBackward"); 
     28    document.execCommand("MoveBackwardAndModifySelection"); 
     29    document.execCommand("MoveDown"); 
     30    document.execCommand("MoveDownAndModifySelection"); 
     31    document.execCommand("MoveForward"); 
     32    document.execCommand("MoveForwardAndModifySelection"); 
     33    document.execCommand("MoveLeft"); 
     34    document.execCommand("MoveLeftAndModifySelection"); 
     35    document.execCommand("MoveRight"); 
     36    document.execCommand("MoveRightAndModifySelection"); 
     37    document.execCommand("MoveToBeginningOfDocument"); 
     38    document.execCommand("MoveToBeginningOfLine"); 
     39    document.execCommand("MoveToBeginningOfParagraph"); 
     40    document.execCommand("MoveToEndOfDocument"); 
     41    document.execCommand("MoveToEndOfLine"); 
     42    document.execCommand("MoveToEndOfParagraph"); 
     43    document.execCommand("MoveUp"); 
     44    document.execCommand("MoveUpAndModifySelection"); 
     45    document.execCommand("MoveWordBackward"); 
     46    document.execCommand("MoveWordBackwardAndModifySelection"); 
     47    document.execCommand("MoveWordForward"); 
     48    document.execCommand("MoveWordForwardAndModifySelection"); 
     49    document.execCommand("MoveWordLeft"); 
     50    document.execCommand("MoveWordRight"); 
     51    document.execCommand("MoveWordRightAndModifySelection"); 
     52    document.execCommand("MoveWordLeftAndModifySelection"); 
     53    document.execCommand("MovePageDown"); 
     54    document.execCommand("MovePageUp"); 
     55    document.execCommand("SelectLine"); 
     56    document.execCommand("SelectParagraph"); 
     57    document.execCommand("SelectWord"); 
    5858} 
    5959 
  • trunk/WebCore/ChangeLog

    r28716 r28717  
     12007-12-14  Darin Adler  <darin@apple.com> 
     2 
     3        Reviewed by Alexey. 
     4 
     5        - http://bugs.webkit.org/show_bug.cgi?id=16420 
     6          change regression tests to use document.execCommand instead of textInputController.doCommand 
     7 
     8        Add a few more operations to document.execCommand. 
     9 
     10        Finished up the transition to the new Editor::Command, including removing 
     11        the Editor::execCommand function. 
     12 
     13        * WebCore.base.exp: Added Editor::Command::isSupported. 
     14        * editing/Editor.h: Removed execCommand. 
     15        * editing/EditorCommand.cpp: 
     16        (WebCore::expandSelectionToGranularity): Added. 
     17        (WebCore::verticalScrollDistance): Added; replaces canScroll. 
     18        (WebCore::executeDeleteBackward): Added. Moved code here from WebHTMLView. 
     19        (WebCore::executeDeleteBackwardByDecomposingPreviousCharacter): Ditto. 
     20        (WebCore::executeDeleteForward): Ditto. 
     21        (WebCore::executeDeleteToBeginningOfLine): Ditto. 
     22        (WebCore::executeDeleteToBeginningOfParagraph): Ditto. 
     23        (WebCore::executeDeleteToEndOfLine): Ditto. 
     24        (WebCore::executeDeleteToEndOfParagraph): Ditto. 
     25        (WebCore::executeMovePageDown): Renamed this command to be consistent with all the other 
     26        Move commands. They all modify the caret. Reimplemented to match the Mac OS X version by 
     27        removing the explicit scrolling, and letting it be done automatically by code that makes 
     28        the caret visible. In some cases the old code would scroll twice which was harmless but 
     29        unnecessary. 
     30        (WebCore::executeMovePageDownAndModifySelection): Added. Moved code here from WebHTMLView. 
     31        (WebCore::executeMovePageUp): See MovePageDown above. 
     32        (WebCore::executeMovePageUpAndModifySelection): Added. Moved code here from WebHTMLView. 
     33        (WebCore::executeSelectLine): Ditto. 
     34        (WebCore::executeSelectParagraph): Ditto. 
     35        (WebCore::executeSelectSentence): Ditto. 
     36        (WebCore::executeSelectWord): Ditto. 
     37        (WebCore::executeSwapWithMark): Some small tweaks. 
     38 
     39        * page/ContextMenuController.cpp: 
     40        (WebCore::ContextMenuController::contextMenuItemSelected): Changed to use Editor::command() 
     41        instead of Editor::execCommand(). This code could be changed to use Editor::Command quite a 
     42        bit more, but I didn't do that this time. 
     43 
     44        - Removed some obsolete unused code. 
     45 
     46        * page/mac/EventHandlerMac.mm: 
     47        (WebCore::EventHandler::passMouseDownEventToWidget): Removed the special case code for 
     48        NSTextView. This was left over from when we used NSTextField and NSTextView for form 
     49        elements and is no longer used at all. 
     50 
     51        * page/mac/WebCoreFrameBridge.h: Removed 20 unused methods that were still on one side 
     52        of the bridge or another. We really need to find a time to tear down the rest of the 
     53        bridge, but that's not this patch. 
     54 
     55        * page/mac/WebCoreFrameBridge.mm: 
     56        (-[WebCoreFrameBridge addData:]): Changed to get at the _shouldCreateRenderers field directly 
     57        instead of using a method. 
     58        (-[WebCoreFrameBridge rangeByAlteringCurrentSelection:SelectionController::direction:SelectionController::granularity:]): 
     59        Took out obsolete comment about matching enums (we use a single enum now and have for some 
     60        time). 
     61        (-[WebCoreFrameBridge selectionGranularity]): Ditto. 
     62 
    1632007-12-14  Justin Garcia  <justin.garcia@apple.com> 
    264 
  • trunk/WebCore/WebCore.base.exp

    r28693 r28717  
    676676__ZNK7WebCore6Editor23getCompositionSelectionERjS1_ 
    677677__ZNK7WebCore6Editor6canCutEv 
     678__ZNK7WebCore6Editor7Command11isSupportedEv 
    678679__ZNK7WebCore6Editor7Command15isTextInsertionEv 
    679680__ZNK7WebCore6Editor7Command5stateEPNS_5EventE 
  • trunk/WebCore/editing/Editor.h

    r28626 r28717  
    187187    Command command(const String& commandName, EditorCommandSource); 
    188188 
    189     // Deprecated, but used by old key binding code. Keep around until we have eliminated all callers. 
    190     bool execCommand(const AtomicString& commandName, Event* triggeringEvent = 0); 
    191  
    192189    bool insertText(const String&, Event* triggeringEvent); 
    193190    bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, Event* triggeringEvent = 0); 
  • trunk/WebCore/editing/EditorCommand.cpp

    <
    r28653 r28717  
    3232#include "DocumentFragment.h" 
    3333#include "Editor.h" 
     34#include "EditorClient.h" 
    3435#include "Event.h" 
    3536#include "EventHandler.h" 
     
    175176} 
    176177 
     178static bool expandSelectionToGranularity(Frame* frame, TextGranularity granularity) 
     179{ 
     180    Selection selection = frame->selectionController()->selection(); 
     181    selection.expandUsingGranularity(granularity); 
     182    RefPtr<Range> newRange = selection.toRange(); 
     183    if (!newRange) 
     184        return false; 
     185    ExceptionCode ec = 0; 
     186    if (newRange->collapsed(ec)) 
     187        return false; 
     188    RefPtr<Range> oldRange = frame->selectionController()->selection().toRange(); 
     189    EAffinity affinity = frame->selectionController()->affinity(); 
     190    if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false)) 
     191        return false; 
     192    frame->selectionController()->setSelectedRange(newRange.get(), affinity, true); 
     193    return true; 
     194} 
     195 
    177196static TriState stateStyle(Frame* frame, int propertyID, const char* desiredValue) 
    178197{ 
     
    187206} 
    188207 
    189 static bool canScroll(RenderObject* renderer) 
    190 { 
     208static int verticalScrollDistance(Frame* frame) 
     209{ 
     210    Node* focusedNode = frame->document()->focusedNode(); 
     211    if (!focusedNode) 
     212        return 0; 
     213    RenderObject* renderer = focusedNode->renderer(); 
    191214    if (!renderer) 
    192         return false; 
     215        return 0; 
    193216    RenderStyle* style = renderer->style(); 
    194217    if (!style) 
    195         return false; 
    196     return style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea(); 
     218        return 0; 
     219    if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea())) 
     220        return 0; 
     221    int height = renderer->clientHeight(); 
     222    return max((height + 1) / 2, height - PAGE_KEEP); 
    197223} 
    198224 
     
    259285} 
    260286 
     287static bool executeDeleteBackward(Frame* frame, Event*, EditorCommandSource, const String&) 
     288{ 
     289    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true); 
     290    return true; 
     291} 
     292 
     293static bool executeDeleteBackwardByDecomposingPreviousCharacter(Frame* frame, Event*, EditorCommandSource, const String&) 
     294{ 
     295    LOG_ERROR("DeleteBackwardByDecomposingPreviousCharacter is not implemented, doing DeleteBackward instead"); 
     296    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true); 
     297    return true; 
     298} 
     299 
     300static bool executeDeleteForward(Frame* frame, Event*, EditorCommandSource source, const String&) 
     301{ 
     302    frame->editor()->deleteWithDirection(SelectionController::FORWARD, CharacterGranularity, false, true); 
     303    return true; 
     304} 
     305 
     306static bool executeDeleteToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&) 
     307{ 
     308    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, LineBoundary, true, false); 
     309    return true; 
     310} 
     311 
     312static bool executeDeleteToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&) 
     313{ 
     314    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, ParagraphBoundary, true, false); 
     315    return true; 
     316} 
     317 
     318static bool executeDeleteToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&) 
     319{ 
     320    // Despite its name, this command should delete the newline at the end of 
     321    // a paragraph if you are at the end of a paragraph (like DeleteToEndOfParagraph). 
     322    frame->editor()->deleteWithDirection(SelectionController::FORWARD, LineBoundary, true, false); 
     323    return true; 
     324} 
     325 
     326static bool executeDeleteToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&) 
     327{ 
     328    // Despite its name, this command should delete the newline at the end of 
     329    // a paragraph if you are at the end of a paragraph. 
     330    frame->editor()->deleteWithDirection(SelectionController::FORWARD, ParagraphBoundary, true, false); 
     331    return true; 
     332} 
     333 
    261334static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const String&) 
    262335{ 
     
    475548} 
    476549 
    477 static bool executeMoveDownByPageAndModifyCaret(Frame* frame, Event*, EditorCommandSource, const String&) 
    478 { 
    479