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
相关推荐
2201_757830874 小时前
全局异常处理器
java
香蕉卜拿拿拿4 小时前
软件解耦与扩展的利器:基于C++与C#的插件式开发实践
c++
小徐Chao努力5 小时前
【Langchain4j-Java AI开发】09-Agent智能体工作流
java·开发语言·人工智能
CoderCodingNo5 小时前
【GESP】C++五级真题(贪心和剪枝思想) luogu-B3930 [GESP202312 五级] 烹饪问题
开发语言·c++·剪枝
Coder_Boy_5 小时前
SpringAI与LangChain4j的智能应用-(理论篇3)
java·人工智能·spring boot·langchain
Coder_Boy_5 小时前
基于SpringAI的智能平台基座开发-(六)
java·数据库·人工智能·spring·langchain·langchain4j
阿闽ooo6 小时前
深入浅出适配器模式:从跨国插头适配看接口兼容的艺术
c++·设计模式·适配器模式
伯明翰java6 小时前
Java数据类型与变量
java·开发语言
想用offer打牌7 小时前
如何开启第一次开源贡献之路?
java·后端·面试·开源·github
小许学java7 小时前
Spring原理
java·spring·生命周期·作用域·原理