mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
LibWeb: Add the CSSStyleRule interface with some limited functionality
This commit is contained in:
parent
71087422f6
commit
6cda24097b
8 changed files with 84 additions and 1 deletions
|
@ -18,4 +18,29 @@ CSSStyleRule::~CSSStyleRule()
|
|||
{
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylerule-selectortext
|
||||
String CSSStyleRule::selector_text() const
|
||||
{
|
||||
TODO();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylerule-selectortext
|
||||
void CSSStyleRule::set_selector_text(StringView selector_text)
|
||||
{
|
||||
// FIXME: 1. Run the parse a group of selectors algorithm on the given value.
|
||||
|
||||
// FIXME: 2. If the algorithm returns a non-null value replace the associated group of selectors with the returned value.
|
||||
|
||||
// FIXME: 3. Otherwise, if the algorithm returns a null value, do nothing.
|
||||
|
||||
(void)selector_text;
|
||||
TODO();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylerule-style
|
||||
CSSStyleDeclaration* CSSStyleRule::style()
|
||||
{
|
||||
return m_declaration;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ class CSSStyleRule : public CSSRule {
|
|||
AK_MAKE_NONMOVABLE(CSSStyleRule);
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::CSSStyleRuleWrapper;
|
||||
|
||||
static NonnullRefPtr<CSSStyleRule> create(NonnullRefPtrVector<Selector>&& selectors, NonnullRefPtr<CSSStyleDeclaration>&& declaration)
|
||||
{
|
||||
return adopt_ref(*new CSSStyleRule(move(selectors), move(declaration)));
|
||||
|
@ -33,6 +35,11 @@ public:
|
|||
virtual StringView class_name() const { return "CSSStyleRule"; };
|
||||
virtual Type type() const { return Type::Style; };
|
||||
|
||||
String selector_text() const;
|
||||
void set_selector_text(StringView);
|
||||
|
||||
CSSStyleDeclaration* style();
|
||||
|
||||
private:
|
||||
CSSStyleRule(NonnullRefPtrVector<Selector>&&, NonnullRefPtr<CSSStyleDeclaration>&&);
|
||||
|
||||
|
|
6
Userland/Libraries/LibWeb/CSS/CSSStyleRule.idl
Normal file
6
Userland/Libraries/LibWeb/CSS/CSSStyleRule.idl
Normal file
|
@ -0,0 +1,6 @@
|
|||
interface CSSStyleRule {
|
||||
|
||||
attribute CSSOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue