1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

LibWeb: Resolve cyclic declaration/definitions involving Length

This remained undetected for a long time as HeaderCheck is disabled by
default. This commit makes the following file compile again:

    // file: compile_me.cpp
    #include <LibWeb/CSS/GridTrackSize.h>
    // That's it, this was enough to cause a compilation error.
This commit is contained in:
Ben Wiederhake 2022-09-13 17:42:39 +02:00 committed by Sam Atkins
parent 53eb35caba
commit 8deced39a8
15 changed files with 192 additions and 125 deletions

View file

@ -40,6 +40,7 @@ public:
// this file already. To break the cyclic dependency, we must move all method definitions out.
Length(int value, Type type);
Length(float value, Type type);
~Length();
static Length make_auto();
static Length make_px(float value);
@ -117,13 +118,9 @@ public:
String to_string() const;
bool operator==(Length const& other) const
{
if (is_calculated())
return m_calculated_style == other.m_calculated_style;
return m_type == other.m_type && m_value == other.m_value;
}
// We have a RefPtr<CalculatedStyleValue> member, but can't include the header StyleValue.h as it includes
// this file already. To break the cyclic dependency, we must move all method definitions out.
bool operator==(Length const& other) const;
bool operator!=(Length const& other) const
{
return !(*this == other);