1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 17:55:08 +00:00

LibWeb: Resolve cyclic dependency between StyleSheet and ImportRule

Previously: CSSImportRule::loaded_style_sheet() (and others) depend on
the definition of class CSSStyleSheet. Meanwhile,
CSSStyleSheet::template for_each_effective_style_rule (and others)
depend on the definition of class CSSImportRule.

This hasn't caused any problems so far because CSSStyleSheet.h happened
to be always included after CSSImportRule.h (in part due to alphabetical
ordering).

However, a compilation unit that (for example) only contains
    #include <Userland/Libraries/LibWeb/CSSImportRule.h>
would fail to compile.

This patch resolves this issue by pushing the inline definition of
Web::CSS::CSSStyleSheet::for_each_effective_style_rule and
for_first_not_loaded_import_rule into a different file, and adding the
missing headers.
This commit is contained in:
Ben Wiederhake 2021-09-30 22:57:35 +02:00 committed by Linus Groh
parent 0f35ae13fb
commit 0db6ca4065
6 changed files with 41 additions and 33 deletions

View file

@ -6,6 +6,7 @@
#include <AK/Debug.h>
#include <AK/URL.h>
#include <LibWeb/CSS/CSSImportRule.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>