2023-03-24 23:53:41 +00:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2023-03-24 23:53:41 +00:00
|
|
|
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
2024-10-14 16:23:35 +01:00
|
|
|
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
2023-03-24 23:53:41 +00:00
|
|
|
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "UnresolvedStyleValue.h"
|
|
|
|
#include <AK/StringBuilder.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2024-12-07 00:59:49 +01:00
|
|
|
String UnresolvedStyleValue::to_string(SerializationMode) const
|
2023-03-24 23:53:41 +00:00
|
|
|
{
|
2024-10-14 16:23:35 +01:00
|
|
|
if (m_original_source_text.has_value())
|
|
|
|
return *m_original_source_text;
|
|
|
|
|
2024-10-15 10:21:40 +01:00
|
|
|
return MUST(String::join(' ', m_values));
|
2023-03-24 23:53:41 +00:00
|
|
|
}
|
|
|
|
|
2024-08-14 11:10:54 +01:00
|
|
|
bool UnresolvedStyleValue::equals(CSSStyleValue const& other) const
|
2023-03-24 23:53:41 +00:00
|
|
|
{
|
|
|
|
if (type() != other.type())
|
|
|
|
return false;
|
|
|
|
// This is a case where comparing the strings actually makes sense.
|
2024-12-07 00:59:49 +01:00
|
|
|
return to_string(SerializationMode::Normal) == other.to_string(SerializationMode::Normal);
|
2023-03-24 23:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|