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
相关推荐
小巫编程室2 分钟前
我造了一个 Java 能力包:让 AI 直接调用你的业务代码
java·前端·后端
旖旎夜光36 分钟前
【C++ 基础入门】智能指针:RAII、unique_ptr 与 shared_ptr 循环引用
c++·笔记·学习·智能指针
深入云栈41 分钟前
Netty 4.2.x 源码深度解析 (二十四):池化内存分配 —— PoolArena、PoolChunk 与 PoolSubpage
java·后端·架构
惜.己2 小时前
Java结合idea简单使用Playwright
java·开发语言·自动化
ShineWinsu2 小时前
对于Qt:QSpacerItem常见属性以及方法的解析
开发语言·c++·qt·面试·系统架构·客户端·qspaceritem
Vex2une2 小时前
JDK 8 下载安装与环境变量配置完整指南(Windows新手图文教程)
java·windows·环境配置·环境变量·jdk8·jdk下载安装·java入门教程
文丑颜不良啊4 小时前
LeetCode3281~3300题目解析
java·leetcode
nice_lcj5205 小时前
【从零理解计算机网络 · 02】分层模型:别背 OSI 七层,看数据怎么被“打包“和“拆包“
java·后端·tcp/ip·计算机网络·面试·osi·分层模型
ShineWinsu5 小时前
对于Qt:QGripLayout常见属性、方法以及QSizePolicy的解析
开发语言·c++·qt·面试·gui·客户端·网格
SimonKing5 小时前
给Deepseek Harness装上插件市场,从此插件无忧
java·后端·程序员