From 7d6ab5a708b3c459b17cc967364531f9f78672f7 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Thu, 15 Jan 2026 08:23:22 +0100 Subject: [PATCH] axnode: force manual formatting in switches In order to uses less space and improve the readability. zig fmt allows only 1 switch case per line or all in one line. When having a lot of conditions, splitting the line is useful. --- src/cdp/AXNode.zig | 158 ++++++++++++++------------------------------- 1 file changed, 49 insertions(+), 109 deletions(-) diff --git a/src/cdp/AXNode.zig b/src/cdp/AXNode.zig index 742b3303..e66a7486 100644 --- a/src/cdp/AXNode.zig +++ b/src/cdp/AXNode.zig @@ -141,7 +141,22 @@ pub const Writer = struct { } const AXProperty = struct { - name: enum(u8) { actions, busy, disabled, editable, focusable, focused, hidden, hiddenRoot, invalid, keyshortcuts, settable, roledescription, live, atomic, relevant, root, autocomplete, hasPopup, level, multiselectable, orientation, multiline, readonly, required, valuemin, valuemax, valuetext, checked, expanded, modal, pressed, selected, activedescendant, controls, describedby, details, errormessage, flowto, labelledby, owns, url, activeFullscreenElement, activeModalDialog, activeAriaModalDialog, ariaHiddenElement, ariaHiddenSubtree, emptyAlt, emptyText, inertElement, inertSubtree, labelContainer, labelFor, notRendered, notVisible, presentationalRole, probablyPresentational, inactiveCarouselTabContent, uninteresting }, + // zig fmt: off + name: enum(u8) { + actions, busy, disabled, editable, focusable, focused, hidden, + hiddenRoot, invalid, keyshortcuts, settable, roledescription, live, + atomic, relevant, root, autocomplete, hasPopup, level, + multiselectable, orientation, multiline, readonly, required, + valuemin, valuemax, valuetext, checked, expanded, modal, pressed, + selected, activedescendant, controls, describedby, details, + errormessage, flowto, labelledby, owns, url, + activeFullscreenElement, activeModalDialog, activeAriaModalDialog, + ariaHiddenElement, ariaHiddenSubtree, emptyAlt, emptyText, + inertElement, inertSubtree, labelContainer, labelFor, notRendered, + notVisible, presentationalRole, probablyPresentational, + inactiveCarouselTabContent, uninteresting, + }, + // zig fmt: on value: AXValue, }; @@ -337,62 +352,16 @@ pub const Writer = struct { }; pub const AXRole = enum(u8) { - none, - article, - banner, - blockquote, - button, - caption, - cell, - checkbox, - code, - columnheader, - combobox, - complementary, - contentinfo, - definition, - deletion, - dialog, - document, - emphasis, - figure, - form, - group, - heading, - image, - insertion, - link, - list, - listbox, - listitem, - main, - marquee, - meter, - navigation, - option, - paragraph, - presentation, - progressbar, - radio, - region, - row, - rowgroup, - rowheader, - searchbox, - separator, - slider, - spinbutton, - status, - strong, - subscript, - superscript, - table, - term, - textbox, - time, - RootWebArea, - LineBreak, + // zig fmt: off + none, article, banner, blockquote, button, caption, cell, checkbox, code, + columnheader, combobox, complementary, contentinfo, definition, deletion, + dialog, document, emphasis, figure, form, group, heading, image, insertion, + link, list, listbox, listitem, main, marquee, meter, navigation, option, + paragraph, presentation, progressbar, radio, region, row, rowgroup, + rowheader, searchbox, separator, slider, spinbutton, status, strong, + subscript, superscript, table, term, textbox, time, RootWebArea, LineBreak, StaticText, + // zig fmt: on fn fromNode(node: *DOMNode) !AXRole { return switch (node._type) { @@ -447,7 +416,10 @@ pub const AXRole = enum(u8) { .number => .spinbutton, .search => .searchbox, .checkbox => .checkbox, - .password, .datetime_local, .hidden, .month, .color, .week, .time, .file, .date => .none, + // zig fmt: off + .password, .datetime_local, .hidden, .month, .color, + .week, .time, .file, .date => .none, + // zig fmt: ofn }; }, .textarea => .textbox, @@ -616,37 +588,12 @@ fn writeName(axnode: AXNode, w: anytype, page: *Page) !?AXSource { // TODO Check for