mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
LibWeb: Make factory method of HTML::TextMetrics fallible
This commit is contained in:
parent
d9845bb24b
commit
c5de2c3348
3 changed files with 5 additions and 4 deletions
|
@ -377,7 +377,7 @@ JS::NonnullGCPtr<TextMetrics> CanvasRenderingContext2D::measure_text(DeprecatedS
|
||||||
// TextMetrics object with members behaving as described in the following
|
// TextMetrics object with members behaving as described in the following
|
||||||
// list:
|
// list:
|
||||||
auto prepared_text = prepare_text(text);
|
auto prepared_text = prepare_text(text);
|
||||||
auto metrics = TextMetrics::create(realm());
|
auto metrics = TextMetrics::create(realm()).release_value_but_fixme_should_propagate_errors();
|
||||||
// FIXME: Use the font that was used to create the glyphs in prepared_text.
|
// FIXME: Use the font that was used to create the glyphs in prepared_text.
|
||||||
auto& font = Platform::FontPlugin::the().default_font();
|
auto& font = Platform::FontPlugin::the().default_font();
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
|
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/HTML/TextMetrics.h>
|
#include <LibWeb/HTML/TextMetrics.h>
|
||||||
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
JS::NonnullGCPtr<TextMetrics> TextMetrics::create(JS::Realm& realm)
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<TextMetrics>> TextMetrics::create(JS::Realm& realm)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<TextMetrics>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
return MUST_OR_THROW_OOM(realm.heap().allocate<TextMetrics>(realm, realm));
|
||||||
}
|
}
|
||||||
|
|
||||||
TextMetrics::TextMetrics(JS::Realm& realm)
|
TextMetrics::TextMetrics(JS::Realm& realm)
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TextMetrics : public Bindings::PlatformObject {
|
||||||
WEB_PLATFORM_OBJECT(TextMetrics, Bindings::PlatformObject);
|
WEB_PLATFORM_OBJECT(TextMetrics, Bindings::PlatformObject);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static JS::NonnullGCPtr<TextMetrics> create(JS::Realm&);
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<TextMetrics>> create(JS::Realm&);
|
||||||
|
|
||||||
virtual ~TextMetrics() override;
|
virtual ~TextMetrics() override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue