mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb/CSS: Implement CSSStyleRule.styleMap
StylePropertyMap is just a stub, so this doesn't yet accomplish much.
This commit is contained in:
Notes:
github-actions[bot]
2025-08-13 09:15:50 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/215d8b80762 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5823 Reviewed-by: https://github.com/trflynn89
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <LibWeb/CSS/CSSStyleSheet.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/StylePropertyMap.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
@@ -40,6 +41,7 @@ void CSSStyleRule::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_declaration);
|
||||
visitor.visit(m_style_map);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-1/#dom-cssstylerule-style
|
||||
@@ -48,6 +50,14 @@ GC::Ref<CSSStyleProperties> CSSStyleRule::style()
|
||||
return m_declaration;
|
||||
}
|
||||
|
||||
// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssstylerule-stylemap
|
||||
GC::Ref<StylePropertyMap> CSSStyleRule::style_map()
|
||||
{
|
||||
if (!m_style_map)
|
||||
m_style_map = StylePropertyMap::create(realm(), m_declaration);
|
||||
return *m_style_map;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-1/#serialize-a-css-rule
|
||||
String CSSStyleRule::serialized() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user