当前位置: 首页 > news >正文

Chromium html<lable>c++接口定义

HTML <label> 元素(标签)表示用户界面中某个元素的说明。

1、<label> 在html_tag_names.json5中接口定义:

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

    {name: "label",interfaceHeaderDir: "third_party/blink/renderer/core/html/forms",},

2、html_label_element.idl接口定义:

// https://html.spec.whatwg.org/C/#the-label-element
[Exposed=Window,HTMLConstructor
] interface HTMLLabelElement : HTMLElement {readonly attribute HTMLFormElement? form;[CEReactions, Reflect=for] attribute DOMString htmlFor;readonly attribute HTMLElement? control;
};

2、html_label_element.idl接口blink实现:

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

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

namespace blink {class CORE_EXPORT HTMLLabelElement final : public HTMLElement {DEFINE_WRAPPERTYPEINFO();public:explicit HTMLLabelElement(Document&);HTMLElement* control() const;HTMLFormElement* form() const;bool WillRespondToMouseClickEvents() override;private:bool IsInInteractiveContent(Node*) const;bool IsInteractiveContent() const override;void AccessKeyAction(SimulatedClickCreationScope creation_scope) override;// Overridden to update the hover/active state of the corresponding control.void SetActive(bool active) override;void SetHovered(bool hovered) override;// Overridden to either click() or focus() the corresponding control.void DefaultEventHandler(Event&) override;bool HasActivationBehavior() const override;void Focus(const FocusParams&) override;bool processing_click_;
};}  // namespace blink

3、html_label_element.idl接口v8实现:

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

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

namespace blink {bool V8HTMLLabelElement::IsExposed(ExecutionContext* execution_context) {return execution_context->IsWindow();
}// Construction of WrapperTypeInfo may require non-trivial initialization due
// to cross-component address resolution in order to load the pointer to the
// parent interface's WrapperTypeInfo.  We ignore this issue because the issue
// happens only on component builds and the official release builds
// (statically-linked builds) are never affected by this issue.
#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endifconst WrapperTypeInfo V8HTMLLabelElement::wrapper_type_info_{gin::kEmbedderBlink,V8HTMLLabelElement::InstallInterfaceTemplate,nullptr,"HTMLLabelElement",V8HTMLElement::GetWrapperTypeInfo(),WrapperTypeInfo::kWrapperTypeObjectPrototype,WrapperTypeInfo::kNodeClassId,WrapperTypeInfo::kNotInheritFromActiveScriptWrappable,WrapperTypeInfo::kIdlInterface,false,
};#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
#pragma clang diagnostic pop
#endifconst WrapperTypeInfo& HTMLLabelElement::wrapper_type_info_ =V8HTMLLabelElement::wrapper_type_info_;// non-[ActiveScriptWrappable]
static_assert(!std::is_base_of<ActiveScriptWrappableBase, HTMLLabelElement>::value,"HTMLLabelElement inherits from ActiveScriptWrappable<> without ""[ActiveScriptWrappable] extended attribute.");namespace  {namespace v8_html_label_element {void FormAttributeGetCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_HTMLLabelElement_form_Getter");
BLINK_BINDINGS_TRACE_EVENT("HTMLLabelElement.form.get");v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> v8_receiver = info.This();
HTMLLabelElement* blink_receiver = V8HTMLLabelElement::ToWrappableUnsafe(isolate, v8_receiver);
auto&& return_value = blink_receiver->form();
bindings::V8SetReturnValue(info, return_value, blink_receiver);
}void HTMLForAttributeGetCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_HTMLLabelElement_htmlFor_Getter");
BLINK_BINDINGS_TRACE_EVENT("HTMLLabelElement.htmlFor.get");v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> v8_receiver = info.This();
HTMLLabelElement* blink_receiver = V8HTMLLabelElement::ToWrappableUnsafe(isolate, v8_receiver);
auto&& return_value = blink_receiver->FastGetAttribute(html_names::kForAttr);
bindings::V8SetReturnValue(info, return_value, isolate, bindings::V8ReturnValue::kNonNullable);
}void HTMLForAttributeSetCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_HTMLLabelElement_htmlFor_Setter");
BLINK_BINDINGS_TRACE_EVENT("HTMLLabelElement.htmlFor.set");const char* const class_like_name = "HTMLLabelElement";
const char* const property_name = "htmlFor";
bindings::PerformAttributeSetCEReactionsReflectTypeString(info, html_names::kForAttr, class_like_name, property_name);
}void ControlAttributeGetCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_HTMLLabelElement_control_Getter");
BLINK_BINDINGS_TRACE_EVENT("HTMLLabelElement.control.get");v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> v8_receiver = info.This();
HTMLLabelElement* blink_receiver = V8HTMLLabelElement::ToWrappableUnsafe(isolate, v8_receiver);
auto&& return_value = blink_receiver->control();
bindings::V8SetReturnValue(info, return_value, blink_receiver);
}void ConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_HTMLLabelElement_constructor");
BLINK_BINDINGS_TRACE_EVENT("HTMLLabelElement.constructor");v8::Isolate* isolate = info.GetIsolate();
if (!info.IsConstructCall()) {const ExceptionContextType exception_context_type = ExceptionContextType::kConstructorOperationInvoke;
const char* const class_like_name = "HTMLLabelElement";
ExceptionState exception_state(isolate, exception_context_type, class_like_name);
exception_state.ThrowTypeError(ExceptionMessages::ConstructorCalledAsFunction());
return;
}
if (ConstructorMode::Current(isolate) == ConstructorMode::kWrapExistingObject) {v8::Local<v8::Object> v8_receiver = info.This();
bindings::V8SetReturnValue(info, v8_receiver);
return;
}// [HTMLConstructor]
V8HTMLConstructor::HtmlConstructor(info, *V8HTMLLabelElement::GetWrapperTypeInfo(), HTMLElementType::kHTMLLabelElement);
}}  // namespace v8_html_label_elementusing namespace v8_html_label_element;}  // namespace void V8HTMLLabelElement::InstallInterfaceTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::Template> interface_template) {const WrapperTypeInfo* const wrapper_type_info = V8HTMLLabelElement::GetWrapperTypeInfo();
v8::Local<v8::FunctionTemplate> interface_function_template = interface_template.As<v8::FunctionTemplate>();
v8::Local<v8::ObjectTemplate> instance_object_template = interface_function_template->InstanceTemplate();
v8::Local<v8::ObjectTemplate> prototype_object_template = interface_function_template->PrototypeTemplate();
v8::Local<v8::FunctionTemplate> parent_interface_template = wrapper_type_info->parent_class->GetV8ClassTemplate(isolate, world).As<v8::FunctionTemplate>();
bindings::SetupIDLInterfaceTemplate(isolate, wrapper_type_info, instance_object_template, prototype_object_template, interface_function_template, parent_interface_template);interface_function_template->SetCallHandler(ConstructorCallback);
interface_function_template->SetLength(0);v8::Local<v8::Template> instance_template = instance_object_template;
v8::Local<v8::Template> prototype_template = prototype_object_template;
InstallUnconditionalProperties(isolate, world, instance_template, prototype_template, interface_template);
}void V8HTMLLabelElement::InstallUnconditionalProperties(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::Template> instance_template, v8::Local<v8::Template> prototype_template, v8::Local<v8::Template> interface_template) {using bindings::IDLMemberInstaller;{static const IDLMemberInstaller::AttributeConfig kAttributeTable[] = {
{"form", FormAttributeGetCallback, nullptr, unsigned(v8::None), unsigned(IDLMemberInstaller::FlagLocation::kPrototype), unsigned(IDLMemberInstaller::FlagWorld::kAllWorlds), unsigned(IDLMemberInstaller::FlagReceiverCheck::kCheck), unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), unsigned(v8::SideEffectType::kHasNoSideEffect), unsigned(V8PrivateProperty::CachedAccessor::kNone)},
{"htmlFor", HTMLForAttributeGetCallback, HTMLForAttributeSetCallback, unsigned(v8::None), unsigned(IDLMemberInstaller::FlagLocation::kPrototype), unsigned(IDLMemberInstaller::FlagWorld::kAllWorlds), unsigned(IDLMemberInstaller::FlagReceiverCheck::kCheck), unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), unsigned(v8::SideEffectType::kHasNoSideEffect), unsigned(V8PrivateProperty::CachedAccessor::kNone)},
{"control", ControlAttributeGetCallback, nullptr, unsigned(v8::None), unsigned(IDLMemberInstaller::FlagLocation::kPrototype), unsigned(IDLMemberInstaller::FlagWorld::kAllWorlds), unsigned(IDLMemberInstaller::FlagReceiverCheck::kCheck), unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), unsigned(v8::SideEffectType::kHasNoSideEffect), unsigned(V8PrivateProperty::CachedAccessor::kNone)},
};
v8::Local<v8::FunctionTemplate> interface_function_template = interface_template.As<v8::FunctionTemplate>();
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interface_function_template);
IDLMemberInstaller::InstallAttributes(isolate, world, instance_template, prototype_template, interface_template, signature, kAttributeTable);
}}}  // namespace blink

http://www.lryc.cn/news/467768.html

相关文章:

  • QT中中文显示乱码问题
  • [面试常见]Javascript基础知识
  • 使用注解@ExcelIgnoreUnannotated实现了在导出 Excel 时忽略没有被标注的字段
  • 线程的同步
  • 【启明智显分享】ZX7981PG/ZX7981PM融入官方OpenWrt,启明智显SDK/官方OpenWrt任由选择!
  • 如何用java发送包含表格形式的邮件
  • 讲个故事:关于一次接口性能优化的心里路程
  • Centos7升级到openssh9.9
  • 使用 STM32F407 串口实现 485 通信
  • 基于NERF技术重建学习笔记
  • webView 支持全屏播放
  • QGIS之三十二DEM地形导出三维模型gltf
  • 【python爬虫】携程旅行景点游客数据分析与可视化
  • python实现onvif协议下控制摄像头变焦,以及融合人形识别与跟踪控制
  • 【Vue】Vue3.0(十四)接口,泛型和自定义类型的概念及使用
  • 【C++】红黑树万字详解(一文彻底搞懂红黑树的底层逻辑)
  • 开源FluentFTP实操,操控FTP文件
  • 论文解读 | ECCV2024 AutoEval-Video:一个用于评估大型视觉-语言模型在开放式视频问答中的自动基准测试...
  • postgresql14主从同步流复制搭建
  • 企业信息化管理中的数据集成方案:销售出库单对接
  • 3.cpp基本数据类型
  • MCK主机加固与防漏扫的深度解析
  • 《软件估算之原始功能点:精准度量软件规模的关键》
  • 序列化与反序列化
  • 安装nginx实现多ip访问多网站
  • 每日回顾:简单用C写 冒泡排序、快速排序
  • 前端_007_Axios库
  • NAND FLASH 与 SPI FLASH
  • QTCreator打不开双击没反应
  • vue npm run ...时 报错-系统找不到指定的路径