#include "third_party/blink/renderer/core/editing/commands/typing_command.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
#include "third_party/blink/renderer/core/editing/commands/break_blockquote_command.h"
#include "third_party/blink/renderer/core/editing/commands/delete_selection_command.h"
#include "third_party/blink/renderer/core/editing/commands/delete_selection_options.h"
#include "third_party/blink/renderer/core/editing/commands/editing_commands_utilities.h"
#include "third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.h"
#include "third_party/blink/renderer/core/editing/commands/insert_line_break_command.h"
#include "third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.h"
#include "third_party/blink/renderer/core/editing/commands/insert_text_command.h"
#include "third_party/blink/renderer/core/editing/editing_behavior.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/ime/input_method_controller.h"
#include "third_party/blink/renderer/core/editing/plain_text_range.h"
#include "third_party/blink/renderer/core/editing/selection_modifier.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/visible_position.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
#include "third_party/blink/renderer/core/editing/visible_units.h"
#include "third_party/blink/renderer/core/events/before_text_inserted_event.h"
#include "third_party/blink/renderer/core/events/text_event.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/html_br_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
namespace blink {
namespace {
bool IsValidDocument(const Document& document) { … }
String DispatchBeforeTextInsertedEvent(const String& text,
const SelectionInDOMTree& selection,
EditingState* editing_state) { … }
DispatchEventResult DispatchTextInputEvent(LocalFrame* frame,
const String& text,
EditingState* editing_state) { … }
PlainTextRange GetSelectionOffsets(const SelectionInDOMTree& selection) { … }
SelectionInDOMTree CreateSelection(const wtf_size_t start,
const wtf_size_t end,
Element* element) { … }
bool CanAppendNewLineFeedToSelection(const SelectionInDOMTree& selection,
EditingState* editing_state) { … }
Position AfterBlockIfBeforeAnonymousPlaceholder(const Position& position) { … }
}
TypingCommand::TypingCommand(Document& document,
CommandType command_type,
const String& text_to_insert,
Options options,
TextGranularity granularity,
TextCompositionType composition_type)
: … { … }
void TypingCommand::DeleteSelection(Document& document, Options options) { … }
void TypingCommand::DeleteSelectionIfRange(
const SelectionForUndoStep& selection,
EditingState* editing_state) { … }
void TypingCommand::DeleteKeyPressed(Document& document,
Options options,
TextGranularity granularity) { … }
void TypingCommand::ForwardDeleteKeyPressed(Document& document,
EditingState* editing_state,
Options options,
TextGranularity granularity) { … }
String TypingCommand::TextDataForInputEvent() const { … }
void TypingCommand::UpdateSelectionIfDifferentFromCurrentSelection(
TypingCommand* typing_command,
LocalFrame* frame) { … }
void TypingCommand::InsertText(Document& document,
const String& text,
Options options,
TextCompositionType composition,
const bool is_incremental_insertion) { … }
void TypingCommand::AdjustSelectionAfterIncrementalInsertion(
LocalFrame* frame,
const wtf_size_t selection_start,
const wtf_size_t text_length,
EditingState* editing_state) { … }
void TypingCommand::InsertText(
Document& document,
const String& text,
const SelectionInDOMTree& passed_selection_for_insertion,
Options options,
EditingState* editing_state,
TextCompositionType composition_type,
const bool is_incremental_insertion,
InputEvent::InputType input_type) { … }
bool TypingCommand::InsertLineBreak(Document& document) { … }
bool TypingCommand::InsertParagraphSeparatorInQuotedContent(
Document& document) { … }
bool TypingCommand::InsertParagraphSeparator(Document& document) { … }
TypingCommand* TypingCommand::LastTypingCommandIfStillOpenForTyping(
LocalFrame* frame) { … }
void TypingCommand::CloseTyping(LocalFrame* frame) { … }
void TypingCommand::CloseTypingIfNeeded(LocalFrame* frame) { … }
void TypingCommand::DoApply(EditingState* editing_state) { … }
InputEvent::InputType TypingCommand::GetInputType() const { … }
void TypingCommand::TypingAddedToOpenCommand(
CommandType command_type_for_added_typing) { … }
void TypingCommand::InsertTextInternal(const String& text,
bool select_inserted_text,
EditingState* editing_state) { … }
void TypingCommand::InsertTextRunWithoutNewlines(const String& text,
EditingState* editing_state) { … }
void TypingCommand::InsertLineBreak(EditingState* editing_state) { … }
void TypingCommand::InsertParagraphSeparator(EditingState* editing_state) { … }
void TypingCommand::InsertParagraphSeparatorInQuotedContent(
EditingState* editing_state) { … }
bool TypingCommand::MakeEditableRootEmpty(EditingState* editing_state) { … }
static SelectionForUndoStep AdjustSelectionForBackwardDelete(
const SelectionInDOMTree& selection) { … }
void TypingCommand::DeleteKeyPressed(TextGranularity granularity,
bool kill_ring,
EditingState* editing_state) { … }
void TypingCommand::DeleteKeyPressedInternal(
const SelectionForUndoStep& selection_to_delete,
const SelectionForUndoStep& selection_after_undo,
bool kill_ring,
EditingState* editing_state) { … }
static Position ComputeExtentForForwardDeleteUndo(
const VisibleSelection& selection,
const Position& extent) { … }
void TypingCommand::ForwardDeleteKeyPressed(TextGranularity granularity,
bool kill_ring,
EditingState* editing_state) { … }
void TypingCommand::ForwardDeleteKeyPressedInternal(
const SelectionForUndoStep& selection_to_delete,
const SelectionForUndoStep& selection_after_undo,
bool kill_ring,
EditingState* editing_state) { … }
void TypingCommand::DeleteSelection(bool smart_delete,
EditingState* editing_state) { … }
void TypingCommand::UpdatePreservesTypingStyle(CommandType command_type) { … }
bool TypingCommand::IsTypingCommand() const { … }
}