ladybird/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp
Andreas Kling d641bfd7e2 LibWeb: Store custom property names as UTF-16
Move PropertyNameAndID, custom property data, registered custom
properties, and Typed OM associated property names to Utf16FlyString.

This removes the FlyString storage boundary from CSS property-name
handling and lets CSSStyleProperties keep the name it receives from
CSSOM instead of converting it back to UTF-8.
2026-06-09 11:48:02 +02:00

26 lines
814 B
C++

/*
* Copyright (c) 2023, Emil Militzer <emil.militzer@posteo.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "DisplayStyleValue.h"
#include <LibWeb/CSS/CSSKeywordValue.h>
#include <LibWeb/CSS/CSSStyleValue.h>
namespace Web::CSS {
ValueComparingNonnullRefPtr<DisplayStyleValue const> DisplayStyleValue::create(Display const& display)
{
return adopt_ref(*new (nothrow) DisplayStyleValue(display));
}
GC::Ref<CSSStyleValue> DisplayStyleValue::reify(JS::Realm& realm, Utf16FlyString 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);
}
}