mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
LibWeb: Make PercentageOr<T> equality comparison work for calc() values
This makes hovering around on GitHub fast again, as it no longer believes that the grid-template-areas property keeps changing when it didn't :^) Also made to_string() work for calc() values as well, since I stumbled upon that while debugging this.
This commit is contained in:
parent
d7ca52afaf
commit
c8cf599c44
Notes:
sideshowbarker
2024-07-17 03:30:41 +09:00
Author: https://github.com/awesomekling
Commit: c8cf599c44
Pull-request: https://github.com/SerenityOS/serenity/pull/18790
1 changed files with 5 additions and 2 deletions
|
@ -114,18 +114,21 @@ public:
|
|||
|
||||
ErrorOr<String> to_string() const
|
||||
{
|
||||
if (is_calculated())
|
||||
return m_value.template get<NonnullRefPtr<CalculatedStyleValue>>()->to_string();
|
||||
if (is_percentage())
|
||||
return m_value.template get<Percentage>().to_string();
|
||||
|
||||
return m_value.template get<T>().to_string();
|
||||
}
|
||||
|
||||
bool operator==(PercentageOr<T> const& other) const
|
||||
{
|
||||
if (is_calculated())
|
||||
if (is_calculated() != other.is_calculated())
|
||||
return false;
|
||||
if (is_percentage() != other.is_percentage())
|
||||
return false;
|
||||
if (is_calculated())
|
||||
return (*m_value.template get<NonnullRefPtr<CalculatedStyleValue>>() == *other.m_value.template get<NonnullRefPtr<CalculatedStyleValue>>());
|
||||
if (is_percentage())
|
||||
return (m_value.template get<Percentage>() == other.m_value.template get<Percentage>());
|
||||
return (m_value.template get<T>() == other.m_value.template get<T>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue