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
相关推荐
HIT_Weston13 分钟前
47、【Ubuntu】【Gitlab】拉出内网 Web 服务:Nginx 事件驱动分析(一)
前端·ubuntu·gitlab
开发者小天32 分钟前
React中的 闭包陷阱
前端·javascript·react.js
翔云 OCR API37 分钟前
承兑汇票识别接口技术解析-开发者接口
开发语言·前端·数据库·人工智能·ocr
涔溪1 小时前
Vue3 的核心语法
前端·vue.js·typescript
G***E3161 小时前
前端在移动端中的React Native Web
前端·react native·react.js
云烟飘渺o1 小时前
JPA 的脏检查:一次“没 save() 却更新了”的排查记录
前端
AA陈超1 小时前
Lyra学习004:GameFeatureData分析
c++·笔记·学习·ue5·虚幻引擎
Neptune11 小时前
深入浅出:理解js的‘万物皆对象’与原型链
前端·javascript
王霸天2 小时前
扒一扒 Vue3 大屏适配插件 vfit 的源码:原来这么简单?
前端
王霸天2 小时前
拒绝 rem 计算!Vue3 大屏适配,我是这样做的 (vfit 使用体验)
前端