diff options
author | Andreas Kling <kling@serenityos.org> | 2023-05-08 06:57:55 +0200 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-05-08 09:29:44 +0200 |
commit | 4399ca2d82945297ebd9239a45717616f4957036 (patch) | |
tree | 7602336b76fc12f04f090b20a7d988e8051944e4 /Userland | |
parent | 5b5fbecb387dc62593eeedac12d495d55ae38abc (diff) | |
download | serenity-4399ca2d82945297ebd9239a45717616f4957036.zip |
LibWeb: Don't include CSS/CSSStyleDeclaration.h from DOM/Element.h
This required splitting out CSS::StyleProperty into its own file and
out-of-lining Element::layout_node().
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h | 13 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleProperty.h | 23 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Element.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Element.h | 6 |
4 files changed, 37 insertions, 15 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h index a04eebd38a..6bb10890ab 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h @@ -9,22 +9,11 @@ #include <AK/DeprecatedString.h> #include <AK/Vector.h> #include <LibWeb/Bindings/PlatformObject.h> +#include <LibWeb/CSS/StyleProperty.h> #include <LibWeb/CSS/StyleValue.h> namespace Web::CSS { -enum class Important { - No, - Yes, -}; - -struct StyleProperty { - Important important { Important::No }; - CSS::PropertyID property_id; - NonnullRefPtr<StyleValue const> value; - DeprecatedString custom_name {}; -}; - class CSSStyleDeclaration : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(CSSStyleDeclaration, Bindings::PlatformObject); diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperty.h b/Userland/Libraries/LibWeb/CSS/StyleProperty.h new file mode 100644 index 0000000000..8adfc386f0 --- /dev/null +++ b/Userland/Libraries/LibWeb/CSS/StyleProperty.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023, Andreas Kling <kling@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +namespace Web::CSS { + +enum class Important { + No, + Yes, +}; + +struct StyleProperty { + Important important { Important::No }; + CSS::PropertyID property_id; + NonnullRefPtr<StyleValue const> value; + DeprecatedString custom_name {}; +}; + +} diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index abc1bc99a0..fe2a649375 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1682,4 +1682,14 @@ void Element::for_each_attribute(Function<void(DeprecatedFlyString const&, Depre } } +Layout::NodeWithStyle* Element::layout_node() +{ + return static_cast<Layout::NodeWithStyle*>(Node::layout_node()); +} + +Layout::NodeWithStyle const* Element::layout_node() const +{ + return static_cast<Layout::NodeWithStyle const*>(Node::layout_node()); +} + } diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 9254b8ee47..23d4118dd8 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -12,7 +12,7 @@ #include <LibWeb/Bindings/ElementPrototype.h> #include <LibWeb/Bindings/ShadowRootPrototype.h> #include <LibWeb/Bindings/WindowGlobalMixin.h> -#include <LibWeb/CSS/CSSStyleDeclaration.h> +#include <LibWeb/CSS/StyleProperty.h> #include <LibWeb/DOM/ChildNode.h> #include <LibWeb/DOM/NamedNodeMap.h> #include <LibWeb/DOM/NonDocumentTypeChildNode.h> @@ -132,8 +132,8 @@ public: }; NeedsRelayout recompute_style(); - Layout::NodeWithStyle* layout_node() { return static_cast<Layout::NodeWithStyle*>(Node::layout_node()); } - Layout::NodeWithStyle const* layout_node() const { return static_cast<Layout::NodeWithStyle const*>(Node::layout_node()); } + Layout::NodeWithStyle* layout_node(); + Layout::NodeWithStyle const* layout_node() const; DeprecatedString name() const { return attribute(HTML::AttributeNames::name); } |