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
相关推荐
MediaTea23 分钟前
Python 第三方库:Markdown(将文本渲染为 HTML)
开发语言·前端·python·html
Halo_tjn30 分钟前
Java 基于分支和循环结构的专项实验
java·开发语言·计算机
洛_尘31 分钟前
Java EE进阶5:Spring IoC&DI
java·spring·java-ee
IT小哥哥呀33 分钟前
Spring Cloud Stream:一次编写,随处运行
java·spring cloud·微服务··后端开发
Kuo-Teng37 分钟前
LeetCode 141. Linked List Cycle
java·算法·leetcode·链表·职场和发展
洛_尘41 分钟前
数据结构--9:反射、枚举以及lambda表达式(了解即可)
java·开发语言·数据结构
青衫码上行1 小时前
【Java Web学习 | 第12篇】JavaScript(6)DOM
java·开发语言·前端·javascript·学习
TDengine (老段)1 小时前
TDengine 字符串函数 POSITION 用户手册
android·java·大数据·数据库·物联网·时序数据库·tdengine
弘毅 失败的 mian1 小时前
C++、Java 还是测试开发?
java·c++·经验分享·笔记·测试开发·技术方向·就业
杜子不疼.1 小时前
【C++】 set/multiset底层原理与逻辑详解
java·开发语言·c++