Closed Bug 1563278 Opened 5 months ago Closed 4 months ago

web-platform-test contain-paint-008.html fails on mac & windows due to having "PASS" text mis-positioned by < 1px


(Core :: Layout, task, P3)




Tracking Status
firefox70 --- fixed


(Reporter: dholbert, Assigned: dholbert)



(1 file)

On Mac and Windows, this css-contain WPT test...
...renders with the "PASS" text positioned slightly higher (< 1px?) than in the corresponding reference case:

The only obvious difference between the files (aside from contain:paint which has no effect) is that the testcase uses position:relative. I'm guessing that might be triggering pixel-snapping perhaps.

The rendering difference probably isn't meaningful and is barely perceptible, though it does cause quite a few pixels to differ. If the pixel-snapping is correct or at least unworrisome, then perhaps there's a way we can adjust the testcase or reference case so that they both have the same pixel alignment.

Summary: web-platform-test contain-paint-008.html fails due to having "PASS" text mis-positioned by < 1px → web-platform-test contain-paint-008.html fails on mac & windows due to having "PASS" text mis-positioned by < 1px
Flags: needinfo?(dholbert)

OK, this is a test bug.

The issue is that the testcase specifies font-size: 1rem and font-family: monospace on two different elements (parent vs. child), whereas the reference case specifies font-size and font-family on the same element. There's no reason for this -- I think it's just an oversight.

This problem potentially creates a legitimate alignment difference (hence the test failure), because the testcase effectively creates a line-box with the default font's font-metrics, vs. the reference case creates a line-box with the font-family:monospace font metrics. These line-boxes may have different sizes and/or baseline-positons. So the inline-level child that we baseline-align into them (which is monospace text in both cases) may end up at a different position.

There's a simple fix -- let's just move the font-family to be on the parent element in the testcase (the same spot we specify font-size)

Assignee: nobody → dholbert
Flags: needinfo?(dholbert)

This patch corrects a likely-inadvertent difference between the CSS in this
testcase vs. its reference case.

This patch fixes a Windows & MacOS off-by-1px spurious failure in this test,
which was probably due to having text whose font-metrics differ from its
line-box (in the testcase) vs. agree with its line-box (in the reference).

Pushed by
Specify font-family and font-size on the same element in web-platform-test contain-paint-008.html. r=TYLin
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Created web-platform-tests PR for changes under testing/web-platform/tests
Upstream PR merged
You need to log in before you can comment on or make changes to this bug.