mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Add CSSGroupingRule
This is an abstract base class for CSSRules that hold a CSSRuleList.
This commit is contained in:
parent
eb83d2617c
commit
06f9395056
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/06f93950568 Pull-request: https://github.com/SerenityOS/serenity/pull/10262 Reviewed-by: https://github.com/awesomekling
4 changed files with 74 additions and 0 deletions
|
@ -12,6 +12,7 @@ set(SOURCES
|
|||
Bindings/ScriptExecutionContext.cpp
|
||||
Bindings/WindowObject.cpp
|
||||
Bindings/Wrappable.cpp
|
||||
CSS/CSSGroupingRule.cpp
|
||||
CSS/CSSImportRule.cpp
|
||||
CSS/CSSRule.cpp
|
||||
CSS/CSSRuleList.cpp
|
||||
|
|
33
Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp
Normal file
33
Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/CSS/CSSGroupingRule.h>
|
||||
#include <LibWeb/CSS/CSSRuleList.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
CSSGroupingRule::CSSGroupingRule(NonnullRefPtrVector<CSSRule>&& rules)
|
||||
: m_rules(CSSRuleList { move(rules) })
|
||||
{
|
||||
}
|
||||
|
||||
CSSGroupingRule::~CSSGroupingRule()
|
||||
{
|
||||
}
|
||||
|
||||
size_t CSSGroupingRule::insert_rule(StringView const&, size_t)
|
||||
{
|
||||
// https://www.w3.org/TR/cssom-1/#insert-a-css-rule
|
||||
TODO();
|
||||
}
|
||||
|
||||
void CSSGroupingRule::delete_rule(size_t)
|
||||
{
|
||||
// https://www.w3.org/TR/cssom-1/#remove-a-css-rule
|
||||
TODO();
|
||||
}
|
||||
|
||||
}
|
34
Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h
Normal file
34
Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <LibWeb/CSS/CSSRule.h>
|
||||
#include <LibWeb/CSS/CSSRuleList.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class CSSGroupingRule : public CSSRule {
|
||||
AK_MAKE_NONCOPYABLE(CSSGroupingRule);
|
||||
AK_MAKE_NONMOVABLE(CSSGroupingRule);
|
||||
|
||||
public:
|
||||
~CSSGroupingRule();
|
||||
|
||||
CSSRuleList const& css_rules() const { return m_rules; }
|
||||
size_t insert_rule(StringView const& rule, size_t index = 0);
|
||||
void delete_rule(size_t index);
|
||||
|
||||
protected:
|
||||
explicit CSSGroupingRule(NonnullRefPtrVector<CSSRule>&&);
|
||||
|
||||
private:
|
||||
CSSRuleList m_rules;
|
||||
};
|
||||
|
||||
}
|
6
Userland/Libraries/LibWeb/CSS/CSSGroupingRule.idl
Normal file
6
Userland/Libraries/LibWeb/CSS/CSSGroupingRule.idl
Normal file
|
@ -0,0 +1,6 @@
|
|||
interface CSSGroupingRule : CSSRule {
|
||||
[SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
|
||||
undefined deleteRule(unsigned long index);
|
||||
};
|
||||
|
Loading…
Reference in a new issue