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
相关推荐
码路飞2 小时前
GPT-5.4 Computer Use 实战:3 步让 AI 操控浏览器帮你干活 🖥️
java·javascript
不想写代码的星星4 小时前
C++继承、组合、聚合:选错了是屎山,选对了是神器
c++
祈安_4 小时前
Java实现循环队列、栈实现队列、队列实现栈
java·数据结构·算法
皮皮林55116 小时前
拒绝写重复代码,试试这套开源的 SpringBoot 组件,效率翻倍~
java·spring boot
顺风尿一寸19 小时前
从 Java NIO poll 到 Linux 内核 poll:一次系统调用的完整旅程
java
程途知微19 小时前
JVM运行时数据区各区域作用与溢出原理
java
华仔啊1 天前
为啥不用 MP 的 saveOrUpdateBatch?MySQL 一条 SQL 批量增改才是最优解
java·后端
xiaoye20181 天前
Lettuce连接模型、命令执行、Pipeline 浅析
java
beata1 天前
Java基础-18:Java开发中的常用设计模式:深入解析与实战应用
java·后端
Seven971 天前
剑指offer-81、⼆叉搜索树的最近公共祖先
java