diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-04 16:06:32 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-04 16:06:32 +0200 |
commit | 959de19418c831e1384f6d65a45971dd1d6a4287 (patch) | |
tree | 11799bded8de162b37feab50fd098aeb0b6a0a71 /Libraries/LibWeb/DOM/Document.h | |
parent | ec1891837fd2aeec9b644ca1b70caf6f026e305a (diff) | |
download | serenity-959de19418c831e1384f6d65a45971dd1d6a4287.zip |
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. :^)
Diffstat (limited to 'Libraries/LibWeb/DOM/Document.h')
-rw-r--r-- | Libraries/LibWeb/DOM/Document.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h index 37db176127..6679e46e23 100644 --- a/Libraries/LibWeb/DOM/Document.h +++ b/Libraries/LibWeb/DOM/Document.h @@ -37,6 +37,7 @@ #include <LibJS/Forward.h> #include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleSheet.h> +#include <LibWeb/CSS/StyleSheetList.h> #include <LibWeb/DOM/NonElementParentNode.h> #include <LibWeb/DOM/ParentNode.h> @@ -63,8 +64,8 @@ public: StyleResolver& style_resolver() { return *m_style_resolver; } const StyleResolver& style_resolver() const { return *m_style_resolver; } - void add_sheet(const StyleSheet& sheet) { m_sheets.append(sheet); } - const NonnullRefPtrVector<StyleSheet>& stylesheets() const { return m_sheets; } + CSS::StyleSheetList& style_sheets() { return *m_style_sheets; } + const CSS::StyleSheetList& style_sheets() const { return *m_style_sheets; } virtual FlyString tag_name() const override { return "#document"; } @@ -146,7 +147,7 @@ private: virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override; OwnPtr<StyleResolver> m_style_resolver; - NonnullRefPtrVector<StyleSheet> m_sheets; + RefPtr<CSS::StyleSheetList> m_style_sheets; RefPtr<Node> m_hovered_node; RefPtr<Node> m_inspected_node; WeakPtr<Frame> m_frame; |