mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb: Let style elements remember which StyleSheetList they live in
Instead of trying to locate the relevant StyleSheetList on style element removal from the DOM, we now simply keep a pointer to the list instead. This fixes an issue where using attachShadow() on an element that had a declarative shadow DOM would cause any style elements present to use the wrong StyleSheetList when removing themselves from the tree.
This commit is contained in:
parent
2064be708f
commit
8543b8ad6a
Notes:
github-actions[bot]
2024-09-21 06:56:52 +00:00
Author: https://github.com/awesomekling
Commit: 8543b8ad6a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1467
6 changed files with 30 additions and 25 deletions
|
@ -14,19 +14,21 @@ namespace Web::DOM {
|
|||
|
||||
class StyleElementUtils {
|
||||
public:
|
||||
void update_a_style_block(DOM::Element& style_element, JS::GCPtr<DOM::Node> old_parent_if_removed_from = nullptr);
|
||||
void update_a_style_block(DOM::Element& style_element);
|
||||
|
||||
CSS::CSSStyleSheet* sheet() { return m_associated_css_style_sheet; }
|
||||
CSS::CSSStyleSheet const* sheet() const { return m_associated_css_style_sheet; }
|
||||
|
||||
void visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(m_associated_css_style_sheet);
|
||||
}
|
||||
[[nodiscard]] JS::GCPtr<CSS::StyleSheetList> style_sheet_list() { return m_style_sheet_list; }
|
||||
[[nodiscard]] JS::GCPtr<CSS::StyleSheetList const> style_sheet_list() const { return m_style_sheet_list; }
|
||||
|
||||
void visit_edges(JS::Cell::Visitor&);
|
||||
|
||||
private:
|
||||
// https://www.w3.org/TR/cssom/#associated-css-style-sheet
|
||||
JS::GCPtr<CSS::CSSStyleSheet> m_associated_css_style_sheet;
|
||||
|
||||
JS::GCPtr<CSS::StyleSheetList> m_style_sheet_list;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue