wpt / css / css-inline / text-box-trim / text-box-trim-om-001.html

Status: FAIL | Duration: 51ms | Subtests: 1/4 | Open test on wpt.live | wpt.fyi

Data from commit:
a50cb89 wpt: run reference-named files which are themselves tests (#836) (2026-09-03)

SubtestStatusMessage
getBoundingClientRect.topPASS
getBoundingClientRect.heightFAILassert_equals: expected 50 but got 400
elementFromPoint: 10px above the client rectFAILcannot convert 'null' or 'undefined' to object
elementFromPoint: 10px below the client rectFAILcannot convert 'null' or 'undefined' to object

/css/css-inline/text-box-trim/text-box-trim-om-001.html

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#text-box-edge">
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#text-box-trim">
<link rel="stylesheet" href="/fonts/baseline-diagnostic/baseline-diagnostic-font.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.spacer {
  background: lightgray;
  block-size: 200px;
}
#target {
  font: 200px/2 BaselineDiagnosticAlphabeticZero;
  text-box: trim-both ex alphabetic;
}
</style>
<div id="container">
  <div class="spacer"></div>
  <div id="target">X</div>
  <div class="spacer"></div>
</div>
<script>
function run_tests(test_names) {
  const container = document.getElementById('container');
  const container_bounds = container.getBoundingClientRect();
  const target = document.getElementById('target');
  const target_bounds = target.getBoundingClientRect();

  // Test `getBoundingClientRect()` returns the trimmed box size.
  test(() => {
    assert_equals(target_bounds.top - container_bounds.top, 200);
  }, "getBoundingClientRect.top");
  test(() => {
    assert_equals(target_bounds.height, 50);
  }, "getBoundingClientRect.height");

  // Test `elementFromPoint()` hits `target` even if the point is above/below
  // the client rect, because the inner line box overflows the box.
  test(() => {
    const result = document.elementFromPoint(10, 90 + container_bounds.top);
    assert_equals(result, target);
  }, "elementFromPoint: 10px above the client rect");
  test(() => {
    const result = document.elementFromPoint(10, 130 + container_bounds.top);
    assert_equals(result, target);
  }, "elementFromPoint: 10px below the client rect");
}

setup({explicit_done: true});
document.fonts.ready.then(() => {
  run_tests();
  done();
});
</script>