Files
ladybird/Libraries/LibWeb/CSS/CSSFunctionDeclarations.cpp
Shannon Booth fd44da6829 LibWeb/Bindings: Emit one bindings header and cpp per IDL
Previously, the LibWeb bindings generator would output multiple per
interface files like Prototype/Constructor/Namespace/GlobalMixin
depending on the contents of that IDL file.

This complicates the build system as it means that it does not know
what files will be generated without knowledge of the contents of that
IDL file.

Instead, for each IDL file only generate a single Bindings/<IDLFile>.h
and Bindings/<IDLFile>.cpp.
2026-04-21 07:36:13 +02:00

56 lines
1.6 KiB
C++

/*
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "CSSFunctionDeclarations.h"
#include <LibWeb/Bindings/CSSFunctionDeclarations.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/Dump.h>
namespace Web::CSS {
GC_DEFINE_ALLOCATOR(CSSFunctionDeclarations);
GC::Ref<CSSFunctionDeclarations> CSSFunctionDeclarations::create(JS::Realm& realm, Parser::Parser& parser, Vector<Parser::Declaration> const& declarations)
{
return realm.create<CSSFunctionDeclarations>(realm, parser.convert_to_descriptors<CSSFunctionDescriptors>(AtRuleID::Function, declarations));
}
CSSFunctionDeclarations::CSSFunctionDeclarations(JS::Realm& realm, GC::Ref<CSSFunctionDescriptors> style)
: CSSRule(realm, Type::FunctionDeclarations)
, m_style(style)
{
}
void CSSFunctionDeclarations::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSFunctionDeclarations);
Base::initialize(realm);
}
void CSSFunctionDeclarations::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_style);
}
String CSSFunctionDeclarations::serialized() const
{
// https://drafts.csswg.org/css-mixins-1/#the-function-declarations-interface
// The CSSFunctionDeclarations rule, like CSSNestedDeclarations, serializes as if its declaration block had been
// serialized directly.
return m_style->serialized();
}
void CSSFunctionDeclarations::dump(StringBuilder& builder, int indent_levels) const
{
Base::dump(builder, indent_levels);
dump_descriptors(builder, m_style, indent_levels + 1);
}
}