WebCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2007 20:03:16 +0000 (20:03 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2007 20:03:16 +0000 (20:03 +0000)
        Reviewed by Alexey.

        - http://bugs.webkit.org/show_bug.cgi?id=16420
          change regression tests to use document.execCommand instead of textInputController.doCommand

        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:
        (-[WebCoreFrameBridge addData:]): Changed to get at the _shouldCreateRenderers field directly
        instead of using a method.
        (-[WebCoreFrameBridge rangeByAlteringCurrentSelection:SelectionController::direction:SelectionController::granularity:]):
        Took out obsolete comment about matching enums (we use a single enum now and have for some
        time).
        (-[WebCoreFrameBridge 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:
        (+[WebFrameView _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.

        - http://bugs.webkit.org/show_bug.cgi?id=16420
          change regression tests to use document.execCommand instead of textInputController.doCommand

        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28717 268f45cc-cd09-0410-ab3c-d52691b4dbfc

38 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/deleting/5300379.html
LayoutTests/editing/deleting/delete-to-end-of-paragraph.html
LayoutTests/editing/deleting/smart-delete-003.html
LayoutTests/editing/deleting/smart-delete-004.html
LayoutTests/editing/execCommand/nsresponder-indent.html
LayoutTests/editing/execCommand/nsresponder-outdent.html
LayoutTests/editing/selection/4947387.html
LayoutTests/editing/selection/5195166-1.html
LayoutTests/editing/selection/5195166-2.html
LayoutTests/editing/selection/select-line.html
LayoutTests/editing/selection/selection-actions.html
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/editing/Editor.h
WebCore/editing/EditorCommand.cpp
WebCore/page/ContextMenuController.cpp
WebCore/page/mac/EventHandlerMac.mm
WebCore/page/mac/WebCoreFrameBridge.h
WebCore/page/mac/WebCoreFrameBridge.mm
WebKit/ChangeLog
WebKit/StringsNotToBeLocalized.txt
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
WebKit/gtk/WebView/webkitwebview.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebFrameBridge.h
WebKit/mac/WebCoreSupport/WebFrameBridge.mm
WebKit/mac/WebView/WebFrameView.mm
WebKit/mac/WebView/WebHTMLView.mm
WebKit/mac/WebView/WebHTMLViewInternal.h
WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/EditorClientQt.cpp
WebKit/win/ChangeLog
WebKit/win/WebView.cpp
WebKit/wx/ChangeLog
WebKit/wx/WebKitSupport/EditorClientWx.cpp

index e5c04cb..996b8b1 100644 (file)
@@ -1,3 +1,26 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        Reviewed by Alexey.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=16420
+          change regression tests to use document.execCommand instead of textInputController.doCommand
+
+        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.
+
 2007-12-14  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Darin Adler.
index ea2b344..e001a05 100644 (file)
@@ -6,14 +6,10 @@
 div = document.getElementById("div");
 sel = window.getSelection();
 sel.setPosition(div, 0);
-if (window.layoutTestController) {
-    // Test to see if deleteWordBackward: hangs.
-    textInputController.doCommand("deleteWordBackward:");
-    document.execCommand("InsertText", false, "Success FAIL");
-    // Delete 'FAIL' with deleteWordBackward: to verify that it's not a no-op.
-    textInputController.doCommand("deleteWordBackward:");
-    textInputController.doCommand("deleteBackward:");
-} else {
-    document.execCommand("InsertText", false, "To run this test manually.  Delete all this text and then option-delete.  Safari shouldn't hang.");
-}
+// Test to see if DeleteWordBackward hangs.
+document.execCommand("DeleteWordBackward");
+document.execCommand("InsertText", false, "Success FAIL");
+// Delete 'FAIL' with DeleteWordBackward to verify that it's not a no-op.
+document.execCommand("DeleteWordBackward");
+document.execCommand("DeleteBackward");
 </script>
index 40415a3..8e426c2 100644 (file)
 <script>
 
 function editingTest() {
-    if (window.layoutTestController) {
-        
-        try {
-            // test for 4570218 by using double deleteToEndOfParagraph
-            textInputController.doCommand("deleteToEndOfParagraph:");    
-            textInputController.doCommand("deleteToEndOfParagraph:");    
+    try {
+        // test for 4570218 by using double deleteToEndOfParagraph
+        document.execCommand("DeleteToEndOfParagraph");    
+        document.execCommand("DeleteToEndOfParagraph");    
 
-        } catch (ex) {
-            document.write("Exception: " + ex.description);
-        }
-    } else {
-        document.write("(cannot run interactively)");
+    } catch (ex) {
+        document.write("Exception: " + ex.description);
     }
 }
 
index 2b71d7d..46b4c28 100644 (file)
@@ -6,14 +6,12 @@ if (window.layoutTestController)
 <div id="div" contenteditable="true">foo bar baz</div>
 
 <script>
-if (window.layoutTestController) {
-    var div = document.getElementById("div");
-    var sel = window.getSelection();
-    
-    sel.setPosition(div, 0);
-    sel.modify("move", "forward", "word");
-    sel.modify("move", "forward", "word");
-    sel.modify("extend", "backward", "word");
-    textInputController.doCommand("deleteBackward:");
-}
+var div = document.getElementById("div");
+var sel = window.getSelection();
+
+sel.setPosition(div, 0);
+sel.modify("move", "forward", "word");
+sel.modify("move", "forward", "word");
+sel.modify("extend", "backward", "word");
+document.execCommand("DeleteBackward");
 </script>
index 49ec7e4..b07e4fd 100644 (file)
@@ -6,14 +6,12 @@ if (window.layoutTestController)
 <div id="div" contenteditable="true">foo bar baz</div>
 
 <script>
-if (window.layoutTestController) {
-    var div = document.getElementById("div");
-    var sel = window.getSelection();
-    
-    sel.setPosition(div, 0);
-    sel.modify("move", "forward", "word");
-    sel.modify("move", "forward", "word");
-    sel.modify("extend", "backward", "word");
-    textInputController.doCommand("deleteForward:");
-}
+var div = document.getElementById("div");
+var sel = window.getSelection();
+
+sel.setPosition(div, 0);
+sel.modify("move", "forward", "word");
+sel.modify("move", "forward", "word");
+sel.modify("extend", "backward", "word");
+document.execCommand("DeleteForward");
 </script>
index 9ec1a1c..8a9f3b2 100644 (file)
@@ -11,5 +11,5 @@ var sel = window.getSelection();
 
 sel.setPosition(div, 0);
 
-textInputController.doCommand("indent:");
+document.execCommand("Indent");
 </script>
index bf53fe7..0285bd5 100644 (file)
@@ -11,5 +11,5 @@ var sel = window.getSelection();
 
 sel.setPosition(div, 0);
 
-textInputController.doCommand("outdent:");
+document.execCommand("Outdent");
 </script>
index 0f0c84f..a86a073 100644 (file)
@@ -3,24 +3,23 @@
 
 <script>
 
-if (window.layoutTestController) {
-
+if (window.layoutTestController)
     window.layoutTestController.dumpEditingCallbacks();
     
-    var div = document.getElementById("div");
-    var text = div.firstChild;
-    var sel = window.getSelection();
-    
-    sel.setPosition(text, text.length);
-    textInputController.doCommand("moveToBeginningOfLineAndModifySelection:");
-    
-    sel.setPosition(text, 0);
-    textInputController.doCommand("moveToEndOfLineAndModifySelection:");
+var div = document.getElementById("div");
+var text = div.firstChild;
+var sel = window.getSelection();
+
+sel.setPosition(text, text.length);
+document.execCommand("MoveToBeginningOfLineAndModifySelection");
+
+sel.setPosition(text, 0);
+document.execCommand("MoveToEndOfLineAndModifySelection");
+
+sel.setPosition(text, text.length);
+document.execCommand("MoveToBeginningOfParagraphAndModifySelection");
+
+sel.setPosition(text, 0);
+document.execCommand("MoveToEndOfParagraphAndModifySelection");
 
-    sel.setPosition(text, text.length);
-    textInputController.doCommand("moveToBeginningOfParagraphAndModifySelection:");
-    
-    sel.setPosition(text, 0);
-    textInputController.doCommand("moveToEndOfParagraphAndModifySelection:");
-}
 </script>
index b4398ee..1d444fa 100644 (file)
@@ -9,23 +9,20 @@ function log(str) {
     console.appendChild(li);
     li.appendChild(text);
 }
-if (window.layoutTestController) {
-    var text = document.getElementById("div").firstChild;
-    var selection = window.getSelection();
-    
-    // FIXME: m_lastChangeWasHorizontalExtension isn't cleared in several places
-    // where it should be, when opening a new document for example.
-    selection.setPosition(text, 0);
-    selection.modify("move", "forward", "character");
-    
-    selection.setBaseAndExtent(text, 3 + 5, text, 3);
-    // Extending this 5 character selection will select 6 characters.
-    textInputController.doCommand("moveForwardAndModifySelection:");
-    // Extending it in this way flips the base and the extent.
-    if (selection.extentOffset - selection.baseOffset != 6)
-        log("Failure: Selection isn't the right size.");
-    else
-        log ("Success");
-} else
-    log ("Failure: This test cannot be run manually.")
+var text = document.getElementById("div").firstChild;
+var selection = window.getSelection();
+
+// FIXME: m_lastChangeWasHorizontalExtension isn't cleared in several places
+// where it should be, when opening a new document for example.
+selection.setPosition(text, 0);
+selection.modify("move", "forward", "character");
+
+selection.setBaseAndExtent(text, 3 + 5, text, 3);
+// Extending this 5 character selection will select 6 characters.
+document.execCommand("MoveForwardAndModifySelection");
+// Extending it in this way flips the base and the extent.
+if (selection.extentOffset - selection.baseOffset != 6)
+    log("Failure: Selection isn't the right size.");
+else
+    log ("Success");
 </script>
index a8eb6ae..ea43000 100644 (file)
@@ -9,17 +9,13 @@ function log(str) {
     console.appendChild(li);
     li.appendChild(text);
 }
-if (window.layoutTestController) {
+if (window.layoutTestController)
     window.layoutTestController.dumpEditingCallbacks();
-    var text = document.getElementById("div").firstChild;
-    var selection = window.getSelection();
-    selection.setBaseAndExtent(text, 0, text, 0);
-    textInputController.doCommand("moveForwardAndModifySelection:");
-    textInputController.doCommand("moveForwardAndModifySelection:");
-    textInputController.doCommand("moveForwardAndModifySelection:");
-    textInputController.doCommand("moveBackwardAndModifySelection:");
-} else {
-    log("Failure: This test cannot be run manually.")
-}
-
+var text = document.getElementById("div").firstChild;
+var selection = window.getSelection();
+selection.setBaseAndExtent(text, 0, text, 0);
+document.execCommand("MoveForwardAndModifySelection");
+document.execCommand("MoveForwardAndModifySelection");
+document.execCommand("MoveForwardAndModifySelection");
+document.execCommand("MoveBackwardAndModifySelection");
 </script>
index 2d10391..81e718a 100644 (file)
@@ -9,6 +9,5 @@ var div = document.getElementById("div");
 var sel = window.getSelection();
 
 sel.setPosition(div, 0);
-if (window.layoutTestController)
-    textInputController.doCommand("selectLine:");
+document.execCommand("SelectLine");
 </script>
index affedaa..6b37410 100644 (file)
@@ -24,37 +24,37 @@ function editingTest() {
     eventSender.mouseMoveTo(x, y);
     eventSender.mouseUp();
     
-    textInputController.doCommand("moveBackward:");
-    textInputController.doCommand("moveBackwardAndModifySelection:");
-    textInputController.doCommand("moveDown:");
-    textInputController.doCommand("moveDownAndModifySelection:");
-    textInputController.doCommand("moveForward:");
-    textInputController.doCommand("moveForwardAndModifySelection:");
-    textInputController.doCommand("moveLeft:");
-    textInputController.doCommand("moveLeftAndModifySelection:");
-    textInputController.doCommand("moveRight:");
-    textInputController.doCommand("moveRightAndModifySelection:");
-    textInputController.doCommand("moveToBeginningOfDocument:");
-    textInputController.doCommand("moveToBeginningOfLine:");
-    textInputController.doCommand("moveToBeginningOfParagraph:");
-    textInputController.doCommand("moveToEndOfDocument:");
-    textInputController.doCommand("moveToEndOfLine:");
-    textInputController.doCommand("moveToEndOfParagraph:");
-    textInputController.doCommand("moveUp:");
-    textInputController.doCommand("moveUpAndModifySelection:");
-    textInputController.doCommand("moveWordBackward:");
-    textInputController.doCommand("moveWordBackwardAndModifySelection:");
-    textInputController.doCommand("moveWordForward:");
-    textInputController.doCommand("moveWordForwardAndModifySelection:");
-    textInputController.doCommand("moveWordLeft:");
-    textInputController.doCommand("moveWordRight:");
-    textInputController.doCommand("moveWordRightAndModifySelection:");
-    textInputController.doCommand("moveWordLeftAndModifySelection:");
-    textInputController.doCommand("pageDown:");
-    textInputController.doCommand("pageUp:");
-    textInputController.doCommand("selectLine:");
-    textInputController.doCommand("selectParagraph:");
-    textInputController.doCommand("selectWord:");
+    document.execCommand("MoveBackward");
+    document.execCommand("MoveBackwardAndModifySelection");
+    document.execCommand("MoveDown");
+    document.execCommand("MoveDownAndModifySelection");
+    document.execCommand("MoveForward");
+    document.execCommand("MoveForwardAndModifySelection");
+    document.execCommand("MoveLeft");
+    document.execCommand("MoveLeftAndModifySelection");
+    document.execCommand("MoveRight");
+    document.execCommand("MoveRightAndModifySelection");
+    document.execCommand("MoveToBeginningOfDocument");
+    document.execCommand("MoveToBeginningOfLine");
+    document.execCommand("MoveToBeginningOfParagraph");
+    document.execCommand("MoveToEndOfDocument");
+    document.execCommand("MoveToEndOfLine");
+    document.execCommand("MoveToEndOfParagraph");
+    document.execCommand("MoveUp");
+    document.execCommand("MoveUpAndModifySelection");
+    document.execCommand("MoveWordBackward");
+    document.execCommand("MoveWordBackwardAndModifySelection");
+    document.execCommand("MoveWordForward");
+    document.execCommand("MoveWordForwardAndModifySelection");
+    document.execCommand("MoveWordLeft");
+    document.execCommand("MoveWordRight");
+    document.execCommand("MoveWordRightAndModifySelection");
+    document.execCommand("MoveWordLeftAndModifySelection");
+    document.execCommand("MovePageDown");
+    document.execCommand("MovePageUp");
+    document.execCommand("SelectLine");
+    document.execCommand("SelectParagraph");
+    document.execCommand("SelectWord");
 }
 
 </script>
index ce7af3f..97c1702 100644 (file)
@@ -1,3 +1,65 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        Reviewed by Alexey.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=16420
+          change regression tests to use document.execCommand instead of textInputController.doCommand
+
+        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:
+        (-[WebCoreFrameBridge addData:]): Changed to get at the _shouldCreateRenderers field directly
+        instead of using a method.
+        (-[WebCoreFrameBridge rangeByAlteringCurrentSelection:SelectionController::direction:SelectionController::granularity:]):
+        Took out obsolete comment about matching enums (we use a single enum now and have for some
+        time).
+        (-[WebCoreFrameBridge selectionGranularity]): Ditto.
+
 2007-12-14  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Darin Adler.
index 3f96aed..f1b5037 100644 (file)
@@ -675,6 +675,7 @@ __ZNK7WebCore6Editor17shouldDeleteRangeEPNS_5RangeE
 __ZNK7WebCore6Editor22selectionStartHasStyleEPNS_19CSSStyleDeclarationE
 __ZNK7WebCore6Editor23getCompositionSelectionERjS1_
 __ZNK7WebCore6Editor6canCutEv
+__ZNK7WebCore6Editor7Command11isSupportedEv
 __ZNK7WebCore6Editor7Command15isTextInsertionEv
 __ZNK7WebCore6Editor7Command5stateEPNS_5EventE
 __ZNK7WebCore6Editor7Command7executeEPNS_5EventE
index 1abd4b4..5c42ae8 100644 (file)
@@ -186,9 +186,6 @@ public:
     Command command(const String& commandName); // Default is CommandFromMenuOrKeyBinding.
     Command command(const String& commandName, EditorCommandSource);
 
-    // Deprecated, but used by old key binding code. Keep around until we have eliminated all callers.
-    bool execCommand(const AtomicString& commandName, Event* triggeringEvent = 0);
-
     bool insertText(const String&, Event* triggeringEvent);
     bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, Event* triggeringEvent = 0);
     bool insertLineBreak();
index 28cc2ad..d2857db 100644 (file)
@@ -31,6 +31,7 @@
 #include "CreateLinkCommand.h"
 #include "DocumentFragment.h"
 #include "Editor.h"
+#include "EditorClient.h"
 #include "Event.h"
 #include "EventHandler.h"
 #include "FormatBlockCommand.h"
@@ -174,6 +175,24 @@ static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content)
     return executeInsertFragment(frame, fragment.release());
 }
 
+static bool expandSelectionToGranularity(Frame* frame, TextGranularity granularity)
+{
+    Selection selection = frame->selectionController()->selection();
+    selection.expandUsingGranularity(granularity);
+    RefPtr<Range> newRange = selection.toRange();
+    if (!newRange)
+        return false;
+    ExceptionCode ec = 0;
+    if (newRange->collapsed(ec))
+        return false;
+    RefPtr<Range> oldRange = frame->selectionController()->selection().toRange();
+    EAffinity affinity = frame->selectionController()->affinity();
+    if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
+        return false;
+    frame->selectionController()->setSelectedRange(newRange.get(), affinity, true);
+    return true;
+}
+
 static TriState stateStyle(Frame* frame, int propertyID, const char* desiredValue)
 {
     RefPtr<CSSMutableStyleDeclaration> style = new CSSMutableStyleDeclaration;
@@ -186,14 +205,21 @@ static String valueStyle(Frame* frame, int propertyID)
     return frame->selectionStartStylePropertyValue(propertyID);
 }
 
-static bool canScroll(RenderObject* renderer)
+static int verticalScrollDistance(Frame* frame)
 {
+    Node* focusedNode = frame->document()->focusedNode();
+    if (!focusedNode)
+        return 0;
+    RenderObject* renderer = focusedNode->renderer();
     if (!renderer)
-        return false;
+        return 0;
     RenderStyle* style = renderer->style();
     if (!style)
-        return false;
-    return style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea();
+        return 0;
+    if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea()))
+        return 0;
+    int height = renderer->clientHeight();
+    return max((height + 1) / 2, height - PAGE_KEEP);
 }
 
 static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
@@ -258,6 +284,53 @@ static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, cons
     return false;
 }
 
+static bool executeDeleteBackward(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true);
+    return true;
+}
+
+static bool executeDeleteBackwardByDecomposingPreviousCharacter(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    LOG_ERROR("DeleteBackwardByDecomposingPreviousCharacter is not implemented, doing DeleteBackward instead");
+    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true);
+    return true;
+}
+
+static bool executeDeleteForward(Frame* frame, Event*, EditorCommandSource source, const String&)
+{
+    frame->editor()->deleteWithDirection(SelectionController::FORWARD, CharacterGranularity, false, true);
+    return true;
+}
+
+static bool executeDeleteToBeginningOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, LineBoundary, true, false);
+    return true;
+}
+
+static bool executeDeleteToBeginningOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    frame->editor()->deleteWithDirection(SelectionController::BACKWARD, ParagraphBoundary, true, false);
+    return true;
+}
+
+static bool executeDeleteToEndOfLine(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    // Despite its name, this command should delete the newline at the end of
+    // a paragraph if you are at the end of a paragraph (like DeleteToEndOfParagraph).
+    frame->editor()->deleteWithDirection(SelectionController::FORWARD, LineBoundary, true, false);
+    return true;
+}
+
+static bool executeDeleteToEndOfParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    // Despite its name, this command should delete the newline at the end of
+    // a paragraph if you are at the end of a paragraph.
+    frame->editor()->deleteWithDirection(SelectionController::FORWARD, ParagraphBoundary, true, false);
+    return true;
+}
+
 static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     RefPtr<Range> mark = frame->mark().toRange();
@@ -474,19 +547,6 @@ static bool executeMoveDownAndModifySelection(Frame* frame, Event*, EditorComman
     return true;
 }
 
-static bool executeMoveDownByPageAndModifyCaret(Frame* frame, Event*, EditorCommandSource, const String&)
-{
-    Node* focusedNode = frame->document()->focusedNode();
-    if (!focusedNode)
-        return false;
-    RenderObject* renderer = focusedNode->renderer();
-    if (!canScroll(renderer))
-        return false;
-    bool handledScroll = renderer->scroll(ScrollDown, ScrollByPage);
-    bool handledCaretMove = frame->selectionController()->modify(SelectionController::MOVE, renderer->clientHeight() - PAGE_KEEP);
-    return handledScroll || handledCaretMove;
-}
-
 static bool executeMoveForward(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     frame->selectionController()->modify(SelectionController::MOVE, SelectionController::FORWARD, CharacterGranularity, true);
@@ -511,6 +571,38 @@ static bool executeMoveLeftAndModifySelection(Frame* frame, Event*, EditorComman
     return true;
 }
 
+static bool executeMovePageDown(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    int distance = verticalScrollDistance(frame);
+    if (!distance)
+        return false;
+    return frame->selectionController()->modify(SelectionController::MOVE, distance, true);
+}
+
+static bool executeMovePageDownAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    int distance = verticalScrollDistance(frame);
+    if (!distance)
+        return false;
+    return frame->selectionController()->modify(SelectionController::EXTEND, distance, true);
+}
+
+static bool executeMovePageUp(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    int distance = verticalScrollDistance(frame);
+    if (!distance)
+        return false;
+    return frame->selectionController()->modify(SelectionController::MOVE, -distance, true);
+}
+
+static bool executeMovePageUpAndModifySelection(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    int distance = verticalScrollDistance(frame);
+    if (!distance)
+        return false;
+    return frame->selectionController()->modify(SelectionController::EXTEND, -distance, true);
+}
+
 static bool executeMoveRight(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     frame->selectionController()->modify(SelectionController::MOVE, SelectionController::RIGHT, CharacterGranularity, true);
@@ -643,19 +735,6 @@ static bool executeMoveUpAndModifySelection(Frame* frame, Event*, EditorCommandS
     return true;
 }
 
-static bool executeMoveUpByPageAndModifyCaret(Frame* frame, Event*, EditorCommandSource, const String&)
-{
-    Node* focusedNode = frame->document()->focusedNode();
-    if (!focusedNode)
-        return false;
-    RenderObject* renderer = focusedNode->renderer();
-    if (!canScroll(renderer))
-        return false;
-    bool handledScroll = renderer->scroll(ScrollDown, ScrollByPage);
-    bool handledCaretMove = frame->selectionController()->modify(SelectionController::MOVE, -(renderer->clientHeight() - PAGE_KEEP));
-    return handledScroll || handledCaretMove;
-}
-
 static bool executeMoveWordBackward(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     frame->selectionController()->modify(SelectionController::MOVE, SelectionController::BACKWARD, WordGranularity, true);
@@ -749,6 +828,21 @@ static bool executeSelectAll(Frame* frame, Event*, EditorCommandSource, const St
     return true;
 }
 
+static bool executeSelectLine(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    return expandSelectionToGranularity(frame, LineGranularity);
+}
+
+static bool executeSelectParagraph(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    return expandSelectionToGranularity(frame, ParagraphGranularity);
+}
+
+static bool executeSelectSentence(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    return expandSelectionToGranularity(frame, SentenceGranularity);
+}
+
 static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     RefPtr<Range> mark = frame->mark().toRange();
@@ -761,6 +855,11 @@ static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const
     return true;
 }
 
+static bool executeSelectWord(Frame* frame, Event*, EditorCommandSource, const String&)
+{
+    return expandSelectionToGranularity(frame, WordGranularity);
+}
+
 static bool executeSetMark(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     frame->setMark(frame->selectionController()->selection());
@@ -785,12 +884,11 @@ static bool executeSuperscript(Frame* frame, Event*, EditorCommandSource source,
 static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     const Selection& mark = frame->mark();
-    Selection selection = frame->selectionController()->selection();
+    const Selection& selection = frame->selectionController()->selection();
     if (mark.isNone() || selection.isNone()) {
         systemBeep();
         return false;
     }
-
     frame->selectionController()->setSelection(mark);
     frame->setMark(selection);
     return true;
@@ -1042,6 +1140,13 @@ static const CommandMap& createCommandMap()
         { "CreateLink", { executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion } },
         { "Cut", { executeCut, supported, enabledCut, stateNone, valueNull, notTextInsertion } },
         { "Delete", { executeDelete, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteBackward", { executeDeleteBackward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteBackwardByDecomposingPreviousCharacter", { executeDeleteBackwardByDecomposingPreviousCharacter, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteForward", { executeDeleteForward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteToBeginningOfLine", { executeDeleteToBeginningOfLine, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteToBeginningOfParagraph", { executeDeleteToBeginningOfParagraph, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteToEndOfLine", { executeDeleteToEndOfLine, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "DeleteToEndOfParagraph", { executeDeleteToEndOfParagraph, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "DeleteToMark", { executeDeleteToMark, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "DeleteWordBackward", { executeDeleteWordBackward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "DeleteWordForward", { executeDeleteWordForward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
@@ -1076,11 +1181,14 @@ static const CommandMap& createCommandMap()
         { "MoveBackwardAndModifySelection", { executeMoveBackwardAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveDown", { executeMoveDown, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveDownAndModifySelection", { executeMoveDownAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
-        { "MoveDownByPageAndModifyCaret", { executeMoveDownByPageAndModifyCaret, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveForward", { executeMoveForward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveForwardAndModifySelection", { executeMoveForwardAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveLeft", { executeMoveLeft, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveLeftAndModifySelection", { executeMoveLeftAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "MovePageDown", { executeMovePageDown, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "MovePageDownAndModifySelection", { executeMovePageDownAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "MovePageUp", { executeMovePageUp, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "MovePageUpAndModifySelection", { executeMovePageUpAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveParagraphBackwardAndModifySelection", { executeMoveParagraphBackwardAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveParagraphForwardAndModifySelection", { executeMoveParagraphForwardAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveRight", { executeMoveRight, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
@@ -1103,7 +1211,6 @@ static const CommandMap& createCommandMap()
         { "MoveToEndOfSentenceAndModifySelection", { executeMoveToEndOfSentenceAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveUp", { executeMoveUp, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveUpAndModifySelection", { executeMoveUpAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
-        { "MoveUpByPageAndModifyCaret", { executeMoveUpByPageAndModifyCaret, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveWordBackward", { executeMoveWordBackward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveWordBackwardAndModifySelection", { executeMoveWordBackwardAndModifySelection, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "MoveWordForward", { executeMoveWordForward, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
@@ -1119,7 +1226,11 @@ static const CommandMap& createCommandMap()
         { "Redo", { executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion } },
         { "RemoveFormat", { executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion } },
         { "SelectAll", { executeSelectAll, supported, enabled, stateNone, valueNull, notTextInsertion } },
+        { "SelectLine", { executeSelectLine, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "SelectParagraph", { executeSelectParagraph, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
+        { "SelectSentence", { executeSelectSentence, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "SelectToMark", { executeSelectToMark, supported, enabledAnySelectionAndMark, stateNone, valueNull, notTextInsertion } },
+        { "SelectWord", { executeSelectWord, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion } },
         { "SetMark", { executeSetMark, supported, enabledAnySelection, stateNone, valueNull, notTextInsertion } },
         { "Strikethrough", { executeStrikethrough, supported, enabledInRichlyEditableText, stateStrikethrough, valueNull, notTextInsertion } },
         { "Subscript", { executeSubscript, supported, enabledInRichlyEditableText, stateSubscript, valueNull, notTextInsertion } },
@@ -1270,9 +1381,4 @@ bool Editor::Command::isTextInsertion() const
     return m_command && m_command->isTextInsertion;
 }
 
-bool Editor::execCommand(const AtomicString& commandName, Event* triggeringEvent)
-{
-    return command(commandName).execute(triggeringEvent);
-}
-
 } // namespace WebCore
index 081dc71..a9419e0 100644 (file)
@@ -214,10 +214,10 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
                 openNewWindow(result.absoluteLinkURL(), frame);
             break;
         case ContextMenuItemTagBold:
-            frame->editor()->execCommand("ToggleBold");
+            frame->editor()->command("ToggleBold").execute();
             break;
         case ContextMenuItemTagItalic:
-            frame->editor()->execCommand("ToggleItalic");
+            frame->editor()->command("ToggleItalic").execute();
             break;
         case ContextMenuItemTagUnderline:
             frame->editor()->toggleUnderline();
index f8f8054..2e37b74 100644 (file)
@@ -243,37 +243,16 @@ bool EventHandler::passMouseDownEventToWidget(Widget* widget)
     ASSERT(nodeView);
     ASSERT([nodeView superview]);
     NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[currentEvent().get() locationInWindow] fromView:nil]];
-    if (!view)
+    if (!view) {
         // We probably hit the border of a RenderWidget
         return true;
+    }
     
-    if ([m_frame->bridge() firstResponder] == view) {
-        // In the case where we just became first responder, we should send the mouseDown:
-        // to the NSTextField, not the NSTextField's editor. This code makes sure that happens.
-        // If we don't do this, we see a flash of selected text when clicking in a text field.
-        // FIXME: This is the only caller of textViewWasFirstResponderAtMouseDownTime. When we
-        // eliminate all use of NSTextField/NSTextView in form fields we can eliminate this code,
-        // and textViewWasFirstResponderAtMouseDownTime:, and the instance variable WebHTMLView
-        // keeps solely to support textViewWasFirstResponderAtMouseDownTime:.
-        if ([view isKindOfClass:[NSTextView class]] && ![m_frame->bridge() textViewWasFirstResponderAtMouseDownTime:(NSTextView *)view]) {
-            NSView *superview = view;
-            while (superview != nodeView) {
-                superview = [superview superview];
-                ASSERT(superview);
-                if ([superview isKindOfClass:[NSControl class]]) {
-                    NSControl *control = static_cast<NSControl*>(superview);
-                    if ([control currentEditor] == view)
-                        view = superview;
-                    break;
-                }
-            }
-        }
-    } else {
+    if ([m_frame->bridge() firstResponder] != view) {
         // Normally [NSWindow sendEvent:] handles setting the first responder.
         // But in our case, the event was sent to the view representing the entire web page.
-        if ([currentEvent().get() clickCount] <= 1 && [view acceptsFirstResponder] && [view needsPanelToBecomeKey]) {
+        if ([currentEvent().get() clickCount] <= 1 && [view acceptsFirstResponder] && [view needsPanelToBecomeKey])
             [m_frame->bridge() makeFirstResponder:view];
-        }
     }
 
     // We need to "defer loading" while tracking the mouse, because tearing down the
index ba48274..757c4e3 100644 (file)
@@ -103,8 +103,6 @@ enum WebScrollGranularity {
 - (id)init;
 - (void)close;
 
-- (void)addData:(NSData *)data;
-
 - (void)clearFrame;
 
 - (NSURL *)baseURL;
@@ -120,7 +118,6 @@ enum WebScrollGranularity {
 - (void)forceLayoutWithMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustSizeFlag;
 - (void)sendScrollEvent;
 - (BOOL)needsLayout;
-- (void)setNeedsLayout;
 - (void)drawRect:(NSRect)rect;
 - (void)adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
 - (NSArray*)computePageRectsWithPrintWidthScaleFactor:(float)printWidthScaleFactor printHeight:(float)printHeight;
@@ -163,17 +160,13 @@ enum WebScrollGranularity {
 - (NSRect)firstRectForDOMRange:(DOMRange *)range;
 - (void)scrollDOMRangeToVisible:(DOMRange *)range;
 
-// Emacs-style-editing "mark"
-- (DOMRange *)markDOMRange;
-
 - (NSFont *)fontForSelection:(BOOL *)hasMultipleFonts;
 - (NSWritingDirection)baseWritingDirectionForSelectionStart;
 
 - (NSString *)stringWithData:(NSData *)data; // using the encoding of the frame's main resource
 + (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName; // nil for textEncodingName means Latin-1
 
-- (void)setShouldCreateRenderers:(BOOL)f;
-- (BOOL)shouldCreateRenderers;
+- (void)setShouldCreateRenderers:(BOOL)shouldCreateRenderers;
 
 - (void)setBaseBackgroundColor:(NSColor *)backgroundColor;
 - (void)setDrawsBackground:(BOOL)drawsBackround;
@@ -183,10 +176,7 @@ enum WebScrollGranularity {
 - (id)accessibilityTree;
 
 - (DOMRange *)rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionController::EDirection)direction granularity:(WebCore::TextGranularity)granularity;
-- (void)alterCurrentSelection:(WebCore::SelectionController::EAlteration)alteration verticalDistance:(float)distance;
 - (WebCore::TextGranularity)selectionGranularity;
-- (DOMRange *)smartDeleteRangeForProposedRange:(DOMRange *)proposedCharRange;
-- (void)smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
 - (void)selectNSRange:(NSRange)range;
 - (NSRange)selectedNSRange;
 - (NSRange)markedTextNSRange;
@@ -204,10 +194,6 @@ enum WebScrollGranularity {
 
 - (void)insertParagraphSeparatorInQuotedContent;
 
-- (void)setSelectionToDragCaret;
-- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove;
-- (DOMRange *)dragCaretDOMRange;
-- (BOOL)isDragCaretRichlyEditable;
 - (DOMRange *)characterRangeAtPoint:(NSPoint)point;
 
 - (DOMCSSStyleDeclaration *)typingStyle;
@@ -230,46 +216,21 @@ enum WebScrollGranularity {
 
 @protocol WebCoreFrameBridge
 
-- (NSView *)documentView;
-
-- (WebCore::Frame*)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL referrer:(const WebCore::String&)referrer
-    ownerElement:(WebCore::HTMLFrameOwnerElement *)ownerElement allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
-
 - (NSWindow *)window;
 
 - (NSResponder *)firstResponder;
 - (void)makeFirstResponder:(NSResponder *)responder;
-- (void)willMakeFirstResponderForNodeFocus;
-
-- (BOOL)textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView;
 
 - (void)runOpenPanelForFileButtonWithResultListener:(id <WebCoreOpenPanelResultListener>)resultListener;
 
-- (NSView *)viewForPluginWithFrame:(NSRect)frame
-                               URL:(NSURL *)URL
-                    attributeNames:(NSArray *)attributeNames
-                   attributeValues:(NSArray *)attributeValues
-                          MIMEType:(NSString *)MIMEType
-                        DOMElement:(DOMElement *)element
-                      loadManually:(BOOL)loadManually;
-- (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
-                        attributeNames:(NSArray *)attributeNames
-                       attributeValues:(NSArray *)attributeValues
-                               baseURL:(NSURL *)baseURL
-                            DOMElement:(DOMElement *)element;
-- (void)redirectDataToPlugin:(NSView *)pluginView;
-
-- (WebCore::ObjectContentType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
-
 - (jobject)getAppletInView:(NSView *)view;
 
 // Deprecated, use getAppletInView: instead.
 - (jobject)pollForAppletInView:(NSView *)view;
 
 - (void)issuePasteCommand;
-- (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
 
-- (void)windowObjectCleared;
+- (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
 
 - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
 - (void)willPopupMenu:(NSMenu *)menu;
index 1c03154..760ad11 100644 (file)
@@ -291,7 +291,7 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     // changing another's location before the frame's document
     // has been created. 
     if (doc) {
-        doc->setShouldCreateRenderers([self shouldCreateRenderers]);
+        doc->setShouldCreateRenderers(_shouldCreateRenderers);
         m_frame->loader()->addData((const char *)[data bytes], [data length]);
     }
 }
@@ -774,12 +774,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return m_frame->view() ? m_frame->view()->needsLayout() : false;
 }
 
-- (void)setNeedsLayout
-{
-    if (m_frame->view())
-        m_frame->view()->setNeedsLayout();
-}
-
 - (NSString *)renderTreeAsExternalRepresentation
 {
     return externalRepresentation(m_frame->renderer()).getNSString();
@@ -790,11 +784,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     _shouldCreateRenderers = f;
 }
 
-- (BOOL)shouldCreateRenderers
-{
-    return _shouldCreateRenderers;
-}
-
 - (NSColor *)selectionColor
 {
     return m_frame->isActive() ? [NSColor selectedTextBackgroundColor] : [NSColor secondarySelectedControlColor];
@@ -830,24 +819,14 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     if (m_frame->selectionController()->isNone())
         return nil;
 
-    // NOTE: The enums *must* match the very similar ones declared in SelectionController.h
     SelectionController selectionController;
     selectionController.setSelection(m_frame->selectionController()->selection());
     selectionController.modify(alteration, direction, granularity);
     return [DOMRange _wrapRange:selectionController.toRange().get()];
 }
 
-- (void)alterCurrentSelection:(SelectionController::EAlteration)alteration verticalDistance:(float)verticalDistance
-{
-    if (m_frame->selectionController()->isNone())
-        return;
-    SelectionController* selectionController = m_frame->selectionController();
-    selectionController->modify(alteration, static_cast<int>(verticalDistance), true);
-}
-
 - (TextGranularity)selectionGranularity
 {
-    // NOTE: The enums *must* match the very similar ones declared in SelectionController.h
     return m_frame->selectionGranularity();
 }
 
@@ -1086,16 +1065,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     m_frame->revealSelection(RenderLayer::gAlignToEdgeIfNeeded);
 }
 
-- (void)setSelectionToDragCaret
-{
-    m_frame->selectionController()->setSelection(m_frame->dragCaretController()->selection());
-}
-
-- (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove
-{
-    applyCommand(new MoveSelectionCommand([selectionFragment _documentFragment], m_frame->dragCaretController()->base(), smartMove));
-}
-
 - (VisiblePosition)_visiblePositionForPoint:(NSPoint)point
 {
     IntPoint outerPoint(point);
@@ -1112,16 +1081,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return visiblePos;
 }
 
-- (DOMRange *)dragCaretDOMRange
-{
-    return [DOMRange _wrapRange:m_frame->dragCaretController()->toRange().get()];
-}
-
-- (BOOL)isDragCaretRichlyEditable
-{
-    return m_frame->dragCaretController()->isContentRichlyEditable();
-}
-
 - (DOMRange *)characterRangeAtPoint:(NSPoint)point
 {
     VisiblePosition position = [self _visiblePositionForPoint:point];
index bb56c64..3383d55 100644 (file)
@@ -1,8 +1,12 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        * StringsNotToBeLocalized.txt: Updated.
+
 2007-12-12  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Sam Weinig
 
-                Fix for <rdar://problem/4886844> and lay groundwork for <rdar://problem/4516170> (Back/Forward Cache on Windows)
+        Fix for <rdar://problem/4886844> and lay groundwork for <rdar://problem/4516170> (Back/Forward Cache on Windows)
 
         * WebKit.xcodeproj/project.pbxproj: Added a new file
 
index fb80adf..5ce7180 100644 (file)
@@ -5,8 +5,8 @@
 " *POST*"
 " *target*"
 " >>>"
-" Mac OS X; %@) AppleWebKit/%@ (KHTML, like Gecko) %@"
-" Mac OS X; %@) AppleWebKit/%@ (KHTML, like Gecko)"
+" Mac OS X %@; %@) AppleWebKit/%@ (KHTML, like Gecko) %@"
+" Mac OS X %@; %@) AppleWebKit/%@ (KHTML, like Gecko)"
 " webViewDrawResizer delegate call"
 "#"
 "%"
@@ -31,6 +31,8 @@
 "%@://%@/%@"
 "%@://%@:%d"
 "%d"
+"%d_%d"
+"%d_%d_%d"
 "%dpx"
 "%ld"
 "&ie=UTF-8&oe=UTF-8"
@@ -67,6 +69,7 @@
 "419"
 "420+"
 "422"
+"5242880"
 "5CACD637-F82F-491F-947A-5DCA38AA0FEA"
 "6EB8D98F-2723-4472-88D3-5936F9D6E631"
 "7"
 "BEGIN:VCARD"
 "BP_CreatePluginMIMETypesPreferences"
 "BackwardDelete"
-"CFNetwork"
 "CSS"
 "Cache-Control"
 "Content-Encoding"
 "ImmSetOpenStatus"
 "IncludeDebugMenu"
 "InsertBacktab"
-"InsertLineBreak"
 "InsertNewline"
 "InsertTab"
 "Intel"
 "MIME\\Database\\Content Type"
 "MoveDown"
 "MoveDownAndModifySelection"
-"MoveDownByPageAndModifyCaret"
 "MoveLeft"
 "MoveLeftAndModifySelection"
+"MovePageDown"
+"MovePageDownAndModifySelection"
+"MovePageUp"
+"MovePageUpAndModifySelection"
 "MoveRight"
 "MoveRightAndModifySelection"
 "MoveToBeginningOfDocument"
 "MoveToEndOfLineAndModifySelection"
 "MoveUp"
 "MoveUpAndModifySelection"
-"MoveUpByPageAndModifyCaret"
 "MoveWordLeft"
 "MoveWordLeftAndModifySelection"
 "MoveWordRight"
 "Referer"
 "SAMILang"
 "SAMIStyle"
-"STInitialize"
 "Safari.exe"
 "Safari/419.3"
 "Times"
@@ -531,16 +533,14 @@ WebKit/mac/WebView/WebHTMLView.mm:"black"
 WebKit/mac/WebView/WebHTMLView.mm:"body"
 WebKit/mac/WebView/WebHTMLView.mm:"bold"
 WebKit/mac/WebView/WebHTMLView.mm:"center"
+WebKit/mac/WebView/WebHTMLView.mm:"direction"
 WebKit/mac/WebView/WebHTMLView.mm:"font"
 WebKit/mac/WebView/WebHTMLView.mm:"head"
 WebKit/mac/WebView/WebHTMLView.mm:"italic"
-WebKit/mac/WebView/WebHTMLView.mm:"justify"
-WebKit/mac/WebView/WebHTMLView.mm:"left"
 WebKit/mac/WebView/WebHTMLView.mm:"menu"
 WebKit/mac/WebView/WebHTMLView.mm:"none"
 WebKit/mac/WebView/WebHTMLView.mm:"normal"
 WebKit/mac/WebView/WebHTMLView.mm:"object"
-WebKit/mac/WebView/WebHTMLView.mm:"right"
 WebKit/mac/WebView/WebHTMLView.mm:"strike"
 WebKit/mac/WebView/WebHTMLView.mm:"style"
 WebKit/mac/WebView/WebHTMLView.mm:"super"
index 95d3ecb..65c261f 100644 (file)
@@ -1,3 +1,12 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        Reviewed by Alexey.
+
+        * WebCoreSupport/EditorClientGtk.cpp:
+        (WebKit::EditorClient::handleKeyboardEvent): Changed to use Editor::command
+        instead of Editor::execCommand.
+        * WebView/webkitwebview.cpp: Ditto.
+
 2007-12-12  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Sam Weinig
index fc76347..d045827 100644 (file)
@@ -271,33 +271,33 @@ void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
                         true);
                 break;
             case VK_PRIOR:  // PageUp
-                frame->editor()->execCommand("MoveUpByPageAndModifyCaret");
+                frame->editor()->command("MovePageUp").execute();
                 break;
             case VK_NEXT:  // PageDown
-                frame->editor()->execCommand("MoveDownByPageAndModifyCaret");
+                frame->editor()->command("MovePageDown").execute();
                 break;
             case VK_HOME:
                 if (kevent->ctrlKey() && kevent->shiftKey())
-                    frame->editor()->execCommand("MoveToBeginningOfDocumentAndModifySelection");
+                    frame->editor()->command("MoveToBeginningOfDocumentAndModifySelection").execute();
                 else if (kevent->ctrlKey())
-                    frame->editor()->execCommand("MoveToBeginningOfDocument");
+                    frame->editor()->command("MoveToBeginningOfDocument").execute();
                 else if (kevent->shiftKey())
-                    frame->editor()->execCommand("MoveToBeginningOfLineAndModifySelection");
+                    frame->editor()->command("MoveToBeginningOfLineAndModifySelection").execute();
                 else
-                    frame->editor()->execCommand("MoveToBeginningOfLine");
+                    frame->editor()->command("MoveToBeginningOfLine").execute();
                 break;
             case VK_END:
                 if (kevent->ctrlKey() && kevent->shiftKey())
-                    frame->editor()->execCommand("MoveToEndOfDocumentAndModifySelection");
+                    frame->editor()->command("MoveToEndOfDocumentAndModifySelection").execute();
                 else if (kevent->ctrlKey())
-                    frame->editor()->execCommand("MoveToEndOfDocument");
+                    frame->editor()->command("MoveToEndOfDocument").execute();
                 else if (kevent->shiftKey())
-                    frame->editor()->execCommand("MoveToEndOfLineAndModifySelection");
+                    frame->editor()->command("MoveToEndOfLineAndModifySelection").execute();
                 else
-                    frame->editor()->execCommand("MoveToEndOfLine");
+                    frame->editor()->command("MoveToEndOfLine").execute();
                 break;
             case VK_RETURN:
-                frame->editor()->execCommand("InsertLineBreak");
+                frame->editor()->command("InsertLineBreak").execute();
                 break;
             case VK_TAB:
                 return;
@@ -313,16 +313,16 @@ void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
                 } else if (kevent->ctrlKey()) {
                     switch (kevent->windowsVirtualKeyCode()) {
                         case VK_B:
-                            frame->editor()->execCommand("ToggleBold");
+                            frame->editor()->command("ToggleBold").execute();
                             break;
                         case VK_I:
-                            frame->editor()->execCommand("ToggleItalic");
+                            frame->editor()->command("ToggleItalic").execute();
                             break;
                         case VK_Y:
-                            frame->editor()->execCommand("Redo");
+                            frame->editor()->command("Redo").execute();
                             break;
                         case VK_Z:
-                            frame->editor()->execCommand("Undo");
+                            frame->editor()->command("Undo").execute();
                             break;
                         default:
                             return;
@@ -332,24 +332,24 @@ void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
     } else {
         switch (kevent->windowsVirtualKeyCode()) {
             case VK_UP:
-                frame->editor()->execCommand("MoveUp");
+                frame->editor()->command("MoveUp").execute();
                 break;
             case VK_DOWN:
-                frame->editor()->execCommand("MoveDown");
+                frame->editor()->command("MoveDown").execute();
                 break;
             case VK_PRIOR:  // PageUp
-                frame->editor()->execCommand("MoveUpByPageAndModifyCaret");
+                frame->editor()->command("MovePageUp").execute();
                 break;
             case VK_NEXT:  // PageDown
-                frame->editor()->execCommand("MoveDownByPageAndModifyCaret");
+                frame->editor()->command("MovePageDown").execute();
                 break;
             case VK_HOME:
                 if (kevent->ctrlKey())
-                    frame->editor()->execCommand("MoveToBeginningOfDocument");
+                    frame->editor()->command("MoveToBeginningOfDocument").execute();
                 break;
             case VK_END:
                 if (kevent->ctrlKey())
-                    frame->editor()->execCommand("MoveToEndOfDocument");
+                    frame->editor()->command("MoveToEndOfDocument").execute();
                 break;
             default:
                 return;
index f911816..e51b5cf 100644 (file)
@@ -404,25 +404,25 @@ static gboolean webkit_web_view_real_console_message(WebKitWebView* webView, con
 static void webkit_web_view_real_select_all(WebKitWebView* webView)
 {
     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-    frame->editor()->execCommand("SelectAll");
+    frame->editor()->command("SelectAll").execute();
 }
 
 static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView)
 {
     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-    frame->editor()->execCommand("Cut");
+    frame->editor()->command("Cut").execute();
 }
 
 static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView)
 {
     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-    frame->editor()->execCommand("Copy");
+    frame->editor()->command("Copy").execute();
 }
 
 static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView)
 {
     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-    frame->editor()->execCommand("Paste");
+    frame->editor()->command("Paste").execute();
 }
 
 static void webkit_web_view_finalize(GObject* object)
index c88cea1..18de238 100644 (file)
@@ -1,3 +1,45 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        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:
+        (+[WebFrameView _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.
+
 2007-12-13  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 060b7fd..05d5bc0 100644 (file)
@@ -56,4 +56,28 @@ namespace WebCore {
 
 - (WebFrame *)webFrame;
 
+// The following methods can all move off the bridge; they're used on the WebKit side only.
+
+- (NSView *)viewForPluginWithFrame:(NSRect)frame
+                               URL:(NSURL *)URL
+                    attributeNames:(NSArray *)attributeNames
+                   attributeValues:(NSArray *)attributeValues
+                          MIMEType:(NSString *)MIMEType
+                        DOMElement:(DOMElement *)element
+                      loadManually:(BOOL)loadManually;
+- (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
+                        attributeNames:(NSArray *)attributeNames
+                       attributeValues:(NSArray *)attributeValues
+                               baseURL:(NSURL *)baseURL
+                            DOMElement:(DOMElement *)element;
+
+- (WebCore::Frame*)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL referrer:(const WebCore::String&)referrer
+    ownerElement:(WebCore::HTMLFrameOwnerElement *)ownerElement allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
+
+- (void)redirectDataToPlugin:(NSView *)pluginView;
+
+- (WebCore::ObjectContentType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
+
+- (void)windowObjectCleared;
+
 @end
index e3628ab..9440f2d 100644 (file)
@@ -244,12 +244,6 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
     return [[[self webView] mainFrame] _bridge];
 }
 
-- (NSView *)documentView
-{
-    ASSERT(_frame != nil);
-    return [[_frame frameView] documentView];
-}
-
 - (NSResponder *)firstResponder
 {
     ASSERT(_frame != nil);
@@ -269,22 +263,6 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
     [webView _popPerformingProgrammaticFocus];
 }
 
-- (void)willMakeFirstResponderForNodeFocus
-{
-    ASSERT([[[_frame frameView] documentView] isKindOfClass:[WebHTMLView class]]);
-    [(WebHTMLView *)[[_frame frameView] documentView] _willMakeFirstResponderForNodeFocus];
-}
-
-- (BOOL)textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView;
-{
-    ASSERT(_frame != nil);
-    NSView *documentView = [[_frame frameView] documentView];
-    if (![documentView isKindOfClass:[WebHTMLView class]])
-        return NO;
-    WebHTMLView *webHTMLView = (WebHTMLView *)documentView;
-    return [webHTMLView _textViewWasFirstResponderAtMouseDownTime:textView];
-}
-
 - (NSWindow *)window
 {
     ASSERT(_frame != nil);
index 35f8c9a..61f473c 100644 (file)
@@ -260,7 +260,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
         viewTypes = [[NSMutableDictionary alloc] init];
         addTypesFromClass(viewTypes, [WebHTMLView class], [WebHTMLView supportedNonImageMIMETypes]);
 
-        // Since this is a "secret default" we don't both registering it.
+        // Since this is a "secret default" we don't bother registering it.
         BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
         if (!omitPDFSupport)
             addTypesFromClass(viewTypes, [WebPDFView class], [WebPDFView supportedMIMETypes]);
index 8da8ae5..92a0959 100644 (file)
@@ -418,7 +418,6 @@ static NSCellStateValue kit(TriState state)
     [pluginController release];
     [toolTip release];
     [compController release];
-    [firstResponderTextViewAtMouseDownTime release];
     [dataSource release];
     [highlighters release];
     if (promisedDragTIFFDataSource)
@@ -444,7 +443,6 @@ static NSCellStateValue kit(TriState state)
     [pluginController release];
     [toolTip release];
     [compController release];
-    [firstResponderTextViewAtMouseDownTime release];
     [dataSource release];
     [highlighters release];
     if (promisedDragTIFFDataSource)
@@ -455,7 +453,6 @@ static NSCellStateValue kit(TriState state)
     pluginController = nil;
     toolTip = nil;
     compController = nil;
-    firstResponderTextViewAtMouseDownTime = nil;
     dataSource = nil;
     highlighters = nil;
     promisedDragTIFFDataSource = 0;
@@ -802,21 +799,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     [event retain];
     [_private->mouseDownEvent release];
     _private->mouseDownEvent = event;
-
-    [_private->firstResponderTextViewAtMouseDownTime release];
-    
-    // The only code that checks this ivar only cares about NSTextViews. The code used to be more general,
-    // but it caused reference cycles leading to world leaks (see 4557386). We should be able to eliminate
-    // firstResponderTextViewAtMouseDownTime entirely when all the form controls are native widgets, because 
-    // the only caller (in WebCore) will be unnecessary.
-    if (event) {
-        NSResponder *firstResponder = [[self window] firstResponder];
-        if ([firstResponder isKindOfClass:[NSTextView class]])
-            _private->firstResponderTextViewAtMouseDownTime = [firstResponder retain];
-        else
-            _private->firstResponderTextViewAtMouseDownTime = nil;
-    } else
-        _private->firstResponderTextViewAtMouseDownTime = nil;
 }
 
 - (void)_cancelUpdateActiveStateTimer
@@ -1179,29 +1161,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     return self != [self _topHTMLView];
 }
 
-- (void)scrollPoint:(NSPoint)point
-{
-    // Since we can't subclass NSTextView to do what we want, we have to second guess it here.
-    // If we get called during the handling of a key down event, we assume the call came from
-    // NSTextView, and ignore it and use our own code to decide how to page up and page down
-    // We are smarter about how far to scroll, and we have "superview scrolling" logic.
-    NSEvent *event = [[self window] currentEvent];
-    if ([event type] == NSKeyDown) {
-        const unichar pageUp = NSPageUpFunctionKey;
-        if ([[event characters] rangeOfString:[NSString stringWithCharacters:&pageUp length:1]].length == 1) {
-            [self tryToPerform:@selector(scrollPageUp:) with:nil];
-            return;
-        }
-        const unichar pageDown = NSPageDownFunctionKey;
-        if ([[event characters] rangeOfString:[NSString stringWithCharacters:&pageDown length:1]].length == 1) {
-            [self tryToPerform:@selector(scrollPageDown:) with:nil];
-            return;
-        }
-    }
-    
-    [super scrollPoint:point];
-}
-
 - (NSView *)hitTest:(NSPoint)point
 {
     // WebHTMLView objects handle all events for objects inside them.
@@ -2060,13 +2019,22 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     return [[webView _editingDelegateForwarder] webView:webView doCommandBySelector:selector];
 }
 
-static String comandNameForSelector(SEL selector)
+static String commandNameForSelector(SEL selector)
 {
     // Change a few command names into ones supported by WebCore::Editor.
+    // If this list gets too long we might decide we need to use a hash table.
     if (selector == @selector(insertParagraphSeparator:) || selector == @selector(insertNewlineIgnoringFieldEditor:))
         return "InsertNewline";
     if (selector == @selector(insertTabIgnoringFieldEditor:))
         return "InsertTab";
+    if (selector == @selector(pageDown:))
+        return "MovePageDown";
+    if (selector == @selector(pageDownAndModifySelection:))
+        return "MovePageDownAndModifySelection";
+    if (selector == @selector(pageUp:))
+        return "MovePageUp";
+    if (selector == @selector(pageUpAndModifySelection:))
+        return "MovePageUpAndModifySelection";
 
     // Remove the trailing colon.
     const char* selectorName = sel_getName(selector);
@@ -2081,7 +2049,7 @@ static String comandNameForSelector(SEL selector)
     Frame* coreFrame = core([self _frame]);
     if (!coreFrame)
         return Editor::Command();
-    return coreFrame->editor()->command(comandNameForSelector(selector));
+    return coreFrame->editor()->command(commandNameForSelector(selector));
 }
 
 - (Editor::Command)coreCommandByName:(const char*)name
@@ -2118,8 +2086,16 @@ WEBCORE_COMMAND(alignCenter)
 WEBCORE_COMMAND(alignJustified)
 WEBCORE_COMMAND(alignLeft)
 WEBCORE_COMMAND(alignRight)
-WEBCORE_COMMAND(cut)
 WEBCORE_COMMAND(copy)
+WEBCORE_COMMAND(cut)
+WEBCORE_COMMAND(delete)
+WEBCORE_COMMAND(deleteBackward)
+WEBCORE_COMMAND(deleteBackwardByDecomposingPreviousCharacter)
+WEBCORE_COMMAND(deleteForward)
+WEBCORE_COMMAND(deleteToBeginningOfLine)
+WEBCORE_COMMAND(deleteToBeginningOfParagraph)
+WEBCORE_COMMAND(deleteToEndOfLine)
+WEBCORE_COMMAND(deleteToEndOfParagraph)
 WEBCORE_COMMAND(deleteToMark)
 WEBCORE_COMMAND(deleteWordBackward)
 WEBCORE_COMMAND(deleteWordForward)
@@ -2170,8 +2146,16 @@ WEBCORE_COMMAND(moveWordLeftAndModifySelection)
 WEBCORE_COMMAND(moveWordRight)
 WEBCORE_COMMAND(moveWordRightAndModifySelection)
 WEBCORE_COMMAND(outdent)
+WEBCORE_COMMAND(pageDown)
+WEBCORE_COMMAND(pageDownAndModifySelection)
+WEBCORE_COMMAND(pageUp)
+WEBCORE_COMMAND(pageUpAndModifySelection)
 WEBCORE_COMMAND(selectAll)
+WEBCORE_COMMAND(selectLine)
+WEBCORE_COMMAND(selectParagraph)
+WEBCORE_COMMAND(selectSentence)
 WEBCORE_COMMAND(selectToMark)
+WEBCORE_COMMAND(selectWord)
 WEBCORE_COMMAND(setMark)
 WEBCORE_COMMAND(subscript)
 WEBCORE_COMMAND(superscript)
@@ -2228,10 +2212,10 @@ WEBCORE_COMMAND(yankAndSelect)
 }
 
 // jumpToSelection is the old name for what AppKit now calls centerSelectionInVisibleArea. Safari
-// was using the old jumpToSelection selector in its menu. Newer versions of Safari will us the
-// selector centerSelectionInVisibleArea. We'll leave this old selector in place for two reasons:
-// (1) compatibility between older Safari and newer WebKit; (2) other WebKit-based applications
-// might be using the jumpToSelection: selector, and we don't want to break them.
+// was using the old jumpToSelection selector in its menu. Newer versions of Safari will use the
+// selector centerSelectionInVisibleArea. We'll leave the old selector in place for two reasons:
+// (1) Compatibility between older Safari and newer WebKit; (2) other WebKit-based applications
+// might be using the selector, and we don't want to break them.
 - (void)jumpToSelection:(id)sender
 {
     COMMAND_PROLOGUE
@@ -2259,104 +2243,17 @@ WEBCORE_COMMAND(yankAndSelect)
     if (Document* doc = frame->document()) {
         if (doc->isPluginDocument())
             return NO;
-        
         if (doc->isImageDocument()) {            
             if (action == @selector(copy:))
                 return frame->loader()->isComplete();
-        
             return NO;
         }
     }
 
-    if (action == @selector(alignCenter:)
-            || action == @selector(alignJustified:)
-            || action == @selector(alignLeft:)
-            || action == @selector(alignRight:)
-            || action == @selector(cut:)
-            || action == @selector(copy:)
-            || action == @selector(deleteToMark:)
-            || action == @selector(deleteWordBackward:)
-            || action == @selector(deleteWordForward:)
-            || action == @selector(indent:)
-            || action == @selector(insertBacktab:)
-            || action == @selector(insertLineBreak:)
-            || action == @selector(insertNewline:)
-            || action == @selector(insertNewlineIgnoringFieldEditor:)
-            || action == @selector(insertParagraphSeparator:)
-            || action == @selector(insertTab:)
-            || action == @selector(insertTabIgnoringFieldEditor:)
-            || action == @selector(moveBackward:)
-            || action == @selector(moveBackwardAndModifySelection:)
-            || action == @selector(moveDown:)
-            || action == @selector(moveDownAndModifySelection:)
-            || action == @selector(moveForward:)
-            || action == @selector(moveForwardAndModifySelection:)
-            || action == @selector(moveLeft:)
-            || action == @selector(moveLeftAndModifySelection:)
-            || action == @selector(moveParagraphBackwardAndModifySelection:)
-            || action == @selector(moveParagraphForwardAndModifySelection:)
-            || action == @selector(moveRight:)
-            || action == @selector(moveRightAndModifySelection:)
-            || action == @selector(moveToBeginningOfDocument:)
-            || action == @selector(moveToBeginningOfDocumentAndModifySelection:)
-            || action == @selector(moveToBeginningOfLine:)
-            || action == @selector(moveToBeginningOfLineAndModifySelection:)
-            || action == @selector(moveToBeginningOfParagraph:)
-            || action == @selector(moveToBeginningOfParagraphAndModifySelection:)
-            || action == @selector(moveToBeginningOfSentence:)
-            || action == @selector(moveToBeginningOfSentenceAndModifySelection:)
-            || action == @selector(moveToEndOfDocument:)
-            || action == @selector(moveToEndOfDocumentAndModifySelection:)
-            || action == @selector(moveToEndOfLine:)
-            || action == @selector(moveToEndOfLineAndModifySelection:)
-            || action == @selector(moveToEndOfParagraph:)
-            || action == @selector(moveToEndOfParagraphAndModifySelection:)
-            || action == @selector(moveToEndOfSentence:)
-            || action == @selector(moveToEndOfSentenceAndModifySelection:)
-            || action == @selector(moveUp:)
-            || action == @selector(moveUpAndModifySelection:)
-            || action == @selector(moveWordBackward:)
-            || action == @selector(moveWordBackwardAndModifySelection:)
-            || action == @selector(moveWordForward:)
-            || action == @selector(moveWordForwardAndModifySelection:)
-            || action == @selector(moveWordLeft:)
-            || action == @selector(moveWordLeftAndModifySelection:)
-            || action == @selector(moveWordRight:)
-            || action == @selector(moveWordRightAndModifySelection:)
-            || action == @selector(outdent:)
-            || action == @selector(selectAll:)
-            || action == @selector(selectToMark:)
-            || action == @selector(setMark:)
-            || action == @selector(subscript:)
-            || action == @selector(superscript:)
-            || action == @selector(swapWithMark:)
-            || action == @selector(transpose:)
-            || action == @selector(underline:)
-            || action == @selector(unscript:)
-            || action == @selector(yank:)
-            || action == @selector(yankAndSelect:)) {
-        Editor::Command command = [self coreCommandBySelector:action];
-        NSMenuItem *menuItem = (NSMenuItem *)item;
-        if ([menuItem isKindOfClass:[NSMenuItem class]])
-            [menuItem setState:kit(command.state())];
-        return command.isEnabled();
-    }
-
     if (action == @selector(changeSpelling:)
             || action == @selector(_changeSpellingFromMenu:)
             || action == @selector(checkSpelling:)
             || action == @selector(complete:)
-            || action == @selector(deleteBackward:)
-            || action == @selector(deleteBackwardByDecomposingPreviousCharacter:)
-            || action == @selector(deleteForward:)
-            || action == @selector(deleteToBeginningOfLine:)
-            || action == @selector(deleteToBeginningOfParagraph:)
-            || action == @selector(deleteToEndOfLine:)
-            || action == @selector(deleteToEndOfParagraph:)
-            || action == @selector(pageDown:)
-            || action == @selector(pageDownAndModifySelection:)
-            || action == @selector(pageUp:)
-            || action == @selector(pageUpAndModifySelection:)
             || action == @selector(pasteFont:))
         return [self _canEdit];
     
@@ -2373,13 +2270,11 @@ WEBCORE_COMMAND(yankAndSelect)
     }
     
     if (action == @selector(changeBaseWritingDirection:)) {
+        NSWritingDirection writingDirection = static_cast<NSWritingDirection>([item tag]);
+        if (writingDirection == NSWritingDirectionNatural)
+            return NO;
         NSMenuItem *menuItem = (NSMenuItem *)item;
         if ([menuItem isKindOfClass:[NSMenuItem class]]) {
-            NSWritingDirection writingDirection = static_cast<NSWritingDirection>([item tag]);
-            if (writingDirection == NSWritingDirectionNatural) {
-                [menuItem setState:NSOffState];
-                return NO;
-            }
             RefPtr<CSSStyleDeclaration> style = new CSSMutableStyleDeclaration;
             ExceptionCode ec;
             style->setProperty("direction", writingDirection == NSWritingDirectionLeftToRight ? "LTR" : "RTL", ec);
@@ -2421,9 +2316,6 @@ WEBCORE_COMMAND(yankAndSelect)
     if (action == @selector(changeDocumentBackgroundColor:))
         return [[self _webView] isEditable] && [self _canEditRichly];
     
-    if (action == @selector(delete:))
-        return frame && frame->editor()->canDelete();
-    
     if (action == @selector(_ignoreSpellingFromMenu:)
             || action == @selector(_learnSpellingFromMenu:)
             || action == @selector(takeFindStringFromSelection:))
@@ -2437,27 +2329,31 @@ WEBCORE_COMMAND(yankAndSelect)
             || (frame->editor()->canPaste() && frame->selectionController()->isContentRichlyEditable()));
     
     if (action == @selector(performFindPanelAction:))
-        // FIXME: Not yet implemented.
         return NO;
     
-    if (action == @selector(_lookUpInDictionaryFromMenu:)) {
+    if (action == @selector(_lookUpInDictionaryFromMenu:))
         return [self _hasSelection];
-    } 
     
 #ifndef BUILDING_ON_TIGER
     if (action == @selector(toggleGrammarChecking:)) {
         // FIXME 4799134: WebView is the bottleneck for this grammar-checking logic, but we must validate 
         // the selector here because we implement it here, and we must implement it here because the AppKit 
         // code checks the first responder.
-        BOOL checkMark = [self isGrammarCheckingEnabled];
-        if ([(NSObject *)item isKindOfClass:[NSMenuItem class]]) {
-            NSMenuItem *menuItem = (NSMenuItem *)item;
-            [menuItem setState:checkMark ? NSOnState : NSOffState];
-        }
+        NSMenuItem *menuItem = (NSMenuItem *)item;
+        if ([menuItem isKindOfClass:[NSMenuItem class]])
+            [menuItem setState:[self isGrammarCheckingEnabled] ? NSOnState : NSOffState];
         return YES;
     }
 #endif
     
+    Editor::Command command = [self coreCommandBySelector:action];
+    if (command.isSupported()) {
+        NSMenuItem *menuItem = (NSMenuItem *)item;
+        if ([menuItem isKindOfClass:[NSMenuItem class]])
+            [menuItem setState:kit(command.state())];
+        return command.isEnabled();
+    }
+
     return YES;
 }
 
@@ -3084,9 +2980,6 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
     }
 
 done:
-    [_private->firstResponderTextViewAtMouseDownTime release];
-    _private->firstResponderTextViewAtMouseDownTime = nil;
-
     _private->handlingMouseDownEvent = NO;
 }
 
@@ -3259,9 +3152,8 @@ noPromisedData:
 - (BOOL)becomeFirstResponder
 {
     NSSelectionDirection direction = NSDirectSelection;
-    if (![[self _webView] _isPerformingProgrammaticFocus] && !_private->willBecomeFirstResponderForNodeFocus)
+    if (![[self _webView] _isPerformingProgrammaticFocus])
         direction = [[self window] keyViewSelectionDirection];
-    _private->willBecomeFirstResponderForNodeFocus = NO;
 
     [self _updateActiveState];
     [self _updateFontPanel];
@@ -3300,7 +3192,6 @@ noPromisedData:
         }
         [self _updateActiveState];
         _private->resigningFirstResponder = NO;
-        _private->willBecomeFirstResponderForNodeFocus = NO;
     }
     return resign;
 }
@@ -3668,115 +3559,6 @@ noPromisedData:
         coreFrame->revealSelection(RenderLayer::gAlignCenterAlways);
 }
 
-- (void)pageUp:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    WebFrameView *frameView = [self _frameView];
-    if (!frameView)
-        return;
-    if ([self _canAlterCurrentSelection])
-        [[self _bridge] alterCurrentSelection:SelectionController::MOVE verticalDistance:-[frameView _verticalPageScrollDistance]];
-}
-
-- (void)pageDown:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    WebFrameView *frameView = [self _frameView];
-    if (!frameView)
-        return;
-    if ([self _canAlterCurrentSelection])
-        [[self _bridge] alterCurrentSelection:SelectionController::MOVE verticalDistance:[frameView _verticalPageScrollDistance]];
-}
-
-- (void)pageUpAndModifySelection:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    WebFrameView *frameView = [self _frameView];
-    if (!frameView)
-        return;
-    if ([self _canAlterCurrentSelection])
-        [[self _bridge] alterCurrentSelection:SelectionController::EXTEND verticalDistance:-[frameView _verticalPageScrollDistance]];
-}
-
-- (void)pageDownAndModifySelection:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    WebFrameView *frameView = [self _frameView];
-    if (frameView == nil)
-        return;
-    if ([self _canAlterCurrentSelection])
-        [[self _bridge] alterCurrentSelection:SelectionController::EXTEND verticalDistance:[frameView _verticalPageScrollDistance]];
-}
-
-- (void)_expandSelectionToGranularity:(TextGranularity)granularity
-{
-    if (![self _canAlterCurrentSelection])
-        return;
-    
-    Frame* coreFrame = core([self _frame]);
-    if (!coreFrame || !coreFrame->selectionController()->isCaretOrRange())
-        return;
-
-    // NOTE: The enums *must* match the very similar ones declared in SelectionController.h
-    Selection selection(coreFrame->selectionController()->selection());
-    selection.expandUsingGranularity(static_cast<TextGranularity>(granularity));
-    
-    RefPtr<Range> range = selection.toRange();
-    if (!range)
-        return;
-    
-    DOMRange *domRange = kit(range.get());
-    
-    if ([domRange collapsed])
-        return;
-
-    EAffinity affinity = coreFrame->selectionController()->affinity();
-    WebView *webView = [self _webView];
-    if ([[webView _editingDelegateForwarder] webView:webView shouldChangeSelectedDOMRange:[self _selectedRange] toDOMRange:domRange affinity:kit(affinity) stillSelecting:NO]) {
-        coreFrame->selectionController()->setSelectedRange(range.get(), affinity, true);
-    }
-}
-
-- (void)selectParagraph:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    [self _expandSelectionToGranularity:ParagraphGranularity];
-}
-
-- (void)selectLine:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    [self _expandSelectionToGranularity:LineGranularity];
-}
-
-- (void)selectSentence:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    [self _expandSelectionToGranularity:SentenceGranularity];
-}
-
-- (void)selectWord:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    [self _expandSelectionToGranularity:WordGranularity];
-}
-
-- (void)delete:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    if (Frame* coreFrame = core([self _frame]))
-        coreFrame->editor()->performDelete();
-}
-
 - (NSData *)_selectionStartFontAttributesAsRTF
 {
     Frame* coreFrame = core([self _frame]);
@@ -4300,80 +4082,6 @@ NSStrokeColorAttributeName        /* NSColor, default nil: same as foreground co
     [self _changeWordCaseWithSelector:@selector(capitalizedString)];
 }
 
-- (void)deleteForward:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    if (![self _isEditable])
-        return;
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::FORWARD, CharacterGranularity, false, true);
-}
-
-- (void)deleteBackward:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    if (![self _isEditable])
-        return;
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true);
-}
-
-- (void)deleteBackwardByDecomposingPreviousCharacter:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    LOG_ERROR("unimplemented, doing deleteBackward instead");
-
-    if (![self _isEditable])
-        return;
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true);
-}
-
-- (void)deleteToBeginningOfLine:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::BACKWARD, LineBoundary, true, false);
-}
-
-- (void)deleteToEndOfLine:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    // To match NSTextView, this command should delete the newline at the end of
-    // a paragraph if you are at the end of a paragraph (like deleteToEndOfParagraph does below).
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::FORWARD, LineBoundary, true, false);
-}
-
-- (void)deleteToBeginningOfParagraph:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::BACKWARD, ParagraphBoundary, true, false);
-}
-
-- (void)deleteToEndOfParagraph:(id)sender
-{
-    COMMAND_PROLOGUE
-
-    // Despite the name of the method, this should delete the newline if the caret is at the end of a paragraph.
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->deleteWithDirection(SelectionController::FORWARD, ParagraphBoundary, true, false);
-}
-
 - (void)complete:(id)sender
 {
     COMMAND_PROLOGUE
@@ -4389,12 +4097,6 @@ NSStrokeColorAttributeName        /* NSColor, default nil: same as foreground co
 {
     COMMAND_PROLOGUE
 
-    NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
-    if (!checker) {
-        LOG_ERROR("No NSSpellChecker");
-        return;
-    }
-    
     if (Frame* coreFrame = core([self _frame]))
         coreFrame->editor()->advanceToNextMisspelling();
 }
@@ -4774,33 +4476,6 @@ NSStrokeColorAttributeName        /* NSColor, default nil: same as foreground co
     return [[self _webView] smartInsertDeleteEnabled] && [[self _bridge] selectionGranularity] == WordGranularity;
 }
 
-- (DOMRange *)_smartDeleteRangeForProposedRange:(DOMRange *)proposedRange
-{
-    if (proposedRange == nil || [self _canSmartCopyOrDelete] == NO)
-        return nil;
-    
-    return [[self _bridge] smartDeleteRangeForProposedRange:proposedRange];
-}
-
-- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString
-{
-    if (!pasteString || !rangeToReplace || ![[self _webView] smartInsertDeleteEnabled]) {
-        if (beforeString)
-            *beforeString = nil;
-        if (afterString)
-            *afterString = nil;
-        return;
-    }
-    
-    [[self _bridge] smartInsertForString:pasteString replacingRange:rangeToReplace beforeString:beforeString afterString:afterString];
-}
-
-- (BOOL)_textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView
-{
-    return textView == _private->firstResponderTextViewAtMouseDownTime;
-}
-
-
 - (NSEvent *)_mouseDownEvent
 {
     return _private->mouseDownEvent;
@@ -4836,11 +4511,6 @@ NSStrokeColorAttributeName        /* NSColor, default nil: same as foreground co
 }
 #endif
 
-- (void)_willMakeFirstResponderForNodeFocus
-{
-    _private->willBecomeFirstResponderForNodeFocus = YES;
-}
-
 - (id<WebHTMLHighlighter>)_highlighterForType:(NSString*)type
 {
     return [_private->highlighters objectForKey:type];
index 3ca5839..845da90 100644 (file)
@@ -78,7 +78,6 @@ struct WebHTMLViewInterpretKeyEventsParameters;
 
     BOOL resigningFirstResponder;
     BOOL nextResponderDisabledOnce;
-    BOOL willBecomeFirstResponderForNodeFocus;
     
     WebTextCompleteController *compController;
     
@@ -87,8 +86,6 @@ struct WebHTMLViewInterpretKeyEventsParameters;
     WebHTMLViewInterpretKeyEventsParameters *interpretKeyEventsParameters;
     BOOL receivedNOOP;
     
-    NSTextView *firstResponderTextViewAtMouseDownTime;
-    
     WebDataSource *dataSource;
     WebCore::CachedImage *promisedDragTIFFDataSource;
     
@@ -108,12 +105,10 @@ struct WebHTMLViewInterpretKeyEventsParameters;
 - (void)_selectionChanged;
 - (void)_updateFontPanel;
 - (BOOL)_canSmartCopyOrDelete;
-- (BOOL)_textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView;
 #ifndef __LP64__
 - (void)_pauseNullEventsForAllNetscapePlugins;
 - (void)_resumeNullEventsForAllNetscapePlugins;
 #endif
-- (void)_willMakeFirstResponderForNodeFocus;
 - (id<WebHTMLHighlighter>)_highlighterForType:(NSString*)type;
 - (WebFrame *)_frame;
 - (void)paste:(id)sender;
index 86b2236..7ca2310 100644 (file)
@@ -488,20 +488,20 @@ void QWebPage::triggerAction(WebAction action, bool checked)
             mainFrame()->d->frame->loader()->reload();
             break;
         case Cut:
-            editor->cut();
+            command = "Cut";
             break;
         case Copy:
-            editor->copy();
+            command = "Copy";
             break;
         case Paste:
-            editor->paste();
+            command = "Paste";
             break;
 
         case Undo:
-            editor->undo();
+            command = "Undo";
             break;
         case Redo:
-            editor->redo();
+            command = "Redo";
             break;
 
         case MoveToNextChar:
@@ -593,7 +593,6 @@ void QWebPage::triggerAction(WebAction action, bool checked)
             editor->setBaseWritingDirection("rtl");
             break;
 
-
         case ToggleBold:
             command = "ToggleBold";
             break;
@@ -611,7 +610,7 @@ void QWebPage::triggerAction(WebAction action, bool checked)
     }
 
     if (command)
-        editor->execCommand(command);
+        editor->command(command).execute();
 }
 
 QWebPage::NavigationRequestResponse QWebPage::navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)
index c35def0..8146824 100644 (file)
@@ -1,3 +1,15 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        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.
+
 2007-12-12  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Sam Weinig
index eeed5eb..fced385 100644 (file)
@@ -343,7 +343,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
     if (start->isContentEditable()) {
         switch (kevent->windowsVirtualKeyCode()) {
             case VK_RETURN:
-                frame->editor()->execCommand("InsertLineBreak");
+                frame->editor()->command("InsertLineBreak").execute();
                 break;
             case VK_BACK:
                 frame->editor()->deleteWithDirection(SelectionController::BACKWARD,
@@ -355,29 +355,29 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
                 break;
             case VK_LEFT:
                 if (kevent->shiftKey())
-                    frame->editor()->execCommand("MoveLeftAndModifySelection");
-                else frame->editor()->execCommand("MoveLeft");
+                    frame->editor()->command("MoveLeftAndModifySelection").execute();
+                else frame->editor()->command("MoveLeft").execute();
                 break;
             case VK_RIGHT:
                 if (kevent->shiftKey())
-                    frame->editor()->execCommand("MoveRightAndModifySelection");
-                else frame->editor()->execCommand("MoveRight");
+                    frame->editor()->command("MoveRightAndModifySelection").execute();
+                else frame->editor()->command("MoveRight").execute();
                 break;
             case VK_UP:
                 if (kevent->shiftKey())
-                    frame->editor()->execCommand("MoveUpAndModifySelection");
-                else frame->editor()->execCommand("MoveUp");
+                    frame->editor()->command("MoveUpAndModifySelection").execute();
+                else frame->editor()->command("MoveUp").execute();
                 break;
             case VK_DOWN:
                 if (kevent->shiftKey())
-                    frame->editor()->execCommand("MoveDownAndModifySelection");
-                else frame->editor()->execCommand("MoveDown");
+                    frame->editor()->command("MoveDownAndModifySelection").execute();
+                else frame->editor()->command("MoveDown").execute();
                 break;
             case VK_PRIOR:  // PageUp
-                frame->editor()->execCommand("MoveUpByPageAndModifyCaret");
+                frame->editor()->command("MovePageUp").execute();
                 break;
             case VK_NEXT:  // PageDown
-                frame->editor()->execCommand("MoveDownByPageAndModifyCaret");
+                frame->editor()->command("MovePageDown").execute();
                 break;
             case VK_TAB:
                 return;
@@ -387,28 +387,28 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
                 } else if (kevent->ctrlKey()) {
                     switch (kevent->windowsVirtualKeyCode()) {
                         case VK_A:
-                            frame->editor()->execCommand("SelectAll");
+                            frame->editor()->command("SelectAll").execute();
                             break;
                         case VK_B:
-                            frame->editor()->execCommand("ToggleBold");
+                            frame->editor()->command("ToggleBold").execute();
                             break;
                         case VK_C:
-                            frame->editor()->execCommand("Copy");
+                            frame->editor()->command("Copy").execute();
                             break;
                         case VK_I:
-                            frame->editor()->execCommand("ToggleItalic");
+                            frame->editor()->command("ToggleItalic").execute();
                             break;
                         case VK_V:
-                            frame->editor()->execCommand("Paste");
+                            frame->editor()->command("Paste").execute();
                             break;
                         case VK_X:
-                            frame->editor()->execCommand("Cut");
+                            frame->editor()->command("Cut").execute();
                             break;
                         case VK_Y:
-                            frame->editor()->execCommand("Redo");
+                            frame->editor()->command("Redo").execute();
                             break;
                         case VK_Z:
-                            frame->editor()->execCommand("Undo");
+                            frame->editor()->command("Undo").execute();
                             break;
                         default:
                             return;
@@ -418,33 +418,33 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
     } else {
         switch (kevent->windowsVirtualKeyCode()) {
             case VK_UP:
-                frame->editor()->execCommand("MoveUp");
+                frame->editor()->command("MoveUp").execute();
                 break;
             case VK_DOWN:
-                frame->editor()->execCommand("MoveDown");
+                frame->editor()->command("MoveDown").execute();
                 break;
             case VK_PRIOR:  // PageUp
-                frame->editor()->execCommand("MoveUpByPageAndModifyCaret");
+                frame->editor()->command("MovePageUp").execute();
                 break;
             case VK_NEXT:  // PageDown
-                frame->editor()->execCommand("MoveDownByPageAndModifyCaret");
+                frame->editor()->command("MovePageDown").execute();
                 break;
             case VK_HOME:
                 if (kevent->ctrlKey())
-                    frame->editor()->execCommand("MoveToBeginningOfDocument");
+                    frame->editor()->command("MoveToBeginningOfDocument").execute();
                 break;
             case VK_END:
                 if (kevent->ctrlKey())
-                    frame->editor()->execCommand("MoveToEndOfDocument");
+                    frame->editor()->command("MoveToEndOfDocument").execute();
                 break;
             default:
                 if (kevent->ctrlKey()) {
-                    switch(kevent->windowsVirtualKeyCode()) {
+                    switch (kevent->windowsVirtualKeyCode()) {
                         case VK_A:
-                            frame->editor()->execCommand("SelectAll");
+                            frame->editor()->command("SelectAll").execute();
                             break;
                         case VK_C: case VK_X:
-                            frame->editor()->execCommand("Copy");
+                            frame->editor()->command("Copy").execute();
                             break;
                         default:
                             return;
index 913fd97..f24af29 100644 (file)
@@ -1,3 +1,16 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        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.
+
 2007-12-13  Steve Falkenburg  <sfalken@apple.com>
 
         Move source file generation into its own vcproj to fix build dependencies.
index 282698b..8129821 100644 (file)
@@ -1245,21 +1245,15 @@ bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isHorizontal)
 bool WebView::execCommand(WPARAM wParam, LPARAM /*lParam*/)
 {
     Frame* frame = m_page->focusController()->focusedOrMainFrame();
-    bool handled = false;
     switch (LOWORD(wParam)) {
-    case SelectAll:
-        handled = frame->editor()->execCommand("SelectAll");
-        break;
-    case Undo:
-        handled = frame->editor()->execCommand("Undo");
-        break;
-    case Redo:
-        handled = frame->editor()->execCommand("Redo");
-        break;
-    default:
-        break;
+        case SelectAll:
+            return frame->editor()->command("SelectAll").execute();
+        case Undo:
+            return frame->editor()->command("Undo").execute();
+        case Redo:
+            return frame->editor()->command("Redo").execute();
     }
-    return handled;
+    return false;
 }
 
 bool WebView::keyUp(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
@@ -1304,8 +1298,8 @@ static const KeyDownEntry keyDownEntries[] = {
     { VK_DOWN,   0,                  "MoveDown"                                    },
     { VK_DOWN,   ShiftKey,           "MoveDownAndModifySelection"                  },
     { VK_NEXT,   ShiftKey,           "MoveDownAndModifySelection"                  },
-    { VK_PRIOR,  0,                  "MoveUpByPageAndModifyCaret"                  },
-    { VK_NEXT,   0,                  "MoveDownByPageAndModifyCaret"                },
+    { VK_PRIOR,  0,                  "MovePageUp"                                  },
+    { VK_NEXT,   0,                  "MovePageDown"                                },
     { VK_HOME,   0,                  "MoveToBeginningOfLine"                       },
     { VK_HOME,   ShiftKey,           "MoveToBeginningOfLineAndModifySelection"     },
     { VK_HOME,   CtrlKey,            "MoveToBeginningOfDocument"                   },
@@ -3496,21 +3490,21 @@ HRESULT STDMETHODCALLTYPE WebView::applyStyle(
 HRESULT STDMETHODCALLTYPE WebView::copy( 
         /* [in] */ IUnknown* /*sender*/)
 {
-    m_page->focusController()->focusedOrMainFrame()->editor()->execCommand("Copy");
+    m_page->focusController()->focusedOrMainFrame()->editor()->command("Copy").execute();
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE WebView::cut( 
         /* [in] */ IUnknown* /*sender*/)
 {
-    m_page->focusController()->focusedOrMainFrame()->editor()->execCommand("Cut");
+    m_page->focusController()->focusedOrMainFrame()->editor()->command("Cut").execute();
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE WebView::paste( 
         /* [in] */ IUnknown* /*sender*/)
 {
-    m_page->focusController()->focusedOrMainFrame()->editor()->execCommand("Paste");
+    m_page->focusController()->focusedOrMainFrame()->editor()->command("Paste").execute();
     return S_OK;
 }
 
@@ -3540,7 +3534,7 @@ HRESULT STDMETHODCALLTYPE WebView::pasteFont(
 HRESULT STDMETHODCALLTYPE WebView::delete_( 
         /* [in] */ IUnknown* /*sender*/)
 {
-    m_page->focusController()->focusedOrMainFrame()->editor()->execCommand("Delete");
+    m_page->focusController()->focusedOrMainFrame()->editor()->command("Delete").execute();
     return S_OK;
 }
     
index 493e634..2d7f590 100644 (file)
@@ -1,3 +1,11 @@
+2007-12-14  Darin Adler  <darin@apple.com>
+
+        Reviewed by Alexey.
+
+        * WebKitSupport/EditorClientWx.cpp:
+        (WebCore::EditorClientWx::handleKeyboardEvent): Switched from Editor::execCommand
+        to Edtor::command.
+
 2007-12-12  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Sam Weinig
index 76b2a28..7e8889c 100644 (file)
@@ -279,19 +279,19 @@ void EditorClientWx::handleKeyboardEvent(KeyboardEvent* event)
                                                      CharacterGranularity, false, true);
                 break;
             case VK_LEFT:
-                frame->editor()->execCommand("MoveLeft");
+                frame->editor()->command("MoveLeft").execute();
                 break;
             case VK_RIGHT:
-                frame->editor()->execCommand("MoveRight");
+                frame->editor()->command("MoveRight").execute();
                 break;
             case VK_UP:
-                frame->editor()->execCommand("MoveUp");
+                frame->editor()->command("MoveUp").execute();
                 break;
             case VK_DOWN:
-                frame->editor()->execCommand("MoveDown");
+                frame->editor()->command("MoveDown").execute();
                 break;
             case VK_RETURN:
-                frame->editor()->execCommand("InsertLineBreak");
+                frame->editor()->command("InsertLineBreak").execute();
             default:
                 break;
         }