LibWeb: Make TextMetrics GC-allocated

This commit is contained in:
Andreas Kling 2022-09-02 23:58:31 +02:00
parent 2704bcdaaa
commit 6b7a1d13e9
Notes: sideshowbarker 2024-07-17 07:26:40 +09:00
7 changed files with 28 additions and 18 deletions

View file

@ -4,13 +4,23 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "TextMetrics.h"
#include <LibWeb/Bindings/TextMetricsPrototype.h>
#include <LibWeb/HTML/TextMetrics.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {
RefPtr<TextMetrics> TextMetrics::create()
JS::NonnullGCPtr<TextMetrics> TextMetrics::create(HTML::Window& window)
{
return adopt_ref(*new TextMetrics());
return *window.heap().allocate<TextMetrics>(window.realm(), window);
}
TextMetrics::TextMetrics(HTML::Window& window)
: PlatformObject(window.realm())
{
set_prototype(&window.ensure_web_prototype<Bindings::TextMetricsPrototype>("TextMetrics"));
}
TextMetrics::~TextMetrics() = default;
}