diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-02-14 20:39:13 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-18 00:52:47 +0100 |
commit | 8fbd43cb27aacad32e143f3bb9458bbd1b30f4af (patch) | |
tree | a58f0c9983f2b56c4bbcee261f1e3f9bc43ea7fc | |
parent | f28b8431bf6da1252050f20cd2b1d21cda13457e (diff) | |
download | serenity-8fbd43cb27aacad32e143f3bb9458bbd1b30f4af.zip |
LibWeb: Make factory method of CSS::ResolvedCSSStyleDeclaration fallible
4 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 07f3975f14..f3dcc9ac2d 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -20,9 +20,9 @@ namespace Web::CSS { -ResolvedCSSStyleDeclaration* ResolvedCSSStyleDeclaration::create(DOM::Element& element) +WebIDL::ExceptionOr<JS::NonnullGCPtr<ResolvedCSSStyleDeclaration>> ResolvedCSSStyleDeclaration::create(DOM::Element& element) { - return element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element)); } ResolvedCSSStyleDeclaration::ResolvedCSSStyleDeclaration(DOM::Element& element) diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h index d6b17cd531..b659be5dda 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h @@ -14,7 +14,7 @@ class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration { WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration); public: - static ResolvedCSSStyleDeclaration* create(DOM::Element& element); + static WebIDL::ExceptionOr<JS::NonnullGCPtr<ResolvedCSSStyleDeclaration>> create(DOM::Element& element); virtual ~ResolvedCSSStyleDeclaration() override = default; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index c07b8de419..e346f804e5 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -438,7 +438,7 @@ Element::NeedsRelayout Element::recompute_style() NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values() { - auto element_computed_style = CSS::ResolvedCSSStyleDeclaration::create(*this); + auto element_computed_style = CSS::ResolvedCSSStyleDeclaration::create(*this).release_value_but_fixme_should_propagate_errors(); auto properties = CSS::StyleProperties::create(); for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) { diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index df9a7c3893..4e8984ddc8 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -644,7 +644,7 @@ Page const* Window::page() const CSS::CSSStyleDeclaration* Window::get_computed_style_impl(DOM::Element& element) const { - return CSS::ResolvedCSSStyleDeclaration::create(element); + return CSS::ResolvedCSSStyleDeclaration::create(element).release_value_but_fixme_should_propagate_errors().ptr(); } JS::NonnullGCPtr<CSS::MediaQueryList> Window::match_media_impl(DeprecatedString media) |