mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 13:05:12 +00:00
LibWeb: Use FlyString for Element tag names
This makes selector matching a lot more efficient, and also reduces the number of strings on the heap.
This commit is contained in:
parent
c4a6d6ae9f
commit
7309642ca8
Notes:
sideshowbarker
2024-07-19 08:10:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7309642ca88
48 changed files with 67 additions and 63 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/CSS/Specificity.h>
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
};
|
||||
PseudoClass pseudo_class { PseudoClass::None };
|
||||
|
||||
String value;
|
||||
FlyString value;
|
||||
|
||||
enum class AttributeMatchType {
|
||||
None,
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
};
|
||||
|
||||
AttributeMatchType attribute_match_type { AttributeMatchType::None };
|
||||
String attribute_name;
|
||||
FlyString attribute_name;
|
||||
String attribute_value;
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/DOM/CharacterData.h>
|
||||
|
||||
namespace Web {
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
explicit Comment(Document&, const String&);
|
||||
virtual ~Comment() override;
|
||||
|
||||
virtual String tag_name() const override { return "#comment"; }
|
||||
virtual FlyString tag_name() const override { return "#comment"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
|
@ -69,7 +70,7 @@ public:
|
|||
void add_sheet(const StyleSheet& sheet) { m_sheets.append(sheet); }
|
||||
const NonnullRefPtrVector<StyleSheet>& stylesheets() const { return m_sheets; }
|
||||
|
||||
virtual String tag_name() const override { return "#document"; }
|
||||
virtual FlyString tag_name() const override { return "#document"; }
|
||||
|
||||
void set_hovered_node(Node*);
|
||||
Node* hovered_node() { return m_hovered_node; }
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/DOM/ParentNode.h>
|
||||
|
||||
namespace Web {
|
||||
|
@ -37,7 +38,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual String tag_name() const override { return "#document-fragment"; }
|
||||
virtual FlyString tag_name() const override { return "#document-fragment"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
|
||||
namespace Web {
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
explicit DocumentType(Document&);
|
||||
virtual ~DocumentType() override;
|
||||
|
||||
virtual String tag_name() const override { return "#doctype"; }
|
||||
virtual FlyString tag_name() const override { return "#doctype"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
Element::Element(Document& document, const String& tag_name)
|
||||
Element::Element(Document& document, const FlyString& tag_name)
|
||||
: ParentNode(document, NodeType::ELEMENT_NODE)
|
||||
, m_tag_name(tag_name)
|
||||
{
|
||||
|
|
|
@ -55,10 +55,10 @@ private:
|
|||
|
||||
class Element : public ParentNode {
|
||||
public:
|
||||
Element(Document&, const String& tag_name);
|
||||
Element(Document&, const FlyString& tag_name);
|
||||
virtual ~Element() override;
|
||||
|
||||
virtual String tag_name() const final { return m_tag_name; }
|
||||
virtual FlyString tag_name() const final { return m_tag_name; }
|
||||
|
||||
bool has_attribute(const FlyString& name) const { return !attribute(name).is_null(); }
|
||||
String attribute(const FlyString& name) const;
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
Attribute* find_attribute(const FlyString& name);
|
||||
const Attribute* find_attribute(const FlyString& name) const;
|
||||
|
||||
String m_tag_name;
|
||||
FlyString m_tag_name;
|
||||
Vector<Attribute> m_attributes;
|
||||
|
||||
RefPtr<StyleProperties> m_resolved_style;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
NonnullRefPtr<Element> create_element(Document& document, const String& tag_name)
|
||||
NonnullRefPtr<Element> create_element(Document& document, const FlyString& tag_name)
|
||||
{
|
||||
auto lowercase_tag_name = tag_name.to_lowercase();
|
||||
if (lowercase_tag_name == "a")
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
NonnullRefPtr<Element> create_element(Document&, const String& tag_name);
|
||||
NonnullRefPtr<Element> create_element(Document&, const FlyString& tag_name);
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLAnchorElement::HTMLAnchorElement(Document& document, const String& tag_name)
|
||||
HTMLAnchorElement::HTMLAnchorElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLAnchorElement : public HTMLElement {
|
||||
public:
|
||||
HTMLAnchorElement(Document&, const String& tag_name);
|
||||
HTMLAnchorElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLAnchorElement() override;
|
||||
|
||||
String href() const { return attribute("href"); }
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
template<>
|
||||
inline bool is<HTMLAnchorElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "a";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("a");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLBRElement::HTMLBRElement(Document& document, const String& tag_name)
|
||||
HTMLBRElement::HTMLBRElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLBRElement final : public HTMLElement {
|
||||
public:
|
||||
HTMLBRElement(Document&, const String& tag_name);
|
||||
HTMLBRElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLBRElement() override;
|
||||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
template<>
|
||||
inline bool is<HTMLBRElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "br";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("br");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLBlinkElement::HTMLBlinkElement(Document& document, const String& tag_name)
|
||||
HTMLBlinkElement::HTMLBlinkElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
, m_timer(Core::Timer::construct())
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Web {
|
|||
|
||||
class HTMLBlinkElement : public HTMLElement {
|
||||
public:
|
||||
HTMLBlinkElement(Document&, const String& tag_name);
|
||||
HTMLBlinkElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLBlinkElement() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLBodyElement::HTMLBodyElement(Document& document, const String& tag_name)
|
||||
HTMLBodyElement::HTMLBodyElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLBodyElement : public HTMLElement {
|
||||
public:
|
||||
HTMLBodyElement(Document&, const String& tag_name);
|
||||
HTMLBodyElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLBodyElement() override;
|
||||
|
||||
virtual void parse_attribute(const FlyString&, const String&) override;
|
||||
|
@ -45,7 +45,7 @@ private:
|
|||
template<>
|
||||
inline bool is<HTMLBodyElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "body";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("body");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLCanvasElement::HTMLCanvasElement(Document& document, const String& tag_name)
|
||||
HTMLCanvasElement::HTMLCanvasElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class HTMLCanvasElement : public HTMLElement {
|
|||
public:
|
||||
using WrapperType = Bindings::HTMLCanvasElementWrapper;
|
||||
|
||||
HTMLCanvasElement(Document&, const String& tag_name);
|
||||
HTMLCanvasElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLCanvasElement() override;
|
||||
|
||||
int preferred_width() const;
|
||||
|
@ -59,7 +59,7 @@ private:
|
|||
template<>
|
||||
inline bool is<HTMLCanvasElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "canvas";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("canvas");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLElement::HTMLElement(Document& document, const String& tag_name)
|
||||
HTMLElement::HTMLElement(Document& document, const FlyString& tag_name)
|
||||
: Element(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLElement : public Element {
|
||||
public:
|
||||
HTMLElement(Document&, const String& tag_name);
|
||||
HTMLElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLElement() override;
|
||||
|
||||
String title() const { return attribute("title"); }
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLFontElement::HTMLFontElement(Document& document, const String& tag_name)
|
||||
HTMLFontElement::HTMLFontElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLFontElement : public HTMLElement {
|
||||
public:
|
||||
HTMLFontElement(Document&, const String& tag_name);
|
||||
HTMLFontElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLFontElement() override;
|
||||
|
||||
virtual void apply_presentational_hints(StyleProperties&) const override;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLFormElement::HTMLFormElement(Document& document, const String& tag_name)
|
||||
HTMLFormElement::HTMLFormElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLFormElement : public HTMLElement {
|
||||
public:
|
||||
HTMLFormElement(Document&, const String& tag_name);
|
||||
HTMLFormElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLFormElement() override;
|
||||
|
||||
String action() const { return attribute("action"); }
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
template<>
|
||||
inline bool is<HTMLFormElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "form";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("form");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLHRElement::HTMLHRElement(Document& document, const String& tag_name)
|
||||
HTMLHRElement::HTMLHRElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLHRElement : public HTMLElement {
|
||||
public:
|
||||
HTMLHRElement(Document&, const String& tag_name);
|
||||
HTMLHRElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLHRElement() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLHeadElement::HTMLHeadElement(Document& document, const String& tag_name)
|
||||
HTMLHeadElement::HTMLHeadElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,14 +32,14 @@ namespace Web {
|
|||
|
||||
class HTMLHeadElement : public HTMLElement {
|
||||
public:
|
||||
HTMLHeadElement(Document&, const String& tag_name);
|
||||
HTMLHeadElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLHeadElement() override;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool is<HTMLHeadElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "head";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("head");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLHeadingElement::HTMLHeadingElement(Document& document, const String& tag_name)
|
||||
HTMLHeadingElement::HTMLHeadingElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLHeadingElement : public HTMLElement {
|
||||
public:
|
||||
HTMLHeadingElement(Document&, const String& tag_name);
|
||||
HTMLHeadingElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLHeadingElement() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLHtmlElement::HTMLHtmlElement(Document& document, const String& tag_name)
|
||||
HTMLHtmlElement::HTMLHtmlElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,14 +32,14 @@ namespace Web {
|
|||
|
||||
class HTMLHtmlElement : public HTMLElement {
|
||||
public:
|
||||
HTMLHtmlElement(Document&, const String& tag_name);
|
||||
HTMLHtmlElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLHtmlElement() override;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool is<HTMLHtmlElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "html";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("html");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLImageElement::HTMLImageElement(Document& document, const String& tag_name)
|
||||
HTMLImageElement::HTMLImageElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class LayoutDocument;
|
|||
|
||||
class HTMLImageElement : public HTMLElement {
|
||||
public:
|
||||
HTMLImageElement(Document&, const String& tag_name);
|
||||
HTMLImageElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLImageElement() override;
|
||||
|
||||
virtual void parse_attribute(const FlyString& name, const String& value) override;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLInputElement::HTMLInputElement(Document& document, const String& tag_name)
|
||||
HTMLInputElement::HTMLInputElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLInputElement : public HTMLElement {
|
||||
public:
|
||||
HTMLInputElement(Document&, const String& tag_name);
|
||||
HTMLInputElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLInputElement() override;
|
||||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
template<>
|
||||
inline bool is<HTMLInputElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "input";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("input");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLLinkElement::HTMLLinkElement(Document& document, const String& tag_name)
|
||||
HTMLLinkElement::HTMLLinkElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLLinkElement final : public HTMLElement {
|
||||
public:
|
||||
HTMLLinkElement(Document&, const String& tag_name);
|
||||
HTMLLinkElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLLinkElement() override;
|
||||
|
||||
virtual void inserted_into(Node&) override;
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
template<>
|
||||
inline bool is<HTMLLinkElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "link";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("link");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLScriptElement::HTMLScriptElement(Document& document, const String& tag_name)
|
||||
HTMLScriptElement::HTMLScriptElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class HTMLScriptElement : public HTMLElement {
|
||||
public:
|
||||
HTMLScriptElement(Document&, const String& tag_name);
|
||||
HTMLScriptElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLScriptElement() override;
|
||||
|
||||
virtual void inserted_into(Node&) override;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLStyleElement::HTMLStyleElement(Document& document, const String& tag_name)
|
||||
HTMLStyleElement::HTMLStyleElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class StyleSheet;
|
|||
|
||||
class HTMLStyleElement : public HTMLElement {
|
||||
public:
|
||||
HTMLStyleElement(Document&, const String& tag_name);
|
||||
HTMLStyleElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLStyleElement() override;
|
||||
|
||||
virtual void inserted_into(Node&) override;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
HTMLTitleElement::HTMLTitleElement(Document& document, const String& tag_name)
|
||||
HTMLTitleElement::HTMLTitleElement(Document& document, const FlyString& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,14 +32,14 @@ namespace Web {
|
|||
|
||||
class HTMLTitleElement : public HTMLElement {
|
||||
public:
|
||||
HTMLTitleElement(Document&, const String& tag_name);
|
||||
HTMLTitleElement(Document&, const FlyString& tag_name);
|
||||
virtual ~HTMLTitleElement() override;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool is<HTMLTitleElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "title";
|
||||
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("title");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const;
|
||||
|
||||
virtual String tag_name() const = 0;
|
||||
virtual FlyString tag_name() const = 0;
|
||||
|
||||
virtual String text_content() const;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibWeb/DOM/CharacterData.h>
|
||||
|
||||
|
@ -36,7 +37,7 @@ public:
|
|||
explicit Text(Document&, const String&);
|
||||
virtual ~Text() override;
|
||||
|
||||
virtual String tag_name() const override { return "#text"; }
|
||||
virtual FlyString tag_name() const override { return "#text"; }
|
||||
|
||||
private:
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
|
|
@ -75,7 +75,7 @@ void dump_tree(const LayoutNode& layout_node)
|
|||
for (size_t i = 0; i < indent; ++i)
|
||||
dbgprintf(" ");
|
||||
|
||||
String tag_name;
|
||||
FlyString tag_name;
|
||||
if (layout_node.is_anonymous())
|
||||
tag_name = "(anonymous)";
|
||||
else if (is<Text>(layout_node.node()))
|
||||
|
|
Loading…
Add table
Reference in a new issue