当前位置: 首页 > 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.mrgr.cn/news/54668.html

相关文章:

  • 【Spring MVC】创建项目和建立请求连接
  • 如何计算表格中重复项有多少?
  • Ansible自动化工具
  • Linux基础项目开发day06:量产工具——业务系统
  • 国有企业在薪酬管理方面常出现哪些问题?
  • 使用 Docker-compose 部署达梦 DM 数据库
  • 3、面向对象之封装与继承(找工作版)
  • 【OD】【E卷】【真题】【100分】流浪地球(PythonJavaJavaScriptC++C)
  • python 模块 输入与输出
  • 探究互联网数字化商品管理变革:从数据化到精准运营的路径转型
  • Leaflet地图中实现绘图(点、线、多边形、圆等)功能
  • 美学心得(第二百六十八集) 罗国正
  • 机器学习【工业高精度计算及其应用】
  • C++头文件大全及解释(补丁)
  • 一 、揭秘操作系统架构:从整体式到微内核的技术演变
  • <Project-11 Calculator> 计算器 0.3 年龄计算器 age Calculator HTML JS
  • 可达性分析法
  • 力扣71~75题
  • docker容器操作
  • 最近很火的ITIL证书是什么证书?
  • 软硬连接,Linux下的动静态库
  • Nat Comput Sci | 分而治之!基于子任务分解的单细胞扰动人工智能模型 STAMP
  • 洛谷 P1038 [NOIP2003 提高组] 神经网络(拓扑排序)
  • Redis之持久化机制和实现原理
  • C/C++程序员为什么要了解汇编?汇编语言的好处与学习路径详解
  • Python进阶语法