mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
LibWeb: Make CSSRule and CSSRuleList available to JavaScript :^)
This patch makes both of these classes inherit from RefCounted and Bindings::Wrappable, plus some minimal rejigging to allow us to keep using them internally while also exposing them to web content.
This commit is contained in:
parent
87f0059088
commit
3a4565beec
15 changed files with 64 additions and 13 deletions
|
@ -15,10 +15,18 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
class CSSRuleList {
|
||||
// https://drafts.csswg.org/cssom/#the-cssrulelist-interface
|
||||
class CSSRuleList
|
||||
: public RefCounted<CSSRuleList>
|
||||
, public Bindings::Wrappable {
|
||||
public:
|
||||
explicit CSSRuleList(NonnullRefPtrVector<CSSRule>&&);
|
||||
virtual ~CSSRuleList();
|
||||
using WrapperType = Bindings::CSSRuleListWrapper;
|
||||
|
||||
static NonnullRefPtr<CSSRuleList> create(NonnullRefPtrVector<CSSRule>&& rules)
|
||||
{
|
||||
return adopt_ref(*new CSSRuleList(move(rules)));
|
||||
}
|
||||
~CSSRuleList();
|
||||
|
||||
RefPtr<CSSRule> item(size_t index) const
|
||||
{
|
||||
|
@ -37,7 +45,11 @@ public:
|
|||
ConstIterator const end() const { return m_rules.end(); }
|
||||
Iterator end() { return m_rules.end(); }
|
||||
|
||||
bool is_supported_property_index(u32 index) const;
|
||||
|
||||
private:
|
||||
explicit CSSRuleList(NonnullRefPtrVector<CSSRule>&&);
|
||||
|
||||
NonnullRefPtrVector<CSSRule> m_rules;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue