chromium/third_party/blink/renderer/core/html/forms/input_type.cc

/*
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 1999 Antti Koivisto ([email protected])
 *           (C) 2001 Dirk Mueller ([email protected])
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
 * rights reserved.
 *           (C) 2006 Alexey Proskuryakov ([email protected])
 * Copyright (C) 2007 Samuel Weinig ([email protected])
 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved.
 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#include "third_party/blink/renderer/core/html/forms/input_type.h"

#include <limits>
#include <memory>
#include <utility>

#include "base/debug/crash_logging.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
#include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/events/keyboard_event.h"
#include "third_party/blink/renderer/core/fileapi/file_list.h"
#include "third_party/blink/renderer/core/html/forms/button_input_type.h"
#include "third_party/blink/renderer/core/html/forms/checkbox_input_type.h"
#include "third_party/blink/renderer/core/html/forms/color_chooser.h"
#include "third_party/blink/renderer/core/html/forms/color_input_type.h"
#include "third_party/blink/renderer/core/html/forms/date_input_type.h"
#include "third_party/blink/renderer/core/html/forms/date_time_local_input_type.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_data.h"
#include "third_party/blink/renderer/core/html/forms/hidden_input_type.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/image_input_type.h"
#include "third_party/blink/renderer/core/html/forms/month_input_type.h"
#include "third_party/blink/renderer/core/html/forms/number_input_type.h"
#include "third_party/blink/renderer/core/html/forms/password_input_type.h"
#include "third_party/blink/renderer/core/html/forms/radio_input_type.h"
#include "third_party/blink/renderer/core/html/forms/range_input_type.h"
#include "third_party/blink/renderer/core/html/forms/reset_input_type.h"
#include "third_party/blink/renderer/core/html/forms/search_input_type.h"
#include "third_party/blink/renderer/core/html/forms/submit_input_type.h"
#include "third_party/blink/renderer/core/html/forms/telephone_input_type.h"
#include "third_party/blink/renderer/core/html/forms/text_input_type.h"
#include "third_party/blink/renderer/core/html/forms/time_input_type.h"
#include "third_party/blink/renderer/core/html/forms/url_input_type.h"
#include "third_party/blink/renderer/core/html/forms/week_input_type.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.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/layout/layout_theme.h"
#include "third_party/blink/renderer/core/page/page.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/json/json_values.h"
#include "third_party/blink/renderer/platform/text/platform_locale.h"
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"

namespace blink {

const AtomicString& InputType::TypeToString(Type type) {}

// Listed once to avoid any discrepancy between InputType::Create and
// InputType::NormalizeTypeName.
//
// No need to register "text" because it is the default type.
#define INPUT_TYPES(INPUT_TYPE)

InputType* InputType::Create(HTMLInputElement& element,
                             const AtomicString& type_name) {}

const AtomicString& InputType::NormalizeTypeName(
    const AtomicString& type_name) {}

InputType::~InputType() = default;

void InputType::Trace(Visitor* visitor) const {}

const AtomicString& InputType::FormControlTypeAsString() const {}

bool InputType::IsTextField() const {}

bool InputType::IsAutoDirectionalityFormAssociated() const {}

template <typename T>
bool ValidateInputType(const T& input_type, const String& value) {}

// Do not use virtual function for performance reason.
bool InputType::IsValidValue(const String& value) const {}

bool InputType::ShouldSaveAndRestoreFormControlState() const {}

bool InputType::IsFormDataAppendable() const {}

void InputType::AppendToFormData(FormData& form_data) const {}

String InputType::ResultForDialogSubmit() const {}

double InputType::ValueAsDate() const {}

void InputType::SetValueAsDate(const std::optional<base::Time>&,
                               ExceptionState& exception_state) const {}

double InputType::ValueAsDouble() const {}

void InputType::SetValueAsDouble(double double_value,
                                 TextFieldEventBehavior event_behavior,
                                 ExceptionState& exception_state) const {}

void InputType::SetValueAsDecimal(const Decimal& new_value,
                                  TextFieldEventBehavior event_behavior,
                                  ExceptionState&) const {}

void InputType::ReadingChecked() const {}

void InputType::WillUpdateCheckedness(bool) {}

bool InputType::SupportsValidation() const {}

// Do not use virtual function for performance reason.
bool InputType::TypeMismatchFor(const String& value) const {}

bool InputType::TypeMismatch() const {}

bool InputType::SupportsRequired() const {}

// Do not use virtual function for performance reason.
bool InputType::ValueMissing(const String& value) const {}

bool InputType::TooLong(const String&,
                        TextControlElement::NeedsToCheckDirtyFlag) const {}

bool InputType::TooShort(const String&,
                         TextControlElement::NeedsToCheckDirtyFlag) const {}

// Do not use virtual function for performance reason.
bool InputType::PatternMismatch(const String& value) const {}

bool InputType::RangeUnderflow(const String& value) const {}

bool InputType::RangeOverflow(const String& value) const {}

Decimal InputType::DefaultValueForStepUp() const {}

double InputType::Minimum() const {}

double InputType::Maximum() const {}

bool InputType::IsInRange(const String& value) const {}

bool InputType::IsOutOfRange(const String& value) const {}

void InputType::InRangeChanged() const {}

bool InputType::StepMismatch(const String& value) const {}

String InputType::BadInputText() const {}

String InputType::ValueNotEqualText(const Decimal& value) const {}

String InputType::RangeOverflowText(const Decimal&) const {}

String InputType::RangeUnderflowText(const Decimal&) const {}

String InputType::ReversedRangeOutOfRangeText(const Decimal&,
                                              const Decimal&) const {}

String InputType::RangeInvalidText(const Decimal&, const Decimal&) const {}

String InputType::TypeMismatchText() const {}

String InputType::ValueMissingText() const {}

std::pair<String, String> InputType::ValidationMessage(
    const InputTypeView& input_type_view) const {}

Decimal InputType::ParseToNumber(const String&,
                                 const Decimal& default_value) const {}

Decimal InputType::ParseToNumberOrNaN(const String& string) const {}

String InputType::Serialize(const Decimal&) const {}

ChromeClient* InputType::GetChromeClient() const {}

Locale& InputType::GetLocale() const {}

// Do not use virtual function for performance reason.
bool InputType::CanSetStringValue() const {}

bool InputType::IsKeyboardFocusable(
    Element::UpdateBehavior update_behavior) const {}

bool InputType::MayTriggerVirtualKeyboard() const {}

void InputType::CountUsage() {}

void InputType::DidRecalcStyle(const StyleRecalcChange) {}

bool InputType::ShouldRespectAlignAttribute() {}

void InputType::SanitizeValueInResponseToMinOrMaxAttributeChange() {}

bool InputType::CanBeSuccessfulSubmitButton() {}

bool InputType::MatchesDefaultPseudoClass() {}

bool InputType::LayoutObjectIsNeeded() {}

FileList* InputType::Files() {}

bool InputType::SetFiles(FileList*) {}

void InputType::SetFilesAndDispatchEvents(FileList*) {}

void InputType::SetFilesFromPaths(const Vector<String>& paths) {}

String InputType::ValueInFilenameValueMode() const {}

String InputType::DefaultLabel() const {}

bool InputType::CanSetSuggestedValue() {}

bool InputType::ShouldSendChangeEventAfterCheckedChanged() {}

void InputType::DispatchSearchEvent() {}

void InputType::SetValue(const String& sanitized_value,
                         bool value_changed,
                         TextFieldEventBehavior event_behavior,
                         TextControlSetValueSelection) {}

bool InputType::CanSetValue(const String&) {}

String InputType::LocalizeValue(const String& proposed_value) const {}

String InputType::VisibleValue() const {}

String InputType::SanitizeValue(const String& proposed_value) const {}

String InputType::SanitizeUserInputValue(const String& proposed_value) const {}

void InputType::WarnIfValueIsInvalidAndElementIsVisible(
    const String& value) const {}

void InputType::WarnIfValueIsInvalid(const String&) const {}

bool InputType::ReceiveDroppedFiles(const DragData*) {}

String InputType::DroppedFileSystemId() {}

bool InputType::ShouldRespectListAttribute() {}

bool InputType::IsButton() const {}

bool InputType::IsTextButton() const {}

bool InputType::IsInteractiveContent() const {}

bool InputType::IsEnumeratable() {}

bool InputType::IsCheckable() {}

// Do not use virtual function for performance reason.
bool InputType::IsSteppable() const {}

HTMLFormControlElement::PopoverTriggerSupport
InputType::SupportsPopoverTriggering() const {}

bool InputType::ShouldRespectHeightAndWidthAttributes() {}

int InputType::MaxLength() const {}

int InputType::MinLength() const {}

bool InputType::SupportsPlaceholder() const {}

bool InputType::SupportsReadOnly() const {}

String InputType::DefaultToolTip(const InputTypeView& input_type_view) const {}

Decimal InputType::FindClosestTickMarkValue(const Decimal&) {}

bool InputType::HasLegalLinkAttribute(const QualifiedName&) const {}

void InputType::CopyNonAttributeProperties(const HTMLInputElement&) {}

void InputType::OnAttachWithLayoutObject() {}

bool InputType::ShouldAppearIndeterminate() const {}

bool InputType::SupportsInputModeAttribute() const {}

bool InputType::SupportsSelectionAPI() const {}

unsigned InputType::Height() const {}

unsigned InputType::Width() const {}

ColorChooserClient* InputType::GetColorChooserClient() {}

void InputType::ApplyStep(const Decimal& current,
                          const bool current_was_invalid,
                          double count,
                          AnyStepHandling any_step_handling,
                          TextFieldEventBehavior event_behavior,
                          ExceptionState& exception_state) {}

bool InputType::GetAllowedValueStep(Decimal* step) const {}

StepRange InputType::CreateStepRange(AnyStepHandling) const {}

void InputType::StepUp(double n, ExceptionState& exception_state) {}

void InputType::StepUpFromLayoutObject(int n) {}

void InputType::CountUsageIfVisible(WebFeature feature) const {}

Decimal InputType::FindStepBase(const Decimal& default_value) const {}

StepRange InputType::CreateReversibleStepRange(
    AnyStepHandling any_step_handling,
    const Decimal& step_base_default,
    const Decimal& minimum_default,
    const Decimal& maximum_default,
    const StepRange::StepDescription& step_description) const {}

StepRange InputType::CreateStepRange(
    AnyStepHandling any_step_handling,
    const Decimal& step_base_default,
    const Decimal& minimum_default,
    const Decimal& maximum_default,
    const StepRange::StepDescription& step_description) const {}

StepRange InputType::CreateStepRange(
    AnyStepHandling any_step_handling,
    const Decimal& step_base_default,
    const Decimal& minimum_default,
    const Decimal& maximum_default,
    const StepRange::StepDescription& step_description,
    bool supports_reversed_range) const {}

void InputType::AddWarningToConsole(const char* message_format,
                                    const String& value) const {}

}  // namespace blink