From 022a9fb9aa95e9bcace1aa5fd8030425167c8104 Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 20 Dec 2024 22:56:29 +0100 Subject: cascade: blockify on position: absolute or fixed Welp, turns out I was overthinking it. CSS does not support inline position: absolute at all, it just blockifies. That does leave us with the question of "why does inline-block behave differently than block?" Especially because both in Gecko and Blink, getComputedStyle for absolute inline-blocks gives me "block", not "inline-block", and yet there is the same difference in rendering when I change the CSS. I first thought it's a quirks mode issue, but standards mode doesn't affect it. Wat. --- src/css/cascade.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/css') diff --git a/src/css/cascade.nim b/src/css/cascade.nim index 8b0d9574..7fb7734d 100644 --- a/src/css/cascade.nim +++ b/src/css/cascade.nim @@ -270,10 +270,10 @@ func buildComputedValues(rules: CSSValueEntryMap; if not inited[t]: result.initialOrInheritFrom(parent, t) if result{"float"} != FloatNone: - #TODO it may be better to handle this in layout - let display = result{"display"}.blockify() - if display != result{"display"}: - result{"display"} = display + result{"display"} = result{"display"}.blockify() + elif result{"position"} in {PositionAbsolute, PositionFixed} and + result{"display"} == DisplayInline: + result{"display"} = DisplayBlock if (result{"overflow-x"} in {OverflowVisible, OverflowClip}) != (result{"overflow-y"} in {OverflowVisible, OverflowClip}): result{"overflow-x"} = result{"overflow-x"}.bfcify() -- cgit