mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
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.
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
/*
|
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
#include <LibWeb/Bindings/VTTRegion.h>
|
|
#include <LibWeb/WebIDL/Types.h>
|
|
|
|
namespace Web::WebVTT {
|
|
|
|
// https://w3c.github.io/webvtt/#vttregion
|
|
class VTTRegion final : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(VTTRegion, Bindings::PlatformObject);
|
|
GC_DECLARE_ALLOCATOR(VTTRegion);
|
|
|
|
public:
|
|
static WebIDL::ExceptionOr<GC::Ref<VTTRegion>> construct_impl(JS::Realm&);
|
|
virtual ~VTTRegion() override = default;
|
|
|
|
String const& id() const { return m_identifier; }
|
|
void set_id(String const& id) { m_identifier = id; }
|
|
|
|
double width() const { return m_width; }
|
|
WebIDL::ExceptionOr<void> set_width(double width);
|
|
|
|
WebIDL::UnsignedLong lines() const { return m_lines; }
|
|
void set_lines(WebIDL::UnsignedLong lines) { m_lines = lines; }
|
|
|
|
double region_anchor_x() const { return m_anchor_x; }
|
|
WebIDL::ExceptionOr<void> set_region_anchor_x(double region_anchor_x);
|
|
|
|
double region_anchor_y() const { return m_anchor_y; }
|
|
WebIDL::ExceptionOr<void> set_region_anchor_y(double region_anchor_y);
|
|
|
|
double viewport_anchor_x() const { return m_viewport_anchor_x; }
|
|
WebIDL::ExceptionOr<void> set_viewport_anchor_x(double viewport_anchor_x);
|
|
|
|
double viewport_anchor_y() const { return m_viewport_anchor_y; }
|
|
WebIDL::ExceptionOr<void> set_viewport_anchor_y(double viewport_anchor_y);
|
|
|
|
Bindings::ScrollSetting scroll() const { return m_scroll_setting; }
|
|
void set_scroll(Bindings::ScrollSetting scroll) { m_scroll_setting = scroll; }
|
|
|
|
private:
|
|
VTTRegion(JS::Realm&);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
// https://w3c.github.io/webvtt/#webvtt-region-identifier
|
|
String m_identifier {};
|
|
|
|
// https://w3c.github.io/webvtt/#webvtt-region-width
|
|
double m_width { 100 };
|
|
|
|
// https://w3c.github.io/webvtt/#webvtt-region-lines
|
|
WebIDL::UnsignedLong m_lines { 3 };
|
|
|
|
// https://w3c.github.io/webvtt/#webvtt-region-anchor
|
|
double m_anchor_x { 0 };
|
|
double m_anchor_y { 100 };
|
|
|
|
// https://w3c.github.io/webvtt/#webvtt-region-viewport-anchor
|
|
double m_viewport_anchor_x { 0 };
|
|
double m_viewport_anchor_y { 100 };
|
|
|
|
// https://w3c.github.io/webvtt/#webvtt-region-scroll
|
|
Bindings::ScrollSetting m_scroll_setting { Bindings::ScrollSetting::Empty };
|
|
};
|
|
|
|
}
|