Chromium HTML Input 类型定义 对应c++

一、HTML 表单input输入类型 对应c++总的定义在:

third_party\blink\renderer\core\html\forms\input_type.h

third_party\blink\renderer\core\html\forms\input_type.cc

二、截取定义部分:

class CORE_EXPORT InputType : public GarbageCollected<InputType> {
 public:
  // The type attribute of HTMLInputElement is an enumerated attribute:
  // https://html.spec.whatwg.org/multipage/input.html#attr-input-type
  // These values are a subset of the `FormControlType` enum. They have the same
  // binary representation so that FormControlType() reduces to a type cast.
  enum class Type : std::underlying_type_t<mojom::blink::FormControlType> {
    kButton = base::to_underlying(mojom::blink::FormControlType::kInputButton),
    kColor = base::to_underlying(mojom::blink::FormControlType::kInputColor),
    kFile = base::to_underlying(mojom::blink::FormControlType::kInputFile),
    kHidden = base::to_underlying(mojom::blink::FormControlType::kInputHidden),
    kImage = base::to_underlying(mojom::blink::FormControlType::kInputImage),
    kNumber = base::to_underlying(mojom::blink::FormControlType::kInputNumber),
    kRange = base::to_underlying(mojom::blink::FormControlType::kInputRange),
    kReset = base::to_underlying(mojom::blink::FormControlType::kInputReset),
    kSubmit = base::to_underlying(mojom::blink::FormControlType::kInputSubmit),

    // BaseCheckable
    kRadio = base::to_underlying(mojom::blink::FormControlType::kInputRadio),
    kCheckbox =
        base::to_underlying(mojom::blink::FormControlType::kInputCheckbox),

    // BaseTemporal
    kDate = base::to_underlying(mojom::blink::FormControlType::kInputDate),
    kDateTimeLocal =
        base::to_underlying(mojom::blink::FormControlType::kInputDatetimeLocal),
    kMonth = base::to_underlying(mojom::blink::FormControlType::kInputMonth),
    kTime = base::to_underlying(mojom::blink::FormControlType::kInputTime),
    kWeek = base::to_underlying(mojom::blink::FormControlType::kInputWeek),

    // BaseText
    kEmail = base::to_underlying(mojom::blink::FormControlType::kInputEmail),
    kPassword =
        base::to_underlying(mojom::blink::FormControlType::kInputPassword),
    kSearch = base::to_underlying(mojom::blink::FormControlType::kInputSearch),
    kTelephone =
        base::to_underlying(mojom::blink::FormControlType::kInputTelephone),
    kURL = base::to_underlying(mojom::blink::FormControlType::kInputUrl),
    kText = base::to_underlying(mojom::blink::FormControlType::kInputText),
  };
..................................................
};

三、类型定义form_control_type.mojom

third_party\blink\public\mojom\forms\form_control_type.mojom

module blink.mojom;

// An enum representation of the values of the `type` attribute of form control
// elements. This list is exhaustive.
enum FormControlType {
  // https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-type
  kButtonButton,
  kButtonSubmit,
  kButtonReset,
  kButtonSelectList,
  // https://html.spec.whatwg.org/multipage/form-elements.html#dom-fieldset-type
  kFieldset,
  // https://html.spec.whatwg.org/multipage/input.html#attr-input-type
  kInputButton,
  kInputCheckbox,
  kInputColor,
  kInputDate,
  kInputDatetimeLocal,
  kInputEmail,
  kInputFile,
  kInputHidden,
  kInputImage,
  kInputMonth,
  kInputNumber,
  kInputPassword,
  kInputRadio,
  kInputRange,
  kInputReset,
  kInputSearch,
  kInputSubmit,
  kInputTelephone,
  kInputText,
  kInputTime,
  kInputUrl,
  kInputWeek,
  // https://html.spec.whatwg.org/multipage/form-elements.html#dom-output-type
  kOutput,
  // https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type
  kSelectOne,
  kSelectMultiple,
  kSelectList,
  // https://html.spec.whatwg.org/multipage/form-elements.html#dom-textarea-type
  kTextArea,
};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值