LibWeb: Make CSSStyleDeclaration GC-allocated

This commit is contained in:
Andreas Kling 2022-08-07 16:21:26 +02:00
parent 12042f0757
commit 72bacba97b
Notes: sideshowbarker 2024-07-17 07:28:59 +09:00
18 changed files with 146 additions and 129 deletions

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/Completion.h>
#include <LibWeb/Bindings/CSSStyleDeclarationWrapper.h>
#include <LibWeb/DOM/Element.h>
namespace Web::Bindings {
static CSS::PropertyID property_id_from_name(StringView name)
{
// FIXME: Perhaps this should go in the code generator.
if (name == "cssFloat"sv)
return CSS::PropertyID::Float;
if (auto property_id = CSS::property_id_from_camel_case_string(name); property_id != CSS::PropertyID::Invalid)
return property_id;
if (auto property_id = CSS::property_id_from_string(name); property_id != CSS::PropertyID::Invalid)
return property_id;
return CSS::PropertyID::Invalid;
}
JS::ThrowCompletionOr<bool> CSSStyleDeclarationWrapper::internal_has_property(JS::PropertyKey const& name) const
{
if (!name.is_string())
return Base::internal_has_property(name);
return property_id_from_name(name.to_string()) != CSS::PropertyID::Invalid;
}
JS::ThrowCompletionOr<JS::Value> CSSStyleDeclarationWrapper::internal_get(JS::PropertyKey const& name, JS::Value receiver) const
{
if (!name.is_string())
return Base::internal_get(name, receiver);
auto property_id = property_id_from_name(name.to_string());
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_get(name, receiver);
if (auto maybe_property = impl().property(property_id); maybe_property.has_value())
return { js_string(vm(), maybe_property->value->to_string()) };
return { js_string(vm(), String::empty()) };
}
JS::ThrowCompletionOr<bool> CSSStyleDeclarationWrapper::internal_set(JS::PropertyKey const& name, JS::Value value, JS::Value receiver)
{
if (!name.is_string())
return Base::internal_set(name, value, receiver);
auto& vm = this->vm();
auto property_id = property_id_from_name(name.to_string());
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_set(name, value, receiver);
auto css_text = TRY(value.to_string(vm));
impl().set_property(property_id, css_text);
return true;
}
}

View File

@ -14,7 +14,6 @@
#include <LibJS/Runtime/Shape.h>
#include <LibTextCodec/Decoder.h>
#include <LibWeb/Bindings/CSSNamespace.h>
#include <LibWeb/Bindings/CSSStyleDeclarationWrapper.h>
#include <LibWeb/Bindings/CryptoWrapper.h>
#include <LibWeb/Bindings/DocumentWrapper.h>
#include <LibWeb/Bindings/ElementWrapper.h>
@ -526,7 +525,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::get_computed_style)
if (!is<ElementWrapper>(object))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "DOM element");
return wrap(realm, impl->get_computed_style(static_cast<ElementWrapper*>(object)->impl()));
return wrap(realm, *impl->get_computed_style(static_cast<ElementWrapper*>(object)->impl()));
}
JS_DEFINE_NATIVE_FUNCTION(WindowObject::get_selection)

View File

@ -4,7 +4,6 @@ set(SOURCES
Bindings/AudioConstructor.cpp
Bindings/CrossOriginAbstractOperations.cpp
Bindings/CSSNamespace.cpp
Bindings/CSSStyleDeclarationWrapperCustom.cpp
Bindings/EventListenerWrapper.cpp
Bindings/EventTargetWrapperFactory.cpp
Bindings/EventWrapperFactory.cpp

View File

@ -1,17 +1,31 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/CSSStyleDeclarationPrototype.h>
#include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
namespace Web::CSS {
PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
: m_properties(move(properties))
CSSStyleDeclaration::CSSStyleDeclaration(Bindings::WindowObject& window_object)
: PlatformObject(window_object.ensure_web_prototype<Bindings::CSSStyleDeclarationPrototype>("CSSStyleDeclaration"))
{
}
PropertyOwningCSSStyleDeclaration* PropertyOwningCSSStyleDeclaration::create(Bindings::WindowObject& window_object, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
{
return window_object.heap().allocate<PropertyOwningCSSStyleDeclaration>(window_object.realm(), window_object, move(properties), move(custom_properties));
}
PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(Bindings::WindowObject& window_object, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
: CSSStyleDeclaration(window_object)
, m_properties(move(properties))
, m_custom_properties(move(custom_properties))
{
}
@ -23,8 +37,14 @@ String PropertyOwningCSSStyleDeclaration::item(size_t index) const
return CSS::string_from_property_id(m_properties[index].property_id);
}
ElementInlineCSSStyleDeclaration* ElementInlineCSSStyleDeclaration::create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
{
auto& window_object = element.document().preferred_window_object();
return window_object.heap().allocate<ElementInlineCSSStyleDeclaration>(window_object.realm(), element, move(properties), move(custom_properties));
}
ElementInlineCSSStyleDeclaration::ElementInlineCSSStyleDeclaration(DOM::Element& element, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
: PropertyOwningCSSStyleDeclaration(move(properties), move(custom_properties))
: PropertyOwningCSSStyleDeclaration(element.document().preferred_window_object(), move(properties), move(custom_properties))
, m_element(element.make_weak_ptr<DOM::Element>())
{
}
@ -284,4 +304,52 @@ String PropertyOwningCSSStyleDeclaration::serialized() const
return builder.to_string();
}
static CSS::PropertyID property_id_from_name(StringView name)
{
// FIXME: Perhaps this should go in the code generator.
if (name == "cssFloat"sv)
return CSS::PropertyID::Float;
if (auto property_id = CSS::property_id_from_camel_case_string(name); property_id != CSS::PropertyID::Invalid)
return property_id;
if (auto property_id = CSS::property_id_from_string(name); property_id != CSS::PropertyID::Invalid)
return property_id;
return CSS::PropertyID::Invalid;
}
JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_has_property(JS::PropertyKey const& name) const
{
if (!name.is_string())
return Base::internal_has_property(name);
return property_id_from_name(name.to_string()) != CSS::PropertyID::Invalid;
}
JS::ThrowCompletionOr<JS::Value> CSSStyleDeclaration::internal_get(JS::PropertyKey const& name, JS::Value receiver) const
{
if (!name.is_string())
return Base::internal_get(name, receiver);
auto property_id = property_id_from_name(name.to_string());
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_get(name, receiver);
if (auto maybe_property = property(property_id); maybe_property.has_value())
return { js_string(vm(), maybe_property->value->to_string()) };
return { js_string(vm(), String::empty()) };
}
JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_set(JS::PropertyKey const& name, JS::Value value, JS::Value receiver)
{
if (!name.is_string())
return Base::internal_set(name, value, receiver);
auto property_id = property_id_from_name(name.to_string());
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_set(name, value, receiver);
auto css_text = TRY(value.to_string(vm()));
impl().set_property(property_id, css_text);
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -8,7 +8,7 @@
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/CSS/StyleValue.h>
namespace Web::CSS {
@ -25,14 +25,14 @@ struct StyleProperty {
String custom_name {};
};
class CSSStyleDeclaration
: public RefCounted<CSSStyleDeclaration>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::CSSStyleDeclarationWrapper;
class CSSStyleDeclaration : public Bindings::PlatformObject {
JS_OBJECT(CSSStyleDeclaration, Bindings::PlatformObject);
public:
virtual ~CSSStyleDeclaration() = default;
CSSStyleDeclaration& impl() { return *this; }
virtual size_t length() const = 0;
virtual String item(size_t index) const = 0;
@ -52,18 +52,21 @@ public:
virtual String serialized() const = 0;
virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override;
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override;
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
protected:
CSSStyleDeclaration() = default;
CSSStyleDeclaration(Bindings::WindowObject&);
};
class PropertyOwningCSSStyleDeclaration : public CSSStyleDeclaration {
JS_OBJECT(PropertyOwningCSSStyleDeclaration, CSSStyleDeclaration);
friend class ElementInlineCSSStyleDeclaration;
public:
static NonnullRefPtr<PropertyOwningCSSStyleDeclaration> create(Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
{
return adopt_ref(*new PropertyOwningCSSStyleDeclaration(move(properties), move(custom_properties)));
}
static PropertyOwningCSSStyleDeclaration* create(Bindings::WindowObject&, Vector<StyleProperty>, HashMap<String, StyleProperty> custom_properties);
PropertyOwningCSSStyleDeclaration(Bindings::WindowObject&, Vector<StyleProperty>, HashMap<String, StyleProperty>);
virtual ~PropertyOwningCSSStyleDeclaration() override = default;
@ -83,8 +86,6 @@ public:
virtual String serialized() const final override;
protected:
explicit PropertyOwningCSSStyleDeclaration(Vector<StyleProperty>, HashMap<String, StyleProperty>);
virtual void update_style_attribute() { }
private:
@ -95,8 +96,12 @@ private:
};
class ElementInlineCSSStyleDeclaration final : public PropertyOwningCSSStyleDeclaration {
JS_OBJECT(ElementInlineCSSStyleDeclaration, PropertyOwningCSSStyleDeclaration);
public:
static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties) { return adopt_ref(*new ElementInlineCSSStyleDeclaration(element, move(properties), move(custom_properties))); }
static ElementInlineCSSStyleDeclaration* create(DOM::Element&, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties);
explicit ElementInlineCSSStyleDeclaration(DOM::Element&, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties);
virtual ~ElementInlineCSSStyleDeclaration() override = default;
DOM::Element* element() { return m_element.ptr(); }
@ -105,8 +110,6 @@ public:
bool is_updating() const { return m_updating; }
private:
explicit ElementInlineCSSStyleDeclaration(DOM::Element&, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties);
virtual void update_style_attribute() override;
WeakPtr<DOM::Element> m_element;
@ -118,7 +121,6 @@ private:
}
namespace Web::Bindings {
CSSStyleDeclarationWrapper* wrap(JS::Realm&, CSS::CSSStyleDeclaration&);
inline JS::Object* wrap(JS::Realm&, Web::CSS::CSSStyleDeclaration& object) { return &object; }
using CSSStyleDeclarationWrapper = Web::CSS::CSSStyleDeclaration;
}

View File

@ -1,4 +1,4 @@
[CustomGet,CustomSet,CustomHasProperty]
[NoInstanceWrapper]
interface CSSStyleDeclaration {
readonly attribute unsigned long length;

View File

@ -11,23 +11,29 @@
namespace Web::CSS {
CSSStyleRule* CSSStyleRule::create(Bindings::WindowObject& window_object, NonnullRefPtrVector<Web::CSS::Selector>&& selectors, NonnullRefPtr<Web::CSS::CSSStyleDeclaration>&& declaration)
CSSStyleRule* CSSStyleRule::create(Bindings::WindowObject& window_object, NonnullRefPtrVector<Web::CSS::Selector>&& selectors, CSSStyleDeclaration& declaration)
{
return window_object.heap().allocate<CSSStyleRule>(window_object.realm(), window_object, move(selectors), move(declaration));
return window_object.heap().allocate<CSSStyleRule>(window_object.realm(), window_object, move(selectors), declaration);
}
CSSStyleRule::CSSStyleRule(Bindings::WindowObject& window_object, NonnullRefPtrVector<Selector>&& selectors, NonnullRefPtr<CSSStyleDeclaration>&& declaration)
CSSStyleRule::CSSStyleRule(Bindings::WindowObject& window_object, NonnullRefPtrVector<Selector>&& selectors, CSSStyleDeclaration& declaration)
: CSSRule(window_object)
, m_selectors(move(selectors))
, m_declaration(move(declaration))
, m_declaration(declaration)
{
set_prototype(&window_object.ensure_web_prototype<Bindings::CSSStyleRulePrototype>("CSSStyleRule"));
}
void CSSStyleRule::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(&m_declaration);
}
// https://www.w3.org/TR/cssom/#dom-cssstylerule-style
CSSStyleDeclaration* CSSStyleRule::style()
{
return m_declaration;
return &m_declaration;
}
// https://www.w3.org/TR/cssom/#serialize-a-css-rule

View File

@ -21,8 +21,8 @@ class CSSStyleRule final : public CSSRule {
AK_MAKE_NONMOVABLE(CSSStyleRule);
public:
static CSSStyleRule* create(Bindings::WindowObject&, NonnullRefPtrVector<Selector>&&, NonnullRefPtr<CSSStyleDeclaration>&&);
CSSStyleRule(Bindings::WindowObject&, NonnullRefPtrVector<Selector>&&, NonnullRefPtr<CSSStyleDeclaration>&&);
static CSSStyleRule* create(Bindings::WindowObject&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
CSSStyleRule(Bindings::WindowObject&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
virtual ~CSSStyleRule() override = default;
@ -39,10 +39,11 @@ public:
CSSStyleDeclaration* style();
private:
virtual void visit_edges(Cell::Visitor&) override;
virtual String serialized() const override;
NonnullRefPtrVector<Selector> m_selectors;
NonnullRefPtr<CSSStyleDeclaration> m_declaration;
CSSStyleDeclaration& m_declaration;
};
template<>

View File

@ -2320,7 +2320,7 @@ Vector<Vector<ComponentValue>> Parser::parse_a_comma_separated_list_of_component
return list_of_component_value_lists;
}
RefPtr<ElementInlineCSSStyleDeclaration> Parser::parse_as_style_attribute(DOM::Element& element)
ElementInlineCSSStyleDeclaration* Parser::parse_as_style_attribute(DOM::Element& element)
{
auto declarations_and_at_rules = parse_a_list_of_declarations(m_token_stream);
auto [properties, custom_properties] = extract_properties(declarations_and_at_rules);
@ -2706,13 +2706,13 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
auto stream = TokenStream(rule->block()->values());
auto declarations_and_at_rules = parse_a_style_blocks_contents(stream);
auto declaration = convert_to_style_declaration(declarations_and_at_rules);
auto* declaration = convert_to_style_declaration(declarations_and_at_rules);
if (!declaration) {
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: style rule declaration invalid; discarding.");
return {};
}
return CSSStyleRule::create(m_context.window_object(), move(selectors.value()), move(*declaration));
return CSSStyleRule::create(m_context.window_object(), move(selectors.value()), *declaration);
}
return {};
@ -2741,10 +2741,10 @@ auto Parser::extract_properties(Vector<DeclarationOrAtRule> const& declarations_
return result;
}
RefPtr<PropertyOwningCSSStyleDeclaration> Parser::convert_to_style_declaration(Vector<DeclarationOrAtRule> declarations_and_at_rules)
PropertyOwningCSSStyleDeclaration* Parser::convert_to_style_declaration(Vector<DeclarationOrAtRule> declarations_and_at_rules)
{
auto [properties, custom_properties] = extract_properties(declarations_and_at_rules);
return PropertyOwningCSSStyleDeclaration::create(move(properties), move(custom_properties));
return PropertyOwningCSSStyleDeclaration::create(m_context.window_object(), move(properties), move(custom_properties));
}
Optional<StyleProperty> Parser::convert_to_style_property(Declaration const& declaration)
@ -6396,7 +6396,7 @@ CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& cont
return parser.parse_as_css_stylesheet(location);
}
RefPtr<CSS::ElementInlineCSSStyleDeclaration> parse_css_style_attribute(CSS::Parser::ParsingContext const& context, StringView css, DOM::Element& element)
CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::ParsingContext const& context, StringView css, DOM::Element& element)
{
if (css.is_empty())
return CSS::ElementInlineCSSStyleDeclaration::create(element, {}, {});

View File

@ -127,7 +127,7 @@ public:
~Parser() = default;
CSSStyleSheet* parse_as_css_stylesheet(Optional<AK::URL> location);
RefPtr<ElementInlineCSSStyleDeclaration> parse_as_style_attribute(DOM::Element&);
ElementInlineCSSStyleDeclaration* parse_as_style_attribute(DOM::Element&);
CSSRule* parse_as_css_rule();
Optional<StyleProperty> parse_as_supports_condition();
@ -240,7 +240,7 @@ private:
Vector<FontFace::Source> parse_font_face_src(TokenStream<ComponentValue>&);
CSSRule* convert_to_rule(NonnullRefPtr<Rule>);
RefPtr<PropertyOwningCSSStyleDeclaration> convert_to_style_declaration(Vector<DeclarationOrAtRule> declarations);
PropertyOwningCSSStyleDeclaration* convert_to_style_declaration(Vector<DeclarationOrAtRule> declarations);
Optional<StyleProperty> convert_to_style_property(Declaration const&);
class Dimension {
@ -421,7 +421,7 @@ private:
namespace Web {
CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional<AK::URL> location = {});
RefPtr<CSS::ElementInlineCSSStyleDeclaration> parse_css_style_attribute(CSS::Parser::ParsingContext const&, StringView, DOM::Element&);
CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::ParsingContext const&, StringView, DOM::Element&);
RefPtr<CSS::StyleValue> parse_css_value(CSS::Parser::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
Optional<CSS::SelectorList> parse_selector(CSS::Parser::ParsingContext const&, StringView);
CSS::CSSRule* parse_css_rule(CSS::Parser::ParsingContext const&, StringView);

View File

@ -19,8 +19,15 @@
namespace Web::CSS {
ResolvedCSSStyleDeclaration* ResolvedCSSStyleDeclaration::create(DOM::Element& element)
{
auto& window_object = element.document().preferred_window_object();
return window_object.heap().allocate<ResolvedCSSStyleDeclaration>(window_object.realm(), element);
}
ResolvedCSSStyleDeclaration::ResolvedCSSStyleDeclaration(DOM::Element& element)
: m_element(element)
: CSSStyleDeclaration(element.document().preferred_window_object())
, m_element(element)
{
}

View File

@ -11,11 +11,11 @@
namespace Web::CSS {
class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration {
JS_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration);
public:
static NonnullRefPtr<ResolvedCSSStyleDeclaration> create(DOM::Element& element)
{
return adopt_ref(*new ResolvedCSSStyleDeclaration(element));
}
static ResolvedCSSStyleDeclaration* create(DOM::Element& element);
explicit ResolvedCSSStyleDeclaration(DOM::Element&);
virtual ~ResolvedCSSStyleDeclaration() override = default;
@ -28,8 +28,6 @@ public:
virtual String serialized() const override;
private:
explicit ResolvedCSSStyleDeclaration(DOM::Element&);
RefPtr<StyleValue> style_value_for_property(Layout::NodeWithStyle const&, PropertyID) const;
NonnullRefPtr<DOM::Element> m_element;

View File

@ -295,7 +295,7 @@ RefPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document&
CSS::CSSStyleDeclaration const* Element::inline_style() const
{
return m_inline_style;
return m_inline_style.cell();
}
void Element::parse_attribute(FlyString const& name, String const& value)
@ -311,9 +311,9 @@ void Element::parse_attribute(FlyString const& name, String const& value)
m_class_list->associated_attribute_changed(value);
} else if (name == HTML::AttributeNames::style) {
// https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-updating-flag
if (m_inline_style && m_inline_style->is_updating())
if (m_inline_style.cell() && m_inline_style->is_updating())
return;
m_inline_style = parse_css_style_attribute(CSS::Parser::ParsingContext(document()), value, *this);
m_inline_style = JS::make_handle(parse_css_style_attribute(CSS::Parser::ParsingContext(document()), value, *this));
set_needs_style_update(true);
}
}
@ -321,8 +321,8 @@ void Element::parse_attribute(FlyString const& name, String const& value)
void Element::did_remove_attribute(FlyString const& name)
{
if (name == HTML::AttributeNames::style) {
if (m_inline_style) {
m_inline_style = nullptr;
if (m_inline_style.cell()) {
m_inline_style = {};
set_needs_style_update(true);
}
}
@ -507,11 +507,11 @@ void Element::set_shadow_root(RefPtr<ShadowRoot> shadow_root)
invalidate_style();
}
NonnullRefPtr<CSS::CSSStyleDeclaration> Element::style_for_bindings()
CSS::CSSStyleDeclaration* Element::style_for_bindings()
{
if (!m_inline_style)
m_inline_style = CSS::ElementInlineCSSStyleDeclaration::create(*this, {}, {});
return *m_inline_style;
if (m_inline_style.is_null())
m_inline_style = JS::make_handle(CSS::ElementInlineCSSStyleDeclaration::create(*this, {}, {}));
return m_inline_style.cell();
}
// https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name

View File

@ -105,7 +105,7 @@ public:
CSS::CSSStyleDeclaration const* inline_style() const;
NonnullRefPtr<CSS::CSSStyleDeclaration> style_for_bindings();
CSS::CSSStyleDeclaration* style_for_bindings();
String inner_html() const;
ExceptionOr<void> set_inner_html(String const&);
@ -152,7 +152,7 @@ private:
String m_html_uppercased_qualified_name;
NonnullRefPtr<NamedNodeMap> m_attributes;
RefPtr<CSS::ElementInlineCSSStyleDeclaration> m_inline_style;
JS::Handle<CSS::ElementInlineCSSStyleDeclaration> m_inline_style;
RefPtr<CSS::StyleProperties> m_computed_css_values;
HashMap<FlyString, CSS::StyleProperty> m_custom_properties;

View File

@ -459,7 +459,6 @@ class CharacterDataWrapper;
class CloseEventWrapper;
class CommentWrapper;
class CryptoWrapper;
class CSSStyleDeclarationWrapper;
class CustomEventWrapper;
class DocumentFragmentWrapper;
class DocumentTypeWrapper;

View File

@ -319,7 +319,7 @@ Page const* Window::page() const
return associated_document().page();
}
NonnullRefPtr<CSS::CSSStyleDeclaration> Window::get_computed_style(DOM::Element& element) const
CSS::CSSStyleDeclaration* Window::get_computed_style(DOM::Element& element) const
{
return CSS::ResolvedCSSStyleDeclaration::create(element);
}

View File

@ -95,7 +95,7 @@ public:
DOM::Event const* current_event() const { return m_current_event; }
void set_current_event(DOM::Event* event) { m_current_event = event; }
NonnullRefPtr<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&) const;
CSS::CSSStyleDeclaration* get_computed_style(DOM::Element&) const;
NonnullRefPtr<CSS::MediaQueryList> match_media(String);
Optional<CSS::MediaFeatureValue> query_media_feature(CSS::MediaFeatureID) const;

View File

@ -10,7 +10,7 @@ libweb_js_wrapper(CSS/CSSImportRule NO_INSTANCE)
libweb_js_wrapper(CSS/CSSMediaRule NO_INSTANCE)
libweb_js_wrapper(CSS/CSSRule NO_INSTANCE)
libweb_js_wrapper(CSS/CSSRuleList NO_INSTANCE)
libweb_js_wrapper(CSS/CSSStyleDeclaration)
libweb_js_wrapper(CSS/CSSStyleDeclaration NO_INSTANCE)
libweb_js_wrapper(CSS/CSSStyleRule NO_INSTANCE)
libweb_js_wrapper(CSS/CSSStyleSheet NO_INSTANCE)
libweb_js_wrapper(CSS/CSSSupportsRule NO_INSTANCE)