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
相关推荐
ShineWinsu7 小时前
对于C++:IO流状态的详细解析
c++·面试·io·cin·io流状态·goodbit·failbit
M-Robots echo7 小时前
轻量化裁剪方案解析:M-Robots 模块化构建,适配高低端各类机器人硬件平台
java·机器人·ros·开源社区·atomgit·m-robots
不可求~8 小时前
多模型路由怎么落地:把任务分流写进项目的最小实现
java·前端·数据库
Lzg_na8 小时前
constexpr的优势
c++
mldong8 小时前
用 DDD 设计工作流引擎:聚合根与充血模型
java·架构
mqiqe9 小时前
AgentScope Java Harness:4. 双层记忆系统 让 Agent 拥有真正的“长期大脑“
java·开发语言
伍一519 小时前
03-文件管理模块-一个看似简单的模块藏着多少细节
java·ruoyi·若依
gugucoding9 小时前
46. 【Java】JUC并发工具:让并发更简单
java·开发语言
王维同学10 小时前
进程模块枚举、映像身份与线程启动地址关联
c++·windows·安全
hold?fish:palm10 小时前
24 回文链表
数据结构·c++·链表