Files
ladybird/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.h
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

50 lines
1.4 KiB
C++

/*
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Bindings/ResizeObserver.h>
namespace Web::ResizeObserver {
// https://drafts.csswg.org/resize-observer-1/#resizeobserversize
class ResizeObserverSize : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(ResizeObserverSize, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(ResizeObserverSize);
public:
struct RawSize {
double inline_size { 0 };
double block_size { 0 };
};
static RawSize compute_box_size(DOM::Element& target, Bindings::ResizeObserverBoxOptions observed_box);
static GC::Ref<ResizeObserverSize> calculate_box_size(JS::Realm& realm, DOM::Element& target, Bindings::ResizeObserverBoxOptions observed_box);
double inline_size() const { return m_inline_size; }
void set_inline_size(double inline_size) { m_inline_size = inline_size; }
double block_size() const { return m_block_size; }
void set_block_size(double block_size) { m_block_size = block_size; }
bool equals(RawSize const& other) const;
bool equals(ResizeObserverSize const& other) const;
private:
explicit ResizeObserverSize(JS::Realm& realm)
: PlatformObject(realm)
{
}
virtual void initialize(JS::Realm&) override;
double m_inline_size { 0 };
double m_block_size { 0 };
};
}