LibWeb: Optimize CSS::StyleDeclaration for size
We can reduce the amount of padding the compiler adds in order to ensure data alignment of member variables by ordering the types in a struct by size in decending order. Found By PVS-Studio: https://pvs-studio.com/en/docs/warnings/v802/
This commit is contained in:
parent
1b00ddf07e
commit
027cbe6b89
Notes:
sideshowbarker
2024-07-18 02:51:37 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/027cbe6b891 Pull-request: https://github.com/SerenityOS/serenity/pull/10418
3 changed files with 4 additions and 4 deletions
|
@ -87,9 +87,9 @@ bool PropertyOwningCSSStyleDeclaration::set_property(PropertyID property_id, Str
|
|||
}
|
||||
|
||||
m_properties.append(CSS::StyleProperty {
|
||||
.important = false,
|
||||
.property_id = property_id,
|
||||
.value = new_value.release_nonnull(),
|
||||
.important = false,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
namespace Web::CSS {
|
||||
|
||||
struct StyleProperty {
|
||||
bool important { false };
|
||||
CSS::PropertyID property_id;
|
||||
NonnullRefPtr<StyleValue> value;
|
||||
String custom_name {};
|
||||
bool important { false };
|
||||
};
|
||||
|
||||
class CSSStyleDeclaration
|
||||
|
|
|
@ -1834,9 +1834,9 @@ Optional<StyleProperty> Parser::convert_to_style_property(StyleDeclarationRule c
|
|||
}
|
||||
|
||||
if (property_id == PropertyID::Custom) {
|
||||
return StyleProperty { property_id, value.release_value(), declaration.m_name, declaration.m_important };
|
||||
return StyleProperty { declaration.m_important, property_id, value.release_value(), declaration.m_name };
|
||||
} else {
|
||||
return StyleProperty { property_id, value.release_value(), {}, declaration.m_important };
|
||||
return StyleProperty { declaration.m_important, property_id, value.release_value(), {} };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue