LibWeb: Process style sheets in document order

Until now we would simply apply stylesheets in the order they finished
loading. This patch adds a StyleSheetList object that hangs off of each
Document and contains all the style sheets in document order.

There's still a lot of work to do for a proper cascade, but at least
this makes us consistently wrong every time. :^)
This commit is contained in:
Andreas Kling 2020-06-04 16:06:32 +02:00
parent ec1891837f
commit 959de19418
Notes: sideshowbarker 2024-07-19 05:50:13 +09:00
11 changed files with 120 additions and 7 deletions

View file

@ -50,7 +50,9 @@ void HTMLStyleElement::children_changed()
});
m_stylesheet = parse_css(builder.to_string());
if (m_stylesheet)
document().add_sheet(*m_stylesheet);
document().style_sheets().add_sheet(*m_stylesheet);
else
document().style_sheets().add_sheet(StyleSheet::create({}));
HTMLElement::children_changed();
}