From 6131f5ec6e244496029aa1de9afc4dae41c70f52 Mon Sep 17 00:00:00 2001 From: andycall Date: Tue, 19 Nov 2024 02:05:47 +0800 Subject: [PATCH] fix: generate atomic string for css properties. --- bridge/core/css/parser/css_selector_parser.cc | 1 - .../templates/json_templates/css_properties.cc.tpl | 5 +++++ .../templates/json_templates/css_properties.h.tpl | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bridge/core/css/parser/css_selector_parser.cc b/bridge/core/css/parser/css_selector_parser.cc index 357ea66924..4ff739242f 100644 --- a/bridge/core/css/parser/css_selector_parser.cc +++ b/bridge/core/css/parser/css_selector_parser.cc @@ -1766,7 +1766,6 @@ tcb::span CSSSelectorParser::ConsumeCompoundSelector(CSSParserToken AtomicString namespace_prefix; AtomicString element_name; const bool has_q_name = ConsumeName(stream, element_name, namespace_prefix); - element_name = element_name.LowerASCII(); // A tag name is not valid following a pseudo-element. This can happen for // e.g. :::part(x):is(div). diff --git a/bridge/scripts/code_generator/templates/json_templates/css_properties.cc.tpl b/bridge/scripts/code_generator/templates/json_templates/css_properties.cc.tpl index 1588f2293d..7cc075e52a 100644 --- a/bridge/scripts/code_generator/templates/json_templates/css_properties.cc.tpl +++ b/bridge/scripts/code_generator/templates/json_templates/css_properties.cc.tpl @@ -38,6 +38,11 @@ const char* <%= class_name %>::GetPropertyName() const { return "<%= exposed_property.name %>"; } +const AtomicString& <%= class_name %>::GetPropertyNameAtomicString() const { + thread_local static AtomicString name("<%= exposed_property.name %>"); + return name; +} + const char* <%= class_name %>::GetJSPropertyName() const { return "<%= lowerCamelCase(exposed_property.name) %>"; } diff --git a/bridge/scripts/code_generator/templates/json_templates/css_properties.h.tpl b/bridge/scripts/code_generator/templates/json_templates/css_properties.h.tpl index e319501ec1..dc37050bdc 100644 --- a/bridge/scripts/code_generator/templates/json_templates/css_properties.h.tpl +++ b/bridge/scripts/code_generator/templates/json_templates/css_properties.h.tpl @@ -71,6 +71,7 @@ class <%= class_name %> final : public <%= property.superclass %> { public: constexpr <%= class_name %>() : <%= property.superclass %>(<%= ctor_args.join(', ') %> ) { } const char* GetPropertyName() const override; + const AtomicString& GetPropertyNameAtomicString() const override; const char* GetJSPropertyName() const override; <% if(property.alternative) { %> CSSPropertyID GetAlternative() const override {