Chromium HTML Tags与c++接口对应关系分析

news2024/11/24 12:49:24

一、HTML 标签(HTML Tags)

<a> <head> <img>等等这些标签在c++中的接口是如何定义和查找的呢?

更多标签参考:

HTML <a> target 属性 (w3school.com.cn)

二、html_tag_names.json5

(third_party\blink\renderer\core\html\html_tag_names.json5)

此文件里面是c++用来生成前端对应HTML Tags。

{
  metadata: {
    namespace: "HTML",
    namespacePrefix: "xhtml",
    namespaceURI: "http://www.w3.org/1999/xhtml",
    fallbackInterfaceName: "HTMLUnknownElement",
    export: "CORE_EXPORT",
  },

  // If you add any tag names here, remember to update html_tree_builder_test.cc.

  // Note that if an element is associated with a feature flag that has an
  // origin trial, you must:
  // * set runtimeFlagHasOriginTrial to true below, which disables the checks
  //   that ensure that the tokenizer produces HTMLTag::kUnknown when the
  //   feature flag is disabled.
  // * make sure that any uses of HTMLTag::kYourElement treat it as
  //   HTMLTag::kUnknown if the feature flag is disabled.  The member is
  //   renamed to HTMLTag::kYourElementOrUnknown to remind you of this.
  // * have a virtual suite testing the feature flag being disabled that
  //   checks that any relevant behaviors (parsing or otherwise) are
  //   unaffected when the feature is disabled.
  // See https://crbug.com/1512345
  data: [
    {
      name: "a",
      interfaceName: "HTMLAnchorElement",
    },
    {
      name: "abbr",
      interfaceName: "HTMLElement",
    },
    {
      name: "acronym",
      interfaceName: "HTMLElement",
    },
    {
      name: "address",
      interfaceName: "HTMLElement",
    },
    {
      name: "applet",
      interfaceName: "HTMLUnknownElement",
    },
    "area",
    {
      name: "article",
      interfaceName: "HTMLElement",
    },
    {
      name: "aside",
      interfaceName: "HTMLElement",
    },
    {
      name: "audio",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/media",
    },
    {
      name: "b",
      interfaceName: "HTMLElement",
    },
    "base",
    {
      name: "basefont",
      interfaceName: "HTMLElement",
    },
    {
      name: "bdi",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLBDIElement",
    },
    {
      name: "bdo",
      interfaceName: "HTMLElement",
    },
    {
      name: "bgsound",
      interfaceName: "HTMLUnknownElement",
    },
    {
      name: "big",
      interfaceName: "HTMLElement",
    },
    {
      name: "blockquote",
      interfaceName: "HTMLQuoteElement",
    },
    "body",
    {
      name: "br",
      interfaceName: "HTMLBRElement",
    },
    {
      name: "button",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "canvas",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/canvas",
    },
    {
      name: "caption",
      interfaceName: "HTMLTableCaptionElement",
    },
    {
      name: "center",
      interfaceName: "HTMLElement",
    },
    {
      name: "cite",
      interfaceName: "HTMLElement",
    },
    {
      name: "code",
      interfaceName: "HTMLElement",
    },
    {
      name: "col",
      interfaceName: "HTMLTableColElement",
    },
    {
      name: "colgroup",
      interfaceName: "HTMLTableColElement",
    },
    {
      name: "command",
      interfaceName: "HTMLUnknownElement",
    },
    {
      name: "data",
      interfaceName: "HTMLDataElement",
    },
    {
      name: "datalist",
      interfaceName: "HTMLDataListElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "dd",
      interfaceName: "HTMLElement",
    },
    {
      name: "del",
      interfaceName: "HTMLModElement",
    },
    "details",
    {
      name: "dfn",
      interfaceName: "HTMLElement",
    },
    {
      name: "dir",
      interfaceName: "HTMLDirectoryElement",
    },
    "dialog",
    "div",
    {
      name: "dl",
      interfaceName: "HTMLDListElement",
    },
    {
      name: "dt",
      interfaceName: "HTMLElement",
    },
    {
      name: "em",
      interfaceName: "HTMLElement",
    },
    {
      name: "embed",
      constructorNeedsCreateElementFlags: true,
    },
    {
      name: "fencedframe",
      interfaceName: "HTMLFencedFrameElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/fenced_frame",
      runtimeEnabled: "FencedFrames",
      // Set runtimeFlagHasOriginTrial to disable feature flag checks in
      // the tokenizer (which doesn't necessarily have access to the
      // document)
      runtimeFlagHasOriginTrial: true,
      // This element could be enabled in some documents but not others (due to
      // origin trials), so we need custom type helpers.
      noTypeHelpers: true,
    },
    {
      name: "fieldset",
      interfaceName: "HTMLFieldSetElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "figcaption",
      interfaceName: "HTMLElement",
    },
    {
      name: "figure",
      interfaceName: "HTMLElement",
    },
    "font",
    {
      name: "footer",
      interfaceName: "HTMLElement",
    },
    {
      name: "form",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    "frame",
    {
      name: "frameset",
      interfaceName: "HTMLFrameSetElement",
    },
    {
      name: "h1",
      interfaceName: "HTMLHeadingElement",
    },
    {
      name: "h2",
      interfaceName: "HTMLHeadingElement",
    },
    {
      name: "h3",
      interfaceName: "HTMLHeadingElement",
    },
    {
      name: "h4",
      interfaceName: "HTMLHeadingElement",
    },
    {
      name: "h5",
      interfaceName: "HTMLHeadingElement",
    },
    {
      name: "h6",
      interfaceName: "HTMLHeadingElement",
    },
    "head",
    {
      name: "header",
      interfaceName: "HTMLElement",
    },
    {
      name: "hgroup",
      interfaceName: "HTMLElement",
    },
    {
      name: "hr",
      interfaceName: "HTMLHRElement",
    },
    "html",
    {
      name: "i",
      interfaceName: "HTMLElement",
    },
    {
      name: "iframe",
      interfaceName: "HTMLIFrameElement",
    },
    {
      name: "image",
      interfaceName: "HTMLUnknownElement",
    },
    {
      name: "img",
      constructorNeedsCreateElementFlags: true,
      interfaceName: "HTMLImageElement",
    },
    {
      name: "input",
      constructorNeedsCreateElementFlags: true,
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "ins",
      interfaceName: "HTMLModElement",
    },
    {
      name: "kbd",
      interfaceName: "HTMLElement",
    },
    {
      name: "keygen",
      interfaceName: "HTMLUnknownElement",
    },
    {
      name: "label",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "layer",
      interfaceName: "HTMLElement",
    },
    {
      name: "legend",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "li",
      interfaceName: "HTMLLIElement",
    },
    {
      name: "link",
      constructorNeedsCreateElementFlags: true,
    },
    {
      name: "listbox",
      interfaceName: "HTMLListboxElement",
      runtimeEnabled: "HTMLSelectListElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "listing",
      interfaceName: "HTMLPreElement",
    },
    {
      name: "main",
      interfaceName: "HTMLElement",
    },
    "map",
    {
      name: "mark",
      interfaceName: "HTMLElement",
    },
    "marquee",
    "menu",
    {
      name: "meta",
      constructorNeedsCreateElementFlags: true,
    },
    {
      name: "meter",
      interfaceName: "HTMLMeterElement",
    },
    {
      name: "nav",
      interfaceName: "HTMLElement",
    },
    {
      name: "nobr",
      interfaceName: "HTMLElement",
    },
    {
      name: "noembed",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLNoEmbedElement",
    },
    {
      name: "noframes",
      interfaceName: "HTMLElement",
    },
    {
      name: "nolayer",
      interfaceName: "HTMLElement",
    },
    {
      name: "object",
      constructorNeedsCreateElementFlags: true,
    },
    {
      name: "ol",
      interfaceName: "HTMLOListElement",
    },
    {
      name: "optgroup",
      interfaceName: "HTMLOptGroupElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "option",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "output",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "p",
      interfaceName: "HTMLParagraphElement",
    },
    "param",
    {
      name: "permission",
      interfaceName: "HTMLPermissionElement",
      runtimeEnabled: "PermissionElement",
    },
    {
      name: "picture",
      interfaceName: "HTMLPictureElement",
    },
    {
      name: "plaintext",
      interfaceName: "HTMLElement",
    },
    "pre",
    {
      name: "progress",
      interfaceName: "HTMLProgressElement",
    },
    {
      name: "q",
      interfaceName: "HTMLQuoteElement",
    },
    {
      name: "rb",
      interfaceName: "HTMLElement",
    },
    {
      name: "rp",
      interfaceName: "HTMLElement",
    },
    {
      name: "rt",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLRTElement",
    },
    {
      name: "rtc",
      interfaceName: "HTMLElement",
    },
    {
      name: "ruby",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLRubyElement",
    },
    {
      name: "s",
      interfaceName: "HTMLElement",
    },
    {
      name: "samp",
      interfaceName: "HTMLElement",
    },
    {
      name: "script",
      constructorNeedsCreateElementFlags: true,
    },
    {
      name: "search",
      interfaceName: "HTMLElement",
      runtimeEnabled: "HTMLSearchElement",
    },
    {
      name: "section",
      interfaceName: "HTMLElement",
    },
    {
      name: "select",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "selectedoption",
      interfaceName: "HTMLElement",
      runtimeEnabled: "HTMLSelectListElement",
    },
    {
      name: "selectlist",
      interfaceName: "HTMLSelectListElement",
      runtimeEnabled: "HTMLSelectListElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "slot",
      interfaceName: "HTMLSlotElement",
    },
    {
      name: "small",
      interfaceName: "HTMLElement",
    },
    "source",
    "span",
    {
      name: "strike",
      interfaceName: "HTMLElement",
    },
    {
      name: "strong",
      interfaceName: "HTMLElement",
    },
    {
      name: "style",
      constructorNeedsCreateElementFlags: true,
    },
    {
      name: "sub",
      interfaceName: "HTMLElement",
    },
    {
      name: "summary",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLSummaryElement",
    },
    {
      name: "sup",
      interfaceName: "HTMLElement",
    },
    "table",
    {
      name: "tbody",
      interfaceName: "HTMLTableSectionElement",
    },
    {
      name: "td",
      interfaceName: "HTMLTableCellElement",
    },
    "template",
    {
      name: "textarea",
      interfaceName: "HTMLTextAreaElement",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },
    {
      name: "tfoot",
      interfaceName: "HTMLTableSectionElement",
    },
    {
      name: "th",
      interfaceName: "HTMLTableCellElement",
    },
    {
      name: "thead",
      interfaceName: "HTMLTableSectionElement",
    },
    {
      name: "time",
      interfaceName: "HTMLTimeElement",
    },
    "title",
    {
      name: "tr",
      interfaceName: "HTMLTableRowElement",
    },
    {
      name: "track",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/track",
    },
    {
      name: "tt",
      interfaceName: "HTMLElement",
    },
    {
      name: "u",
      interfaceName: "HTMLElement",
    },
    {
      name: "ul",
      interfaceName: "HTMLUListElement",
    },
    {
      name: "var",
      interfaceName: "HTMLElement",
    },
    {
      name: "video",
      interfaceHeaderDir: "third_party/blink/renderer/core/html/media",
    },
    {
      name: "wbr",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLWBRElement",
    },
    {
      name: "xmp",
      interfaceName: "HTMLPreElement",
    },
    {
      name: "noscript",
      JSInterfaceName: "HTMLElement",
      interfaceName: "HTMLNoScriptElement",
    },
  ],
}

三、接下来以以<a>  <head>标签定义看下html_tag_names.json5中如何定义的

3.1、<a> 对应    {
      name: "a",
      interfaceName: "HTMLAnchorElement",
    },

<head>对应   

"head",
    {
      name: "header",
      interfaceName: "HTMLElement",
    },

其中<a> == "a" 接口定义 interfaceName: "HTMLAnchorElement", 其他的也类似。

3.2、interfaceName: "HTMLAnchorElement" 名字直接对应的HTMLAnchorElement.idl(c++接口定义)

   2.1)、规则interfaceName+.idl,

   2.2)、还有根据interfaceHeaderDir定义的接口   {
      name: "input",
      constructorNeedsCreateElementFlags: true,
      interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",
    },

  2.3)、还有 "body",这样的无name的

  搜索规则: html_"tag"_element.idl  html_"tag"_element.h html_"tag"_element.cc

  看例子:

"body"  html_body_element.idl    html_body_element.h    html_body_element.cc

 "details", html_details_element.idl html_details_element.h html_details_element.cc

3.3、根据HTMLAnchorElement.idl即可找到blink的c++实现

third_party\blink\renderer\core\html\html_anchor_element.h

third_party\blink\renderer\core\html\html_anchor_element.cc

3.4、接口HTMLAnchorElement.idl在v8下实现规则:

规则 v8_ + html_anchor_element.cc

out\Debug\gen\third_party\blink\renderer\bindings\core\v8\v8_html_anchor_element.h

out\Debug\gen\third_party\blink\renderer\bindings\core\v8\v8_html_anchor_element.cc

四、总结:

查找html_tag定义只需在third_party\blink\renderer\core\html\html_tag_names.json5文件中输入对对应标签,即可找到interfaceName定义。又可以根据interfaceName定义的文件名找到blink和v8定义。

   

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2207928.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

QD1-P10 HTML 超链接标签(a)下篇

本节学习&#xff1a;HTML a 标签实现大纲跳转&#xff08;锚点&#xff09;。 本节视频 www.bilibili.com/video/BV1n64y1U7oj?p10 本节实现大纲&#xff08;锚点&#xff09;跳转 ​​ 完整 HTML 代码 <!DOCTYPE html> <html><head><meta charset&…

python爬虫--某动漫信息采集

python爬虫--tx动漫 一、采集主页信息二、采集详情页信息三、代码供参考一、采集主页信息 略。 二、采集详情页信息 如上图所示,使用xpath提取详情页的标题、作者、评分、人气、评论人数等数据。 三、代码供参考 import csv import time import random import requests fr…

弧光保护装置的应用

长期以来&#xff0c;人们对中低压母线的保护一直不够重视&#xff0c;没有保护来快速切除配电站所内部发生的故障&#xff0c;往往使故障发展扩大造成开关设备被严重烧毁&#xff0c;有的甚至发展成“火烧连营”的事故。同时&#xff0c;变电站的变压器由于遭受外部短路电流冲…

【harmonyOS开发笔记3】ArkTS中数组的使用

数组的定义 数组&#xff1a;是一个容器&#xff0c;可以存储多个数据 定义数组的格式&#xff1a; let 数组名: 类型[] [数据1&#xff0c; 数据2&#xff0c; ] 示例&#xff1a;let names: string[] [小明, 小红] // 数组 let 数组名: 类型[] [数据1, 数据2, ] let …

【大模型实战教程】Qwen2.5 PyTorch模型微调入门实战

1 引言 Qwen2.5是Qwen大型语言模型系列的最新成果。对于Qwen2.5&#xff0c;通义千问团队发布了从0.5到720亿参数不等的基础语言模型及指令调优语言模型。Qwen2.5相比Qwen2带来了以下改进&#xff1a; 显著增加知识量&#xff0c;在编程与数学领域的能力得到极大提升&#xf…

四种Agent落地方案:Coze、AutoGen、Langchain、llama-index

前言 1. Coze 优势&#xff1a; 模块化设计&#xff1a; 允许开发者灵活地添加或替换组件&#xff0c;适应不同的应用需求。 易于集成&#xff1a; 支持与多种外部系统和服务的集成&#xff0c;方便与现有业务系统对接。 用户友好&#xff1a; 提供图形化界面和命令行工具&…

讯飞与腾讯云:Android 语音识别服务对比选择

目录 一、讯飞语音识别 1.1 讯飞语音识别介绍 1.1.1 功能特点 1.1.2 优势 1.2 接入流程 1.2.1 注册账号并创建应用 1.2.2 下载SDK等相关资料 1.2.3 导入SDK 1.2.4 添加用户权限 1.2.5 初始化讯飞SDK 1.2.6 初始化语音识别对象 1.2.7 显示结果 二、腾讯云语音识别 …

数字人直播带货操作详解,必看!

作为人工智能和直播带货两大热门行业的结合体&#xff0c;数字人直播带货一经出现就引发了众多商家的关注&#xff0c;许多创业者更是因此对数字人直播这一创业项目产生了浓厚的兴趣&#xff0c;连带着对数字人直播带货怎么操作等问题的讨论也日渐热烈了起来。 本期&#xff0…

给图片加文字的软件有哪些?这几种图片编辑文字软件简单好用

一张优秀的图片往往能瞬间抓住人们的眼球&#xff0c;无论是自媒体运营、广告设计还是日常生活分享&#xff0c;给图片添加文字都是提升视觉效果的重要手段。很多小伙伴不清楚该怎样给图片添加上精美的文字&#xff0c;下面给大家分享几种好用编辑文字的方法&#xff0c;一起来…

双语大脑的神经可塑性能力:来自健康和病理个体的见解

摘要 双语经验的神经印记对于理解大脑如何处理优势语言和非优势语言至关重要&#xff0c;但关于它的研究仍然没有定论。不同的研究表明神经处理存在相似性或差异性&#xff0c;这对患有脑肿瘤的双语患者具有重要意义。保留术后的双语功能需要考虑到术前的神经可塑性变化。在这…

【原创】可用于 Android Studio 的翻译插件

在不少讲解Android 开发的老师视频中会出现一个运行在Android Studio 上的翻译插件&#xff0c;感觉挺实用的。 接下来&#xff0c;我们把它安装在我们的Android Studio 上。 设置 点击右上角齿轮按钮&#xff0c;选择Settings 安装 翻译插件 输入Tanslation&#xff0c;选…

jmeter出参保存到文件,保存失败解决

1、添加JSON提取 2、添加beanshell FileWriter writer new FileWriter("C:/Users/xxx/Desktop/signUrl.csv", true); writer.write(vars.get("company_name")"\t"vars.get("signUrl")"\n"); writer.close(); 写文件的两个…

金融大数据平台总体技术

目录 金融大数据平台应用场景风险管理 场景描述解决方案​​​​​​​市场营销 ​​​​​​​场景描述解决方案​​​​​​​金融大数据信息价值链​​​​​​​金融大数据平台总体目标金融大数据平台功能技术要求​​​​​​​ ​​​​​​​概述数据接入功能要求 ​​…

鹦鸣app——服务端项目搭建

文章目录 服务端项目搭建创建启动程序构建全局初始化工厂函数创建app应用对象基于shell脚本启动项目加载项目配置数据库初始化SQLAlchemy初始化Redis数据库初始化mongoDB数据库初始化 日志初始化日志的等级flask日志功能的基本使用构建日志模块 蓝图初始化自动注册蓝图注册蓝图…

【C++】第五节:内存管理

1、C/C内存分布 看下面一段代码 int globalVar 1; static int staticGlobalVar 1; void Test() {static int staticVar 1;int localVar 1;int num1[10] { 1, 2, 3, 4 };char char2[] "abcd";const char* pChar3 "abcd";int* ptr1 (int*)malloc(s…

Axure PR 9 开关切换 设计交互

大家好&#xff0c;我是大明同学。 这期内容&#xff0c;我们来探讨Axure开关按钮设计与交互技巧​。 创建切换开关所需的元件 1.打开一个新的 RP 文件并在画布上打开 Page 1。 2.将“圆形”元件拖到画布上&#xff0c;在样式窗格中将高度和宽度设置为35&#xff0c;线段宽度…

[贪心+搜索] 马走日升级版

题目描述 国际象棋和中国象棋中&#xff0c;马的移动规则相同&#xff0c;都是走“日”字&#xff0c;我们将这种移动方式称为马步移动。如右图所示&#xff0c;从标号为 0 0 0 的点出发&#xff0c;可以经过一步马步移动达到标号为 1 1 1 的点&#xff0c;经过两步马步移动…

Excel中的常识

工作簿Workbook和工作表Worksheet什么关系&#xff1f; 工作簿&#xff1a;Workbook&#xff0c;也就是一个excel文件 工作表&#xff1a;Worksheet&#xff0c;也就是一个工作表&#xff0c;及Sheet文件 一个工作簿可以包含多个工作表。

IDM(Internet Download Manager)下载器的安装激活与换机方法

很多人都知道 Internet Download Manager(以下简称 IDM)是一款非常优秀的下载提速软件。它功能强大&#xff0c;几乎能下载网页中的所有数据&#xff08;包括视频、音频、图片等&#xff09;&#xff0c;且适用于现在市面上几乎所有的浏览器&#xff0c;非常受大家欢迎。IDM 是…

vue-插槽作用域实用场景

vue-插槽作用域实用场景 1.插槽1.1 自定义列表渲染1.2 数据表格组件1.3 树形组件1.4 表单验证组件1.5 无限滚动组件 1.插槽 插槽感觉知道有这个东西&#xff0c;但是挺少用过的&#xff0c;每次看到基本都会再去看一遍用法和概念。但是在项目里&#xff0c;自己还是没有用到过…