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
相关推荐
晴空万里藏片云1 小时前
elment Table多级表头固定列后,合计行错位显示问题解决
前端·javascript·vue.js
曦月合一1 小时前
html中iframe标签 隐藏滚动条
前端·html·iframe
奶球不是球1 小时前
el-button按钮的loading状态设置
前端·javascript
黑不溜秋的1 小时前
C++ 设计模式 - 策略模式
c++·设计模式·策略模式
kidding7231 小时前
前端VUE3的面试题
前端·typescript·compositionapi·fragment·teleport·suspense
Σίσυφος19003 小时前
halcon 条形码、二维码识别、opencv识别
前端·数据库
学代码的小前端3 小时前
0基础学前端-----CSS DAY13
前端·css
Dream it possible!3 小时前
LeetCode 热题 100_在排序数组中查找元素的第一个和最后一个位置(65_34_中等_C++)(二分查找)(一次二分查找+挨个搜索;两次二分查找)
c++·算法·leetcode
柠石榴4 小时前
【练习】【回溯No.1】力扣 77. 组合
c++·算法·leetcode·回溯
王老师青少年编程4 小时前
【GESP C++八级考试考点详细解读】
数据结构·c++·算法·gesp·csp·信奥赛