Serenity Operating System
at master 34 lines 1.0 kB view raw
1/* 2 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibWeb/Bindings/Intrinsics.h> 8#include <LibWeb/Geometry/DOMRectReadOnly.h> 9#include <LibWeb/WebIDL/ExceptionOr.h> 10 11namespace Web::Geometry { 12 13WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> DOMRectReadOnly::construct_impl(JS::Realm& realm, double x, double y, double width, double height) 14{ 15 return MUST_OR_THROW_OOM(realm.heap().allocate<DOMRectReadOnly>(realm, realm, x, y, width, height)); 16} 17 18DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double width, double height) 19 : PlatformObject(realm) 20 , m_rect(x, y, width, height) 21{ 22} 23 24DOMRectReadOnly::~DOMRectReadOnly() = default; 25 26JS::ThrowCompletionOr<void> DOMRectReadOnly::initialize(JS::Realm& realm) 27{ 28 MUST_OR_THROW_OOM(Base::initialize(realm)); 29 set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMRectReadOnlyPrototype>(realm, "DOMRectReadOnly")); 30 31 return {}; 32} 33 34}