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 {
|
|
|
|
|
2024-12-07 00:59:49 +01:00
|
|
|
String ContentStyleValue::to_string(SerializationMode mode) const
|
2023-03-23 21:17:43 +00:00
|
|
|
{
|
|
|
|
if (has_alt_text())
|
2024-12-07 00:59:49 +01:00
|
|
|
return MUST(String::formatted("{} / {}", m_properties.content->to_string(mode), m_properties.alt_text->to_string(mode)));
|
|
|
|
return m_properties.content->to_string(mode);
|
2023-03-23 21:17:43 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|