Closed Bug 1696721 Opened 3 years ago Closed 3 years ago

Ruby elements with padding have incorrect layout

Categories

(Core :: Layout: Ruby, defect, P3)

Firefox 88
defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox88 --- wontfix
firefox89 --- fixed

People

(Reporter: toasted.nutbread, Assigned: xidorn)

Details

(Keywords: testcase)

Attachments

(4 files)

Attached file ruby-padding-bug.html

Ruby elements with padding contained within a display:inline-block element have incorrect layout.

An example is provided to demonstrate the issue. Collapsing the whitespace will change the layout to not wrap, but the elements will be incorrectly cut off.
Expected: no word wrapping.
Actual: text1 and text2 are wrapped onto different lines.

.item {
    display: inline-block;
    background-color: #ff9999;
}
.item:nth-child(2n) {
    background-color: #9999ff;
}
.item>ruby {
    padding-right: 1em;
}
<span class="item">
    <ruby>text1</ruby>
    <span>text2</span>
</span>

Side note: when more complex HTML is used which has this pattern, the inspect element feature will cause the elements to jump around as they are hovered. I can get an example of that if necessary, but it likely stems from this issue.

The Bugbug bot thinks this bug should belong to the 'Core::Layout' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Layout
Product: Firefox → Core
Severity: -- → S3
Status: UNCONFIRMED → NEW
Component: Layout → Layout: Ruby
Ever confirmed: true
Keywords: testcase
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All

I think I know what's going on here... will take a closer look this weekend.

Assignee: nobody → xidorn+moz

This issue is revealled by the test for this bug in a later part, so it's also covered by that test.

While nsInlineFrame and nsFirstLetterFrame are going to continue sharing the same code, nsRubyFrame will use the refactored version to compute its intrinsic sizes.

This way we can also eliminate the need for checking the intrinsic type inside the function.

Depends on D109226

Pushed by mozilla@upsuper.org:
https://hg.mozilla.org/integration/autoland/rev/43ae915dc91a
part 1 - Fix incorrect span sizing on ruby with border / padding. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/00afc8414972
part 2 - Refactor DoIntrinsicInlineISize to make it accept a function for handling children. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/1245e772d2de
part 3 - Fix intrinsic isize calculation for ruby frame. r=dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/28184 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: