mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibWeb: Make TextMetrics GC-allocated
This commit is contained in:
parent
2704bcdaaa
commit
6b7a1d13e9
Notes:
sideshowbarker
2024-07-17 07:26:40 +09:00
Author: https://github.com/awesomekling
Commit: 6b7a1d13e9
Pull-request: https://github.com/SerenityOS/serenity/pull/14816
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/linusg ✅
7 changed files with 28 additions and 18 deletions
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue