2023-03-23 21:17:43 +00:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2023-03-23 21:17:43 +00:00
|
|
|
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
|
|
|
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
|
|
|
|
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ContentStyleValue.h"
|
2023-03-25 00:12:21 +00:00
|
|
|
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
2023-03-23 21:17:43 +00:00
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
2026-01-08 12:02:18 +00:00
|
|
|
void ContentStyleValue::serialize(StringBuilder& builder, SerializationMode mode) const
|
2023-03-23 21:17:43 +00:00
|
|
|
{
|
2026-01-08 12:02:18 +00:00
|
|
|
m_properties.content->serialize(builder, mode);
|
|
|
|
|
if (has_alt_text()) {
|
|
|
|
|
builder.append(" / "sv);
|
|
|
|
|
m_properties.alt_text->serialize(builder, mode);
|
|
|
|
|
}
|
2023-03-23 21:17:43 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-08 16:19:00 +13:00
|
|
|
bool ContentStyleValue::is_computationally_independent() const
|
|
|
|
|
{
|
|
|
|
|
return m_properties.content->is_computationally_independent() && (!m_properties.alt_text || m_properties.alt_text->is_computationally_independent());
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-04 14:19:23 +01:00
|
|
|
void ContentStyleValue::set_style_sheet(GC::Ptr<CSSStyleSheet> style_sheet)
|
|
|
|
|
{
|
|
|
|
|
Base::set_style_sheet(style_sheet);
|
|
|
|
|
const_cast<StyleValueList&>(*m_properties.content).set_style_sheet(style_sheet);
|
|
|
|
|
if (m_properties.alt_text)
|
|
|
|
|
const_cast<StyleValueList&>(*m_properties.alt_text).set_style_sheet(style_sheet);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-23 21:17:43 +00:00
|
|
|
}
|