1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibWeb: Update anonymous wrappers when applying style changes

Anonymous wrapper boxes inherit style from their layout tree parent,
and since style data is per-layout-node, we have to manually sync them
from parent to anonymous children when something changes.

This is not very elegant or efficient, so I've left a FIXME about
solving it in a nicer way.

This fixes horizontal dog alignment on https://waffles.dog/ :^)
This commit is contained in:
Andreas Kling 2023-07-03 12:49:13 +02:00
parent b918ce4022
commit 510dfbb7e6
4 changed files with 36 additions and 0 deletions

View file

@ -431,6 +431,11 @@ class ImmutableComputedValues final : public ComputedValues {
class MutableComputedValues final : public ComputedValues {
public:
void inherit_from(ComputedValues const& other)
{
m_inherited = static_cast<MutableComputedValues const&>(other).m_inherited;
}
void set_aspect_ratio(AspectRatio aspect_ratio) { m_noninherited.aspect_ratio = aspect_ratio; }
void set_font_size(float font_size) { m_inherited.font_size = font_size; }
void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; }