mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-24 02:09:28 +00:00
LibWeb: Make TextMetrics GC-allocated
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user