Closed Bug 1966313 Opened 2 months ago Closed 2 months ago

Empty span elements interfere with bidirectional text

Categories

(Core :: Layout: Text and Fonts, defect)

Firefox 138
defect

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: NeatNit, Assigned: jfkthame)

Details

Attachments

(2 files)

Attached file bidi_bug.html

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0

Steps to reproduce:

The following HTML contains two spans with identical text, except one of them has an empty span in the middle:

<span dir="auto">1;2;3;5;12;20;22א;</span><br />
<span dir="auto">1;2;3;5;1<span></span>2;20;22א;</span>

They should both be rendered the same, as they are in Chromium. In Firefox, the "12" is rendered as "21".

The re-ordering of characters according to the Unicode Bidirectional Algorithm should not be affected by span elements.

Actual results:

Different rendering between elements

Expected results:

Identical rendering of both elements

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core

Yes, this looks like a bug -- the empty span should have no visible effect.

It does seem to be specific to an empty span; if the span contains another digit, or a punctuation mark like . or -, I see the expected re-ordering.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true

Note that this changes the behavior of an existing reftest at
layout/reftests/bidi/588739-2.html. This is expected, because this
testcase was using an empty <span> with no other relevant properties,
and expecting it to interrupt bidi reordering, but that is exactly
the behavior reported as a bug here.

Both Chrome and Safari agree with the updated rendering of that
testcase (and the WPT version added here), so the change is both
logically correct and aligns us with the other browsers.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/93e17afc2615 Ignore empty inline frames in nsBidiPresUtils::TraverseFrames. r=dshin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/52548 for changes under testing/web-platform/tests

Wow, you're fast - I never would have imagined this would be fixed in less than a day! Thank you :)

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-triage-done-c141/b140]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: