Chromium HTML5 新的 Input 类型time对应c++

一、Input 类型: time

time 类型允许你选择一个时间。

html 复制代码
<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>test</title> 
</head>
<body>

<form action="demo-form.php">
  选择时间: <input type="time" name="usr_time">
  <input type="submit">
</form>

</body>
</html>

二、time c++定义

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

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

cpp 复制代码
namespace blink {

class TimeInputType final : public BaseTemporalInputType {
 public:
  explicit TimeInputType(HTMLInputElement&);

 private:
  void CountUsage() override;
  Decimal DefaultValueForStepUp() const override;
  StepRange CreateStepRange(AnyStepHandling) const override;
  bool ParseToDateComponentsInternal(const String&,
                                     DateComponents*) const override;
  bool SetMillisecondToDateComponents(double, DateComponents*) const override;
  void WarnIfValueIsInvalid(const String&) const override;
  String LocalizeValue(const String&) const override;

  // BaseTemporalInputType functions
  String FormatDateTimeFieldsState(const DateTimeFieldsState&) const override;
  void SetupLayoutParameters(DateTimeEditElement::LayoutParameters&,
                             const DateComponents&) const override;
  bool IsValidFormat(bool has_year,
                     bool has_month,
                     bool has_week,
                     bool has_day,
                     bool has_ampm,
                     bool has_hour,
                     bool has_minute,
                     bool has_second) const override;
  String AriaLabelForPickerIndicator() const override;
  String ReversedRangeOutOfRangeText(const Decimal& minimum,
                                     const Decimal& maximum) const override;
};

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

}  // namespace blink
相关推荐
寻星探路13 分钟前
【深度长文】万字攻克网络原理:从 HTTP 报文解构到 HTTPS 终极加密逻辑
java·开发语言·网络·python·http·ai·https
曹牧2 小时前
Spring Boot:如何测试Java Controller中的POST请求?
java·开发语言
在路上看风景3 小时前
19. 成员初始化列表和初始化对象
c++
zmzb01033 小时前
C++课后习题训练记录Day98
开发语言·c++
念风零壹3 小时前
C++ 内存避坑指南:如何用移动语义和智能指针解决“深拷贝”与“内存泄漏”
c++
爬山算法3 小时前
Hibernate(90)如何在故障注入测试中使用Hibernate?
java·后端·hibernate
kfyty7253 小时前
集成 spring-ai 2.x 实践中遇到的一些问题及解决方案
java·人工智能·spring-ai
猫头虎3 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
李少兄3 小时前
在 IntelliJ IDEA 中修改 Git 远程仓库地址
java·git·intellij-idea
忆~遂愿4 小时前
ops-cv 算子库深度解析:面向视觉任务的硬件优化与数据布局(NCHW/NHWC)策略
java·大数据·linux·人工智能