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

search 类型用于搜索域,比如站点搜索或 Google 搜索。

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

<form action="demo-form.php">
  Search Google: <input type="search" name="googlesearch"><br>
  <input type="submit">
</form>

</body>
</html>

二、c++定义

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

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

cpp 复制代码
namespace blink {

class SearchInputType final : public BaseTextInputType {
 public:
  explicit SearchInputType(HTMLInputElement&);

  void Trace(Visitor*) const final;

 private:
  void CountUsage() override;
  ControlPart AutoAppearance() const override;
  bool NeedsContainer() const override;
  void CreateShadowSubtree() override;
  void HandleKeydownEvent(KeyboardEvent&) override;
  void DidSetValueByUserEdit() override;
  bool SupportsInputModeAttribute() const override;
  void UpdateView() override;
  void DispatchSearchEvent() override;

  void SearchEventTimerFired(TimerBase*);
  bool SearchEventsShouldBeDispatched() const;
  void StartSearchEventTimer();
  void UpdateCancelButtonVisibility();

  HeapTaskRunnerTimer<SearchInputType> search_event_timer_;
};

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

}  // namespace blink
相关推荐
蒸蒸yyyyzwd2 小时前
cpp 选手秋招学习笔记 day33
c++·笔记·求职招聘
hansang_IR9 小时前
【题解】P4460 [CQOI2018] 解锁屏幕
c++·算法
ChampaignWolf9 小时前
在 SAP S/4HANA 内部基于 ICF Handler 从零实现 ABAP MCP Server:架构、代码与踩坑实录
c++·架构·sap·abap·mcp
CharlesYu0110 小时前
前端性能优化的第一性原理,是不断缩短“用户发起意图 → 获得可用结果”之间的时间
前端
平头哥技术团队10 小时前
Day 21 _ 页内锚点_给每段起个 id,目录写 href=_#id_,点一下页面就滚到那一段
前端·html·html5
尘客-追梦11 小时前
Day 01:插件化之前,先看清 ABI 这堵墙
开发语言·c++·qt
有点。11 小时前
*C++哈夫曼树与哈夫曼编码
java·c++·servlet
子兮曰11 小时前
Bun v1.4.1 深度解析:从 Zig 到 Rust,一场 11 天、64 个 AI 代理的语言迁徙
前端·后端·bun
啦啦啦啦啦zzzz11 小时前
利用RAII机制进行日志的采集
linux·服务器·c++·网络编程·c++20
人民广场吃泡面11 小时前
什么是AI Agent?它又能给前端带来哪些效率提升?
前端·人工智能