diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-10-16 22:13:53 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-10-16 22:18:21 +0200 |
| commit | c20166207867f536201ae7148608b9db202a2739 (patch) | |
| tree | d71e861d7182ad83929281c978c98d28608a2cef /src | |
| parent | fe0b8ee5f1128ddab8bc8be9c71339243d3e9de2 (diff) | |
| download | chawan-c20166207867f536201ae7148608b9db202a2739.tar.gz | |
layout: fix inline float + position: absolute bug
As per standard, float "only applies to elements that [...] are not
absolutely positioned."
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/engine.nim | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index adf5b3ce..c6dc5387 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -1514,14 +1514,15 @@ proc addInlineBlock(ictx: var InlineContext; state: var InlineState; proc addBox(ictx: var InlineContext; state: var InlineState; box: BlockBox) = - if box.computed{"float"} != FloatNone: - # This will trigger a re-layout for this inline root. - if not ictx.secondPass: - ictx.addInlineFloat(state, box) - elif box.computed{"position"} == PositionAbsolute: + if box.computed{"position"} == PositionAbsolute: # This doesn't really have to be an inline block. I just want to # handle its positioning here. ictx.addInlineAbsolute(state, box) + elif box.computed{"float"} != FloatNone: + # (Must check after `position: absolute', as that has higher precedence.) + # This will trigger a re-layout for this inline root. + if not ictx.secondPass: + ictx.addInlineFloat(state, box) else: # This is an inline block. assert box.computed{"display"} in DisplayOuterInline |