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

Categories

(Core :: Layout, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

On Mac and Windows, this css-contain WPT test...
https://searchfox.org/mozilla-central/rev/0671407b7b9e3ec1ba96676758b33316f26887a4/testing/web-platform/tests/css/css-contain/contain-paint-008.html
...renders with the "PASS" text positioned slightly higher (< 1px?) than in the corresponding reference case:
https://searchfox.org/mozilla-central/rev/0671407b7b9e3ec1ba96676758b33316f26887a4/testing/web-platform/tests/css/css-contain/reference/contain-paint-008-ref.html

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
Status: NEW → ASSIGNED
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 dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bbcd2af40409
Specify font-family and font-size on the same element in web-platform-test contain-paint-008.html. r=TYLin
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/17786 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.