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
相关推荐
苹果电脑的鑫鑫几秒前
Css画圆弧的方法
前端·css
借个火er11 分钟前
Vue.js 源码揭秘(一):Vue3 架构总览
前端
千寻girling13 分钟前
面试官: “ 请你说一下什么是 ajax ? ”
前端·javascript
MQliferecord17 分钟前
webpack的生命周期与Loader/Plugin
前端
@大迁世界20 分钟前
JavaScript 框架的终结
开发语言·前端·javascript·ecmascript
fpcc24 分钟前
跟我学C++中级篇—Linux内核中链表分析
linux·c++·链表
PPPPickup25 分钟前
easychat项目复盘---管理端系统设置
java·开发语言·前端
挖矿大亨30 分钟前
C++中的this指针
java·开发语言·c++
梦65039 分钟前
Vue 实现动态路由
前端·javascript·vue.js
姜糖编程日记41 分钟前
C++——初识(2)
开发语言·前端·c++