mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-15 22:12:20 +00:00
LibWeb: Avoid FlyString->String->FlyString roundtrips in CSS variables
This commit is contained in:
parent
7da3b0dd7b
commit
b15316eba8
Notes:
sideshowbarker
2024-07-17 00:47:29 +09:00
Author: https://github.com/awesomekling
Commit: b15316eba8
Pull-request: https://github.com/SerenityOS/serenity/pull/23602
1 changed files with 7 additions and 7 deletions
|
@ -6943,7 +6943,7 @@ NonnullRefPtr<StyleValue> Parser::resolve_unresolved_style_value(Badge<StyleComp
|
|||
|
||||
class PropertyDependencyNode : public RefCounted<PropertyDependencyNode> {
|
||||
public:
|
||||
static NonnullRefPtr<PropertyDependencyNode> create(String name)
|
||||
static NonnullRefPtr<PropertyDependencyNode> create(FlyString name)
|
||||
{
|
||||
return adopt_ref(*new PropertyDependencyNode(move(name)));
|
||||
}
|
||||
|
@ -6974,12 +6974,12 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
explicit PropertyDependencyNode(String name)
|
||||
explicit PropertyDependencyNode(FlyString name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
String m_name;
|
||||
FlyString m_name;
|
||||
Vector<NonnullRefPtr<PropertyDependencyNode>> m_children;
|
||||
bool m_marked { false };
|
||||
};
|
||||
|
@ -7008,12 +7008,12 @@ NonnullRefPtr<StyleValue> Parser::resolve_unresolved_style_value(DOM::Element& e
|
|||
static RefPtr<StyleValue const> get_custom_property(DOM::Element const& element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element, FlyString const& custom_property_name)
|
||||
{
|
||||
if (pseudo_element.has_value()) {
|
||||
if (auto it = element.custom_properties(pseudo_element).find(custom_property_name.to_string()); it != element.custom_properties(pseudo_element).end())
|
||||
if (auto it = element.custom_properties(pseudo_element).find(custom_property_name); it != element.custom_properties(pseudo_element).end())
|
||||
return it->value.value;
|
||||
}
|
||||
|
||||
for (auto const* current_element = &element; current_element; current_element = current_element->parent_element()) {
|
||||
if (auto it = current_element->custom_properties({}).find(custom_property_name.to_string()); it != current_element->custom_properties({}).end())
|
||||
if (auto it = current_element->custom_properties({}).find(custom_property_name); it != current_element->custom_properties({}).end())
|
||||
return it->value.value;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -7029,10 +7029,10 @@ bool Parser::expand_variables(DOM::Element& element, Optional<Selector::PseudoEl
|
|||
return false;
|
||||
}
|
||||
|
||||
auto get_dependency_node = [&](FlyString name) -> NonnullRefPtr<PropertyDependencyNode> {
|
||||
auto get_dependency_node = [&](FlyString const& name) -> NonnullRefPtr<PropertyDependencyNode> {
|
||||
if (auto existing = dependencies.get(name); existing.has_value())
|
||||
return *existing.value();
|
||||
auto new_node = PropertyDependencyNode::create(name.to_string());
|
||||
auto new_node = PropertyDependencyNode::create(name);
|
||||
dependencies.set(name, new_node);
|
||||
return new_node;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue