diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/libeditor/HTMLEditor.cpp | 9 | ||||
-rw-r--r-- | editor/libeditor/TextEditor.cpp | 10 |
2 files changed, 4 insertions, 15 deletions
diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index 6a630cb1c4..130b033bd1 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -664,8 +664,7 @@ HTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) return TypedText(NS_LITERAL_STRING("\t"), eTypedText); } case NS_VK_RETURN: - if (nativeKeyEvent->IsControl() || nativeKeyEvent->IsAlt() || - nativeKeyEvent->IsMeta() || nativeKeyEvent->IsOS()) { + if (!nativeKeyEvent->IsInputtingLineBreak()) { return NS_OK; } aKeyEvent->AsEvent()->PreventDefault(); // consumed @@ -677,11 +676,7 @@ HTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) return TypedText(EmptyString(), eTypedBreak); } - // NOTE: On some keyboard layout, some characters are inputted with Control - // key or Alt key, but at that time, widget sets FALSE to these keys. - if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() || - nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() || - nativeKeyEvent->IsOS()) { + if (!nativeKeyEvent->IsInputtingText()) { // we don't PreventDefault() here or keybindings like control-x won't work return NS_OK; } diff --git a/editor/libeditor/TextEditor.cpp b/editor/libeditor/TextEditor.cpp index 3bee7843ce..4b26eff9cd 100644 --- a/editor/libeditor/TextEditor.cpp +++ b/editor/libeditor/TextEditor.cpp @@ -397,20 +397,14 @@ TextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) return TypedText(NS_LITERAL_STRING("\t"), eTypedText); } case NS_VK_RETURN: - if (IsSingleLineEditor() || nativeKeyEvent->IsControl() || - nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() || - nativeKeyEvent->IsOS()) { + if (IsSingleLineEditor() || !nativeKeyEvent->IsInputtingLineBreak()) { return NS_OK; } aKeyEvent->AsEvent()->PreventDefault(); return TypedText(EmptyString(), eTypedBreak); } - // NOTE: On some keyboard layout, some characters are inputted with Control - // key or Alt key, but at that time, widget sets FALSE to these keys. - if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() || - nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() || - nativeKeyEvent->IsOS()) { + if (!nativeKeyEvent->IsInputtingText()) { // we don't PreventDefault() here or keybindings like control-x won't work return NS_OK; } |