Chromium HTML Input 类型radio 对应c++

一、单选按钮(Radio Buttons)

<input type="radio"> 标签定义了表单的单选框选项:

html 复制代码
<form action="">
<input type="radio" name="sex" value="male">男<br>
<input type="radio" name="sex" value="female">女
</form>

二、 radio c++接口定义:

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

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

cpp 复制代码
namespace blink {

class RadioInputType final : public BaseCheckableInputType {
 public:
  CORE_EXPORT static HTMLInputElement* NextRadioButtonInGroup(HTMLInputElement*,
                                                              bool forward);

  RadioInputType(HTMLInputElement& element)
      : BaseCheckableInputType(Type::kRadio, element) {}
  bool ValueMissing(const String&) const;

 private:
  void CountUsage() override;
  ControlPart AutoAppearance() const override;
  void WillUpdateCheckedness(bool new_checked) override;
  String ValueMissingText() const override;
  void HandleClickEvent(MouseEvent&) override;
  void HandleKeydownEvent(KeyboardEvent&) override;
  void HandleKeyupEvent(KeyboardEvent&) override;
  bool IsKeyboardFocusable(
      Element::UpdateBehavior update_behavior =
          Element::UpdateBehavior::kStyleAndLayout) const override;
  bool ShouldSendChangeEventAfterCheckedChanged() override;
  ClickHandlingState* WillDispatchClick() override;
  void DidDispatchClick(Event&, const ClickHandlingState&) override;
  bool ShouldAppearIndeterminate() const override;

  HTMLInputElement* FindNextFocusableRadioButtonInGroup(HTMLInputElement*,
                                                        bool);
  HTMLInputElement* CheckedRadioButtonForGroup() const;
};

template <>
struct DowncastTraits<RadioInputType> {
  static bool AllowFrom(const InputType& type) {
    return type.IsRadioInputType();
  }
};

}  // namespace blink
相关推荐
CSCN新手听安1 天前
【linux】多线程(六)生产者消费者模型,queue模拟阻塞队列的生产消费模型
linux·运维·服务器·c++
-SGlow-1 天前
Linux相关概念和易错知识点(48)(epoll的底层原理、epoll的工作模式、反应堆模式)
linux·服务器·c语言·网络·c++
张较瘦_1 天前
环境搭建 | [入门级]VSCode(Cursor|Trae|Qoder)搭建Java(Springboot3)企业开发环境全流程
java·ide·vscode
007php0071 天前
百度面试题解析:synchronized、volatile、JMM内存模型、JVM运行时区域及堆和方法区(三)
java·开发语言·jvm·缓存·面试·golang·php
YSRM1 天前
Leetcode+Java+图论II
java·leetcode·图论
十铭忘1 天前
基于SAM2的眼动数据跟踪2
java·服务器·前端
luckyPian1 天前
前端+AI:HTML5语义标签(一)
前端·ai·面试·html·html5·ai编程
csdn_aspnet1 天前
C++ 圆台体积和表面积计算程序(Program for Volume and Surface area of Frustum of Cone)
c++
okjohn1 天前
浅谈需求分析与管理
java·架构·系统架构·软件工程·产品经理·需求分析·规格说明书
用户0332126663671 天前
Java添加、设置和删除PDF图层:
java