ladybird/Userland/Libraries/LibWeb/SVG/SVGLength.h
Andreas Kling 72c9f56c66 LibJS: Make Heap::allocate<T>() infallible
Stop worrying about tiny OOMs. Work towards #20449.

While going through these, I also changed the function signature in many
places where returning ThrowCompletionOr<T> is no longer necessary.
2023-08-13 15:38:42 +02:00

36 lines
873 B
C++

/*
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::SVG {
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength
class SVGLength : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGLength> create(JS::Realm&, u8 unit_type, float value);
virtual ~SVGLength() override;
u8 unit_type() const { return m_unit_type; }
float value() const { return m_value; }
WebIDL::ExceptionOr<void> set_value(float value);
private:
SVGLength(JS::Realm&, u8 unit_type, float value);
virtual void initialize(JS::Realm&) override;
u8 m_unit_type { 0 };
float m_value { 0 };
};
}