mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
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().
This commit is contained in:
parent
5b5fbecb38
commit
4399ca2d82
4 changed files with 37 additions and 15 deletions
|
@ -9,22 +9,11 @@
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibWeb/Bindings/PlatformObject.h>
|
#include <LibWeb/Bindings/PlatformObject.h>
|
||||||
|
#include <LibWeb/CSS/StyleProperty.h>
|
||||||
#include <LibWeb/CSS/StyleValue.h>
|
#include <LibWeb/CSS/StyleValue.h>
|
||||||
|
|
||||||
namespace Web::CSS {
|
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 {
|
class CSSStyleDeclaration : public Bindings::PlatformObject {
|
||||||
WEB_PLATFORM_OBJECT(CSSStyleDeclaration, Bindings::PlatformObject);
|
WEB_PLATFORM_OBJECT(CSSStyleDeclaration, Bindings::PlatformObject);
|
||||||
|
|
||||||
|
|
23
Userland/Libraries/LibWeb/CSS/StyleProperty.h
Normal file
23
Userland/Libraries/LibWeb/CSS/StyleProperty.h
Normal file
|
@ -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 {};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <LibWeb/Bindings/ElementPrototype.h>
|
#include <LibWeb/Bindings/ElementPrototype.h>
|
||||||
#include <LibWeb/Bindings/ShadowRootPrototype.h>
|
#include <LibWeb/Bindings/ShadowRootPrototype.h>
|
||||||
#include <LibWeb/Bindings/WindowGlobalMixin.h>
|
#include <LibWeb/Bindings/WindowGlobalMixin.h>
|
||||||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
#include <LibWeb/CSS/StyleProperty.h>
|
||||||
#include <LibWeb/DOM/ChildNode.h>
|
#include <LibWeb/DOM/ChildNode.h>
|
||||||
#include <LibWeb/DOM/NamedNodeMap.h>
|
#include <LibWeb/DOM/NamedNodeMap.h>
|
||||||
#include <LibWeb/DOM/NonDocumentTypeChildNode.h>
|
#include <LibWeb/DOM/NonDocumentTypeChildNode.h>
|
||||||
|
@ -132,8 +132,8 @@ public:
|
||||||
};
|
};
|
||||||
NeedsRelayout recompute_style();
|
NeedsRelayout recompute_style();
|
||||||
|
|
||||||
Layout::NodeWithStyle* layout_node() { return static_cast<Layout::NodeWithStyle*>(Node::layout_node()); }
|
Layout::NodeWithStyle* layout_node();
|
||||||
Layout::NodeWithStyle const* layout_node() const { return static_cast<Layout::NodeWithStyle const*>(Node::layout_node()); }
|
Layout::NodeWithStyle const* layout_node() const;
|
||||||
|
|
||||||
DeprecatedString name() const { return attribute(HTML::AttributeNames::name); }
|
DeprecatedString name() const { return attribute(HTML::AttributeNames::name); }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue