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

一、Input 类型: week

week 类型允许你选择周和年。

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

<body>

<form action="demo-form.php">
  选择周: <input type="week" name="year_week">
  <input type="submit">
</form>

</body>
</html>

二、week c++定义:

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

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

cpp 复制代码
namespace blink {

class WeekInputType final : public BaseTemporalInputType {
 public:
  explicit WeekInputType(HTMLInputElement& element)
      : BaseTemporalInputType(Type::kWeek, element) {}

 private:
  void CountUsage() 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;

  // 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;
};

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

}  // namespace blink
相关推荐
用户059540174462 分钟前
把大模型记忆召回测试从 30 分钟手工核对压到 3 秒自动化,pytest + FAISS 这套组合救了我
前端·css
醉里博客3 分钟前
醉里起始页 Snavigation2.0:纯前端导航页的二开改造与性能优化实践
前端
雪芽蓝域zzs17 分钟前
新建前端pnpm(vue js ) 仿若依项目(一)
前端·javascript·vue.js
vipbic18 分钟前
网站升级了,我却有点舍不得
前端·vue.js·后端
IT_陈寒18 分钟前
Java Stream并行处理让我数据库崩了两次
前端·人工智能·后端
恋猫de小郭19 分钟前
Flutter 3.47 首坑,analysis_options 问题连环回归
android·前端·flutter
Hhy_110723 分钟前
《C++深度解构02》类和对象(上)——定义规范、内存对齐与 this 指针全解
c语言·开发语言·c++·学习·visual studio
晚风叙码31 分钟前
C++哈希表实现:开放定址法和链地址法 (哈希桶)
数据结构·c++·哈希算法·散列表
YWL40 分钟前
OpenLayers测距测面:完整测量工具
前端·javascript·vue.js·信息可视化·openlayers
zhanghaha13141 小时前
HTML系列教程:2_HTML 编辑器(零基础超详细讲解
前端·编辑器·html