#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/choosers/date_time_chooser.mojom-blink.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
#include "third_party/blink/public/mojom/scroll/scroll_into_view_params.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_focus_options.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/css_property_names.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/dom_token_list.h"
#include "third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h"
#include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
#include "third_party/blink/renderer/core/dom/events/simulated_click_options.h"
#include "third_party/blink/renderer/core/dom/id_target_observer.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/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.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/keyboard_event.h"
#include "third_party/blink/renderer/core/events/mouse_event.h"
#include "third_party/blink/renderer/core/fileapi/file_list.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/html/forms/color_chooser.h"
#include "third_party/blink/renderer/core/html/forms/date_time_chooser.h"
#include "third_party/blink/renderer/core/html/forms/email_input_type.h"
#include "third_party/blink/renderer/core/html/forms/file_input_type.h"
#include "third_party/blink/renderer/core/html/forms/form_controller.h"
#include "third_party/blink/renderer/core/html/forms/html_data_list_element.h"
#include "third_party/blink/renderer/core/html/forms/html_data_list_options_collection.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_option_element.h"
#include "third_party/blink/renderer/core/html/forms/input_type.h"
#include "third_party/blink/renderer/core/html/forms/radio_button_group_scope.h"
#include "third_party/blink/renderer/core/html/forms/search_input_type.h"
#include "third_party/blink/renderer/core/html/forms/text_input_type.h"
#include "third_party/blink/renderer/core/html/html_collection.h"
#include "third_party/blink/renderer/core/html/html_image_loader.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/keywords.h"
#include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/layout/layout_theme_font_provider.h"
#include "third_party/blink/renderer/core/page/chrome_client.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/core/scroll/scroll_into_view_util.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/language.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/text/platform_locale.h"
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "ui/base/ui_base_features.h"
namespace blink {
FormControlType;
namespace {
const unsigned kMaxEmailFieldLength = …;
const unsigned kMinStrongPasswordLabelWidth = …;
static bool is_default_font_prewarmed_ = …;
}
ValueMode;
class ListAttributeTargetObserver : public IdTargetObserver { … };
const int kDefaultSize = …;
HTMLInputElement::HTMLInputElement(Document& document,
const CreateElementFlags flags)
: … { … }
void HTMLInputElement::Trace(Visitor* visitor) const { … }
bool HTMLInputElement::HasPendingActivity() const { … }
HTMLImageLoader& HTMLInputElement::EnsureImageLoader() { … }
HTMLInputElement::~HTMLInputElement() = default;
const AtomicString& HTMLInputElement::GetName() const { … }
Vector<String> HTMLInputElement::FilesFromFileInputFormControlState(
const FormControlState& state) { … }
bool HTMLInputElement::ShouldAutocomplete() const { … }
bool HTMLInputElement::IsValidValue(const String& value) const { … }
bool HTMLInputElement::TooLong() const { … }
bool HTMLInputElement::TooShort() const { … }
bool HTMLInputElement::TypeMismatch() const { … }
bool HTMLInputElement::ValueMissing() const { … }
bool HTMLInputElement::HasBadInput() const { … }
bool HTMLInputElement::PatternMismatch() const { … }
bool HTMLInputElement::TooLong(const String& value,
NeedsToCheckDirtyFlag check) const { … }
bool HTMLInputElement::TooShort(const String& value,
NeedsToCheckDirtyFlag check) const { … }
bool HTMLInputElement::RangeUnderflow() const { … }
bool HTMLInputElement::RangeOverflow() const { … }
String HTMLInputElement::validationMessage() const { … }
String HTMLInputElement::ValidationSubMessage() const { … }
double HTMLInputElement::Minimum() const { … }
double HTMLInputElement::Maximum() const { … }
bool HTMLInputElement::StepMismatch() const { … }
bool HTMLInputElement::GetAllowedValueStep(Decimal* step) const { … }
StepRange HTMLInputElement::CreateStepRange(
AnyStepHandling any_step_handling) const { … }
Decimal HTMLInputElement::FindClosestTickMarkValue(const Decimal& value) { … }
void HTMLInputElement::stepUp(int n, ExceptionState& exception_state) { … }
void HTMLInputElement::stepDown(int n, ExceptionState& exception_state) { … }
void HTMLInputElement::blur() { … }
void HTMLInputElement::DefaultBlur() { … }
bool HTMLInputElement::HasCustomFocusLogic() const { … }
bool HTMLInputElement::IsKeyboardFocusable(
UpdateBehavior update_behavior) const { … }
bool HTMLInputElement::MayTriggerVirtualKeyboard() const { … }
bool HTMLInputElement::ShouldHaveFocusAppearance() const { … }
void HTMLInputElement::UpdateSelectionOnFocus(
SelectionBehaviorOnFocus selection_behavior,
const FocusOptions* options) { … }
void HTMLInputElement::EndEditing() { … }
void HTMLInputElement::DispatchFocusInEvent(
const AtomicString& event_type,
Element* old_focused_element,
mojom::blink::FocusType type,
InputDeviceCapabilities* source_capabilities) { … }
void HTMLInputElement::HandleBlurEvent() { … }
void HTMLInputElement::setType(const AtomicString& type) { … }
void HTMLInputElement::InitializeTypeInParsing() { … }
void HTMLInputElement::UpdateType(const AtomicString& type_attribute_value) { … }
void HTMLInputElement::SubtreeHasChanged() { … }
FormControlType HTMLInputElement::FormControlType() const { … }
const AtomicString& HTMLInputElement::FormControlTypeAsString() const { … }
bool HTMLInputElement::ShouldSaveAndRestoreFormControlState() const { … }
FormControlState HTMLInputElement::SaveFormControlState() const { … }
void HTMLInputElement::RestoreFormControlState(const FormControlState& state) { … }
bool HTMLInputElement::CanStartSelection() const { … }
std::optional<uint32_t> HTMLInputElement::selectionStartForBinding(
ExceptionState& exception_state) const { … }
std::optional<uint32_t> HTMLInputElement::selectionEndForBinding(
ExceptionState& exception_state) const { … }
String HTMLInputElement::selectionDirectionForBinding(
ExceptionState& exception_state) const { … }
void HTMLInputElement::setSelectionStartForBinding(
std::optional<uint32_t> start,
ExceptionState& exception_state) { … }
void HTMLInputElement::setSelectionEndForBinding(
std::optional<uint32_t> end,
ExceptionState& exception_state) { … }
void HTMLInputElement::setSelectionDirectionForBinding(
const String& direction,
ExceptionState& exception_state) { … }
void HTMLInputElement::setSelectionRangeForBinding(
unsigned start,
unsigned end,
ExceptionState& exception_state) { … }
void HTMLInputElement::setSelectionRangeForBinding(
unsigned start,
unsigned end,
const String& direction,
ExceptionState& exception_state) { … }
void HTMLInputElement::SetSelectionRangeForTesting(
unsigned start,
unsigned end,
ExceptionState& exception_state) { … }
void HTMLInputElement::AccessKeyAction(
SimulatedClickCreationScope creation_scope) { … }
bool HTMLInputElement::IsPresentationAttribute(
const QualifiedName& name) const { … }
void HTMLInputElement::CollectStyleForPresentationAttribute(
const QualifiedName& name,
const AtomicString& value,
MutableCSSPropertyValueSet* style) { … }
void HTMLInputElement::DidRecalcStyle(const StyleRecalcChange change) { … }
void HTMLInputElement::ParseAttribute(
const AttributeModificationParams& params) { … }
void HTMLInputElement::ParserDidSetAttributes() { … }
void HTMLInputElement::FinishParsingChildren() { … }
bool HTMLInputElement::LayoutObjectIsNeeded(const DisplayStyle& style) const { … }
LayoutObject* HTMLInputElement::CreateLayoutObject(const ComputedStyle& style) { … }
void HTMLInputElement::AttachLayoutTree(AttachContext& context) { … }
void HTMLInputElement::DetachLayoutTree(bool performing_reattach) { … }
String HTMLInputElement::AltText() const { … }
bool HTMLInputElement::CanBeSuccessfulSubmitButton() const { … }
bool HTMLInputElement::IsActivatedSubmit() const { … }
void HTMLInputElement::SetActivatedSubmit(bool flag) { … }
void HTMLInputElement::AppendToFormData(FormData& form_data) { … }
String HTMLInputElement::ResultForDialogSubmit() { … }
void HTMLInputElement::ResetImpl() { … }
bool HTMLInputElement::IsTextField() const { … }
bool HTMLInputElement::IsTelephone() const { … }
bool HTMLInputElement::IsAutoDirectionalityFormAssociated() const { … }
bool HTMLInputElement::HasBeenPasswordField() const { … }
void HTMLInputElement::DispatchChangeEventIfNeeded() { … }
void HTMLInputElement::DispatchInputAndChangeEventIfNeeded() { … }
bool HTMLInputElement::IsCheckable() const { … }
bool HTMLInputElement::Checked() const { … }
void HTMLInputElement::setCheckedForBinding(bool now_checked) { … }
void HTMLInputElement::SetChecked(bool now_checked,
TextFieldEventBehavior event_behavior,
WebAutofillState autofill_state) { … }
void HTMLInputElement::setIndeterminate(bool new_value) { … }
unsigned HTMLInputElement::size() const { … }
bool HTMLInputElement::SizeShouldIncludeDecoration(int& preferred_size) const { … }
void HTMLInputElement::CloneNonAttributePropertiesFrom(const Element& source,
NodeCloningData& data) { … }
String HTMLInputElement::Value() const { … }
String HTMLInputElement::ValueOrDefaultLabel() const { … }
void HTMLInputElement::SetValueForUser(const String& value) { … }
void HTMLInputElement::SetSuggestedValue(const String& value) { … }
void HTMLInputElement::SetInnerEditorValue(const String& value) { … }
void HTMLInputElement::setValueForBinding(const String& value,
ExceptionState& exception_state) { … }
void HTMLInputElement::SetValue(const String& value,
TextFieldEventBehavior event_behavior,
TextControlSetValueSelection selection,
WebAutofillState autofill_state) { … }
void HTMLInputElement::SetNonAttributeValue(const String& sanitized_value) { … }
void HTMLInputElement::SetNonAttributeValueByUserEdit(
const String& sanitized_value) { … }
void HTMLInputElement::SetNonDirtyValue(const String& new_value) { … }
bool HTMLInputElement::HasDirtyValue() const { … }
void HTMLInputElement::UpdateView() { … }
ScriptValue HTMLInputElement::valueAsDate(ScriptState* script_state) const { … }
void HTMLInputElement::setValueAsDate(ScriptState* script_state,
const ScriptValue& value,
ExceptionState& exception_state) { … }
double HTMLInputElement::valueAsNumber() const { … }
void HTMLInputElement::setValueAsNumber(double new_value,
ExceptionState& exception_state,
TextFieldEventBehavior event_behavior) { … }
Decimal HTMLInputElement::RatioValue() const { … }
void HTMLInputElement::SetValueFromRenderer(const String& value) { … }
EventDispatchHandlingState* HTMLInputElement::PreDispatchEventHandler(
Event& event) { … }
void HTMLInputElement::PostDispatchEventHandler(
Event& event,
EventDispatchHandlingState* state) { … }
void HTMLInputElement::DefaultEventHandler(Event& evt) { … }
ShadowRoot* HTMLInputElement::EnsureShadowSubtree() { … }
bool HTMLInputElement::HasActivationBehavior() const { … }
bool HTMLInputElement::WillRespondToMouseClickEvents() { … }
bool HTMLInputElement::IsURLAttribute(const Attribute& attribute) const { … }
bool HTMLInputElement::HasLegalLinkAttribute(const QualifiedName& name) const { … }
const AtomicString& HTMLInputElement::DefaultValue() const { … }
static inline bool IsRFC2616TokenCharacter(UChar ch) { … }
static bool IsValidMIMEType(const String& type) { … }
static bool IsValidFileExtension(const String& type) { … }
static Vector<String> ParseAcceptAttribute(const String& accept_string,
bool (*predicate)(const String&)) { … }
Vector<String> HTMLInputElement::AcceptMIMETypes() const { … }
Vector<String> HTMLInputElement::AcceptFileExtensions() const { … }
const AtomicString& HTMLInputElement::Alt() const { … }
bool HTMLInputElement::Multiple() const { … }
void HTMLInputElement::setSize(unsigned size, ExceptionState& exception_state) { … }
KURL HTMLInputElement::Src() const { … }
FileList* HTMLInputElement::files() const { … }
void HTMLInputElement::setFiles(FileList* files) { … }
bool HTMLInputElement::ReceiveDroppedFiles(const DragData* drag_data) { … }
String HTMLInputElement::DroppedFileSystemId() { … }
bool HTMLInputElement::CanReceiveDroppedFiles() const { … }
void HTMLInputElement::SetCanReceiveDroppedFiles(
bool can_receive_dropped_files) { … }
HTMLInputElement* HTMLInputElement::UploadButton() const { … }
String HTMLInputElement::SanitizeValue(const String& proposed_value) const { … }
String HTMLInputElement::LocalizeValue(const String& proposed_value) const { … }
bool HTMLInputElement::IsInRange() const { … }
bool HTMLInputElement::IsOutOfRange() const { … }
bool HTMLInputElement::IsRequiredFormControl() const { … }
bool HTMLInputElement::MatchesReadOnlyPseudoClass() const { … }
bool HTMLInputElement::MatchesReadWritePseudoClass() const { … }
ControlPart HTMLInputElement::AutoAppearance() const { … }
void HTMLInputElement::OnSearch() { … }
void HTMLInputElement::UpdateClearButtonVisibility() { … }
bool HTMLInputElement::IsInnerEditorValueEmpty() const { … }
void HTMLInputElement::WillChangeForm() { … }
void HTMLInputElement::DidChangeForm() { … }
Node::InsertionNotificationRequest HTMLInputElement::InsertedInto(
ContainerNode& insertion_point) { … }
void HTMLInputElement::RemovedFrom(ContainerNode& insertion_point) { … }
void HTMLInputElement::DidMoveToNewDocument(Document& old_document) { … }
bool HTMLInputElement::RecalcWillValidate() const { … }
void HTMLInputElement::RequiredAttributeChanged() { … }
void HTMLInputElement::DisabledAttributeChanged() { … }
void HTMLInputElement::SelectColorInColorChooser(const Color& color) { … }
void HTMLInputElement::EndColorChooserForTesting() { … }
HTMLDataListElement* HTMLInputElement::DataList() const { … }
HTMLElement* HTMLInputElement::listForBinding() const { … }
bool HTMLInputElement::HasValidDataListOptions() const { … }
HeapVector<Member<HTMLOptionElement>>
HTMLInputElement::FilteredDataListOptions() const { … }
void HTMLInputElement::SetListAttributeTargetObserver(
ListAttributeTargetObserver* new_observer) { … }
void HTMLInputElement::ResetListAttributeTargetObserver() { … }
void HTMLInputElement::ListAttributeTargetChanged() { … }
bool HTMLInputElement::IsSteppable() const { … }
bool HTMLInputElement::IsButton() const { … }
bool HTMLInputElement::IsTextButton() const { … }
bool HTMLInputElement::IsEnumeratable() const { … }
bool HTMLInputElement::IsLabelable() const { … }
bool HTMLInputElement::MatchesDefaultPseudoClass() const { … }
int HTMLInputElement::scrollWidth() { … }
int HTMLInputElement::scrollHeight() { … }
bool HTMLInputElement::ShouldAppearChecked() const { … }
void HTMLInputElement::SetPlaceholderVisibility(bool visible) { … }
bool HTMLInputElement::SupportsPlaceholder() const { … }
void HTMLInputElement::CreateInnerEditorElementIfNecessary() const { … }
HTMLElement* HTMLInputElement::UpdatePlaceholderText() { … }
String HTMLInputElement::GetPlaceholderValue() const { … }
String HTMLInputElement::DefaultToolTip() const { … }
String HTMLInputElement::FileStatusText() const { … }
bool HTMLInputElement::ShouldApplyMiddleEllipsis() const { … }
bool HTMLInputElement::ShouldAppearIndeterminate() const { … }
HTMLFormControlElement::PopoverTriggerSupport
HTMLInputElement::SupportsPopoverTriggering() const { … }
RadioButtonGroupScope* HTMLInputElement::GetRadioButtonGroupScope() const { … }
unsigned HTMLInputElement::SizeOfRadioGroup() const { … }
inline void HTMLInputElement::AddToRadioButtonGroup() { … }
inline void HTMLInputElement::RemoveFromRadioButtonGroup() { … }
unsigned HTMLInputElement::height() const { … }
unsigned HTMLInputElement::width() const { … }
void HTMLInputElement::setHeight(unsigned height) { … }
void HTMLInputElement::setWidth(unsigned width) { … }
ListAttributeTargetObserver::ListAttributeTargetObserver(
const AtomicString& id,
HTMLInputElement* element)
: … { … }
void ListAttributeTargetObserver::Trace(Visitor* visitor) const { … }
void ListAttributeTargetObserver::IdTargetChanged() { … }
void HTMLInputElement::setRangeText(const String& replacement,
ExceptionState& exception_state) { … }
void HTMLInputElement::setRangeText(const String& replacement,
unsigned start,
unsigned end,
const V8SelectionMode& selection_mode,
ExceptionState& exception_state) { … }
bool HTMLInputElement::SetupDateTimeChooserParameters(
DateTimeChooserParameters& parameters) { … }
bool HTMLInputElement::SupportsInputModeAttribute() const { … }
void HTMLInputElement::CapsLockStateMayHaveChanged() { … }
bool HTMLInputElement::ShouldDrawCapsLockIndicator() const { … }
void HTMLInputElement::SetShouldRevealPassword(bool value) { … }
#if BUILDFLAG(IS_ANDROID)
bool HTMLInputElement::IsLastInputElementInForm() {
DCHECK(GetDocument().GetPage());
return !GetDocument()
.GetPage()
->GetFocusController()
.NextFocusableElementForImeAndAutofill(
this, mojom::blink::FocusType::kForward);
}
void HTMLInputElement::DispatchSimulatedEnter() {
DCHECK(GetDocument().GetPage());
GetDocument().GetPage()->GetFocusController().SetFocusedElement(
this, GetDocument().GetFrame());
EventDispatcher::DispatchSimulatedEnterEvent(*this);
}
#endif
bool HTMLInputElement::IsInteractiveContent() const { … }
void HTMLInputElement::AdjustStyle(ComputedStyleBuilder& builder) { … }
void HTMLInputElement::DidNotifySubtreeInsertionsToDocument() { … }
AXObject* HTMLInputElement::PopupRootAXObject() { … }
void HTMLInputElement::EnsureFallbackContent() { … }
void HTMLInputElement::EnsurePrimaryContent() { … }
bool HTMLInputElement::HasFallbackContent() const { … }
void HTMLInputElement::SetFilesFromPaths(const Vector<String>& paths) { … }
void HTMLInputElement::ChildrenChanged(const ChildrenChange& change) { … }
LayoutBox* HTMLInputElement::GetLayoutBoxForScrolling() const { … }
bool HTMLInputElement::IsDraggedSlider() const { … }
void HTMLInputElement::MaybeReportPiiMetrics() { … }
bool HTMLInputElement::isMutable() { … }
void HTMLInputElement::showPicker(ExceptionState& exception_state) { … }
bool HTMLInputElement::IsValidCommand(HTMLElement& invoker,
CommandEventType command) { … }
bool HTMLInputElement::HandleCommandInternal(HTMLElement& invoker,
CommandEventType command) { … }
void HTMLInputElement::SetFocused(bool is_focused,
mojom::blink::FocusType focus_type) { … }
}