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

42 lines
1.3 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>
#include <LibWeb/ResizeObserver/ResizeObserverSize.h>
namespace Web::ResizeObserver {
// https://drafts.csswg.org/resize-observer-1/#resize-observation-interface
class ResizeObservation : public JS::Cell {
GC_CELL(ResizeObservation, JS::Cell);
GC_DECLARE_ALLOCATOR(ResizeObservation);
public:
static WebIDL::ExceptionOr<GC::Ref<ResizeObservation>> create(JS::Realm&, DOM::Element&, Bindings::ResizeObserverBoxOptions);
bool is_active();
GC::Ref<DOM::Element> target() const { return m_target; }
Bindings::ResizeObserverBoxOptions observed_box() const { return m_observed_box; }
Vector<GC::Ref<ResizeObserverSize>>& last_reported_sizes() { return m_last_reported_sizes; }
explicit ResizeObservation(JS::Realm& realm, DOM::Element& target, Bindings::ResizeObserverBoxOptions observed_box);
private:
virtual void visit_edges(JS::Cell::Visitor&) override;
GC::Ref<JS::Realm> m_realm;
GC::Ref<DOM::Element> m_target;
Bindings::ResizeObserverBoxOptions m_observed_box;
Vector<GC::Ref<ResizeObserverSize>> m_last_reported_sizes;
};
}