1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:35:07 +00:00

LibWeb: Make factory method of CSS::ResolvedCSSStyleDeclaration fallible

This commit is contained in:
Kenneth Myhra 2023-02-14 20:39:13 +01:00 committed by Linus Groh
parent f28b8431bf
commit 8fbd43cb27
4 changed files with 5 additions and 5 deletions

View file

@ -20,9 +20,9 @@
namespace Web::CSS { 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) ResolvedCSSStyleDeclaration::ResolvedCSSStyleDeclaration(DOM::Element& element)

View file

@ -14,7 +14,7 @@ class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration {
WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration); WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration);
public: public:
static ResolvedCSSStyleDeclaration* create(DOM::Element& element); static WebIDL::ExceptionOr<JS::NonnullGCPtr<ResolvedCSSStyleDeclaration>> create(DOM::Element& element);
virtual ~ResolvedCSSStyleDeclaration() override = default; virtual ~ResolvedCSSStyleDeclaration() override = default;

View file

@ -438,7 +438,7 @@ Element::NeedsRelayout Element::recompute_style()
NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values() 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(); auto properties = CSS::StyleProperties::create();
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) { for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {

View file

@ -644,7 +644,7 @@ Page const* Window::page() const
CSS::CSSStyleDeclaration* Window::get_computed_style_impl(DOM::Element& element) 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) JS::NonnullGCPtr<CSS::MediaQueryList> Window::match_media_impl(DeprecatedString media)