mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 07:39:16 +00:00
LibWeb: Implement faster equals()
for UnresolvedStyleValue
Compare `Vector<Parser::ComponentValue>` directly instead of serializing them into strings first. This is required for the upcoming changes where we would compare previous and new sets of custom properties to figure out whether we need to invalidate descendant elements. Without this change `equals()` would show up being hot in profiles.
This commit is contained in:
parent
b1efd62ce6
commit
cbe4ba60c3
Notes:
github-actions[bot]
2025-07-30 09:07:30 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: cbe4ba60c3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5618
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/tcl3
4 changed files with 14 additions and 2 deletions
|
@ -48,8 +48,7 @@ bool UnresolvedStyleValue::equals(CSSStyleValue const& other) const
|
|||
{
|
||||
if (type() != other.type())
|
||||
return false;
|
||||
// This is a case where comparing the strings actually makes sense.
|
||||
return to_string(SerializationMode::Normal) == other.to_string(SerializationMode::Normal);
|
||||
return values() == other.as_unresolved().values();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue