Skip to content

script: correctly set fonts for offscreen canvases - #49915

Merged
mrobinson merged 8 commits into
servo:mainfrom
mwja:issue-49890-offscreen-canvas-fonts
Nov 26, 2026
Merged

mrobinson merged 8 commits into
servo:mainfrom
mwja:issue-49890-offscreen-canvas-fonts

Conversation

@mwja

@mwja mwja commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Adjusts the set_font implementation on CanvasState to correctly handle fonts on offscreen canvases

Important note: the regular <canvas> element set_font incorrectly accepts inherit and initial, but I think this is a different substantial change not for this PR. spec

Also full disclosure, there's a bit of manually parsing of font declarations (em and rem being the only accepted units of LengthUnit. - question below)

Testing: Lots of tests in tests/wpt/meta/html/canvas/offscreen/text now and tests/wpt/meta/html/canvas/offscreen/reset unexpectedly pass. Expectations have been updated.
Fixes: #49890

@mwja
mwja force-pushed the issue-49890-offscreen-canvas-fonts branch from 9268856 to 544248a Compare November 14, 2026 16:16
@mwja
mwja force-pushed the issue-49890-offscreen-canvas-fonts branch from 11516f1 to 5daf633 Compare November 14, 2026 19:13
mwja added 3 commits November 14, 2026 22:05
No weights, width, caps yet

Signed-off-by: Jacob MacKenzie <[email protected]>
Signed-off-by: Jacob MacKenzie <[email protected]>
@mwja

mwja commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Question for anyone really, for units like ex, ch, cap and ic, stylo's to_computed_pixel_length_with_font_metrics would be useful here but its locked behind a gecko feature flag. Chrome (I think) makes ch as 0px and ex as 5px, is this wanted or should it remain a TODO for another PR?

Related rex, rch... also have the same issue.

lh also depends on the font metrics (as above).

calc won't work as compute_without_context doesn't handle em.

TL;DR : What's the consensis for units relative to font metrics or parent font metrics. The fallback values according to the spec for when it is impossible or impractical to measure (more like Chrome,) or see if stylo can have this function made available

@mwja
mwja marked this pull request as ready for review November 15, 2026 11:55
@mwja
mwja requested a review from gterzian as a code owner November 15, 2026 11:55
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 15, 2026
@mwja
mwja requested a review from jdm November 15, 2026 11:55
@mwja

mwja commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Personally I'm going to go for the spec suggestion of sane defaults. Will make a zulip thread for it after.

@mwja mwja changed the title script: thread global_scope through set_font script: correctly set fonts for offscreen canvases Nov 15, 2026
willypuzzle pushed a commit to willypuzzle/servo that referenced this pull request Nov 20, 2026
Dedicated and shared workers used to share the page's `FontContext`.
Fonts a worker loaded could end up in the page, and a font loading in a
worker made the page's `document.fonts.ready` wait for it. Now each of
these workers gets its own empty `FontContext`, which matches the spec
("Within a Worker document, the font source is initially empty") and
what Firefox does. Fonts loaded with `self.fonts` are stored there, and
their WebRender resources are freed when the worker shuts down, like the
layout thread does for pages. Service workers already have their own
`FontContext`, so they're unchanged.

This also fixes loading a second `FontFace` for a URL that was already
loaded for the same family. That failed with "Failed to load font data"
on pages too, because script loads skipped URLs that were already
loaded.

Testing: a page's `document.fonts.ready` no longer waits for a slow font
in a worker (7 ms instead of 2.7 s). With servo#49915 applied locally, a
worker's canvas draws with the font the worker loaded, and can't see
fonts loaded by the page. I also created and closed 20 workers that each
load a font and draw text. Two page tests that loaded the same
`FontFace` twice no longer error, and the WPT `workers` and canvas text
tests still pass.

This builds on servo#50046, so its commits are included here until that one
lands.

Part of servo#49892

Signed-off-by: rogerkorantenng <[email protected]>

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great; thanks!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 24, 2026
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 24, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 25, 2026
@jdm
jdm added this pull request to the merge queue Nov 25, 2026
@github-actions

Copy link
Copy Markdown

Test results for linux-wpt from merge queue job (#45674727058):

Flaky unexpected result (25)
  • CRASH [expected OK] /IndexedDB/idbfactory-deleteDatabase-request-success.any.worker.html
  • OK /IndexedDB/idbtransaction-oncomplete.any.worker.html (#42804)
    • FAIL [expected PASS] subtest: IDBTransaction - complete event

      assert_array_equals: lengths differ, expected array ["upgradeneeded", "complete", "success", "opencursor"] length 4, got ["upgradeneeded", "complete", "success"] length 3
      

  • CRASH [expected OK] /IndexedDB/request-event-ordering-small-values.any.sharedworker.html
  • FAIL [expected PASS] /_mozilla/css/image-percentage-dimen.html
  • OK /css/CSS2/visudet/inline-block-baseline-with-block-in-inline-001.html (#49559)
    • PASS [expected FAIL] subtest: An inline-block whose last line box holds a block level box exports that line's baseline
  • FAIL [expected PASS] /css/css-backgrounds/background-size-042.html
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-stretch: '90%' should prefer '110% 140%' over '120% 130%'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • OK /css/css-position/static-position/static-position-through-absolute-in-inline-containing-block.html (#50139)
    • FAIL [expected PASS] subtest: writing-mode: horizontal-tb; fixed positioned box in an absolutely positioned box without insets in an inline box containing block

      assert_equals: left expected 62 but got 100
      

  • OK [expected TIMEOUT] /fetch/api/redirect/redirect-keepalive.https.any.html (#32153)
    • PASS [expected TIMEOUT] subtest: [keepalive][iframe][load] mixed content redirect; setting up
  • OK /fetch/h1-parsing/h1-parsing.tentative.html?include=before-reason
    • FAIL [expected PASS] subtest: HTAB at &lt;before-reason&gt; should fetch without an error

      promise_test: Unhandled rejection with value: object "TypeError: Network error: HTTP failure: client error (SendRequest)"
      

  • CRASH [expected OK] /html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_access_details.sub.html
  • TIMEOUT [expected OK] /html/browsers/windows/consume-user-activation/window-open-multi-global.html (#47399)
    • TIMEOUT [expected FAIL] subtest: window.open() and consuming user activation with multiple globals in play

      Test timed out
      

  • ERROR [expected OK] /html/semantics/forms/the-input-element/show-picker-disabled-readonly.html (#50169)
  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html (#45151)
    • TIMEOUT [expected FAIL] subtest: Post-navigation state reset.

      Test timed out
      

  • OK /infrastructure/testdriver/click_window.html (#47303)
    • FAIL [expected PASS] subtest: TestDriver click method in window

      Unhandled rejection: assert_unreached: click failed Reached unreachable code
      

  • ERROR [expected OK] /intersection-observer/v2/animated-opacity.html (#40827)
  • FAIL [expected PASS] /mathml/presentation-markup/operators/mo-form-dynamic-002.html (#49169)
  • PASS [expected FAIL] /mathml/presentation-markup/operators/operator-dictionary-empty-and-three-chars.html (#49173)
  • OK /preload/prefetch-document.html (#37210)
    • FAIL [expected PASS] subtest: different-site document prefetch with 'as=document' should not be consumed

      assert_equals: expected 2 but got 1
      

  • TIMEOUT [expected PASS] /streams/readable-streams/crashtests/from-cross-realm.https.html
  • CRASH [expected OK] /trusted-types/Element-setAttribute-setAttributeNS-sinks.tentative.html
  • OK /user-timing/measure_associated_with_navigation_timing.html (#47273)
    • FAIL [expected PASS] subtest: loadTime plus loadEventEnd to a mark "a" should equal to navigationStart to "a".

      assert_equals: loadTime plus loadEventEnd to a mark "a" should equal to navigationStart to "a". expected 18.13 but got 18.12
      

  • OK /webdriver/tests/classic/navigate_to/navigate.py
    • ERROR [expected PASS] subtest: test_null_parameter_value

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_null_response_value

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_no_top_browsing_context

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_no_browsing_context

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_timeout_page_load_null

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_seen_nodes[http]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_seen_nodes[https]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_seen_nodes[https coop]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_utf8_meta_tag_after_1024_bytes

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_same_url_replaces_current_history_entry

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

  • OK /webdriver/tests/classic/new_session/response.py
    • FAIL [expected PASS] subtest: test_sessionid

      ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[browserName-str]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[browserVersion-str]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[platformName-str]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[acceptInsecureCerts-bool]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[pageLoadStrategy-str]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[proxy-dict]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[setWindowRect-bool]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[timeouts-dict]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_capability_type[strictFileInteractability-bool]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • And 9 more unexpected results...
  • OK /webdriver/tests/classic/switch_to_frame/cross_origin.py
    • ERROR [expected PASS] subtest: test_cross_origin_iframe

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_nested_cross_origin_iframe

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

Stable unexpected results that are known to be intermittent (5)
  • OK /beacon/beacon-basic.https.window.html (#41723)
    • FAIL [expected PASS] subtest: Payload size restriction should be accumulated: type = blob

      assert_false: expected false got true
      

  • ERROR [expected TIMEOUT] /html/browsers/history/the-location-interface/location_replace_session_history.html (#41896)
  • ERROR [expected OK] /html/semantics/forms/the-input-element/show-picker-does-not-focus.html (#50054)
  • OK /html/webappapis/user-prompts/print-during-unload.html (#35944)
    • FAIL [expected PASS] subtest: print() during unload

      assert_array_equals: expected property 1 to be "destination" but got "error: window.print is not a function" (expected array ["start", "destination"] got ["start", "error: window.print is not a function"])
      

  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?pen (#45536)
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.
Stable unexpected results (38)
  • OK /css/cssom/getComputedStyle-inset-inline-containing-block-vertical.html
    • FAIL [expected PASS] subtest: Resolved bottom measures the inline containing block's physical height

      assert_equals: expected -9.716666666666665 but got -9.28333333333333
      

  • OK /html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html
    • PASS [expected FAIL] subtest: Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas
    • PASS [expected FAIL] subtest: Test that drawing cursive produces the same result between canvas and OffscreenCanvas
    • PASS [expected FAIL] subtest: Test that drawing fantasy produces the same result between canvas and OffscreenCanvas
    • PASS [expected FAIL] subtest: Test that drawing monospace produces the same result between canvas and OffscreenCanvas
  • OK [expected ERROR] /html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html
    • PASS [expected TIMEOUT] subtest: Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing serif produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing cursive produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing fantasy produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing monospace produces the same result between canvas and OffscreenCanvas in a Worker
  • PASS [expected FAIL] /html/canvas/offscreen/manual/text/canvas.2d.offscreen.direction.html
  • OK /html/canvas/offscreen/text/2d.text.draw.align.center.worker.html
    • PASS [expected FAIL] subtest: textAlign center is the center of the em squares (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.html
    • PASS [expected FAIL] subtest: textAlign end with ltr is the right edge
  • OK /html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.html
    • PASS [expected FAIL] subtest: textAlign end with rtl is the left edge
  • OK /html/canvas/offscreen/text/2d.text.draw.align.left.worker.html
    • PASS [expected FAIL] subtest: textAlign left is the left of the first em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.align.right.worker.html
    • PASS [expected FAIL] subtest: textAlign right is the right of the last em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.html
    • PASS [expected FAIL] subtest: textAlign start with ltr is the left edge
  • OK /html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.html
    • PASS [expected FAIL] subtest: textAlign start with rtl is the right edge
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.html
    • PASS [expected FAIL] subtest: 2d
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.html
    • PASS [expected FAIL] subtest: textBaseline bottom is the bottom of the em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.html
    • PASS [expected FAIL] subtest: textBaseline middle is the middle of the em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.html
    • PASS [expected FAIL] subtest: textBaseline top is the top of the em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.html
    • PASS [expected FAIL] subtest: fillText handles maxWidth based on line size, not bounding box size
  • OK /html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.html
    • PASS [expected FAIL] subtest: @font-face fonts should work even if they are not used in the page
  • OK /html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.html
    • PASS [expected FAIL] subtest: Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)
  • OK /html/canvas/offscreen/text/2d.text.draw.fontface.worker.html
    • PASS [expected FAIL] subtest: 2d
  • OK /html/canvas/offscreen/text/2d.text.draw.space.basic.worker.html
    • PASS [expected FAIL] subtest: U+0020 is rendered the correct size (1em wide)
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.html
    • PASS [expected FAIL] subtest: Space characters at the end of a line are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.html
    • PASS [expected FAIL] subtest: Non-space characters are not converted to U+0020 and collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.html
    • PASS [expected FAIL] subtest: Space characters are converted to U+0020, and are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.html
    • PASS [expected FAIL] subtest: Space characters are converted to U+0020, and are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.html
    • PASS [expected FAIL] subtest: Space characters at the start of a line are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.small-font.worker.html
    • PASS [expected FAIL] subtest: Testing that actualBoundingBox metrics are precise at small font sizes
  • OK /html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.whitespace.worker.html
    • PASS [expected FAIL] subtest: Testing actualBoundingBox with leading/trailing whitespace
  • OK /html/canvas/offscreen/text/2d.text.measure.emHeights.worker.html
    • PASS [expected FAIL] subtest: Testing emHeights
  • OK /html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.ahem.worker.html
    • PASS [expected FAIL] subtest: Testing fontBoundingBox for font ahem
  • OK /html/canvas/offscreen/text/2d.text.measure.width.basic.worker.html
    • PASS [expected FAIL] subtest: The width of character is same as font used
  • OK /html/canvas/offscreen/text/2d.text.measure.width.nullCharacter.html
    • FAIL [expected PASS] subtest: Null character does not take up space

      assert_equals: ctx.measureText('\u0000').width === 0 (got 50[number], expected 0[number]) expected 0 but got 50
      

  • OK /html/canvas/offscreen/text/2d.text.measure.width.space.worker.html
    • PASS [expected FAIL] subtest: Space characters are converted to U+0020 and NOT collapsed
  • OK /html/rendering/non-replaced-elements/form-controls/resets.html
    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - letter-spacing

      assert_equals: expected "normal" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - word-spacing

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - line-height

      assert_equals: expected "normal" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - text-transform

      assert_equals: expected "none" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - text-indent

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - text-shadow

      assert_equals: expected "none" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - text-align

      assert_equals: expected "start" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - overflow

      assert_equals: expected "visible" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - overflow-clip-margin

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;optgroup&gt;&lt;option&gt; (in &lt;select&gt;) - align-content

      assert_equals: expected "normal" but got ""
      

    • And 12 more unexpected results...
  • OK /html/rendering/the-details-element/details-display.html
    • FAIL [expected PASS] subtest: default display of other summary element in details is block

      assert_equals: expected "block" but got ""
      

    • FAIL [expected PASS] subtest: display of other summary element in details can be changed

      assert_equals: expected "flex" but got ""
      

  • OK /html/rendering/widgets/shadow-dom.html
    • PASS [expected FAIL] subtest: &lt;video controls=""&gt;&lt;/video&gt; has a shadow tree with no slots
    • PASS [expected FAIL] subtest: &lt;audio controls=""&gt;&lt;/audio&gt; has a shadow tree with no slots
  • OK /html/rendering/widgets/the-select-element/select-as-listbox-default-styles.tentative.html
    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - margin-top

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - margin-right

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - margin-bottom

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - margin-left

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - padding-top

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - padding-right

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - padding-bottom

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - padding-left

      assert_equals: expected "0px" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - letter-spacing

      assert_equals: expected "normal" but got ""
      

    • FAIL [expected PASS] subtest: &lt;option&gt;1 (in &lt;select multiple=""&gt;) - word-spacing

      assert_equals: expected "0px" but got ""
      

    • And 119 more unexpected results...
  • OK /html/semantics/forms/the-select-element/customizable-select/option-color-inheritance.html
    • FAIL [expected PASS] subtest: option elements should inherit color from their parent select element.

      assert_equals: color expected "rgb(12, 34, 56)" but got ""
      

  • OK /html/semantics/forms/the-select-element/customizable-select/option-disabled-optgroup.html
    • FAIL [expected PASS] subtest: options should check ancestor optgroup for disabled state.

      assert_equals: color before optgroup disabled expected "rgb(0, 0, 0)" but got ""
      

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt from merge queue job (#45693508535):

Flaky unexpected result (28)
  • FAIL [expected PASS] /_mozilla/css/image-percentage-dimen.html
  • CRASH [expected PASS] /css/WOFF2/metadatadisplay-schema-trademark-022.xht
  • FAIL [expected PASS] /css/css-backgrounds/background-size-041.html
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 0deg' should prefer 'oblique 5deg' over 'oblique 15deg 20deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • FAIL [expected PASS] /css/filter-effects/kernel-unit-length-001.html
  • TIMEOUT [expected OK] /html/browsers/windows/consume-user-activation/window-open-multi-global.html (#47399)
    • TIMEOUT [expected FAIL] subtest: window.open() and consuming user activation with multiple globals in play

      Test timed out
      

  • TIMEOUT [expected CRASH] /html/canvas/element/manual/shadows/shadowBlur_gaussian_tolerance.1.html
  • ERROR [expected OK] /html/semantics/forms/the-input-element/show-picker-disabled-readonly.html (#50169)
  • ERROR [expected OK] /html/semantics/forms/the-input-element/show-picker-does-not-focus.html (#50054)
  • OK /html/semantics/scripting-1/the-script-element/execution-timing/077.html (#22139)
    • FAIL [expected PASS] subtest: adding several types of scripts through the DOM and removing some of them confuses scheduler

      assert_array_equals: expected property 1 to be "Script #1 ran" but got "Script #3 ran" (expected array ["Script #2 ran", "Script #1 ran", "Script #3 ran", "Script #4 ran"] got ["Script #2 ran", "Script #3 ran", "Script #4 ran", "Script #1 ran"])
      

  • OK /infrastructure/testdriver/click_iframe.html (#47688)
    • FAIL [expected PASS] subtest: TestDriver click on a document in an iframe

      Unhandled rejection: assert_unreached: click failed Reached unreachable code
      

  • FAIL [expected PASS] /mathml/presentation-markup/operators/mo-form-dynamic-002.html (#49169)
  • PASS [expected FAIL] /mathml/presentation-markup/operators/mo-lspace-rspace-dynamic.html (#49168)
  • PASS [expected FAIL] /mathml/presentation-markup/operators/mo-single-char-and-children.html (#49318)
  • PASS [expected FAIL] /mathml/presentation-markup/operators/operator-dictionary-empty-and-three-chars.html (#49173)
  • TIMEOUT [expected OK] /pointerevents/compat/pointerevent_touch-action_two-finger_interaction.html (#50155)
    • NOTRUN [expected PASS] subtest: touch two-finger pan on 'touch-action: pan-x pan-y'
    • NOTRUN [expected FAIL] subtest: touch two-finger pan on 'touch-action: pinch-zoom'
  • CRASH [expected TIMEOUT] /pointerevents/pointerevent_pointercapture_in_frame.html?mouse
  • OK /preload/prefetch-document.html (#37210)
    • FAIL [expected PASS] subtest: different-site document prefetch with 'as=document' should not be consumed

      assert_equals: expected 2 but got 1
      

  • TIMEOUT [expected PASS] /streams/readable-streams/crashtests/from-cross-realm.https.html
  • OK /upgrade-insecure-requests/gen/sharedworker-module-data.meta/unset/fetch.https.html
    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

  • OK /user-timing/measure_associated_with_navigation_timing.html (#47273)
    • FAIL [expected PASS] subtest: loadTime plus loadEventEnd to a mark "a" should equal to navigationStart to "a".

      assert_equals: loadTime plus loadEventEnd to a mark "a" should equal to navigationStart to "a". expected 14.88 but got 14.870000000000001
      

  • OK /webdriver/tests/classic/execute_async_script/window.py
    • FAIL [expected PASS] subtest: test_web_reference[frame]

      AssertionError: script timeout (500)
      

  • OK /webdriver/tests/classic/get_current_url/get.py
    • ERROR [expected PASS] subtest: test_no_top_browsing_context

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_no_browsing_context

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_get_current_url_matches_location

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_get_current_url_payload

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_get_current_url_special_pages

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_set_malformed_url

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_get_current_url_after_modified_location

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

  • OK /webdriver/tests/classic/get_element_attribute/user_prompts.py
    • ERROR [expected PASS] subtest: test_accept[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept[confirm-True]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept[prompt-]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept_and_notify[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept_and_notify[confirm-True]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept_and_notify[prompt-]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss[confirm-False]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss[prompt-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss_and_notify[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • And 8 more unexpected results...
  • OK /webdriver/tests/classic/perform_actions/pointer_modifier_click.py
    • ERROR [expected PASS] subtest: test_modifier_click[\ue00a-altKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_modifier_click[\ue052-altKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_modifier_click[\ue03d-metaKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_modifier_click[\ue053-metaKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_modifier_click[\ue008-shiftKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_modifier_click[\ue050-shiftKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_many_modifiers_click

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_control_dblclick[\ue009-ctrlKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_control_dblclick[\ue051-ctrlKey]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

  • TIMEOUT [expected OK] /webdriver/tests/classic/perform_actions/pointer_origin.py
  • OK /webdriver/tests/classic/print/printcmd.py
    • ERROR [expected FAIL] subtest: test_no_top_browsing_context

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_no_browsing_context

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_html_document

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_large_html_document

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_page_ranges_document[ranges0-expected0]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_page_ranges_document[ranges1-expected1]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_page_ranges_document[ranges2-expected2]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_page_ranges_document[ranges3-expected3]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_page_ranges_document[ranges4-expected4]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected FAIL] subtest: test_page_ranges_document[ranges5-expected5]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • And 20 more unexpected results...
  • OK /xhr/send-redirect.htm (#32026)
    • FAIL [expected PASS] subtest: XMLHttpRequest: send() - Redirects (basics) (303, GET, content.py)

      assert_equals: expected (string) "GET" but got (object) null
      

Stable unexpected results that are known to be intermittent (6)
  • OK /IndexedDB/idbtransaction-oncomplete.any.sharedworker.html (#45911)
    • FAIL [expected PASS] subtest: IDBTransaction - complete event

      assert_array_equals: lengths differ, expected array ["upgradeneeded", "complete", "success", "opencursor"] length 4, got ["upgradeneeded", "complete", "success"] length 3
      

  • OK /beacon/beacon-basic.https.window.html (#41723)
    • FAIL [expected PASS] subtest: Payload size restriction should be accumulated: type = string

      assert_false: expected false got true
      

  • OK /dom/nodes/moveBefore/iframe-document-preserve.window.html (#43152)
    • FAIL [expected PASS] subtest: moveBefore(): cross-origin iframe is preserved: remove new parent

      assert_equals: iframe does not fire a second load event expected 1 but got 0
      

    • FAIL [expected PASS] subtest: moveBefore(): cross-origin iframe is preserved: remove self

      assert_equals: iframe does not fire a second load event expected 1 but got 0
      

  • OK [expected TIMEOUT] /dom/xpath-evaluation-detached-nodes.html (#49715)
  • TIMEOUT /html/browsers/history/the-history-interface/001.html (#12580)
    • FAIL [expected PASS] subtest: traversing history must also traverse hash changes

      assert_equals: (this could cause other failures later on) expected "" but got "test"
      

  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?pen (#45536)
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.
Stable unexpected results (31)
  • OK /html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html
    • PASS [expected FAIL] subtest: Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas
    • PASS [expected FAIL] subtest: Test that drawing cursive produces the same result between canvas and OffscreenCanvas
    • PASS [expected FAIL] subtest: Test that drawing fantasy produces the same result between canvas and OffscreenCanvas
    • PASS [expected FAIL] subtest: Test that drawing monospace produces the same result between canvas and OffscreenCanvas
  • OK [expected ERROR] /html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html
    • PASS [expected TIMEOUT] subtest: Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing serif produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing cursive produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing fantasy produces the same result between canvas and OffscreenCanvas in a Worker
    • PASS [expected TIMEOUT] subtest: Test that drawing monospace produces the same result between canvas and OffscreenCanvas in a Worker
  • PASS [expected FAIL] /html/canvas/offscreen/manual/text/canvas.2d.offscreen.direction.html
  • OK /html/canvas/offscreen/text/2d.text.draw.align.center.worker.html
    • PASS [expected FAIL] subtest: textAlign center is the center of the em squares (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.html
    • PASS [expected FAIL] subtest: textAlign end with ltr is the right edge
  • OK /html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.html
    • PASS [expected FAIL] subtest: textAlign end with rtl is the left edge
  • OK /html/canvas/offscreen/text/2d.text.draw.align.left.worker.html
    • PASS [expected FAIL] subtest: textAlign left is the left of the first em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.align.right.worker.html
    • PASS [expected FAIL] subtest: textAlign right is the right of the last em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.html
    • PASS [expected FAIL] subtest: textAlign start with ltr is the left edge
  • OK /html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.html
    • PASS [expected FAIL] subtest: textAlign start with rtl is the right edge
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.html
    • PASS [expected FAIL] subtest: 2d
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.html
    • PASS [expected FAIL] subtest: textBaseline bottom is the bottom of the em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.html
    • PASS [expected FAIL] subtest: textBaseline middle is the middle of the em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.html
    • PASS [expected FAIL] subtest: textBaseline top is the top of the em square (not the bounding box)
  • OK /html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.html
    • PASS [expected FAIL] subtest: fillText handles maxWidth based on line size, not bounding box size
  • OK /html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.html
    • PASS [expected FAIL] subtest: @font-face fonts should work even if they are not used in the page
  • OK /html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.html
    • PASS [expected FAIL] subtest: Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)
  • OK /html/canvas/offscreen/text/2d.text.draw.fontface.worker.html
    • PASS [expected FAIL] subtest: 2d
  • OK /html/canvas/offscreen/text/2d.text.draw.space.basic.worker.html
    • PASS [expected FAIL] subtest: U+0020 is rendered the correct size (1em wide)
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.html
    • PASS [expected FAIL] subtest: Space characters at the end of a line are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.html
    • PASS [expected FAIL] subtest: Non-space characters are not converted to U+0020 and collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.html
    • PASS [expected FAIL] subtest: Space characters are converted to U+0020, and are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.html
    • PASS [expected FAIL] subtest: Space characters are converted to U+0020, and are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.html
    • PASS [expected FAIL] subtest: Space characters at the start of a line are NOT collapsed
  • OK /html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.small-font.worker.html
    • PASS [expected FAIL] subtest: Testing that actualBoundingBox metrics are precise at small font sizes
  • OK /html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.whitespace.worker.html
    • PASS [expected FAIL] subtest: Testing actualBoundingBox with leading/trailing whitespace
  • OK /html/canvas/offscreen/text/2d.text.measure.emHeights.worker.html
    • PASS [expected FAIL] subtest: Testing emHeights
  • OK /html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.ahem.worker.html
    • PASS [expected FAIL] subtest: Testing fontBoundingBox for font ahem
  • OK /html/canvas/offscreen/text/2d.text.measure.width.basic.worker.html
    • PASS [expected FAIL] subtest: The width of character is same as font used
  • OK /html/canvas/offscreen/text/2d.text.measure.width.nullCharacter.html
    • FAIL [expected PASS] subtest: Null character does not take up space

      assert_equals: ctx.measureText('\u0000').width === 0 (got 50[number], expected 0[number]) expected 0 but got 50
      

  • OK /html/canvas/offscreen/text/2d.text.measure.width.space.worker.html
    • PASS [expected FAIL] subtest: Space characters are converted to U+0020 and NOT collapsed

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@servo-highfive servo-highfive added the S-tests-failed The changes caused existing tests to fail. label Nov 25, 2026
@mrobinson

Copy link
Copy Markdown
Member

@mwja These results look good. You should run ./mach update-wpt https://github.com/servo/servo/actions/runs/45693508535 locally and then amend the changes to the expected test results to your commit and then push again.

Signed-off-by: Jacob MacKenzie <[email protected]>
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Nov 26, 2026
@mwja

mwja commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@mrobinson done, I had to mark the null character width WPT as failing though (tests/wpt/meta/html/canvas/offscreen/text/2d.text.measure.width.nullCharacter.html.ini), but this seems to match the non offscreen canvas version (as we actually calculate fonts correctly in offscreen canvases with this PR)

@mrobinson
mrobinson enabled auto-merge November 26, 2026 12:35
@mrobinson
mrobinson added this pull request to the merge queue Nov 26, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 26, 2026
Merged via the queue into servo:main with commit 2df3d02 Nov 26, 2026
38 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 26, 2026
devin-ai-integration Bot pushed a commit to baigojahanzaib/servo that referenced this pull request Nov 27, 2026
Adjusts the set_font implementation on `CanvasState` to correctly handle
fonts on offscreen canvases

**Important note:** the regular `<canvas>` element set_font incorrectly
accepts `inherit` and `initial`, but I think this is a different
substantial change not for this PR.
[spec](https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-font:~:text=value%20%28but%20without%20supporting%20property%2Dindependent%20style%20sheet%20syntax%20like%20%27inherit%27%29%2C)

Also full disclosure, there's a bit of manually parsing of font
declarations (`em` and `rem` being the only accepted units of
`LengthUnit`. - question below)

Testing: Lots of tests in tests/wpt/meta/html/canvas/offscreen/text now
and tests/wpt/meta/html/canvas/offscreen/reset unexpectedly pass.
Expectations have been updated.
Fixes: servo#49890

---------

Signed-off-by: Jacob MacKenzie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offscreen canvases ignore fonts

4 participants