From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- editor/libeditor/TextEditor.h | 614 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 614 insertions(+) create mode 100644 editor/libeditor/TextEditor.h (limited to 'editor/libeditor/TextEditor.h') diff --git a/editor/libeditor/TextEditor.h b/editor/libeditor/TextEditor.h new file mode 100644 index 0000000000..77df2dabba --- /dev/null +++ b/editor/libeditor/TextEditor.h @@ -0,0 +1,614 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_TextEditor_h +#define mozilla_TextEditor_h + +#include "mozilla/EditorBase.h" +#include "mozilla/EditorForwards.h" +#include "mozilla/TextControlState.h" +#include "mozilla/UniquePtr.h" + +#include "nsCOMPtr.h" +#include "nsCycleCollectionParticipant.h" +#include "nsINamed.h" +#include "nsISupportsImpl.h" +#include "nsITimer.h" +#include "nscore.h" + +class nsIContent; +class nsIDocumentEncoder; +class nsIOutputStream; +class nsIPrincipal; +class nsISelectionController; +class nsITransferable; + +namespace mozilla { +namespace dom { +class Selection; +} // namespace dom + +/** + * The text editor implementation. + * Use to edit text document represented as a DOM tree. + */ +class TextEditor final : public EditorBase, + public nsITimerCallback, + public nsINamed { + public: + /**************************************************************************** + * NOTE: DO NOT MAKE YOUR NEW METHODS PUBLIC IF they are called by other + * classes under libeditor except EditorEventListener and + * HTMLEditorEventListener because each public method which may fire + * eEditorInput event will need to instantiate new stack class for + * managing input type value of eEditorInput and cache some objects + * for smarter handling. In other words, when you add new root + * method to edit the DOM tree, you can make your new method public. + ****************************************************************************/ + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextEditor, EditorBase) + + TextEditor(); + + /** + * Note that TextEditor::Init() shouldn't cause running script synchronously. + * So, `MOZ_CAN_RUN_SCRIPT_BOUNDARY` is safe here. + * + * @param aDocument The document which aAnonymousDivElement belongs to. + * @param aAnonymousDivElement + * The root editable element for this editor. + * @param aSelectionController + * The selection controller for independent selections + * in the `` or `