diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /editor/libeditor/EditorCommands.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/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.cpp | 17 |
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, |