mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-06-28 04:00:33 +00:00
Move the remaining CSSStyleDeclaration property-name APIs to Utf16FlyString. This lets CSSOM binding and generated accessor code pass JS property names without first constructing FlyString values. Keep internal custom-property and descriptor storage unchanged for now. Those remaining FlyString conversions are at storage boundaries that will be migrated in follow-up commits.
124 lines
3.2 KiB
C++
124 lines
3.2 KiB
C++
/*
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/CSSPageDescriptors.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/CSS/CSSPageDescriptors.h>
|
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
GC_DEFINE_ALLOCATOR(CSSPageDescriptors);
|
|
|
|
GC::Ref<CSSPageDescriptors> CSSPageDescriptors::create(JS::Realm& realm, Vector<Descriptor> descriptors)
|
|
{
|
|
return realm.create<CSSPageDescriptors>(realm, move(descriptors));
|
|
}
|
|
|
|
CSSPageDescriptors::CSSPageDescriptors(JS::Realm& realm, Vector<Descriptor> descriptors)
|
|
: CSSDescriptors(realm, AtRuleID::Page, move(descriptors))
|
|
{
|
|
}
|
|
|
|
CSSPageDescriptors::~CSSPageDescriptors() = default;
|
|
|
|
void CSSPageDescriptors::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSPageDescriptors);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_margin(StringView value)
|
|
{
|
|
return set_property("margin"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::margin() const
|
|
{
|
|
return get_property_value("margin"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_margin_top(StringView value)
|
|
{
|
|
return set_property("margin-top"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::margin_top() const
|
|
{
|
|
return get_property_value("margin-top"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_margin_right(StringView value)
|
|
{
|
|
return set_property("margin-right"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::margin_right() const
|
|
{
|
|
return get_property_value("margin-right"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_margin_bottom(StringView value)
|
|
{
|
|
return set_property("margin-bottom"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::margin_bottom() const
|
|
{
|
|
return get_property_value("margin-bottom"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_margin_left(StringView value)
|
|
{
|
|
return set_property("margin-left"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::margin_left() const
|
|
{
|
|
return get_property_value("margin-left"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_size(StringView value)
|
|
{
|
|
return set_property("size"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::size() const
|
|
{
|
|
return get_property_value("size"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_page_orientation(StringView value)
|
|
{
|
|
return set_property("page-orientation"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::page_orientation() const
|
|
{
|
|
return get_property_value("page-orientation"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_marks(StringView value)
|
|
{
|
|
return set_property("marks"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::marks() const
|
|
{
|
|
return get_property_value("marks"_utf16_fly_string);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<void> CSSPageDescriptors::set_bleed(StringView value)
|
|
{
|
|
return set_property("bleed"_utf16_fly_string, value, ""sv);
|
|
}
|
|
|
|
String CSSPageDescriptors::bleed() const
|
|
{
|
|
return get_property_value("bleed"_utf16_fly_string);
|
|
}
|
|
|
|
}
|