mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
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:
parent
ec1891837f
commit
959de19418
11 changed files with 120 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue