2023-04-26 21:05:38 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Emil Militzer <emil.militzer@posteo.de>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DisplayStyleValue.h"
|
2026-04-30 11:25:35 +12:00
|
|
|
#include <LibWeb/CSS/CSSKeywordValue.h>
|
|
|
|
|
#include <LibWeb/CSS/CSSStyleValue.h>
|
2023-04-26 21:05:38 +02:00
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
2025-04-15 15:18:27 -06:00
|
|
|
ValueComparingNonnullRefPtr<DisplayStyleValue const> DisplayStyleValue::create(Display const& display)
|
2023-04-26 21:05:38 +02:00
|
|
|
{
|
2023-08-19 14:00:10 +01:00
|
|
|
return adopt_ref(*new (nothrow) DisplayStyleValue(display));
|
2023-04-26 21:05:38 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-30 11:25:35 +12:00
|
|
|
GC::Ref<CSSStyleValue> DisplayStyleValue::reify(JS::Realm& realm, FlyString const& associated_property) const
|
|
|
|
|
{
|
|
|
|
|
if (auto keyword = m_display.to_keyword(); keyword.has_value())
|
|
|
|
|
return CSSKeywordValue::create(realm, FlyString::from_utf8_without_validation(string_from_keyword(keyword.value()).bytes()));
|
|
|
|
|
|
|
|
|
|
return CSSStyleValue::create(realm, associated_property, *this);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-26 21:05:38 +02:00
|
|
|
}
|