diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/editing/EditorCommand.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/editing/EditorCommand.cpp')
-rw-r--r-- | Source/WebCore/editing/EditorCommand.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp index 8ea37bb..290ee47 100644 --- a/Source/WebCore/editing/EditorCommand.cpp +++ b/Source/WebCore/editing/EditorCommand.cpp @@ -318,7 +318,7 @@ static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, cons case CommandFromDOMWithUserInterface: // If the current selection is a caret, delete the preceding character. IE performs forwardDelete, but we currently side with Firefox. // Doesn't scroll to make the selection visible, or modify the kill ring (this time, siding with IE, not Firefox). - TypingCommand::deleteKeyPressed(frame->document(), frame->selection()->granularity() == WordGranularity); + TypingCommand::deleteKeyPressed(frame->document(), frame->selection()->granularity() == WordGranularity ? TypingCommand::SmartDelete : 0); return true; } ASSERT_NOT_REACHED(); @@ -1196,27 +1196,27 @@ static bool enabledCut(Frame* frame, Event*, EditorCommandSource) return frame->editor()->canDHTMLCut() || frame->editor()->canCut(); } +static bool enabledInEditableText(Frame* frame, Event* event, EditorCommandSource) +{ + return frame->editor()->selectionForCommand(event).rootEditableElement(); +} + static bool enabledDelete(Frame* frame, Event* event, EditorCommandSource source) { switch (source) { case CommandFromMenuOrKeyBinding: // "Delete" from menu only affects selected range, just like Cut but without affecting pasteboard - return frame->editor()->canDHTMLCut() || frame->editor()->canCut(); + return enabledCut(frame, event, source); case CommandFromDOM: case CommandFromDOMWithUserInterface: // "Delete" from DOM is like delete/backspace keypress, affects selected range if non-empty, // otherwise removes a character - return frame->editor()->selectionForCommand(event).isContentEditable(); + return enabledInEditableText(frame, event, source); } ASSERT_NOT_REACHED(); return false; } -static bool enabledInEditableText(Frame* frame, Event* event, EditorCommandSource) -{ - return frame->editor()->selectionForCommand(event).isContentEditable(); -} - static bool enabledInEditableTextOrCaretBrowsing(Frame* frame, Event* event, EditorCommandSource) { // The EditorCommandSource parameter is unused in enabledInEditableText, so just pass a dummy variable @@ -1225,7 +1225,7 @@ static bool enabledInEditableTextOrCaretBrowsing(Frame* frame, Event* event, Edi static bool enabledInRichlyEditableText(Frame* frame, Event*, EditorCommandSource) { - return frame->selection()->isCaretOrRange() && frame->selection()->isContentRichlyEditable(); + return frame->selection()->isCaretOrRange() && frame->selection()->isContentRichlyEditable() && frame->selection()->rootEditableElement(); } static bool enabledPaste(Frame* frame, Event*, EditorCommandSource) |