#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_selection_mode.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/focus_params.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/dom/text.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/frame_selection.h"
#include "third_party/blink/renderer/core/editing/iterators/character_iterator.h"
#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include "third_party/blink/renderer/core/editing/position.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/editing/set_selection_options.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h"
#include "third_party/blink/renderer/core/editing/text_affinity.h"
#include "third_party/blink/renderer/core/editing/visible_position.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_text_area_element.h"
#include "third_party/blink/renderer/core/html/forms/text_control_inner_elements.h"
#include "third_party/blink/renderer/core/html/html_br_element.h"
#include "third_party/blink/renderer/core/html/html_div_element.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
#include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/inline/fragment_items.h"
#include "third_party/blink/renderer/core/layout/inline/inline_cursor.h"
#include "third_party/blink/renderer/core/layout/inline/offset_mapping.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink {
namespace {
Position GetNextSoftBreak(const OffsetMapping& mapping, InlineCursor& cursor) { … }
}
TextControlElement::TextControlElement(const QualifiedName& tag_name,
Document& doc)
: … { … }
TextControlElement::~TextControlElement() = default;
bool TextControlElement::DispatchFocusEvent(
Element* old_focused_element,
mojom::blink::FocusType type,
InputDeviceCapabilities* source_capabilities) { … }
void TextControlElement::DispatchBlurEvent(
Element* new_focused_element,
mojom::blink::FocusType type,
InputDeviceCapabilities* source_capabilities) { … }
void TextControlElement::DefaultEventHandler(Event& event) { … }
void TextControlElement::ForwardEvent(Event& event) { … }
String TextControlElement::StrippedPlaceholder() const { … }
bool TextControlElement::PlaceholderShouldBeVisible() const { … }
HTMLElement* TextControlElement::PlaceholderElement() const { … }
void TextControlElement::UpdatePlaceholderVisibility() { … }
void TextControlElement::UpdatePlaceholderShadowPseudoId(
HTMLElement& placeholder) { … }
void TextControlElement::setSelectionStart(unsigned start) { … }
void TextControlElement::setSelectionEnd(unsigned end) { … }
void TextControlElement::setSelectionDirection(const String& direction) { … }
void TextControlElement::select() { … }
void TextControlElement::SetValueBeforeFirstUserEditIfNotSet() { … }
void TextControlElement::CheckIfValueWasReverted(const String& value) { … }
void TextControlElement::ClearValueBeforeFirstUserEdit() { … }
void TextControlElement::SetFocused(bool flag,
mojom::blink::FocusType focus_type) { … }
void TextControlElement::DispatchFormControlChangeEvent() { … }
void TextControlElement::EnqueueChangeEvent() { … }
void TextControlElement::setRangeText(const String& replacement,
ExceptionState& exception_state) { … }
void TextControlElement::setRangeText(const String& replacement,
unsigned start,
unsigned end,
const V8SelectionMode& selection_mode,
ExceptionState& exception_state) { … }
void TextControlElement::setSelectionRangeForBinding(
unsigned start,
unsigned end,
const String& direction_string) { … }
static Position PositionForIndex(HTMLElement* inner_editor, unsigned index) { … }
unsigned TextControlElement::IndexForPosition(HTMLElement* inner_editor,
const Position& passed_position) { … }
bool TextControlElement::ShouldApplySelectionCache() const { … }
bool TextControlElement::SetSelectionRange(
unsigned start,
unsigned end,
TextFieldSelectionDirection direction) { … }
bool TextControlElement::CacheSelection(unsigned start,
unsigned end,
TextFieldSelectionDirection direction) { … }
VisiblePosition TextControlElement::VisiblePositionForIndex(int index) const { … }
unsigned TextControlElement::selectionStart() const { … }
void TextControlElement::ComputeSelection(
uint32_t flags,
ComputedSelection& computed_selection) const { … }
unsigned TextControlElement::selectionEnd() const { … }
static const AtomicString& DirectionString(
TextFieldSelectionDirection direction) { … }
const AtomicString& TextControlElement::selectionDirection() const { … }
static inline void SetContainerAndOffsetForRange(Node* node,
int offset,
Node*& container_node,
int& offset_in_container) { … }
SelectionInDOMTree TextControlElement::Selection() const { … }
int TextControlElement::maxLength() const { … }
int TextControlElement::minLength() const { … }
void TextControlElement::setMaxLength(int new_value,
ExceptionState& exception_state) { … }
void TextControlElement::setMinLength(int new_value,
ExceptionState& exception_state) { … }
void TextControlElement::RestoreCachedSelection() { … }
void TextControlElement::SelectionChanged(bool user_triggered) { … }
void TextControlElement::ScheduleSelectEvent() { … }
void TextControlElement::ScheduleSelectionchangeEventOnThisOrDocument() { … }
void TextControlElement::ParseAttribute(
const AttributeModificationParams& params) { … }
void TextControlElement::DisabledOrReadonlyAttributeChanged(
const QualifiedName& attr) { … }
bool TextControlElement::LastChangeWasUserEdit() const { … }
Node* TextControlElement::CreatePlaceholderBreakElement() const { … }
void TextControlElement::AddPlaceholderBreakElementIfNecessary() { … }
void TextControlElement::SetInnerEditorValue(const String& value) { … }
String TextControlElement::InnerEditorValue() const { … }
String TextControlElement::ValueWithHardLineBreaks() const { … }
TextControlElement* EnclosingTextControl(const Position& position) { … }
TextControlElement* EnclosingTextControl(const PositionInFlatTree& position) { … }
TextControlElement* EnclosingTextControl(const Node* container) { … }
String TextControlElement::DirectionForFormData() const { … }
void TextControlElement::SetAutofillValue(const String& value,
WebAutofillState autofill_state) { … }
void TextControlElement::SetSuggestedValue(const String& value) { … }
HTMLElement* TextControlElement::CreateInnerEditorElement() { … }
const String& TextControlElement::SuggestedValue() const { … }
void TextControlElement::ScheduleSelectionchangeEvent() { … }
void TextControlElement::Trace(Visitor* visitor) const { … }
void TextControlElement::CloneNonAttributePropertiesFrom(
const Element& source,
NodeCloningData& data) { … }
ETextOverflow TextControlElement::ValueForTextOverflow() const { … }
}