Commit 68c7c11c authored by enrica@apple.com's avatar enrica@apple.com

REGRESSION: Can't enter pasted with context or Edit menu text in search or...

REGRESSION: Can't enter pasted with context or Edit menu text in search or address field in the browser.
https://bugs.webkit.org/show_bug.cgi?id=57275
<rdar://problem/8246691>

Reviewed by Sam Weinig.

We need to classify cut and paste actions as user typing actions even when
the action is triggered by a context menu selection to
allow the propagation of the textDidChangeInTextField event.

* editing/EditorCommand.cpp:
The following methods have been modified to properly set up
the UserTypingGestureAction when the command source is the
menu or a key binding sequence.
(WebCore::executeCut):
(WebCore::executePaste):
(WebCore::executePasteAndMatchStyle):
(WebCore::executePasteAsPlainText):
(WebCore::executeDelete):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Changed to
call execute command instead of referring to the specific method in
the editor class.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@82176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 137ced7f
2011-03-28 Enrica Casucci <enrica@apple.com>
Reviewed by Sam Weinig.
REGRESSION: Can't enter pasted with context or Edit menu text in search or address field in the browser.
https://bugs.webkit.org/show_bug.cgi?id=57275
<rdar://problem/8246691>
We need to classify cut and paste actions as user typing actions even when
the action is triggered by a context menu selection to
allow the propagation of the textDidChangeInTextField event.
* editing/EditorCommand.cpp:
The following methods have been modified to properly set up
the UserTypingGestureAction when the command source is the
menu or a key binding sequence.
(WebCore::executeCut):
(WebCore::executePaste):
(WebCore::executePasteAndMatchStyle):
(WebCore::executePasteAsPlainText):
(WebCore::executeDelete):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Changed to
call execute command instead of referring to the specific method in
the editor class.
2011-03-28 Oliver Hunt <oliver@apple.com>
Reviewed by Geoffrey Garen.
......@@ -56,6 +56,7 @@
#include "Sound.h"
#include "TypingCommand.h"
#include "UnlinkCommand.h"
#include "UserTypingGestureIndicator.h"
#include "htmlediting.h"
#include "markup.h"
#include <wtf/text/AtomicString.h>
......@@ -294,19 +295,25 @@ static bool executeCreateLink(Frame* frame, Event*, EditorCommandSource, const S
return true;
}
static bool executeCut(Frame* frame, Event*, EditorCommandSource, const String&)
static bool executeCut(Frame* frame, Event*, EditorCommandSource source, const String&)
{
frame->editor()->cut();
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
frame->editor()->cut();
} else
frame->editor()->cut();
return true;
}
static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, const String&)
{
switch (source) {
case CommandFromMenuOrKeyBinding:
case CommandFromMenuOrKeyBinding: {
// Doesn't modify the text if the current selection isn't a range.
UserTypingGestureIndicator typingGestureIndicator(frame);
frame->editor()->performDelete();
return true;
}
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
// If the current selection is a caret, delete the preceding character. IE performs forwardDelete, but we currently side with Firefox.
......@@ -883,21 +890,33 @@ static bool executeOutdent(Frame* frame, Event*, EditorCommandSource, const Stri
return true;
}
static bool executePaste(Frame* frame, Event*, EditorCommandSource, const String&)
static bool executePaste(Frame* frame, Event*, EditorCommandSource source, const String&)
{
frame->editor()->paste();
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
frame->editor()->paste();
} else
frame->editor()->paste();
return true;
}
static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource, const String&)
static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource source, const String&)
{
frame->editor()->pasteAsPlainText();
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
frame->editor()->pasteAsPlainText();
} else
frame->editor()->pasteAsPlainText();
return true;
}
static bool executePasteAsPlainText(Frame* frame, Event*, EditorCommandSource, const String&)
static bool executePasteAsPlainText(Frame* frame, Event*, EditorCommandSource source, const String&)
{
frame->editor()->pasteAsPlainText();
if (source == CommandFromMenuOrKeyBinding) {
UserTypingGestureIndicator typingGestureIndicator(frame);
frame->editor()->pasteAsPlainText();
} else
frame->editor()->pasteAsPlainText();
return true;
}
......
......@@ -63,6 +63,7 @@
#include "SelectionController.h"
#include "Settings.h"
#include "TextIterator.h"
#include "UserTypingGestureIndicator.h"
#include "WindowFeatures.h"
#include "markup.h"
#include <wtf/unicode/Unicode.h>
......@@ -259,10 +260,10 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
frame->loader()->reload();
break;
case ContextMenuItemTagCut:
frame->editor()->cut();
frame->editor()->command("Cut").execute();
break;
case ContextMenuItemTagPaste:
frame->editor()->paste();
frame->editor()->command("Paste").execute();
break;
#if PLATFORM(GTK)
case ContextMenuItemTagDelete:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment