WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Nov 2006 23:20:59 +0000 (23:20 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Nov 2006 23:20:59 +0000 (23:20 +0000)
        Reviewed by Geoff.

        Add more commands, make toggleBold and toggleItalic executable commands.

        * WebCore.exp:
        * editing/Editor.cpp:
        (WebCore::execCopy):
        (WebCore::execCut):
        (WebCore::execDelete):
        (WebCore::execForwardDelete):
        (WebCore::execPaste):
        (WebCore::execSelectAll):
        (WebCore::execToggleBold):
        (WebCore::execToggleItalic):
        (WebCore::enabled):
        (WebCore::canPaste):
        (WebCore::hasEditableSelection):
        (WebCore::hasEditableRangeSelection):
        (WebCore::hasRangeSelection):
        (WebCore::hasRichlyEditableSelection):
        (WebCore::CommandEntry::):
        * editing/Editor.h:

WebKit:

        Reviewed by Geoff.

        Update for changes to WebCore
        * WebView/WebHTMLView.m:
        (-[NSArray _applyStyleToSelection:withUndoAction:]):
        (-[NSArray _applyParagraphStyleToSelection:withUndoAction:]):
        (-[NSArray _toggleBold]):
        (-[NSArray _toggleItalic]):

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

WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebHTMLView.m

index 4958c88c1eca773d874c09842ffe260191316a58..75a5f86c0c0d3de5a204c1d99b0618c27b8230c9 100644 (file)
@@ -1,3 +1,28 @@
+2006-11-10  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Geoff.
+
+        Add more commands, make toggleBold and toggleItalic executable commands.
+
+        * WebCore.exp:
+        * editing/Editor.cpp:
+        (WebCore::execCopy):
+        (WebCore::execCut):
+        (WebCore::execDelete):
+        (WebCore::execForwardDelete):
+        (WebCore::execPaste):
+        (WebCore::execSelectAll):
+        (WebCore::execToggleBold):
+        (WebCore::execToggleItalic):
+        (WebCore::enabled):
+        (WebCore::canPaste):
+        (WebCore::hasEditableSelection):
+        (WebCore::hasEditableRangeSelection):
+        (WebCore::hasRangeSelection):
+        (WebCore::hasRichlyEditableSelection):
+        (WebCore::CommandEntry::):
+        * editing/Editor.h:
+
 2006-11-10  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Maciej, Geoff.
index 8874ef75cc215888d2fdee6236635d359d2c3fad..1533169e3cba0c1223fd0f4879252470054652fd 100644 (file)
@@ -240,9 +240,7 @@ __ZN7WebCore5Image21getTIFFRepresentationEv
 __ZN7WebCore5RangeC1EPNS_8DocumentEPNS_4NodeEiS4_i
 __ZN7WebCore5RangeD1Ev
 __ZN7WebCore6Editor10applyStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
-__ZN7WebCore6Editor10toggleBoldEv
 __ZN7WebCore6Editor11execCommandERKNS_6StringE
-__ZN7WebCore6Editor12toggleItalicEv
 __ZN7WebCore6Editor19applyParagraphStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
 __ZN7WebCore6Editor21applyStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE
 __ZN7WebCore6Editor30applyParagraphStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE
index 3b9a30975c887bf692d5f64661e0dd862e84c5d2..206017cfe5a904cef7ec082dbf4731b0d518af8a 100644 (file)
                4B3043C90AE0371D00A82647 /* SoundMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3043C80AE0371D00A82647 /* SoundMac.mm */; };
                4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3043CA0AE0373B00A82647 /* Editor.cpp */; };
                4B3043CD0AE0373B00A82647 /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043CB0AE0373B00A82647 /* Editor.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               4BBDBF7D0ACC9290005F6E97 /* CommandByName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBDBF7B0ACC9290005F6E97 /* CommandByName.cpp */; };
-               4BBDBF7E0ACC9290005F6E97 /* CommandByName.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBDBF7C0ACC9290005F6E97 /* CommandByName.h */; };
                4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */; };
                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */; };
                4E1959290A39DACC00220FE5 /* MediaQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E1959230A39DACC00220FE5 /* MediaQuery.cpp */; };
                4B3043C80AE0371D00A82647 /* SoundMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SoundMac.mm; sourceTree = "<group>"; };
                4B3043CA0AE0373B00A82647 /* Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Editor.cpp; sourceTree = "<group>"; };
                4B3043CB0AE0373B00A82647 /* Editor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Editor.h; sourceTree = "<group>"; };
-               4BBDBF7B0ACC9290005F6E97 /* CommandByName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommandByName.cpp; sourceTree = "<group>"; };
-               4BBDBF7C0ACC9290005F6E97 /* CommandByName.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommandByName.h; sourceTree = "<group>"; };
                4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaFeatureNames.cpp; sourceTree = "<group>"; };
                4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaFeatureNames.h; sourceTree = "<group>"; };
                4E1959230A39DACC00220FE5 /* MediaQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQuery.cpp; sourceTree = "<group>"; };
                93309D86099E64910056E581 /* editing */ = {
                        isa = PBXGroup;
                        children = (
-                               4BBDBF7B0ACC9290005F6E97 /* CommandByName.cpp */,
-                               4BBDBF7C0ACC9290005F6E97 /* CommandByName.h */,
                                DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */,
                                DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */,
                                D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */,
                                85989DCF0ACC8BBD00A0BC51 /* DOMOverflowEventInternal.h in Headers */,
                                85989DD00ACC8BBD00A0BC51 /* DOMUIEventInternal.h in Headers */,
                                85989DD10ACC8BBD00A0BC51 /* DOMWheelEventInternal.h in Headers */,
-                               4BBDBF7E0ACC9290005F6E97 /* CommandByName.h in Headers */,
                                85ACEF0C0ACDCCCF001214FF /* DOMSVGAnimatedPathData.h in Headers */,
                                85ACEF0D0ACDCCCF001214FF /* DOMSVGAnimatedPoints.h in Headers */,
                                85ACEF0E0ACDCCCF001214FF /* DOMSVGAnimatedPreserveAspectRatio.h in Headers */,
                                850FD1FA0AC9C84200123D0D /* DOMSVGAnimatedTransformList.mm in Sources */,
                                85D79ADB0ACA17EB00F02FC5 /* DOMSVGStringList.mm in Sources */,
                                859C9C400ACACCCC00791611 /* DOMSVGRectElement.mm in Sources */,
-                               4BBDBF7D0ACC9290005F6E97 /* CommandByName.cpp in Sources */,
                                85ACEF0F0ACDCCCF001214FF /* DOMSVGAnimatedPreserveAspectRatio.mm in Sources */,
                                85ACEF110ACDCCCF001214FF /* DOMSVGPreserveAspectRatio.mm in Sources */,
                                85ACEF7D0ACDCFCE001214FF /* DOMSVGAElement.mm in Sources */,
                149C284408902B11008A9EFC /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               DEBUG_INFORMATION_FORMAT = stabs;
                                FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
                                GCC_ENABLE_CPP_EXCEPTIONS = NO;
                                GCC_ENABLE_CPP_RTTI = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                DEAD_CODE_STRIPPING = YES;
-                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               DEBUG_INFORMATION_FORMAT = stabs;
                                FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
                                GCC_DEBUGGING_SYMBOLS = full;
                                GCC_ENABLE_CPP_EXCEPTIONS = NO;
index 4b973438598d4526e13cfc353e017a6440f4879f..e11b017e406a5a720969cceb6360b9603e8f5813 100644 (file)
@@ -48,6 +48,7 @@
 #include "ReplaceSelectionCommand.h"
 #include "SelectionController.h"
 #include "Sound.h"
+#include "TypingCommand.h"
 #include "htmlediting.h"
 #include "markup.h"
 
@@ -322,28 +323,6 @@ void Editor::applyParagraphStyleToSelection(CSSStyleDeclaration* style, EditActi
         applyParagraphStyle(style, editingAction);
 }
 
-void Editor::toggleBold()
-{
-    ExceptionCode ec;
-    
-    RefPtr<CSSStyleDeclaration> style = m_frame->document()->createCSSStyleDeclaration();
-    style->setProperty(CSS_PROP_FONT_WEIGHT, "bold", false, ec);
-    if (selectionStartHasStyle(style.get()))
-        style->setProperty(CSS_PROP_FONT_WEIGHT, "normal", false, ec);
-    applyStyleToSelection(style.get(), EditActionSetFont);
-}
-
-void Editor::toggleItalic()
-{
-    ExceptionCode ec;
-    
-    RefPtr<CSSStyleDeclaration> style = m_frame->document()->createCSSStyleDeclaration();
-    style->setProperty(CSS_PROP_FONT_STYLE, "italic", false, ec);
-    if (selectionStartHasStyle(style.get()))
-        style->setProperty(CSS_PROP_FONT_STYLE, "normal", false, ec);
-    applyStyleToSelection(style.get(), EditActionSetFont);
-}
-
 bool Editor::selectionStartHasStyle(CSSStyleDeclaration* style) const
 {
     Node* nodeToRemove;
@@ -452,6 +431,30 @@ void Editor::reappliedEditing(PassRefPtr<EditCommand> cmd)
 
 // Execute command functions
 
+bool execCopy(Frame* frame)
+{
+    frame->copyToPasteboard();
+    return true;
+}
+
+bool execCut(Frame* frame)
+{
+    frame->cutToPasteboard();
+    return true;
+}
+
+static bool execDelete(Frame* frame)
+{
+    TypingCommand::deleteKeyPressed(frame->document(), frame->selectionGranularity() == WordGranularity);
+    return true;
+}
+
+static bool execForwardDelete(Frame* frame)
+{
+    TypingCommand::forwardDeleteKeyPressed(frame->document());
+    return true;
+}
+
 static bool execMoveBackward(Frame* frame)
 {
     frame->selectionController()->modify(SelectionController::MOVE, SelectionController::BACKWARD, CharacterGranularity, true);
@@ -680,13 +683,74 @@ static bool execMoveWordRightAndModifySelection(Frame* frame)
     return true;
 }
 
+static bool execPaste(Frame* frame)
+{
+    frame->pasteFromPasteboard();
+    return true;
+}
+
+static bool execSelectAll(Frame* frame)
+{
+    frame->selectionController()->selectAll();
+    return true;
+}
+
+static bool execToggleBold(Frame* frame)
+{
+    ExceptionCode ec;
+    
+    RefPtr<CSSStyleDeclaration> style = frame->document()->createCSSStyleDeclaration();
+    style->setProperty(CSS_PROP_FONT_WEIGHT, "bold", false, ec);
+    if (frame->editor()->selectionStartHasStyle(style.get()))
+        style->setProperty(CSS_PROP_FONT_WEIGHT, "normal", false, ec);
+    frame->editor()->applyStyleToSelection(style.get(), EditActionSetFont);
+    return true;
+}
+
+static bool execToggleItalic(Frame* frame)
+{
+    ExceptionCode ec;
+    
+    RefPtr<CSSStyleDeclaration> style = frame->document()->createCSSStyleDeclaration();
+    style->setProperty(CSS_PROP_FONT_STYLE, "italic", false, ec);
+    if (frame->editor()->selectionStartHasStyle(style.get()))
+        style->setProperty(CSS_PROP_FONT_STYLE, "normal", false, ec);
+    frame->editor()->applyStyleToSelection(style.get(), EditActionSetFont);
+    return true;
+}
+
 // Enabled functions
 
-bool canAlterCurrentSelection(Frame* frame)
+static bool enabled(Frame*)
+{
+    return true;
+}
+
+static bool canPaste(Frame* frame)
+{
+    return frame->editor()->canPaste();
+}
+
+static bool hasEditableSelection(Frame* frame)
 {
     return frame->selectionController()->isCaretOrRange() && frame->selectionController()->isContentEditable();
 }
 
+static bool hasEditableRangeSelection(Frame* frame)
+{
+    return frame->selectionController()->isRange() && frame->selectionController()->isContentEditable();
+}
+
+static bool hasRangeSelection(Frame* frame)
+{
+    return frame->selectionController()->isRange();
+}
+
+static bool hasRichlyEditableSelection(Frame* frame)
+{
+    return frame->selectionController()->isCaretOrRange() && frame->selectionController()->isContentRichlyEditable();
+}
+
 struct Command {
     bool (*enabled)(Frame* frame);
     bool (*exec)(Frame* frame);
@@ -699,44 +763,52 @@ static CommandMap* createCommandMap()
     struct CommandEntry { const char* name; Command command; };
     
     static const CommandEntry commands[] = {
-        { "MoveBackward", { canAlterCurrentSelection, execMoveBackward } },
-        { "MoveBackwardAndModifySelection", { canAlterCurrentSelection, execMoveBackwardAndModifySelection } },
-        { "MoveDown", { canAlterCurrentSelection, execMoveDown } },
-        { "MoveDownAndModifySelection", { canAlterCurrentSelection, execMoveDownAndModifySelection } },
-        { "MoveForward", { canAlterCurrentSelection, execMoveForward } },
-        { "MoveForwardAndModifySelection", { canAlterCurrentSelection, execMoveForwardAndModifySelection } },
-        { "MoveLeft", { canAlterCurrentSelection, execMoveLeft } },
-        { "MoveLeftAndModifySelection", { canAlterCurrentSelection, execMoveLeftAndModifySelection } },
-        { "MoveRight", { canAlterCurrentSelection, execMoveRight } },
-        { "MoveRightAndModifySelection", { canAlterCurrentSelection, execMoveRightAndModifySelection } },
-        { "MoveToBeginningOfDocument", { canAlterCurrentSelection, execMoveToBeginningOfDocument } },
-        { "MoveToBeginningOfDocumentAndModifySelection", { canAlterCurrentSelection, execMoveToBeginningOfDocumentAndModifySelection } },
-        { "MoveToBeginningOfSentence", { canAlterCurrentSelection, execMoveToBeginningOfSentence } },
-        { "MoveToBeginningOfSentenceAndModifySelection", { canAlterCurrentSelection, execMoveToBeginningOfSentenceAndModifySelection } },
-        { "MoveToBeginningOfLine", { canAlterCurrentSelection, execMoveToBeginningOfLine } },
-        { "MoveToBeginningOfLineAndModifySelection", { canAlterCurrentSelection, execMoveToBeginningOfLineAndModifySelection } },
-        { "MoveToBeginningOfParagraph", { canAlterCurrentSelection, execMoveToBeginningOfParagraph } },
-        { "MoveToBeginningOfLineAndModifySelection", { canAlterCurrentSelection, execMoveToBeginningOfParagraphAndModifySelection } },
-        { "MoveToEndOfDocument", { canAlterCurrentSelection, execMoveToEndOfDocument } },
-        { "MoveToEndOfDocumentAndModifySelection", { canAlterCurrentSelection, execMoveToEndOfDocumentAndModifySelection } },
-        { "MoveToEndOfSentence", { canAlterCurrentSelection, execMoveToEndOfSentence } },
-        { "MoveToEndOfSentenceAndModifySelection", { canAlterCurrentSelection, execMoveToEndOfSentenceAndModifySelection } },
-        { "MoveToEndOfLine", { canAlterCurrentSelection, execMoveToEndOfLine } },
-        { "MoveToEndOfLineAndModifySelection", { canAlterCurrentSelection, execMoveToEndOfLineAndModifySelection } },
-        { "MoveToEndOfParagraph", { canAlterCurrentSelection, execMoveToEndOfParagraph } },
-        { "MoveToEndOfLineAndModifySelection", { canAlterCurrentSelection, execMoveToEndOfParagraphAndModifySelection } },
-        { "MoveParagraphBackwardAndModifySelection", { canAlterCurrentSelection, execMoveParagraphBackwardAndModifySelection } },
-        { "MoveParagraphForwardAndModifySelection", { canAlterCurrentSelection, execMoveParagraphForwardAndModifySelection } },
-        { "MoveUp", { canAlterCurrentSelection, execMoveUp } },
-        { "MoveUpAndModifySelection", { canAlterCurrentSelection, execMoveUpAndModifySelection } },
-        { "MoveWordBackward", { canAlterCurrentSelection, execMoveWordBackward } },
-        { "MoveWordBackwardAndModifySelection", { canAlterCurrentSelection, execMoveWordBackwardAndModifySelection } },
-        { "MoveWordForward", { canAlterCurrentSelection, execMoveWordForward } },
-        { "MoveWordForwardAndModifySelection", { canAlterCurrentSelection, execMoveWordForwardAndModifySelection } },
-        { "MoveWordLeft", { canAlterCurrentSelection, execMoveWordLeft } },
-        { "MoveWordLeftAndModifySelection", { canAlterCurrentSelection, execMoveWordLeftAndModifySelection } },
-        { "MoveWordRight", { canAlterCurrentSelection, execMoveWordRight } },
-        { "MoveWordRightAndModifySelection", { canAlterCurrentSelection, execMoveWordRightAndModifySelection } },
+        { "Copy", { hasRangeSelection, execCopy } },
+        { "Cut", { hasEditableRangeSelection, execCut } },
+        { "Delete", { hasEditableSelection, execDelete } },
+        { "ForwardDelete", { hasEditableSelection, execForwardDelete } },
+        { "MoveBackward", { hasEditableSelection, execMoveBackward } },
+        { "MoveBackwardAndModifySelection", { hasEditableSelection, execMoveBackwardAndModifySelection } },
+        { "MoveDown", { hasEditableSelection, execMoveDown } },
+        { "MoveDownAndModifySelection", { hasEditableSelection, execMoveDownAndModifySelection } },
+        { "MoveForward", { hasEditableSelection, execMoveForward } },
+        { "MoveForwardAndModifySelection", { hasEditableSelection, execMoveForwardAndModifySelection } },
+        { "MoveLeft", { hasEditableSelection, execMoveLeft } },
+        { "MoveLeftAndModifySelection", { hasEditableSelection, execMoveLeftAndModifySelection } },
+        { "MoveRight", { hasEditableSelection, execMoveRight } },
+        { "MoveRightAndModifySelection", { hasEditableSelection, execMoveRightAndModifySelection } },
+        { "MoveToBeginningOfDocument", { hasEditableSelection, execMoveToBeginningOfDocument } },
+        { "MoveToBeginningOfDocumentAndModifySelection", { hasEditableSelection, execMoveToBeginningOfDocumentAndModifySelection } },
+        { "MoveToBeginningOfSentence", { hasEditableSelection, execMoveToBeginningOfSentence } },
+        { "MoveToBeginningOfSentenceAndModifySelection", { hasEditableSelection, execMoveToBeginningOfSentenceAndModifySelection } },
+        { "MoveToBeginningOfLine", { hasEditableSelection, execMoveToBeginningOfLine } },
+        { "MoveToBeginningOfLineAndModifySelection", { hasEditableSelection, execMoveToBeginningOfLineAndModifySelection } },
+        { "MoveToBeginningOfParagraph", { hasEditableSelection, execMoveToBeginningOfParagraph } },
+        { "MoveToBeginningOfLineAndModifySelection", { hasEditableSelection, execMoveToBeginningOfParagraphAndModifySelection } },
+        { "MoveToEndOfDocument", { hasEditableSelection, execMoveToEndOfDocument } },
+        { "MoveToEndOfDocumentAndModifySelection", { hasEditableSelection, execMoveToEndOfDocumentAndModifySelection } },
+        { "MoveToEndOfSentence", { hasEditableSelection, execMoveToEndOfSentence } },
+        { "MoveToEndOfSentenceAndModifySelection", { hasEditableSelection, execMoveToEndOfSentenceAndModifySelection } },
+        { "MoveToEndOfLine", { hasEditableSelection, execMoveToEndOfLine } },
+        { "MoveToEndOfLineAndModifySelection", { hasEditableSelection, execMoveToEndOfLineAndModifySelection } },
+        { "MoveToEndOfParagraph", { hasEditableSelection, execMoveToEndOfParagraph } },
+        { "MoveToEndOfLineAndModifySelection", { hasEditableSelection, execMoveToEndOfParagraphAndModifySelection } },
+        { "MoveParagraphBackwardAndModifySelection", { hasEditableSelection, execMoveParagraphBackwardAndModifySelection } },
+        { "MoveParagraphForwardAndModifySelection", { hasEditableSelection, execMoveParagraphForwardAndModifySelection } },
+        { "MoveUp", { hasEditableSelection, execMoveUp } },
+        { "MoveUpAndModifySelection", { hasEditableSelection, execMoveUpAndModifySelection } },
+        { "MoveWordBackward", { hasEditableSelection, execMoveWordBackward } },
+        { "MoveWordBackwardAndModifySelection", { hasEditableSelection, execMoveWordBackwardAndModifySelection } },
+        { "MoveWordForward", { hasEditableSelection, execMoveWordForward } },
+        { "MoveWordForwardAndModifySelection", { hasEditableSelection, execMoveWordForwardAndModifySelection } },
+        { "MoveWordLeft", { hasEditableSelection, execMoveWordLeft } },
+        { "MoveWordLeftAndModifySelection", { hasEditableSelection, execMoveWordLeftAndModifySelection } },
+        { "MoveWordRight", { hasEditableSelection, execMoveWordRight } },
+        { "MoveWordRightAndModifySelection", { hasEditableSelection, execMoveWordRightAndModifySelection } },
+        { "Paste", { canPaste, execPaste } },
+        { "SelectAll", { enabled, execSelectAll } },
+        { "ToggleBold", { hasRichlyEditableSelection, execToggleBold } },
+        { "ToggleItalic", { hasRichlyEditableSelection, execToggleItalic } }
     };
     
     CommandMap* commandMap = new CommandMap;
index 2e3fcf03e75d022c51bce901eee346a11a605bcb..8b861356044b0a4889266c8aa4eb86aa17755826 100644 (file)
@@ -95,9 +95,6 @@ public:
     void appliedEditing(PassRefPtr<EditCommand>);
     void unappliedEditing(PassRefPtr<EditCommand>);
     void reappliedEditing(PassRefPtr<EditCommand>);
-        
-    void toggleBold();
-    void toggleItalic();
     
     bool selectionStartHasStyle(CSSStyleDeclaration*) const;
     
index d8b071cdf667e27f3be3d6d27433a9915bf5ce4d..a088b1eb634ff1f980e05f544bcd48ff5c94f2a3 100644 (file)
@@ -335,11 +335,6 @@ Editor* Frame::editor() const
     return &d->m_editor;
 }
 
-CommandByName* Frame::command() const
-{
-    return &d->m_command;
-}
-
 TextGranularity Frame::selectionGranularity() const
 {
     return d->m_selectionGranularity;
@@ -1928,7 +1923,6 @@ FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, Element*
     , m_selectionController(thisFrame)
     , m_caretBlinkTimer(thisFrame, &Frame::caretBlinkTimerFired)
     , m_editor(thisFrame, client)
-    , m_command(thisFrame)
     , m_caretVisible(false)
     , m_caretPaint(true)
     , m_isActive(false)
index ec852a19288cc10acb8b3f4c865eed83d404948d..3844b6a20527315629a5ccdb240b59425e91dc8d 100644 (file)
@@ -115,7 +115,6 @@ public:
     Document* document() const;
     FrameView* view() const;
 
-    CommandByName* command() const;
     DOMWindow* domWindow() const;
     Editor* editor() const;
     FrameLoader* loader() const;
index dbbf92d32ea5bbc86a419083bbd036dfcdeb8b48..abf6e7cda364aee3b31415637518ca19a7810992 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef FramePrivate_h
 #define FramePrivate_h
 
-#include "CommandByName.h"
 #include "Editor.h"
 #include "FormData.h"
 #include "FrameTree.h"
@@ -76,7 +75,6 @@ namespace WebCore {
         Selection m_mark;
         Timer<Frame> m_caretBlinkTimer;
         Editor m_editor;
-        CommandByName m_command;
 
         bool m_caretVisible : 1;
         bool m_caretPaint : 1;
index 8465efc7656ec8a862ad24795a0dd1e53864cad6..55645d2f54428b06a18a6601ac03ba2994b8b0f1 100644 (file)
@@ -1,3 +1,14 @@
+2006-11-10  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Geoff.
+
+        Update for changes to WebCore
+        * WebView/WebHTMLView.m:
+        (-[NSArray _applyStyleToSelection:withUndoAction:]):
+        (-[NSArray _applyParagraphStyleToSelection:withUndoAction:]):
+        (-[NSArray _toggleBold]):
+        (-[NSArray _toggleItalic]):
+
 2006-11-09  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Maciej, Geoff.
index 912b9ccfd45c0d2064e53422554d3bc2c2fcc4d9..173c6cc806f9152f595d8c376eb0fa91f394411a 100644 (file)
                149C283308902B0F008A9EFC /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               DEBUG_INFORMATION_FORMAT = stabs;
                                GCC_C_LANGUAGE_STANDARD = gnu99;
                                GCC_ENABLE_CPP_EXCEPTIONS = NO;
                                GCC_ENABLE_CPP_RTTI = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                DEAD_CODE_STRIPPING = YES;
-                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               DEBUG_INFORMATION_FORMAT = stabs;
                                GCC_C_LANGUAGE_STANDARD = gnu99;
                                GCC_DEBUGGING_SYMBOLS = full;
                                GCC_ENABLE_CPP_EXCEPTIONS = NO;
index d41d6ee221d9fcf3fe9bc3bdabc51ff667b899e7..f3f586b22d9baa42d7af27989cf9f2f1ea94138f 100644 (file)
@@ -3982,30 +3982,26 @@ done:
 
 - (void)_applyStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction
 {
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
+    if (Frame* coreFrame = core([self _frame]))
         coreFrame->editor()->applyStyleToSelection(core(style), undoAction);
 }
 
 - (void)_applyParagraphStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction
 {
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
+    if (Frame* coreFrame = core([self _frame]))
         coreFrame->editor()->applyParagraphStyleToSelection(core(style), undoAction);
 }
 
 - (void)_toggleBold
 {
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->toggleBold();
+    if (Frame* coreFrame = core([self _frame]))
+        coreFrame->editor()->execCommand("ToggleBold");
 }
 
 - (void)_toggleItalic
 {
-    Frame* coreFrame = core([self _frame]);
-    if (coreFrame)
-        coreFrame->editor()->toggleItalic();
+    if (Frame* coreFrame = core([self _frame]))
+        coreFrame->editor()->execCommand("ToggleItalic");
 }
 
 - (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event