Skip to content

layout: Add statistics for accessibility updates. - #46385

Merged
mrobinson merged 3 commits into
servo:mainfrom
alice:accessibility-update-counters
Jul 16, 2026
Merged

layout: Add statistics for accessibility updates.#46385
mrobinson merged 3 commits into
servo:mainfrom
alice:accessibility-update-counters

Conversation

@alice

@alice alice commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

For each accessibility update, track the number of times we call a couple of key methods:

  • update_node_and_descendants_from_dom_node()
  • update_node_local()

Also expose the number of nodes added to the TreeUpdate which was produced as the output of the update, for comparison.

These are made available to ServoTestUtils via a new method, forceAccessibilityUpdate(), which works like the existing forceLayout() but returns an AccessibilityResult containing these three values.

Testing: Adds new "WPT" (not really) tests using the new counters
Fixes: Part of #46346

@alice
alice requested a review from delan July 8, 2026 15:33
@codecov-commenter

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@alice
alice force-pushed the accessibility-update-counters branch from 7c690da to 5f22825 Compare July 9, 2026 13:47
alice and others added 3 commits July 15, 2026 10:11
Co-authored-by: delan azabani <dazabani@igalia.com>
Signed-off-by: Alice Boxhall <alice@igalia.com>
Co-authored-by: Alice Boxhall <alice@igalia.com>
Signed-off-by: delan azabani <dazabani@igalia.com>
Unit test wasn't expecting a tuple returned from AccessibilityUpdate::finalize().

Signed-off-by: Alice Boxhall <alice@igalia.com>
@alice
alice force-pushed the accessibility-update-counters branch from 5f22825 to 05e9319 Compare July 15, 2026 08:14
@alice
alice marked this pull request as ready for review July 15, 2026 08:21
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 15, 2026

@mrobinson mrobinson 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.

Looks good with one change request:

Comment on lines +58 to +60
pub update_node_and_descendants_from_dom_node: u32,
pub update_node_local: u32,
pub nodes_in_tree_update: u32,

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.

I think using usize for these will avoid the use of try_into in this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately it needs to be a u32 at some point, because it gets written into an IDL value which is unsigned long.

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.

I think conversion from usize to u32 can be done without try_into() so in that direction we can avoid the uncertainty.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we somehow got our wires crossed, because I'm very confused.

This value (nodes_in_tree_update) is the only one assigned with a try_into(), which is specifically necessary because it's converting from a usize (i.e. the result of changed_nodes.len()) to a u32.

That conversion itself has to happen somewhere because the value of AccessibilityUpdateResult::accessibility_nodes_in_tree_update is a u32, because it's compiled from an IDL value with a type of unsigned long.

So even if nodes_in_tree_update was a usize, and the corresponding value in ReflowStatistics was also a usize, we'd still need to do the conversion eventually when creating the AccessibilityUpdateResult in servotestutils.rs, right?

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.

Ah, you're right! Sorry. I'll send this to the MQ now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly, if we managed to get 2^32 nodes in a WPT test I'd imagine we'd have bigger problems than a try_into().

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jul 15, 2026
@mrobinson
mrobinson added this pull request to the merge queue Jul 16, 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 Jul 16, 2026
Merged via the queue into servo:main with commit ad53f3e Jul 16, 2026
35 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 Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants