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
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; size_t selector_index = 0;
for (CSS::Selector const& selector : rule.selectors()) { for (CSS::Selector const& selector : rule.selectors()) {
MatchingRule matching_rule { MatchingRule matching_rule {
cascade_origin,
shadow_root, shadow_root,
&rule, &rule,
sheet, sheet,
style_sheet_index, style_sheet_index,
rule_index, rule_index,
selector_index, selector_index,
selector.specificity() selector.specificity(),
cascade_origin,
}; };
for (auto const& simple_selector : selector.compound_selectors().last().simple_selectors) { for (auto const& simple_selector : selector.compound_selectors().last().simple_selectors) {

View file

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