LibWeb: Reorder MatchingRule members to make it smaller

By packing the members more efficiently, it goes from 64 to 56 bytes.
This commit is contained in:
Andreas Kling 2024-03-18 16:01:47 +01:00
parent 963aa213c5
commit 25c22bb5e5
Notes: sideshowbarker 2024-07-17 05:23:40 +09:00
2 changed files with 4 additions and 4 deletions

View File

@ -2323,14 +2323,14 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
size_t selector_index = 0;
for (CSS::Selector const& selector : rule.selectors()) {
MatchingRule matching_rule {
cascade_origin,
shadow_root,
&rule,
sheet,
style_sheet_index,
rule_index,
selector_index,
selector.specificity()
selector.specificity(),
cascade_origin,
};
for (auto const& simple_selector : selector.compound_selectors().last().simple_selectors) {

View File

@ -21,7 +21,7 @@
namespace Web::CSS {
// https://www.w3.org/TR/css-cascade/#origin
enum class CascadeOrigin {
enum class CascadeOrigin : u8 {
Author,
User,
UserAgent,
@ -30,7 +30,6 @@ enum class CascadeOrigin {
};
struct MatchingRule {
CascadeOrigin cascade_origin;
JS::GCPtr<DOM::ShadowRoot const> shadow_root;
JS::GCPtr<CSSStyleRule const> rule;
JS::GCPtr<CSSStyleSheet const> sheet;
@ -39,6 +38,7 @@ struct MatchingRule {
size_t selector_index { 0 };
u32 specificity { 0 };
CascadeOrigin cascade_origin;
bool contains_pseudo_element { false };
bool contains_root_pseudo_class { false };
};