mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
LibWeb: Make CSS::PercentageOr<T> non-virtual
This shrinks each instance of PercentageOr by 8 bytes and avoids virtual dispatch when resolving calc() values. It's a win-win! Many data structures shrink as a result. An example is ComputedValues which goes from 3376 bytes to 3024 bytes per instance.
This commit is contained in:
parent
b42b7c8dd0
commit
c282138fd0
Notes:
github-actions[bot]
2024-08-02 18:38:37 +00:00
Author: https://github.com/awesomekling
Commit: c282138fd0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/935
10 changed files with 44 additions and 49 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "Angle.h"
|
||||
#include <AK/Math.h>
|
||||
#include <LibWeb/CSS/Percentage.h>
|
||||
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -83,4 +84,9 @@ Optional<Angle::Type> Angle::unit_from_name(StringView name)
|
|||
return {};
|
||||
}
|
||||
|
||||
Angle Angle::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&, Angle const& reference_value)
|
||||
{
|
||||
return calculated->resolve_angle_percentage(reference_value).value();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue