summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/EditorCommands.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /editor/libeditor/EditorCommands.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editor/libeditor/EditorCommands.cpp')
-rw-r--r--editor/libeditor/EditorCommands.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/editor/libeditor/EditorCommands.cpp b/editor/libeditor/EditorCommands.cpp
index beb4f060ad..45f9e3198f 100644
--- a/editor/libeditor/EditorCommands.cpp
+++ b/editor/libeditor/EditorCommands.cpp
@@ -269,7 +269,8 @@ bool UndoCommand::IsCommandEnabled(Command aCommand,
if (!aEditorBase) {
return false;
}
- return aEditorBase->IsSelectionEditable() && aEditorBase->CanUndo();
+ return aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable() &&
+ aEditorBase->CanUndo();
}
nsresult UndoCommand::DoCommand(Command aCommand, EditorBase& aEditorBase,
@@ -297,7 +298,8 @@ bool RedoCommand::IsCommandEnabled(Command aCommand,
if (!aEditorBase) {
return false;
}
- return aEditorBase->IsSelectionEditable() && aEditorBase->CanRedo();
+ return aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable() &&
+ aEditorBase->CanRedo();
}
nsresult RedoCommand::DoCommand(Command aCommand, EditorBase& aEditorBase,
@@ -548,7 +550,7 @@ bool SwitchTextDirectionCommand::IsCommandEnabled(
if (!aEditorBase) {
return false;
}
- return aEditorBase->IsSelectionEditable();
+ return aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable();
}
nsresult SwitchTextDirectionCommand::DoCommand(Command aCommand,
@@ -581,7 +583,8 @@ bool DeleteCommand::IsCommandEnabled(Command aCommand,
// We can generally delete whenever the selection is editable. However,
// cmd_delete doesn't make sense if the selection is collapsed because it's
// directionless.
- bool isEnabled = aEditorBase->IsSelectionEditable();
+ bool isEnabled =
+ aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable();
if (aCommand == Command::Delete && isEnabled) {
return aEditorBase->CanDeleteSelection();
@@ -820,7 +823,7 @@ bool InsertPlaintextCommand::IsCommandEnabled(Command aCommand,
if (!aEditorBase) {
return false;
}
- return aEditorBase->IsSelectionEditable();
+ return aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable();
}
nsresult InsertPlaintextCommand::DoCommand(Command aCommand,
@@ -877,7 +880,7 @@ bool InsertParagraphCommand::IsCommandEnabled(Command aCommand,
if (!aEditorBase || aEditorBase->IsSingleLineEditor()) {
return false;
}
- return aEditorBase->IsSelectionEditable();
+ return aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable();
}
nsresult InsertParagraphCommand::DoCommand(Command aCommand,
@@ -918,7 +921,7 @@ bool InsertLineBreakCommand::IsCommandEnabled(Command aCommand,
if (!aEditorBase || aEditorBase->IsSingleLineEditor()) {
return false;
}
- return aEditorBase->IsSelectionEditable();
+ return aEditorBase->IsModifiable() && aEditorBase->IsSelectionEditable();
}
nsresult InsertLineBreakCommand::DoCommand(Command aCommand,