mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 23:30:46 +00:00
Bug 1540037 - part 26: Get rid of TextEditor::Copy()
r=m_kato
It's common method of `TextEditor` and `HTMLEditor`, but implemented by `TextEditor` even though it's an override of `nsIEditor`'s method. Therefore, it should be implemented in `EditorBase` instead. Differential Revision: https://phabricator.services.mozilla.com/D115794
This commit is contained in:
parent
98b26adadd
commit
85cc2d756b
@ -1564,7 +1564,18 @@ bool EditorBase::IsCutCommandEnabled() const {
|
||||
return CheckForClipboardCommandListener(nsGkAtoms::oncut, eCut);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditorBase::Copy() { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHODIMP EditorBase::Copy() {
|
||||
AutoEditActionDataSetter editActionData(*this, EditAction::eCopy);
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
bool actionTaken = false;
|
||||
FireClipboardEvent(eCopy, nsIClipboard::kGlobalClipboard, &actionTaken);
|
||||
|
||||
return EditorBase::ToGenericNSResult(
|
||||
actionTaken ? NS_OK : NS_ERROR_EDITOR_ACTION_CANCELED);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP EditorBase::CanCopy(bool* aCanCopy) {
|
||||
if (NS_WARN_IF(!aCanCopy)) {
|
||||
|
@ -595,19 +595,6 @@ bool TextEditor::IsCopyToClipboardAllowedInternal() const {
|
||||
return mUnmaskedStart <= selectionStart && UnmaskedEnd() >= selectionEnd;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TextEditor::Copy() {
|
||||
AutoEditActionDataSetter editActionData(*this, EditAction::eCopy);
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
bool actionTaken = false;
|
||||
FireClipboardEvent(eCopy, nsIClipboard::kGlobalClipboard, &actionTaken);
|
||||
|
||||
return EditorBase::ToGenericNSResult(
|
||||
actionTaken ? NS_OK : NS_ERROR_EDITOR_ACTION_CANCELED);
|
||||
}
|
||||
|
||||
bool TextEditor::CanDeleteSelection() const {
|
||||
AutoEditActionDataSetter editActionData(*this, EditAction::eNotEditing);
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
|
@ -61,8 +61,6 @@ class TextEditor : public EditorBase, public nsITimerCallback, public nsINamed {
|
||||
|
||||
NS_IMETHOD GetTextLength(int32_t* aCount) override;
|
||||
|
||||
NS_IMETHOD Copy() override;
|
||||
|
||||
/**
|
||||
* CanDeleteSelection() returns true if `Selection` is not collapsed and
|
||||
* it's allowed to be removed.
|
||||
|
Loading…
x
Reference in New Issue
Block a user