mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
LibWeb: Remove unecessary dependence on Window from CSS classes
These classes only needed Window to get at its realm. Pass a realm directly to construct CSS classes.
This commit is contained in:
committed by
Linus Groh
parent
8de7e49a56
commit
a2ccb00e1d
@@ -21,12 +21,11 @@ namespace Web::CSS {
|
||||
|
||||
ResolvedCSSStyleDeclaration* ResolvedCSSStyleDeclaration::create(DOM::Element& element)
|
||||
{
|
||||
auto& window_object = element.document().window();
|
||||
return window_object.heap().allocate<ResolvedCSSStyleDeclaration>(window_object.realm(), element);
|
||||
return element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element);
|
||||
}
|
||||
|
||||
ResolvedCSSStyleDeclaration::ResolvedCSSStyleDeclaration(DOM::Element& element)
|
||||
: CSSStyleDeclaration(element.document().window())
|
||||
: CSSStyleDeclaration(element.realm())
|
||||
, m_element(element)
|
||||
{
|
||||
}
|
||||
@@ -541,14 +540,14 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
|
||||
WebIDL::ExceptionOr<void> ResolvedCSSStyleDeclaration::set_property(PropertyID, StringView, StringView)
|
||||
{
|
||||
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
|
||||
return WebIDL::NoModificationAllowedError::create(global_object(), "Cannot modify properties in result of getComputedStyle()");
|
||||
return WebIDL::NoModificationAllowedError::create(realm(), "Cannot modify properties in result of getComputedStyle()");
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty
|
||||
WebIDL::ExceptionOr<String> ResolvedCSSStyleDeclaration::remove_property(PropertyID)
|
||||
{
|
||||
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
|
||||
return WebIDL::NoModificationAllowedError::create(global_object(), "Cannot remove properties from result of getComputedStyle()");
|
||||
return WebIDL::NoModificationAllowedError::create(realm(), "Cannot remove properties from result of getComputedStyle()");
|
||||
}
|
||||
|
||||
String ResolvedCSSStyleDeclaration::serialized() const
|
||||
|
||||
Reference in New Issue
Block a user