mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
LibWeb: Compute StackingContext transform origin only once
When mousing over twitter, 17% of time was spent computing stacking context transform origins. Since this never changes after the stacking context is created, we can cache it and avoid all that work.
This commit is contained in:
parent
901b80f988
commit
5c6621547c
2 changed files with 5 additions and 2 deletions
|
@ -30,6 +30,7 @@ static void paint_node(Layout::Node const& layout_node, PaintContext& context, P
|
|||
StackingContext::StackingContext(Layout::Box& box, StackingContext* parent)
|
||||
: m_box(box)
|
||||
, m_transform(combine_transformations(m_box.computed_values().transformations()))
|
||||
, m_transform_origin(compute_transform_origin())
|
||||
, m_parent(parent)
|
||||
{
|
||||
VERIFY(m_parent != this);
|
||||
|
@ -316,7 +317,7 @@ void StackingContext::paint(PaintContext& context) const
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::FloatPoint StackingContext::transform_origin() const
|
||||
Gfx::FloatPoint StackingContext::compute_transform_origin() const
|
||||
{
|
||||
auto style_value = m_box.computed_values().transform_origin();
|
||||
// FIXME: respect transform-box property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue