mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibWeb: Move CSS classes into the Web::CSS namespace
This commit is contained in:
parent
3e389f4cdc
commit
1f008c95b6
100 changed files with 358 additions and 366 deletions
|
@ -63,7 +63,7 @@ namespace Web::DOM {
|
|||
|
||||
Document::Document(const URL& url)
|
||||
: ParentNode(*this, NodeType::DOCUMENT_NODE)
|
||||
, m_style_resolver(make<StyleResolver>(*this))
|
||||
, m_style_resolver(make<CSS::StyleResolver>(*this))
|
||||
, m_style_sheets(CSS::StyleSheetList::create(*this))
|
||||
, m_url(url)
|
||||
, m_window(Window::create_with_document(*this))
|
||||
|
@ -213,7 +213,7 @@ RefPtr<Gfx::Bitmap> Document::background_image() const
|
|||
if (!background_image.has_value() || !background_image.value()->is_image())
|
||||
return {};
|
||||
|
||||
auto& image_value = static_cast<const ImageStyleValue&>(*background_image.value());
|
||||
auto& image_value = static_cast<const CSS::ImageStyleValue&>(*background_image.value());
|
||||
if (!image_value.bitmap())
|
||||
return {};
|
||||
|
||||
|
@ -270,9 +270,9 @@ void Document::update_layout()
|
|||
layout();
|
||||
}
|
||||
|
||||
RefPtr<LayoutNode> Document::create_layout_node(const StyleProperties*)
|
||||
RefPtr<LayoutNode> Document::create_layout_node(const CSS::StyleProperties*)
|
||||
{
|
||||
return adopt(*new LayoutDocument(*this, StyleProperties::create()));
|
||||
return adopt(*new LayoutDocument(*this, CSS::StyleProperties::create()));
|
||||
}
|
||||
|
||||
void Document::set_link_color(Color color)
|
||||
|
|
|
@ -69,8 +69,8 @@ public:
|
|||
|
||||
void fixup();
|
||||
|
||||
StyleResolver& style_resolver() { return *m_style_resolver; }
|
||||
const StyleResolver& style_resolver() const { return *m_style_resolver; }
|
||||
CSS::StyleResolver& style_resolver() { return *m_style_resolver; }
|
||||
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; }
|
||||
|
||||
CSS::StyleSheetList& style_sheets() { return *m_style_sheets; }
|
||||
const CSS::StyleSheetList& style_sheets() const { return *m_style_sheets; }
|
||||
|
@ -158,9 +158,9 @@ public:
|
|||
const String& compat_mode() const;
|
||||
|
||||
private:
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override;
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
|
||||
|
||||
OwnPtr<StyleResolver> m_style_resolver;
|
||||
OwnPtr<CSS::StyleResolver> m_style_resolver;
|
||||
RefPtr<CSS::StyleSheetList> m_style_sheets;
|
||||
RefPtr<Node> m_hovered_node;
|
||||
RefPtr<Node> m_inspected_node;
|
||||
|
|
|
@ -107,7 +107,7 @@ bool Element::has_class(const FlyString& class_name) const
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_style)
|
||||
RefPtr<LayoutNode> Element::create_layout_node(const CSS::StyleProperties* parent_style)
|
||||
{
|
||||
auto style = document().style_resolver().resolve_style(*this, parent_style);
|
||||
const_cast<Element&>(*this).m_resolved_style = style;
|
||||
|
@ -164,7 +164,7 @@ enum class StyleDifference {
|
|||
NeedsRelayout,
|
||||
};
|
||||
|
||||
static StyleDifference compute_style_difference(const StyleProperties& old_style, const StyleProperties& new_style, const Document& document)
|
||||
static StyleDifference compute_style_difference(const CSS::StyleProperties& old_style, const CSS::StyleProperties& new_style, const Document& document)
|
||||
{
|
||||
if (old_style == new_style)
|
||||
return StyleDifference::None;
|
||||
|
@ -223,7 +223,7 @@ void Element::recompute_style()
|
|||
}
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleProperties> Element::computed_style()
|
||||
NonnullRefPtr<CSS::StyleProperties> Element::computed_style()
|
||||
{
|
||||
auto properties = m_resolved_style->clone();
|
||||
if (layout_node() && layout_node()->has_style()) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
bool has_class(const FlyString&) const;
|
||||
const Vector<FlyString>& class_names() const { return m_classes; }
|
||||
|
||||
virtual void apply_presentational_hints(StyleProperties&) const { }
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
|
||||
virtual void parse_attribute(const FlyString& name, const String& value);
|
||||
|
||||
void recompute_style();
|
||||
|
@ -76,14 +76,14 @@ public:
|
|||
|
||||
String name() const { return attribute(HTML::AttributeNames::name); }
|
||||
|
||||
const StyleProperties* resolved_style() const { return m_resolved_style.ptr(); }
|
||||
NonnullRefPtr<StyleProperties> computed_style();
|
||||
const CSS::StyleProperties* resolved_style() const { return m_resolved_style.ptr(); }
|
||||
NonnullRefPtr<CSS::StyleProperties> computed_style();
|
||||
|
||||
String inner_html() const;
|
||||
void set_inner_html(StringView);
|
||||
|
||||
protected:
|
||||
RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override;
|
||||
RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
|
||||
|
||||
private:
|
||||
Attribute* find_attribute(const FlyString& name);
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
FlyString m_tag_name;
|
||||
Vector<Attribute> m_attributes;
|
||||
|
||||
RefPtr<StyleProperties> m_resolved_style;
|
||||
RefPtr<CSS::StyleProperties> m_resolved_style;
|
||||
|
||||
Vector<FlyString> m_classes;
|
||||
};
|
||||
|
|
|
@ -110,7 +110,7 @@ const Element* Node::previous_element_sibling() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<LayoutNode> Node::create_layout_node(const StyleProperties*)
|
||||
RefPtr<LayoutNode> Node::create_layout_node(const CSS::StyleProperties*)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
RefPtr<Node> append_child(NonnullRefPtr<Node>, bool notify = true);
|
||||
RefPtr<Node> insert_before(NonnullRefPtr<Node> node, RefPtr<Node> child, bool notify = true);
|
||||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style);
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style);
|
||||
|
||||
virtual FlyString node_name() const = 0;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ Text::~Text()
|
|||
{
|
||||
}
|
||||
|
||||
RefPtr<LayoutNode> Text::create_layout_node(const StyleProperties*)
|
||||
RefPtr<LayoutNode> Text::create_layout_node(const CSS::StyleProperties*)
|
||||
{
|
||||
return adopt(*new LayoutText(document(), *this));
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual FlyString node_name() const override { return "#text"; }
|
||||
|
||||
private:
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override;
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue