diff options
-rw-r--r-- | Libraries/LibWeb/DOM/Element.cpp | 10 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Element.h | 19 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLBodyElement.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLBodyElement.h | 2 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLImageElement.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLImageElement.h | 2 |
6 files changed, 19 insertions, 18 deletions
diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index fc3674a32b..f71f69dd0a 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -49,7 +49,7 @@ Element::~Element() { } -Attribute* Element::find_attribute(const String& name) +Attribute* Element::find_attribute(const FlyString& name) { for (auto& attribute : m_attributes) { if (attribute.name() == name) @@ -58,7 +58,7 @@ Attribute* Element::find_attribute(const String& name) return nullptr; } -const Attribute* Element::find_attribute(const String& name) const +const Attribute* Element::find_attribute(const FlyString& name) const { for (auto& attribute : m_attributes) { if (attribute.name() == name) @@ -67,14 +67,14 @@ const Attribute* Element::find_attribute(const String& name) const return nullptr; } -String Element::attribute(const String& name) const +String Element::attribute(const FlyString& name) const { if (auto* attribute = find_attribute(name)) return attribute->value(); return {}; } -void Element::set_attribute(const String& name, const String& value) +void Element::set_attribute(const FlyString& name, const String& value) { if (auto* attribute = find_attribute(name)) attribute->set_value(value); @@ -131,7 +131,7 @@ RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_sty ASSERT_NOT_REACHED(); } -void Element::parse_attribute(const String&, const String&) +void Element::parse_attribute(const FlyString&, const String&) { } diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index 0e7af34ba8..37f95200de 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -26,6 +26,7 @@ #pragma once +#include <AK/FlyString.h> #include <AK/String.h> #include <LibWeb/DOM/ParentNode.h> #include <LibWeb/Layout/LayoutNode.h> @@ -36,19 +37,19 @@ class LayoutNodeWithStyle; class Attribute { public: - Attribute(const String& name, const String& value) + Attribute(const FlyString& name, const String& value) : m_name(name) , m_value(value) { } - const String& name() const { return m_name; } + const FlyString& name() const { return m_name; } const String& value() const { return m_value; } void set_value(const String& value) { m_value = value; } private: - String m_name; + FlyString m_name; String m_value; }; @@ -59,9 +60,9 @@ public: virtual String tag_name() const final { return m_tag_name; } - bool has_attribute(const String& name) const { return !attribute(name).is_null(); } - String attribute(const String& name) const; - void set_attribute(const String& name, const String& value); + bool has_attribute(const FlyString& name) const { return !attribute(name).is_null(); } + String attribute(const FlyString& name) const; + void set_attribute(const FlyString& name, const String& value); void set_attributes(Vector<Attribute>&&); @@ -75,7 +76,7 @@ public: bool has_class(const StringView&) const; virtual void apply_presentational_hints(StyleProperties&) const {} - virtual void parse_attribute(const String& name, const String& value); + virtual void parse_attribute(const FlyString& name, const String& value); void recompute_style(); @@ -90,8 +91,8 @@ public: private: RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override; - Attribute* find_attribute(const String& name); - const Attribute* find_attribute(const String& name) const; + Attribute* find_attribute(const FlyString& name); + const Attribute* find_attribute(const FlyString& name) const; String m_tag_name; Vector<Attribute> m_attributes; diff --git a/Libraries/LibWeb/DOM/HTMLBodyElement.cpp b/Libraries/LibWeb/DOM/HTMLBodyElement.cpp index 5ce725f1f9..962355eb25 100644 --- a/Libraries/LibWeb/DOM/HTMLBodyElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLBodyElement.cpp @@ -58,7 +58,7 @@ void HTMLBodyElement::apply_presentational_hints(StyleProperties& style) const }); } -void HTMLBodyElement::parse_attribute(const String& name, const String& value) +void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value) { if (name.equals_ignoring_case("link")) { auto color = Color::from_string(value); diff --git a/Libraries/LibWeb/DOM/HTMLBodyElement.h b/Libraries/LibWeb/DOM/HTMLBodyElement.h index cef9e3a664..d4589d0d76 100644 --- a/Libraries/LibWeb/DOM/HTMLBodyElement.h +++ b/Libraries/LibWeb/DOM/HTMLBodyElement.h @@ -35,7 +35,7 @@ public: HTMLBodyElement(Document&, const String& tag_name); virtual ~HTMLBodyElement() override; - virtual void parse_attribute(const String&, const String&) override; + virtual void parse_attribute(const FlyString&, const String&) override; virtual void apply_presentational_hints(StyleProperties&) const override; private: diff --git a/Libraries/LibWeb/DOM/HTMLImageElement.cpp b/Libraries/LibWeb/DOM/HTMLImageElement.cpp index f1db4428f9..5d65a68190 100644 --- a/Libraries/LibWeb/DOM/HTMLImageElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLImageElement.cpp @@ -43,7 +43,7 @@ HTMLImageElement::~HTMLImageElement() { } -void HTMLImageElement::parse_attribute(const String& name, const String& value) +void HTMLImageElement::parse_attribute(const FlyString& name, const String& value) { if (name.equals_ignoring_case("src")) load_image(value); diff --git a/Libraries/LibWeb/DOM/HTMLImageElement.h b/Libraries/LibWeb/DOM/HTMLImageElement.h index f30f37d3a1..01d40c3e03 100644 --- a/Libraries/LibWeb/DOM/HTMLImageElement.h +++ b/Libraries/LibWeb/DOM/HTMLImageElement.h @@ -39,7 +39,7 @@ public: HTMLImageElement(Document&, const String& tag_name); virtual ~HTMLImageElement() override; - virtual void parse_attribute(const String& name, const String& value) override; + virtual void parse_attribute(const FlyString& name, const String& value) override; String alt() const { return attribute("alt"); } String src() const { return attribute("src"); } |