ladybird/Libraries/LibWeb/CSS/CSSFunctionDescriptors.cpp
Andreas Kling 22a26babc5 LibWeb: Take UTF-16 names in get_property_value
Change get_property_value() to take a Utf16FlyString so generated CSS
property accessors can pass their JS property names through without
constructing FlyString instances first.

Keep the existing internal descriptor and custom-property storage shape
for now, and convert at those boundaries while the remaining CSS
property APIs are migrated separately.
2026-06-09 11:48:02 +02:00

38 lines
1 KiB
C++

/*
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "CSSFunctionDescriptors.h"
#include <LibWeb/Bindings/CSSFunctionDescriptors.h>
#include <LibWeb/Bindings/Intrinsics.h>
namespace Web::CSS {
GC_DEFINE_ALLOCATOR(CSSFunctionDescriptors);
GC::Ref<CSSFunctionDescriptors> CSSFunctionDescriptors::create(JS::Realm& realm, Vector<Descriptor> descriptors)
{
return realm.create<CSSFunctionDescriptors>(realm, move(descriptors));
}
void CSSFunctionDescriptors::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSFunctionDescriptors);
Base::initialize(realm);
}
// https://drafts.csswg.org/css-mixins-1/#dom-cssfunctiondescriptors-result
String CSSFunctionDescriptors::result() const
{
return get_property_value("result"_utf16_fly_string);
}
// https://drafts.csswg.org/css-mixins-1/#dom-cssfunctiondescriptors-result
WebIDL::ExceptionOr<void> CSSFunctionDescriptors::set_result(StringView value)
{
return set_property("result"_string, value, ""sv);
}
}