Closed Bug 1973437 Opened 1 year ago Closed 1 year ago

boratool.com - Image gallery layout is broken

Categories

(Web Compatibility :: Site Reports, defect, P3)

Desktop
Windows 10

Tracking

(Webcompat Priority:P3, Webcompat Score:4, firefox141 fixed, firefox142 fixed)

VERIFIED FIXED
Webcompat Priority P3
Webcompat Score 4
Tracking Status
firefox141 --- fixed
firefox142 --- fixed

People

(Reporter: ctanase, Unassigned)

References

()

Details

(Keywords: webcompat:platform-bug, webcompat:site-report, Whiteboard: [webcompat-source:web-bugs])

User Story

platform:windows,mac,linux,android
impact:content-missing
configuration:general
affects:all
branch:release
diagnosis-team:layout
user-impact-score:60

Attachments

(5 files, 4 obsolete files)

Environment:
Operating system: Linux/Windows 10
Firefox version: Firefox 139.0/141

Steps to reproduce:

  1. Go to https://boratool.com/ngx-saw-plate.html
  2. Wait for the image gallery to load. (refresh the page it appears to be stuck loading)
  3. Click on the gallery arrows to navigate it.

Expected Behavior:
The images are displayed correctly.

Actual Behavior:
The gallery height is bigger and it shows halves of 2 different images.

Notes:

  • Reproduces regardless of the status of ETP
  • Reproduces in firefox-nightly, and firefox-release
  • Does not reproduce in chrome

Created from https://github.com/webcompat/web-bugs/issues/163064

Attached image image.png
Summary: boratool.com - Image gallery is broken → boratool.com - Image gallery layout is broken
Webcompat Score: --- → 1
Severity: -- → S2
User Story: (updated)
Webcompat Priority: --- → P3
Webcompat Score: 1 → 4
Priority: -- → P3
Attached file Standalone test case (obsolete) —
Attached file More reduced test case (obsolete) —
Attachment #9496719 - Attachment is obsolete: true
Attached file More reduced test case (obsolete) —

If I add a new line before the first div with class="slick-item slick-slide slick-cloned" the rendering looks much more similar between Chrome and Firefox

Attachment #9496720 - Attachment is obsolete: true
Attached file More reduced test case (obsolete) —
Attachment #9496726 - Attachment is obsolete: true
Attached file Reduced test case

It looks like this is caused by a subtle difference in sizing with zoom: 85%; between slick-track and it's children

Attachment #9496733 - Attachment is obsolete: true
Flags: needinfo?(dholbert)

(er, this updated testcase makes the math slightly easier to reason about in frame tree dumps, by removing the influence of borders)

Using my reduced testcase 3, looking at frame-tree-dumps:

If I edit the testcase to remove the zoom styling (which avoids the problem), then:

  • the container's 570px width maps to 34200 app units (570 * 60 = 34200)
  • each child's 190px width maps to 11400 app units (190 * 60 = 11400)
  • three children precisely fit in the parent (11400 * 3 = 34200)

But with the included zoom: 85% styling, then:

  • the container's 570px width maps to 28856 app units, though it should be 29070 if we had perfect arithmetic. (570 * 60 * .85 = 29070)
  • each child's 190px width maps to 9619 app units, though it should be 9690 if we had perfect arithmetic. (190 * 60 * .85 = 9690)
  • three children do not fit in the parent due to our precision issues. (9619 * 3 = 28857 which is just barely larger than the parent's 28856-app-unit-width.)

We seem to be scaling things down a bit more than we should be, for some reason (and by a bit more than floating-point-error would trigger....)

Flags: needinfo?(dholbert)
Attached file testcase 4

Here's a reduced testcase applying various zoom factors to various multiples of 100px. All of the resulting elements should render at precisely 100px wide, but they don't; some are wider (particularly near the top), some are skinnier (revealing some of the red behind them).

(In reply to Daniel Holbert [:dholbert] from comment #9)

We seem to be scaling things down a bit more than we should be, for some reason (and by a bit more than floating-point-error would trigger....)

Ah right, that's because we don't represent zoom as floating-point -- we represent it as a 16-bit fixed-point value, with range from 0 to 1023.984375, per https://searchfox.org/mozilla-central/rev/c25dbe453ff9ca10f2c6bdfb873893c515a29826/servo/components/style/values/computed/box.rs#121-129

So that's why:
(a) we're getting values that aren't quite exact (sometimes over/undershooting in testcase 4)
(b) we end up with fixed-point values that happen to convert to "unlucky" floating-point values which scale app-units in a way that produces fractional app-units, which need to be rounded in ways that might cause things to not fit and hence linewrap, as in testcases 1-3 (presumably in the fixed-point-zoom --> float --> nscoord arithmetic that happens here),

Depends on: 1974099

I filed bug 1974099 on the fact that our zoom representation is less precise than other browsers here.

The issue is no longer reproducible

Firefox Nightly 142.0a1 (2025-07-08)
Windows 10

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED

Verified, the issue is no longer reproducible.

Tested with:

  • Browser 141.0- candidate build 1
  • Operating system: Windows 10
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: