Skip to content

Fix static position of block-level abspos elements in inline layout - #608

Merged
nicoburns merged 1 commit into
mainfrom
devin/1785858220-abspos-static-position
Aug 4, 2026
Merged

Fix static position of block-level abspos elements in inline layout#608
nicoburns merged 1 commit into
mainfrom
devin/1785858220-abspos-static-position

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #607 (split into two PRs per review; the companion iframe/embed/video dimension-attribute fix is a separate PR).

layout_abspos_child in inline layout used the inline box's line position (ibox.x/ibox.y) as the static position for every abspos element with auto insets. That's only correct for elements whose hypothetical box is inline-level. A div { position: absolute } sibling of an inline replaced element was being placed beside it on the line instead of at the containing block's content-box left edge. The call site now checks original_display.outside() == DisplayOutside::Inline (the display before abspos blockification) and passes an explicit static position:

let static_position = Point {
    x: if is_inline_level { ibox.x } else { container_pb.left },
    y: ibox.y,
};

The RTL inline static-position adjustment also only applies when the box is inline-level.

WPT results

Newly passing vs main (no regressions in css-flexbox, css/CSS2/normal-flow, css/CSS2/positioning):

  • css/CSS2/normal-flow/inline-replaced-height-004/007.xht
  • css/CSS2/normal-flow/inline-block-replaced-height-004/007.xht

The *-005 variants and absolute-replaced-height-* tests additionally need the percentage dimension attribute mapping from the companion PR.

Link to Devin session: https://app.devin.ai/sessions/0f8547b7fbb949e28e9acdbedb1ca8d2
Requested by: @nicoburns

WPT results

5 newly passing, 1 newly failing (net +4).

Full diff (6 changed tests)
+ Fail => Pass css/CSS2/floats/floats-placement-008.html
+ Fail => Pass css/CSS2/normal-flow/inline-block-replaced-height-004.xht
+ Fail => Pass css/CSS2/normal-flow/inline-block-replaced-height-007.xht
+ Fail => Pass css/CSS2/normal-flow/inline-replaced-height-004.xht
+ Fail => Pass css/CSS2/normal-flow/inline-replaced-height-007.xht
- Pass => Fail css/css-fonts/variations/font-weight-metrics.html

Generated by the WPT workflow.

@nicoburns nicoburns self-assigned this Aug 4, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1785858220-abspos-static-position branch from f326b11 to 46d08af Compare August 4, 2026 16:31
@nicoburns
nicoburns marked this pull request as ready for review August 4, 2026 16:40
@nicoburns
nicoburns merged commit 1cc2261 into main Aug 4, 2026
15 checks passed
@nicoburns
nicoburns deleted the devin/1785858220-abspos-static-position branch August 4, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant