Diff
Modified: trunk/LayoutTests/ChangeLog (289247 => 289248)
--- trunk/LayoutTests/ChangeLog 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/LayoutTests/ChangeLog 2022-02-08 00:22:19 UTC (rev 289248)
@@ -1,3 +1,29 @@
+2022-02-07 Tyler Wilcock <[email protected]>
+
+ AX: Move node-dependent role computation to AccessibilityNodeObject from AccessibilityRenderObject
+ https://bugs.webkit.org/show_bug.cgi?id=236166
+
+ Reviewed by Chris Fleizach.
+
+ Add test to verify ARIA visible objects (e.g. those with `hidden` and
+ `aria-hidden="false"`) compute their role and subrole properly based
+ on their DOM element.
+
+ * accessibility/aria-visible-element-roles.html: Added.
+ * platform/glib/accessibility/aria-visible-element-roles-expected.txt: Added.
+ * platform/mac-wk1/accessibility/aria-visible-element-roles-expected.txt: Added.
+ * platform/mac-wk2/accessibility/aria-visible-element-roles-expected.txt: Added.
+ * platform/win/accessibility/aria-visible-element-roles-expected.txt: Added.
+
+ * platform/mac-wk2/accessibility/roles-exposed-expected.txt:
+ This patch results in a progression in computing the role of these
+ inputs, which before were all consided to be AXGroup:
+ - input[type='date']
+ - input[type='datetime-local']
+ - input[type='month']
+ - input[type='time']
+ - input[type='week']
+
2022-02-07 Chris Dumez <[email protected]>
Add support for sharing Shared Workers (including across WebProcesses)
Added: trunk/LayoutTests/accessibility/aria-visible-element-roles.html (0 => 289248)
--- trunk/LayoutTests/accessibility/aria-visible-element-roles.html (rev 0)
+++ trunk/LayoutTests/accessibility/aria-visible-element-roles.html 2022-02-08 00:22:19 UTC (rev 289248)
@@ -0,0 +1,200 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="content">
+ <a href="" id="link" hidden aria-hidden="false">apple.com</a>
+
+ <select id="select" name="pets" hidden aria-hidden="false">
+ <option value="dog">Dog</option>
+ <option value="cat">Cat</option>
+ </select>
+
+ <select id="select-multiple" multiple name="pets-multiple" hidden aria-hidden="false">
+ <option value="dog">Dog</option>
+ <option value="cat">Cat</option>
+ </select>
+
+ <textarea id="textarea" rows="5" cols="33" hidden aria-hidden="false">
+ It was a dark and stormy night...
+ </textarea>
+
+ <img id="img-with-map" src="" width="145" height="126" usemap="" aria-label="Label" hidden aria-hidden="false">
+ <map name="map">
+ <area shape="rect" coords="0,0,100,100" href="" alt="cake">
+ </map>
+
+ <ul hidden aria-hidden="false" id="ul">
+ <li hidden aria-hidden="false" id="li-element">Hello world</li>
+ </ul>
+
+ <ol hidden aria-hidden="false" id="ol">
+ <li hidden aria-hidden="false">Hello world</li>
+ </ol>
+
+ <button hidden aria-hidden="false" id="button">Click me</button>
+
+ <fieldset>
+ <legend hidden aria-hidden="false" id="legend">Choose your favorite monster</legend>
+
+ <input hidden aria-hidden="false" type="radio" id="radio-button" name="monster">
+ <label for=""
+
+ <input type="radio" id="sasquatch" name="monster">
+ <label for=""
+ </fieldset>
+
+ <canvas hidden aria-hidden="false" id="canvas-without-fallback-content"></canvas>
+ <canvas hidden aria-hidden="false" id="canvas-with-fallback-content"><p>This is canvas fallback content</p></canvas>
+
+ <input hidden aria-hidden="false" id="file-upload-button" type="file"></input>
+ <input hidden aria-hidden="false" id="checkbox" type="checkbox"></input>
+ <input hidden aria-hidden="false" id="text-button" type="submit"></input>
+ <input hidden aria-hidden="false" id="text-button-with-pressed" aria-pressed="false" type="submit"></input>
+ <input hidden aria-hidden="false" id="date-input" type="date"></input>
+ <input hidden aria-hidden="false" id="time-input" type="time"></input>
+ <input hidden aria-hidden="false" id="color-input" type="color"></input>
+ <input hidden aria-hidden="false" id="range-input" type="range"></input>
+ <input hidden aria-hidden="false" id="search-input" type="search"></input>
+
+ <div hidden aria-hidden="false" id="contenteditable" contenteditable>Hello world</div>
+
+ <h2 hidden aria-hidden="false" id="h2">Hello world</h2>
+
+ <del hidden aria-hidden="false" id="del">Hello world</del>
+ <ins hidden aria-hidden="false" id="ins">Hello world</ins>
+ <sub hidden aria-hidden="false" id="sub">Hello world</sub>
+ <sup hidden aria-hidden="false" id="sup">Hello world</sup>
+ <code hidden aria-hidden="false" id="code">Hello world</code>
+
+ <dl hidden aria-hidden="false" id="dl">
+ <dt hidden aria-hidden="false" id="dt">dt element</dt>
+ <dd hidden aria-hidden="false" id="dd">dd element</dd>
+ </dl>
+
+ <figure hidden aria-hidden="false" id="figure"></figure>
+
+ <p hidden aria-hidden="false" id="p">Paragraph</p>
+
+ <label hidden aria-hidden="false" id="label">Label</label>
+
+ <dfn hidden aria-hidden="false" id="dfn">Some definition</dfn>
+
+ <div hidden aria-hidden="false" id="div">Some text</div>
+
+ <form hidden aria-hidden="false" id="form"></form>
+
+ <article hidden aria-hidden="false" id="article">Article content</article>
+
+ <main hidden aria-hidden="false" id="main">Main content</main>
+
+ <nav hidden aria-hidden="false" id="nav">Nav</nav>
+
+ <aside hidden aria-hidden="false" id="aside">Aside content</aside>
+
+ <section hidden aria-hidden="false" id="section-with-name" aria-label="Section name">Section</section>
+ <section hidden aria-hidden="false" id="section-without-name">Section</section>
+
+ <blockquote hidden aria-hidden="false" id="blockquote">To be or not to be, that is the question</blockquote>
+
+ <mark hidden aria-hidden="false" id="mark">Marked text</mark>
+
+ <pre hidden aria-hidden="false" id="pre">Pre-text</pre>
+
+ <details hidden aria-hidden="false" id="details">
+ <summary hidden aria-hidden="false" id="summary">Summary text</summary>
+ </details>
+
+ <output hidden aria-hidden="false" id="output">Output</output>
+
+ <menu hidden aria-hidden="false" type="toolbar" id="menu-toolbar"></menu>
+
+ <hr hidden aria-hidden="false" id="hr"></hr>
+
+ <time hidden aria-hidden="false" id="time"></time>
+</div>
+
+<script>
+ // Buffer test output and dump it at the end to make the test run faster vs. individual `debug` calls.
+ var testOutput = "This test ensures ARIA visible elements (e.g. those with both `hidden` and `aria-hidden='false'` attributes) have the correct role.\n\n";
+
+ var elementUnderTest;
+ function verifyRole(elementId) {
+ testOutput += `${escapeHTML(document.getElementById(elementId).cloneNode().outerHTML)}\n`;
+ elementUnderTest = accessibilityController.accessibleElementById(elementId);
+ testOutput += ` ${elementUnderTest.role}`;
+
+ let computedRoleString = elementUnderTest.computedRoleString;
+ if (computedRoleString)
+ testOutput += `\n computedRoleString: ${computedRoleString}`;
+
+ let subrole = elementUnderTest.subrole;
+ if (subrole.replace("AXSubrole: ", ""))
+ testOutput += `\n ${subrole}`;
+ testOutput += `\n\n`;
+ }
+
+ if (window.accessibilityController) {
+ verifyRole("link");
+ verifyRole("select");
+ verifyRole("select-multiple");
+ verifyRole("textarea");
+ verifyRole("img-with-map");
+ verifyRole("li-element");
+ verifyRole("button");
+ verifyRole("legend");
+ verifyRole("canvas-without-fallback-content");
+ verifyRole("canvas-with-fallback-content");
+ verifyRole("file-upload-button");
+ verifyRole("checkbox");
+ verifyRole("radio-button");
+ verifyRole("text-button");
+ verifyRole("text-button-with-pressed");
+ verifyRole("date-input");
+ verifyRole("color-input");
+ verifyRole("range-input");
+ verifyRole("search-input");
+ verifyRole("h2");
+ verifyRole("del");
+ verifyRole("ins");
+ verifyRole("sub");
+ verifyRole("sup");
+ verifyRole("code");
+ verifyRole("dt");
+ verifyRole("dd");
+ verifyRole("dl");
+ verifyRole("ol");
+ verifyRole("ul");
+ verifyRole("figure");
+ verifyRole("p");
+ verifyRole("label");
+ verifyRole("dfn");
+ verifyRole("div");
+ verifyRole("form");
+ verifyRole("article");
+ verifyRole("main");
+ verifyRole("nav");
+ verifyRole("aside");
+ verifyRole("section-with-name");
+ verifyRole("section-without-name");
+ verifyRole("blockquote");
+ verifyRole("mark");
+ verifyRole("pre");
+ verifyRole("details");
+ verifyRole("summary");
+ verifyRole("output");
+ verifyRole("menu-toolbar");
+ verifyRole("hr");
+ verifyRole("time");
+
+ document.getElementById("content").style.visibility = "hidden";
+ debug(testOutput);
+ }
+</script>
+</body>
+</html>
+
Added: trunk/LayoutTests/platform/glib/accessibility/aria-visible-element-roles-expected.txt (0 => 289248)
--- trunk/LayoutTests/platform/glib/accessibility/aria-visible-element-roles-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/glib/accessibility/aria-visible-element-roles-expected.txt 2022-02-08 00:22:19 UTC (rev 289248)
@@ -0,0 +1,196 @@
+This test ensures ARIA visible elements (e.g. those with both `hidden` and `aria-hidden='false'` attributes) have the correct role.
+
+<a href="" id="link" hidden="" aria-hidden="false"></a>
+ AXRole: AXLink
+ computedRoleString: link
+
+<select id="select" name="pets" hidden="" aria-hidden="false"></select>
+ AXRole: AXComboBox
+ computedRoleString: button
+
+<select id="select-multiple" multiple="" name="pets-multiple" hidden="" aria-hidden="false"></select>
+ AXRole: AXListBox
+ computedRoleString: listbox
+
+<textarea id="textarea" rows="5" cols="33" hidden="" aria-hidden="false"></textarea>
+ AXRole: AXTextField
+ computedRoleString: textbox
+
+<img id="img-with-map" src="" width="145" height="126" usemap="" aria-label="Label" hidden="" aria-hidden="false">
+ AXRole: AXImageMap
+
+<li hidden="" aria-hidden="false" id="li-element"></li>
+ AXRole: AXListItem
+ computedRoleString: listitem
+
+<button hidden="" aria-hidden="false" id="button"></button>
+ AXRole: AXButton
+ computedRoleString: button
+
+<legend hidden="" aria-hidden="false" id="legend"></legend>
+ AXRole: AXLabel
+
+<canvas hidden="" aria-hidden="false" id="canvas-without-fallback-content"></canvas>
+ AXRole: AXCanvas
+
+<canvas hidden="" aria-hidden="false" id="canvas-with-fallback-content"></canvas>
+ AXRole: AXCanvas
+
+<input hidden="" aria-hidden="false" id="file-upload-button" type="file">
+ AXRole: AXButton
+ computedRoleString: button
+
+<input hidden="" aria-hidden="false" id="checkbox" type="checkbox">
+ AXRole: AXCheckBox
+ computedRoleString: checkbox
+
+<input hidden="" aria-hidden="false" type="radio" id="radio-button" name="monster">
+ AXRole: AXRadioButton
+ computedRoleString: radio
+
+<input hidden="" aria-hidden="false" id="text-button" type="submit">
+ AXRole: AXButton
+ computedRoleString: button
+
+<input hidden="" aria-hidden="false" id="text-button-with-pressed" aria-pressed="false" type="submit">
+ AXRole: AXToggleButton
+ computedRoleString: button
+
+<input hidden="" aria-hidden="false" id="date-input" type="date">
+ AXRole: AXTextField
+
+<input hidden="" aria-hidden="false" id="color-input" type="color">
+ AXRole: AXButton
+
+<input hidden="" aria-hidden="false" id="range-input" type="range">
+ AXRole: AXSlider
+ computedRoleString: slider
+
+<input hidden="" aria-hidden="false" id="search-input" type="search">
+ AXRole: AXTextField
+ computedRoleString: searchbox
+
+<h2 hidden="" aria-hidden="false" id="h2"></h2>
+ AXRole: AXHeading
+ computedRoleString: heading
+
+<del hidden="" aria-hidden="false" id="del"></del>
+ AXRole: AXDeletion
+ computedRoleString: deletion
+
+<ins hidden="" aria-hidden="false" id="ins"></ins>
+ AXRole: AXInsertion
+ computedRoleString: insertion
+
+<sub hidden="" aria-hidden="false" id="sub"></sub>
+ AXRole: AXSubscript
+ computedRoleString: subscript
+
+<sup hidden="" aria-hidden="false" id="sup"></sup>
+ AXRole: AXSuperscript
+ computedRoleString: superscript
+
+<code hidden="" aria-hidden="false" id="code"></code>
+ AXRole: AXSection
+
+<dt hidden="" aria-hidden="false" id="dt"></dt>
+ AXRole: AXDescriptionTerm
+
+<dd hidden="" aria-hidden="false" id="dd"></dd>
+ AXRole: AXDescriptionValue
+
+<dl hidden="" aria-hidden="false" id="dl"></dl>
+ AXRole: AXDescriptionList
+
+<ol hidden="" aria-hidden="false" id="ol"></ol>
+ AXRole: AXList
+ computedRoleString: list
+
+<ul hidden="" aria-hidden="false" id="ul"></ul>
+ AXRole: AXList
+ computedRoleString: list
+
+<figure hidden="" aria-hidden="false" id="figure"></figure>
+ AXRole: AXGroup
+ computedRoleString: figure
+
+<p hidden="" aria-hidden="false" id="p"></p>
+ AXRole: AXParagraph
+ computedRoleString: paragraph
+
+<label hidden="" aria-hidden="false" id="label"></label>
+ AXRole: AXLabel
+
+<dfn hidden="" aria-hidden="false" id="dfn"></dfn>
+ AXRole: AXDefinition
+ computedRoleString: definition
+
+<div hidden="" aria-hidden="false" id="div"></div>
+ AXRole: AXSection
+
+<form hidden="" aria-hidden="false" id="form"></form>
+ AXRole: AXForm
+ computedRoleString: form
+
+<article hidden="" aria-hidden="false" id="article"></article>
+ AXRole: AXArticle
+ computedRoleString: article
+
+<main hidden="" aria-hidden="false" id="main"></main>
+ AXRole: AXLandmarkMain
+ computedRoleString: main
+
+<nav hidden="" aria-hidden="false" id="nav"></nav>
+ AXRole: AXLandmarkNavigation
+ computedRoleString: navigation
+
+<aside hidden="" aria-hidden="false" id="aside"></aside>
+ AXRole: AXLandmarkComplementary
+ computedRoleString: complementary
+
+<section hidden="" aria-hidden="false" id="section-with-name" aria-label="Section name"></section>
+ AXRole: AXLandmarkRegion
+ computedRoleString: region
+
+<section hidden="" aria-hidden="false" id="section-without-name"></section>
+ AXRole: AXSection
+
+<blockquote hidden="" aria-hidden="false" id="blockquote"></blockquote>
+ AXRole: AXBlockquote
+ computedRoleString: blockquote
+
+<mark hidden="" aria-hidden="false" id="mark"></mark>
+
+
+<pre hidden="" aria-hidden="false" id="pre"></pre>
+ AXRole: AXSection
+
+<details hidden="" aria-hidden="false" id="details"></details>
+ AXRole: AXUnknown
+
+<summary hidden="" aria-hidden="false" id="summary"></summary>
+ AXRole: AXUnknown
+
+<output hidden="" aria-hidden="false" id="output"></output>
+ AXRole: AXStatusBar
+ computedRoleString: status
+
+<menu hidden="" aria-hidden="false" type="toolbar" id="menu-toolbar"></menu>
+ AXRole: AXToolbar
+ computedRoleString: toolbar
+
+<hr hidden="" aria-hidden="false" id="hr">
+ AXRole: AXSeparator
+ computedRoleString: separator
+
+<time hidden="" aria-hidden="false" id="time"></time>
+ AXRole: AXStatic
+ computedRoleString: time
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
Added: trunk/LayoutTests/platform/mac-wk1/accessibility/aria-visible-element-roles-expected.txt (0 => 289248)
--- trunk/LayoutTests/platform/mac-wk1/accessibility/aria-visible-element-roles-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/accessibility/aria-visible-element-roles-expected.txt 2022-02-08 00:22:19 UTC (rev 289248)
@@ -0,0 +1,220 @@
+This test ensures ARIA visible elements (e.g. those with both `hidden` and `aria-hidden='false'` attributes) have the correct role.
+
+<a href="" id="link" hidden="" aria-hidden="false"></a>
+ AXRole: AXLink
+ computedRoleString: link
+
+<select id="select" name="pets" hidden="" aria-hidden="false"></select>
+ AXRole: AXPopUpButton
+ computedRoleString: button
+
+<select id="select-multiple" multiple="" name="pets-multiple" hidden="" aria-hidden="false"></select>
+ AXRole: AXList
+ computedRoleString: listbox
+
+<textarea id="textarea" rows="5" cols="33" hidden="" aria-hidden="false"></textarea>
+ AXRole: AXTextArea
+ computedRoleString: textbox
+
+<img id="img-with-map" src="" width="145" height="126" usemap="" aria-label="Label" hidden="" aria-hidden="false">
+ AXRole: AXImageMap
+
+<li hidden="" aria-hidden="false" id="li-element"></li>
+ AXRole: AXGroup
+ computedRoleString: listitem
+
+<button hidden="" aria-hidden="false" id="button"></button>
+ AXRole: AXButton
+ computedRoleString: button
+
+<legend hidden="" aria-hidden="false" id="legend"></legend>
+ AXRole: AXGroup
+
+<canvas hidden="" aria-hidden="false" id="canvas-without-fallback-content"></canvas>
+ AXRole: AXImage
+
+<canvas hidden="" aria-hidden="false" id="canvas-with-fallback-content"></canvas>
+ AXRole: AXGroup
+
+<input hidden="" aria-hidden="false" id="file-upload-button" type="file">
+ AXRole: AXButton
+ computedRoleString: button
+ AXSubrole: AXFileUploadButton
+
+<input hidden="" aria-hidden="false" id="checkbox" type="checkbox">
+ AXRole: AXCheckBox
+ computedRoleString: checkbox
+
+<input hidden="" aria-hidden="false" type="radio" id="radio-button" name="monster">
+ AXRole: AXRadioButton
+ computedRoleString: radio
+
+<input hidden="" aria-hidden="false" id="text-button" type="submit">
+ AXRole: AXButton
+ computedRoleString: button
+
+<input hidden="" aria-hidden="false" id="text-button-with-pressed" aria-pressed="false" type="submit">
+ AXRole: AXCheckBox
+ computedRoleString: button
+ AXSubrole: AXToggle
+
+<input hidden="" aria-hidden="false" id="date-input" type="date">
+ AXRole: AXTextField
+
+<input hidden="" aria-hidden="false" id="color-input" type="color">
+ AXRole: AXTextField
+
+<input hidden="" aria-hidden="false" id="range-input" type="range">
+ AXRole: AXSlider
+ computedRoleString: slider
+
+<input hidden="" aria-hidden="false" id="search-input" type="search">
+ AXRole: AXTextField
+ computedRoleString: searchbox
+ AXSubrole: AXSearchField
+
+<h2 hidden="" aria-hidden="false" id="h2"></h2>
+ AXRole: AXHeading
+ computedRoleString: heading
+
+<del hidden="" aria-hidden="false" id="del"></del>
+ AXRole: AXGroup
+ computedRoleString: deletion
+ AXSubrole: AXDeleteStyleGroup
+
+<ins hidden="" aria-hidden="false" id="ins"></ins>
+ AXRole: AXGroup
+ computedRoleString: insertion
+ AXSubrole: AXInsertStyleGroup
+
+<sub hidden="" aria-hidden="false" id="sub"></sub>
+ AXRole: AXGroup
+ computedRoleString: subscript
+ AXSubrole: AXSubscriptStyleGroup
+
+<sup hidden="" aria-hidden="false" id="sup"></sup>
+ AXRole: AXGroup
+ computedRoleString: superscript
+ AXSubrole: AXSuperscriptStyleGroup
+
+<code hidden="" aria-hidden="false" id="code"></code>
+ AXRole: AXGroup
+ AXSubrole: AXCodeStyleGroup
+
+<dt hidden="" aria-hidden="false" id="dt"></dt>
+ AXRole: AXGroup
+ AXSubrole: AXTerm
+
+<dd hidden="" aria-hidden="false" id="dd"></dd>
+ AXRole: AXGroup
+ AXSubrole: AXDescription
+
+<dl hidden="" aria-hidden="false" id="dl"></dl>
+ AXRole: AXList
+
+<ol hidden="" aria-hidden="false" id="ol"></ol>
+ AXRole: AXList
+ computedRoleString: list
+
+<ul hidden="" aria-hidden="false" id="ul"></ul>
+ AXRole: AXList
+ computedRoleString: list
+
+<figure hidden="" aria-hidden="false" id="figure"></figure>
+ AXRole: AXGroup
+ computedRoleString: figure
+ AXSubrole: AXEmptyGroup
+
+<p hidden="" aria-hidden="false" id="p"></p>
+ AXRole: AXGroup
+ computedRoleString: paragraph
+
+<label hidden="" aria-hidden="false" id="label"></label>
+ AXRole: AXGroup
+
+<dfn hidden="" aria-hidden="false" id="dfn"></dfn>
+ AXRole: AXGroup
+ computedRoleString: definition
+ AXSubrole: AXDefinition
+
+<div hidden="" aria-hidden="false" id="div"></div>
+ AXRole: AXGroup
+
+<form hidden="" aria-hidden="false" id="form"></form>
+ AXRole: AXGroup
+ computedRoleString: form
+ AXSubrole: AXEmptyGroup
+
+<article hidden="" aria-hidden="false" id="article"></article>
+ AXRole: AXGroup
+ computedRoleString: article
+ AXSubrole: AXDocumentArticle
+
+<main hidden="" aria-hidden="false" id="main"></main>
+ AXRole: AXGroup
+ computedRoleString: main
+ AXSubrole: AXLandmarkMain
+
+<nav hidden="" aria-hidden="false" id="nav"></nav>
+ AXRole: AXGroup
+ computedRoleString: navigation
+ AXSubrole: AXLandmarkNavigation
+
+<aside hidden="" aria-hidden="false" id="aside"></aside>
+ AXRole: AXGroup
+ computedRoleString: complementary
+ AXSubrole: AXLandmarkComplementary
+
+<section hidden="" aria-hidden="false" id="section-with-name" aria-label="Section name"></section>
+ AXRole: AXGroup
+ computedRoleString: region
+ AXSubrole: AXLandmarkRegion
+
+<section hidden="" aria-hidden="false" id="section-without-name"></section>
+ AXRole: AXGroup
+
+<blockquote hidden="" aria-hidden="false" id="blockquote"></blockquote>
+ AXRole: AXGroup
+ computedRoleString: blockquote
+
+<mark hidden="" aria-hidden="false" id="mark"></mark>
+ AXRole: AXGroup
+
+<pre hidden="" aria-hidden="false" id="pre"></pre>
+ AXRole: AXGroup
+ AXSubrole: AXPreformattedStyleGroup
+
+<details hidden="" aria-hidden="false" id="details"></details>
+ AXRole: AXGroup
+ AXSubrole: AXDetails
+
+<summary hidden="" aria-hidden="false" id="summary"></summary>
+ AXRole: AXButton
+ AXSubrole: AXSummary
+
+<output hidden="" aria-hidden="false" id="output"></output>
+ AXRole: AXGroup
+ computedRoleString: status
+ AXSubrole: AXApplicationStatus
+
+<menu hidden="" aria-hidden="false" type="toolbar" id="menu-toolbar"></menu>
+ AXRole: AXToolbar
+ computedRoleString: toolbar
+
+<hr hidden="" aria-hidden="false" id="hr">
+ AXRole: AXSplitter
+ computedRoleString: separator
+ AXSubrole: AXContentSeparator
+
+<time hidden="" aria-hidden="false" id="time"></time>
+ AXRole: AXGroup
+ computedRoleString: time
+ AXSubrole: AXEmptyGroup
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
Added: trunk/LayoutTests/platform/mac-wk2/accessibility/aria-visible-element-roles-expected.txt (0 => 289248)
--- trunk/LayoutTests/platform/mac-wk2/accessibility/aria-visible-element-roles-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/accessibility/aria-visible-element-roles-expected.txt 2022-02-08 00:22:19 UTC (rev 289248)
@@ -0,0 +1,220 @@
+This test ensures ARIA visible elements (e.g. those with both `hidden` and `aria-hidden='false'` attributes) have the correct role.
+
+<a href="" id="link" hidden="" aria-hidden="false"></a>
+ AXRole: AXLink
+ computedRoleString: link
+
+<select id="select" name="pets" hidden="" aria-hidden="false"></select>
+ AXRole: AXPopUpButton
+ computedRoleString: button
+
+<select id="select-multiple" multiple="" name="pets-multiple" hidden="" aria-hidden="false"></select>
+ AXRole: AXList
+ computedRoleString: listbox
+
+<textarea id="textarea" rows="5" cols="33" hidden="" aria-hidden="false"></textarea>
+ AXRole: AXTextArea
+ computedRoleString: textbox
+
+<img id="img-with-map" src="" width="145" height="126" usemap="" aria-label="Label" hidden="" aria-hidden="false">
+ AXRole: AXImageMap
+
+<li hidden="" aria-hidden="false" id="li-element"></li>
+ AXRole: AXGroup
+ computedRoleString: listitem
+
+<button hidden="" aria-hidden="false" id="button"></button>
+ AXRole: AXButton
+ computedRoleString: button
+
+<legend hidden="" aria-hidden="false" id="legend"></legend>
+ AXRole: AXGroup
+
+<canvas hidden="" aria-hidden="false" id="canvas-without-fallback-content"></canvas>
+ AXRole: AXImage
+
+<canvas hidden="" aria-hidden="false" id="canvas-with-fallback-content"></canvas>
+ AXRole: AXGroup
+
+<input hidden="" aria-hidden="false" id="file-upload-button" type="file">
+ AXRole: AXButton
+ computedRoleString: button
+ AXSubrole: AXFileUploadButton
+
+<input hidden="" aria-hidden="false" id="checkbox" type="checkbox">
+ AXRole: AXCheckBox
+ computedRoleString: checkbox
+
+<input hidden="" aria-hidden="false" type="radio" id="radio-button" name="monster">
+ AXRole: AXRadioButton
+ computedRoleString: radio
+
+<input hidden="" aria-hidden="false" id="text-button" type="submit">
+ AXRole: AXButton
+ computedRoleString: button
+
+<input hidden="" aria-hidden="false" id="text-button-with-pressed" aria-pressed="false" type="submit">
+ AXRole: AXCheckBox
+ computedRoleString: button
+ AXSubrole: AXToggle
+
+<input hidden="" aria-hidden="false" id="date-input" type="date">
+ AXRole: AXTextField
+
+<input hidden="" aria-hidden="false" id="color-input" type="color">
+ AXRole: AXColorWell
+
+<input hidden="" aria-hidden="false" id="range-input" type="range">
+ AXRole: AXSlider
+ computedRoleString: slider
+
+<input hidden="" aria-hidden="false" id="search-input" type="search">
+ AXRole: AXTextField
+ computedRoleString: searchbox
+ AXSubrole: AXSearchField
+
+<h2 hidden="" aria-hidden="false" id="h2"></h2>
+ AXRole: AXHeading
+ computedRoleString: heading
+
+<del hidden="" aria-hidden="false" id="del"></del>
+ AXRole: AXGroup
+ computedRoleString: deletion
+ AXSubrole: AXDeleteStyleGroup
+
+<ins hidden="" aria-hidden="false" id="ins"></ins>
+ AXRole: AXGroup
+ computedRoleString: insertion
+ AXSubrole: AXInsertStyleGroup
+
+<sub hidden="" aria-hidden="false" id="sub"></sub>
+ AXRole: AXGroup
+ computedRoleString: subscript
+ AXSubrole: AXSubscriptStyleGroup
+
+<sup hidden="" aria-hidden="false" id="sup"></sup>
+ AXRole: AXGroup
+ computedRoleString: superscript
+ AXSubrole: AXSuperscriptStyleGroup
+
+<code hidden="" aria-hidden="false" id="code"></code>
+ AXRole: AXGroup
+ AXSubrole: AXCodeStyleGroup
+
+<dt hidden="" aria-hidden="false" id="dt"></dt>
+ AXRole: AXGroup
+ AXSubrole: AXTerm
+
+<dd hidden="" aria-hidden="false" id="dd"></dd>
+ AXRole: AXGroup
+ AXSubrole: AXDescription
+
+<dl hidden="" aria-hidden="false" id="dl"></dl>
+ AXRole: AXList
+
+<ol hidden="" aria-hidden="false" id="ol"></ol>
+ AXRole: AXList
+ computedRoleString: list
+
+<ul hidden="" aria-hidden="false" id="ul"></ul>
+ AXRole: AXList
+ computedRoleString: list
+
+<figure hidden="" aria-hidden="false" id="figure"></figure>
+ AXRole: AXGroup
+ computedRoleString: figure
+ AXSubrole: AXEmptyGroup
+
+<p hidden="" aria-hidden="false" id="p"></p>
+ AXRole: AXGroup
+ computedRoleString: paragraph
+
+<label hidden="" aria-hidden="false" id="label"></label>
+ AXRole: AXGroup
+
+<dfn hidden="" aria-hidden="false" id="dfn"></dfn>
+ AXRole: AXGroup
+ computedRoleString: definition
+ AXSubrole: AXDefinition
+
+<div hidden="" aria-hidden="false" id="div"></div>
+ AXRole: AXGroup
+
+<form hidden="" aria-hidden="false" id="form"></form>
+ AXRole: AXGroup
+ computedRoleString: form
+ AXSubrole: AXEmptyGroup
+
+<article hidden="" aria-hidden="false" id="article"></article>
+ AXRole: AXGroup
+ computedRoleString: article
+ AXSubrole: AXDocumentArticle
+
+<main hidden="" aria-hidden="false" id="main"></main>
+ AXRole: AXGroup
+ computedRoleString: main
+ AXSubrole: AXLandmarkMain
+
+<nav hidden="" aria-hidden="false" id="nav"></nav>
+ AXRole: AXGroup
+ computedRoleString: navigation
+ AXSubrole: AXLandmarkNavigation
+
+<aside hidden="" aria-hidden="false" id="aside"></aside>
+ AXRole: AXGroup
+ computedRoleString: complementary
+ AXSubrole: AXLandmarkComplementary
+
+<section hidden="" aria-hidden="false" id="section-with-name" aria-label="Section name"></section>
+ AXRole: AXGroup
+ computedRoleString: region
+ AXSubrole: AXLandmarkRegion
+
+<section hidden="" aria-hidden="false" id="section-without-name"></section>
+ AXRole: AXGroup
+
+<blockquote hidden="" aria-hidden="false" id="blockquote"></blockquote>
+ AXRole: AXGroup
+ computedRoleString: blockquote
+
+<mark hidden="" aria-hidden="false" id="mark"></mark>
+ AXRole: AXGroup
+
+<pre hidden="" aria-hidden="false" id="pre"></pre>
+ AXRole: AXGroup
+ AXSubrole: AXPreformattedStyleGroup
+
+<details hidden="" aria-hidden="false" id="details"></details>
+ AXRole: AXGroup
+ AXSubrole: AXDetails
+
+<summary hidden="" aria-hidden="false" id="summary"></summary>
+ AXRole: AXButton
+ AXSubrole: AXSummary
+
+<output hidden="" aria-hidden="false" id="output"></output>
+ AXRole: AXGroup
+ computedRoleString: status
+ AXSubrole: AXApplicationStatus
+
+<menu hidden="" aria-hidden="false" type="toolbar" id="menu-toolbar"></menu>
+ AXRole: AXToolbar
+ computedRoleString: toolbar
+
+<hr hidden="" aria-hidden="false" id="hr">
+ AXRole: AXSplitter
+ computedRoleString: separator
+ AXSubrole: AXContentSeparator
+
+<time hidden="" aria-hidden="false" id="time"></time>
+ AXRole: AXGroup
+ computedRoleString: time
+ AXSubrole: AXEmptyGroup
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
Modified: trunk/LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt (289247 => 289248)
--- trunk/LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt 2022-02-08 00:22:19 UTC (rev 289248)
@@ -240,9 +240,9 @@
AXRoleDescription: checkbox
input[type='date']
- AXRole: AXGroup
+ AXRole: AXTextField
AXSubrole:
- AXRoleDescription: group
+ AXRoleDescription: date field
input[type='datetime']
AXRole: AXTextField
@@ -250,9 +250,9 @@
AXRoleDescription: text field
input[type='datetime-local']
- AXRole: AXGroup
+ AXRole: AXTextField
AXSubrole:
- AXRoleDescription: group
+ AXRoleDescription: date and time field
input[type='email']
AXRole: AXTextField
@@ -275,9 +275,9 @@
AXRoleDescription: button
input[type='month']
- AXRole: AXGroup
+ AXRole: AXTextField
AXSubrole:
- AXRoleDescription: group
+ AXRoleDescription: month and year field
input[type='number']
AXRole: AXTextField
@@ -325,9 +325,9 @@
AXRoleDescription: text field
input[type='time']
- AXRole: AXGroup
+ AXRole: AXTextField
AXSubrole:
- AXRoleDescription: group
+ AXRoleDescription: time field
input[type='url']
AXRole: AXTextField
@@ -335,9 +335,9 @@
AXRoleDescription: URL field
input[type='week']
- AXRole: AXGroup
+ AXRole: AXTextField
AXSubrole:
- AXRoleDescription: group
+ AXRoleDescription: week and year field
ins:not([datetime])
AXRole: AXGroup
Added: trunk/LayoutTests/platform/win/accessibility/aria-visible-element-roles-expected.txt (0 => 289248)
--- trunk/LayoutTests/platform/win/accessibility/aria-visible-element-roles-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/win/accessibility/aria-visible-element-roles-expected.txt 2022-02-08 00:22:19 UTC (rev 289248)
@@ -0,0 +1,162 @@
+This test ensures ARIA visible elements (e.g. those with both `hidden` and `aria-hidden='false'` attributes) have the correct role.
+
+<a href="" id="link" hidden="" aria-hidden="false"></a>
+ AXRole: AXLink
+
+<select id="select" name="pets" hidden="" aria-hidden="false"></select>
+ AXRole: AXComboBox
+
+<select id="select-multiple" multiple="" name="pets-multiple" hidden="" aria-hidden="false"></select>
+ AXRole: AXList
+
+<textarea id="textarea" rows="5" cols="33" hidden="" aria-hidden="false"></textarea>
+ AXRole: AXStaticText
+
+<img id="img-with-map" src="" width="145" height="126" usemap="" aria-label="Label" hidden="" aria-hidden="false">
+ AXRole: AXImage
+
+<li hidden="" aria-hidden="false" id="li-element"></li>
+ AXRole: AXTab
+
+<button hidden="" aria-hidden="false" id="button"></button>
+ AXRole: AXButton
+
+<legend hidden="" aria-hidden="false" id="legend"></legend>
+ AXRole: AXGroup
+
+<canvas hidden="" aria-hidden="false" id="canvas-without-fallback-content"></canvas>
+ AXRole: AXImage
+
+<canvas hidden="" aria-hidden="false" id="canvas-with-fallback-content"></canvas>
+ AXRole: AXImage
+
+<input hidden="" aria-hidden="false" id="file-upload-button" type="file">
+ AXRole: AXButton
+
+<input hidden="" aria-hidden="false" id="checkbox" type="checkbox">
+ AXRole: AXCheckBox
+
+<input hidden="" aria-hidden="false" type="radio" id="radio-button" name="monster">
+ AXRole: AXRadioButton
+
+<input hidden="" aria-hidden="false" id="text-button" type="submit">
+ AXRole: AXButton
+
+<input hidden="" aria-hidden="false" id="text-button-with-pressed" aria-pressed="false" type="submit">
+ AXRole: AXCheckBox
+
+<input hidden="" aria-hidden="false" id="date-input" type="date">
+ AXRole: AXStaticText
+
+<input hidden="" aria-hidden="false" id="color-input" type="color">
+ AXRole: AXStaticText
+
+<input hidden="" aria-hidden="false" id="range-input" type="range">
+ AXRole: slider
+
+<input hidden="" aria-hidden="false" id="search-input" type="search">
+ AXRole: AXWebArea
+
+<h2 hidden="" aria-hidden="false" id="h2"></h2>
+ AXRole: AXStaticText
+
+<del hidden="" aria-hidden="false" id="del"></del>
+ AXRole: AXWebArea
+
+<ins hidden="" aria-hidden="false" id="ins"></ins>
+ AXRole: AXWebArea
+
+<sub hidden="" aria-hidden="false" id="sub"></sub>
+ AXRole: AXWebArea
+
+<sup hidden="" aria-hidden="false" id="sup"></sup>
+ AXRole: AXWebArea
+
+<code hidden="" aria-hidden="false" id="code"></code>
+ AXRole: AXWebArea
+
+<dt hidden="" aria-hidden="false" id="dt"></dt>
+ AXRole: AXGroup
+
+<dd hidden="" aria-hidden="false" id="dd"></dd>
+ AXRole: AXGroup
+
+<dl hidden="" aria-hidden="false" id="dl"></dl>
+ AXRole: AXList
+
+<ol hidden="" aria-hidden="false" id="ol"></ol>
+ AXRole: AXList
+
+<ul hidden="" aria-hidden="false" id="ul"></ul>
+ AXRole: AXList
+
+<figure hidden="" aria-hidden="false" id="figure"></figure>
+ AXRole: AXWebArea
+
+<p hidden="" aria-hidden="false" id="p"></p>
+ AXRole: AXGroup
+
+<label hidden="" aria-hidden="false" id="label"></label>
+ AXRole: AXStaticText
+
+<dfn hidden="" aria-hidden="false" id="dfn"></dfn>
+ AXRole: AXGroup
+
+<div hidden="" aria-hidden="false" id="div"></div>
+ AXRole: AXGroup
+
+<form hidden="" aria-hidden="false" id="form"></form>
+ AXRole: AXGroup
+
+<article hidden="" aria-hidden="false" id="article"></article>
+ AXRole: AXGroup
+
+<main hidden="" aria-hidden="false" id="main"></main>
+ AXRole: AXGroup
+
+<nav hidden="" aria-hidden="false" id="nav"></nav>
+ AXRole: AXGroup
+
+<aside hidden="" aria-hidden="false" id="aside"></aside>
+ AXRole: AXGroup
+
+<section hidden="" aria-hidden="false" id="section-with-name" aria-label="Section name"></section>
+ AXRole: AXGroup
+
+<section hidden="" aria-hidden="false" id="section-without-name"></section>
+ AXRole: AXWebArea
+
+<blockquote hidden="" aria-hidden="false" id="blockquote"></blockquote>
+ AXRole: AXWebArea
+
+<mark hidden="" aria-hidden="false" id="mark"></mark>
+ AXRole: AXWebArea
+
+<pre hidden="" aria-hidden="false" id="pre"></pre>
+ AXRole: AXWebArea
+
+<details hidden="" aria-hidden="false" id="details"></details>
+ AXRole: AXWebArea
+
+<summary hidden="" aria-hidden="false" id="summary"></summary>
+ AXRole: AXWebArea
+
+<output hidden="" aria-hidden="false" id="output"></output>
+ AXRole: status bar
+
+<menu hidden="" aria-hidden="false" type="toolbar" id="menu-toolbar"></menu>
+ AXRole: tool bar
+
+<hr hidden="" aria-hidden="false" id="hr">
+ AXRole: separator
+
+<time hidden="" aria-hidden="false" id="time"></time>
+ AXRole: AXWebArea
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
Modified: trunk/Source/WebCore/ChangeLog (289247 => 289248)
--- trunk/Source/WebCore/ChangeLog 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/ChangeLog 2022-02-08 00:22:19 UTC (rev 289248)
@@ -1,3 +1,44 @@
+2022-02-07 Tyler Wilcock <[email protected]>
+
+ AX: Move node-dependent role computation to AccessibilityNodeObject from AccessibilityRenderObject
+ https://bugs.webkit.org/show_bug.cgi?id=236166
+
+ Reviewed by Chris Fleizach.
+
+ AccessibilityRenderObject::determineAccessibilityRole has a lot of
+ logic for computing the object's role that depends only on the node
+ associated with the object, not the renderer. This means that objects
+ that typically have renderers but sometimes don't (e.g. objects with
+ `hidden` + `aria-hidden="false"`, objects with `display: contents`)
+ can't have these roles, which is wrong.
+
+ This patch improves this by moving these node-dependent role
+ calcuations to a new determineAccessibilityRoleFromNode function, and
+ changing AccessibilityRenderObject to use that.
+
+ Test: accessibility/aria-visible-element-roles.html
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::determineAccessibilityRole):
+ (WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
+ Added.
+ (WebCore::AccessibilityNodeObject::isDescendantOfElementType const):
+ (WebCore::AccessibilityNodeObject::isFileUploadButton const):
+ Moved to AccessibilityObject.
+ * accessibility/AccessibilityNodeObject.h:
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::isButton const):
+ Remove unnecessary whitespace.
+ (WebCore::AccessibilityObject::isFileUploadButton const):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+ If properties of m_renderer don't yield a role, fallback to
+ determineAccessibilityRoleFromNode.
+ (WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
+ Moved to AccessibilityNodeObject.
+ * accessibility/AccessibilityRenderObject.h:
+
2022-02-07 Chris Dumez <[email protected]>
Add support for sharing Shared Workers (including across WebProcesses)
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (289247 => 289248)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2022-02-08 00:22:19 UTC (rev 289248)
@@ -46,6 +46,7 @@
#include "FrameLoader.h"
#include "FrameSelection.h"
#include "FrameView.h"
+#include "HTMLAudioElement.h"
#include "HTMLCanvasElement.h"
#include "HTMLDetailsElement.h"
#include "HTMLFieldSetElement.h"
@@ -60,6 +61,7 @@
#include "HTMLSelectElement.h"
#include "HTMLTextAreaElement.h"
#include "HTMLTextFormControlElement.h"
+#include "HTMLVideoElement.h"
#include "KeyboardEvent.h"
#include "LabelableElement.h"
#include "LocalizedStrings.h"
@@ -235,19 +237,40 @@
AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
{
AXTRACE("AccessibilityNodeObject::determineAccessibilityRole");
+ if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown)
+ return m_ariaRole;
+
+ return determineAccessibilityRoleFromNode();
+}
+
+AccessibilityRole AccessibilityNodeObject::determineAccessibilityRoleFromNode(TreatStyleFormatGroupAsInline treatStyleFormatGroupAsInline) const
+{
if (!node())
return AccessibilityRole::Unknown;
- if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown)
- return m_ariaRole;
-
if (node()->isLink())
return AccessibilityRole::WebCoreLink;
if (node()->isTextNode())
return AccessibilityRole::StaticText;
+ if (node()->hasTagName(selectTag)) {
+ auto& selectElement = downcast<HTMLSelectElement>(*node());
+ return selectElement.multiple() ? AccessibilityRole::ListBox : AccessibilityRole::PopUpButton;
+ }
+ if (is<HTMLTextAreaElement>(*node()))
+ return AccessibilityRole::TextArea;
+ if (is<HTMLImageElement>(*node()) && downcast<HTMLImageElement>(*node()).hasAttributeWithoutSynchronization(usemapAttr))
+ return AccessibilityRole::ImageMap;
+ if (node()->hasTagName(liTag))
+ return AccessibilityRole::ListItem;
if (node()->hasTagName(buttonTag))
return buttonRoleType();
- if (is<HTMLInputElement>(*node())) {
+ if (node()->hasTagName(legendTag))
+ return AccessibilityRole::Legend;
+ if (node()->hasTagName(canvasTag))
+ return AccessibilityRole::Canvas;
+ if (isFileUploadButton())
+ return AccessibilityRole::Button;
+ if (is<HTMLInputElement>(node())) {
HTMLInputElement& input = downcast<HTMLInputElement>(*node());
if (input.isCheckbox())
return AccessibilityRole::CheckBox;
@@ -255,34 +278,139 @@
return AccessibilityRole::RadioButton;
if (input.isTextButton())
return buttonRoleType();
+ // On iOS, the date field and time field are popup buttons. On other platforms they are text fields.
+#if PLATFORM(IOS_FAMILY)
+ if (input.isDateField() || input.isTimeField())
+ return AccessibilityRole::PopUpButton;
+#endif
+#if ENABLE(INPUT_TYPE_COLOR)
+ if (input.isColorControl())
+ return AccessibilityRole::ColorWell;
+#endif
+ if (input.isInputTypeHidden())
+ return AccessibilityRole::Ignored;
if (input.isRangeControl())
return AccessibilityRole::Slider;
- if (input.isInputTypeHidden())
- return AccessibilityRole::Ignored;
if (input.isSearchField())
return AccessibilityRole::SearchField;
-#if ENABLE(INPUT_TYPE_COLOR)
- if (input.isColorControl())
- return AccessibilityRole::ColorWell;
-#endif
+
return AccessibilityRole::TextField;
}
- if (node()->hasTagName(selectTag)) {
- HTMLSelectElement& selectElement = downcast<HTMLSelectElement>(*node());
- return selectElement.multiple() ? AccessibilityRole::ListBox : AccessibilityRole::PopUpButton;
- }
- if (is<HTMLTextAreaElement>(*node()))
+
+ if (hasContentEditableAttributeSet())
return AccessibilityRole::TextArea;
+
if (headingLevel())
return AccessibilityRole::Heading;
- if (node()->hasTagName(blockquoteTag))
- return AccessibilityRole::Blockquote;
- if (node()->hasTagName(divTag))
- return AccessibilityRole::Div;
+
+ if (isStyleFormatGroup()) {
+ if (node()->hasTagName(delTag))
+ return AccessibilityRole::Deletion;
+ if (node()->hasTagName(insTag))
+ return AccessibilityRole::Insertion;
+ if (node()->hasTagName(subTag))
+ return AccessibilityRole::Subscript;
+ if (node()->hasTagName(supTag))
+ return AccessibilityRole::Superscript;
+ return treatStyleFormatGroupAsInline == TreatStyleFormatGroupAsInline::Yes ? AccessibilityRole::Inline : AccessibilityRole::TextGroup;
+ }
+
+ if (node()->hasTagName(ddTag))
+ return AccessibilityRole::DescriptionListDetail;
+ if (node()->hasTagName(dtTag))
+ return AccessibilityRole::DescriptionListTerm;
+ if (node()->hasTagName(dlTag))
+ return AccessibilityRole::DescriptionList;
+ if (node()->hasTagName(olTag) || node()->hasTagName(ulTag))
+ return AccessibilityRole::List;
+ if (node()->hasTagName(fieldsetTag))
+ return AccessibilityRole::Group;
+ if (node()->hasTagName(figureTag))
+ return AccessibilityRole::Figure;
if (node()->hasTagName(pTag))
return AccessibilityRole::Paragraph;
- if (is<HTMLLabelElement>(*node()))
+ if (is<HTMLLabelElement>(node()))
return AccessibilityRole::Label;
+ if (node()->hasTagName(dfnTag))
+ return AccessibilityRole::Definition;
+ if (node()->hasTagName(divTag))
+ return AccessibilityRole::Div;
+ if (is<HTMLFormElement>(node()))
+ return AccessibilityRole::Form;
+ if (node()->hasTagName(articleTag))
+ return AccessibilityRole::DocumentArticle;
+ if (node()->hasTagName(mainTag))
+ return AccessibilityRole::LandmarkMain;
+ if (node()->hasTagName(navTag))
+ return AccessibilityRole::LandmarkNavigation;
+ if (node()->hasTagName(asideTag))
+ return AccessibilityRole::LandmarkComplementary;
+
+ // The default role attribute value for the section element, region, became a landmark in ARIA 1.1.
+ // The HTML AAM spec says it is "strongly recommended" that ATs only convey and provide navigation
+ // for section elements which have names.
+ if (node()->hasTagName(sectionTag))
+ return hasAttribute(aria_labelAttr) || hasAttribute(aria_labelledbyAttr) ? AccessibilityRole::LandmarkRegion : AccessibilityRole::TextGroup;
+ if (node()->hasTagName(addressTag))
+ return AccessibilityRole::Group;
+ if (node()->hasTagName(blockquoteTag))
+ return AccessibilityRole::Blockquote;
+ if (node()->hasTagName(captionTag))
+ return AccessibilityRole::Caption;
+ if (node()->hasTagName(markTag))
+ return AccessibilityRole::Mark;
+ if (node()->hasTagName(preTag))
+ return AccessibilityRole::Pre;
+ if (is<HTMLDetailsElement>(node()))
+ return AccessibilityRole::Details;
+ if (is<HTMLSummaryElement>(node()))
+ return AccessibilityRole::Summary;
+
+ // http://rawgit.com/w3c/aria/master/html-aam/html-aam.html
+ // Output elements should be mapped to status role.
+ if (isOutput())
+ return AccessibilityRole::ApplicationStatus;
+
+#if ENABLE(VIDEO)
+ if (is<HTMLVideoElement>(node()))
+ return AccessibilityRole::Video;
+ if (is<HTMLAudioElement>(node()))
+ return AccessibilityRole::Audio;
+#endif
+
+#if ENABLE(MODEL_ELEMENT)
+ if (node()->hasTagName(modelTag))
+ return AccessibilityRole::Model;
+#endif
+
+ // The HTML element should not be exposed as an element. That's what the RenderView element does.
+ if (node()->hasTagName(htmlTag))
+ return AccessibilityRole::Ignored;
+
+ // There should only be one banner/contentInfo per page. If header/footer are being used within an article or section
+ // then it should not be exposed as whole page's banner/contentInfo
+ if (node()->hasTagName(headerTag) && !isDescendantOfElementType({ articleTag, sectionTag }))
+ return AccessibilityRole::LandmarkBanner;
+
+ // http://webkit.org/b/190138 Footers should become contentInfo's if scoped to body (and consequently become a landmark).
+ // It should remain a footer if scoped to main, sectioning elements (article, section) or root sectioning element (blockquote, details, dialog, fieldset, figure, td).
+ if (node()->hasTagName(footerTag)) {
+ if (!isDescendantOfElementType({ articleTag, sectionTag, mainTag, blockquoteTag, detailsTag, fieldsetTag, figureTag, tdTag }))
+ return AccessibilityRole::LandmarkContentInfo;
+ return AccessibilityRole::Footer;
+ }
+
+ // menu tags with toolbar type should have Toolbar role.
+ if (node()->hasTagName(menuTag) && equalLettersIgnoringASCIICase(getAttribute(typeAttr), "toolbar"))
+ return AccessibilityRole::Toolbar;
+ if (node()->hasTagName(timeTag))
+ return AccessibilityRole::Time;
+ if (node()->hasTagName(hrTag))
+ return AccessibilityRole::HorizontalRule;
+
+ // If the element does not have role, but it has ARIA attributes, or accepts tab focus, accessibility should fallback to exposing it as a group.
+ if (supportsARIAAttributes() || canSetFocusAttribute())
+ return AccessibilityRole::Group;
if (is<Element>(*node()) && downcast<Element>(*node()).isFocusable())
return AccessibilityRole::Group;
@@ -289,6 +417,18 @@
return AccessibilityRole::Unknown;
}
+bool AccessibilityNodeObject::isDescendantOfElementType(const HashSet<QualifiedName>& tagNames) const
+{
+ if (!m_node)
+ return false;
+
+ for (auto& ancestorElement : ancestorsOfType<Element>(*m_node)) {
+ if (tagNames.contains(ancestorElement.tagQName()))
+ return true;
+ }
+ return false;
+}
+
void AccessibilityNodeObject::addChildren()
{
// If the need to add more children in addition to existing children arises,
@@ -563,13 +703,6 @@
}
}
-bool AccessibilityNodeObject::isFileUploadButton() const
-{
- if (is<HTMLInputElement>(m_node))
- return downcast<HTMLInputElement>(m_node)->isFileUpload();
- return false;
-}
-
bool AccessibilityNodeObject::isNativeCheckboxOrRadio() const
{
Node* node = this->node();
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h (289247 => 289248)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h 2022-02-08 00:22:19 UTC (rev 289248)
@@ -66,7 +66,6 @@
bool isMenuButton() const override;
bool isMenuItem() const override;
bool isMenuRelated() const override;
- bool isFileUploadButton() const override;
bool isMultiSelectable() const override;
virtual bool isNativeCheckboxOrRadio() const;
bool isNativeImage() const override;
@@ -154,6 +153,11 @@
bool isDetached() const override { return !m_node; }
virtual AccessibilityRole determineAccessibilityRole();
+ enum class TreatStyleFormatGroupAsInline {
+ No,
+ Yes
+ };
+ AccessibilityRole determineAccessibilityRoleFromNode(TreatStyleFormatGroupAsInline = TreatStyleFormatGroupAsInline::No) const;
void addChildren() override;
bool canHaveChildren() const override;
@@ -200,6 +204,8 @@
bool performDismissAction() final;
bool hasTextAlternative() const;
+ bool isDescendantOfElementType(const HashSet<QualifiedName>&) const;
+
Node* m_node;
};
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (289247 => 289248)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2022-02-08 00:22:19 UTC (rev 289248)
@@ -3557,11 +3557,15 @@
bool AccessibilityObject::isButton() const
{
- AccessibilityRole role = roleValue();
-
+ auto role = roleValue();
return role == AccessibilityRole::Button || role == AccessibilityRole::PopUpButton || role == AccessibilityRole::ToggleButton;
}
+bool AccessibilityObject::isFileUploadButton() const
+{
+ return is<HTMLInputElement>(node()) && downcast<HTMLInputElement>(*node()).isFileUpload();
+}
+
bool AccessibilityObject::accessibilityIsIgnoredByDefault() const
{
return defaultObjectInclusion() == AccessibilityObjectInclusion::IgnoreObject;
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (289247 => 289248)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2022-02-08 00:22:19 UTC (rev 289248)
@@ -141,7 +141,7 @@
bool isMenuBar() const override { return false; }
bool isMenuButton() const override { return false; }
bool isMenuItem() const override { return false; }
- bool isFileUploadButton() const override { return false; }
+ bool isFileUploadButton() const override;
bool isInputImage() const override { return false; }
bool isProgressIndicator() const override { return false; }
bool isSlider() const override { return false; }
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (289247 => 289248)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2022-02-08 00:22:19 UTC (rev 289248)
@@ -49,7 +49,6 @@
#include "FrameSelection.h"
#include "GeometryUtilities.h"
#include "HTMLAreaElement.h"
-#include "HTMLAudioElement.h"
#include "HTMLBRElement.h"
#include "HTMLDetailsElement.h"
#include "HTMLFormElement.h"
@@ -2793,24 +2792,6 @@
return nullptr;
}
-bool AccessibilityRenderObject::isDescendantOfElementType(const HashSet<QualifiedName>& tagNames) const
-{
- for (auto& ancestor : ancestorsOfType<RenderElement>(*m_renderer)) {
- if (ancestor.element() && tagNames.contains(ancestor.element()->tagQName()))
- return true;
- }
- return false;
-}
-
-bool AccessibilityRenderObject::isDescendantOfElementType(const QualifiedName& tagName) const
-{
- for (auto& ancestor : ancestorsOfType<RenderElement>(*m_renderer)) {
- if (ancestor.element() && ancestor.element()->hasTagName(tagName))
- return true;
- }
- return false;
-}
-
String AccessibilityRenderObject::expandedTextValue() const
{
if (AccessibilityObject* parent = parentObject()) {
@@ -2858,20 +2839,14 @@
Node* node = m_renderer->node();
RenderBoxModelObject* cssBox = renderBoxModelObject();
- if (node && node->isLink())
- return AccessibilityRole::WebCoreLink;
- if (node && is<HTMLImageElement>(*node) && downcast<HTMLImageElement>(*node).hasAttributeWithoutSynchronization(usemapAttr))
- return AccessibilityRole::ImageMap;
- if ((cssBox && cssBox->isListItem()) || (node && node->hasTagName(liTag)))
+ if (cssBox && cssBox->isListItem())
return AccessibilityRole::ListItem;
if (m_renderer->isListMarker())
return AccessibilityRole::ListMarker;
- if (node && node->hasTagName(buttonTag))
- return buttonRoleType();
- if (node && node->hasTagName(legendTag))
- return AccessibilityRole::Legend;
if (m_renderer->isText())
return AccessibilityRole::StaticText;
+ if (is<HTMLImageElement>(node) && downcast<HTMLImageElement>(*node).hasAttributeWithoutSynchronization(usemapAttr))
+ return AccessibilityRole::ImageMap;
if (cssBox && cssBox->isImage()) {
if (is<HTMLInputElement>(node))
return hasPopup() ? AccessibilityRole::PopUpButton : AccessibilityRole::Button;
@@ -2880,90 +2855,23 @@
if (svgRoot->hasAccessibleContent())
return AccessibilityRole::SVGRoot;
}
-
return AccessibilityRole::Image;
}
-
- if (node && node->hasTagName(canvasTag))
- return AccessibilityRole::Canvas;
-#if ENABLE(MODEL_ELEMENT)
- if (node && node->hasTagName(modelTag))
- return AccessibilityRole::Model;
-#endif
-
if (cssBox && cssBox->isRenderView())
return AccessibilityRole::WebArea;
-
if (cssBox && cssBox->isTextField()) {
if (is<HTMLInputElement>(node))
return downcast<HTMLInputElement>(*node).isSearchField() ? AccessibilityRole::SearchField : AccessibilityRole::TextField;
}
-
if (cssBox && cssBox->isTextArea())
return AccessibilityRole::TextArea;
-
- if (is<HTMLInputElement>(node)) {
- HTMLInputElement& input = downcast<HTMLInputElement>(*node);
- if (input.isCheckbox())
- return AccessibilityRole::CheckBox;
- if (input.isRadioButton())
- return AccessibilityRole::RadioButton;
- if (input.isTextButton())
- return buttonRoleType();
- // On iOS, the date field and time field are popup buttons. On other platforms they are text fields.
-#if PLATFORM(IOS_FAMILY)
- if (input.isDateField() || input.isTimeField())
- return AccessibilityRole::PopUpButton;
-#endif
-#if ENABLE(INPUT_TYPE_COLOR)
- if (input.isColorControl())
- return AccessibilityRole::ColorWell;
-#endif
- }
-
- if (hasContentEditableAttributeSet())
- return AccessibilityRole::TextArea;
-
- if (isFileUploadButton())
- return AccessibilityRole::Button;
-
if (cssBox && cssBox->isMenuList())
return AccessibilityRole::PopUpButton;
-
- if (headingLevel())
- return AccessibilityRole::Heading;
-
+
if (m_renderer->isSVGRootOrLegacySVGRoot())
return AccessibilityRole::SVGRoot;
- if (isStyleFormatGroup()) {
- if (node->hasTagName(delTag))
- return AccessibilityRole::Deletion;
- if (node->hasTagName(insTag))
- return AccessibilityRole::Insertion;
- if (node->hasTagName(subTag))
- return AccessibilityRole::Subscript;
- if (node->hasTagName(supTag))
- return AccessibilityRole::Superscript;
- return is<RenderInline>(*m_renderer) ? AccessibilityRole::Inline : AccessibilityRole::TextGroup;
- }
-
- if (node && node->hasTagName(ddTag))
- return AccessibilityRole::DescriptionListDetail;
-
- if (node && node->hasTagName(dtTag))
- return AccessibilityRole::DescriptionListTerm;
-
- if (node && node->hasTagName(dlTag))
- return AccessibilityRole::DescriptionList;
-
- if (node && node->hasTagName(fieldsetTag))
- return AccessibilityRole::Group;
-
- if (node && node->hasTagName(figureTag))
- return AccessibilityRole::Figure;
-
// Check for Ruby elements
if (m_renderer->isRubyText())
return AccessibilityRole::RubyText;
@@ -2980,107 +2888,15 @@
// the cell should not be treated as a cell (e.g. because it is a layout table.
if (is<RenderTableCell>(renderer()))
return AccessibilityRole::TextGroup;
-
// Table sections should be ignored.
if (m_renderer->isTableSection())
return AccessibilityRole::Ignored;
- if (m_renderer->isHR())
- return AccessibilityRole::HorizontalRule;
-
- if (node && node->hasTagName(pTag))
- return AccessibilityRole::Paragraph;
-
- if (is<HTMLLabelElement>(node))
- return AccessibilityRole::Label;
-
- if (node && node->hasTagName(dfnTag))
- return AccessibilityRole::Definition;
-
- if (node && node->hasTagName(divTag))
- return AccessibilityRole::Div;
-
- if (is<HTMLFormElement>(node))
- return AccessibilityRole::Form;
-
- if (node && node->hasTagName(articleTag))
- return AccessibilityRole::DocumentArticle;
-
- if (node && node->hasTagName(mainTag))
- return AccessibilityRole::LandmarkMain;
-
- if (node && node->hasTagName(navTag))
- return AccessibilityRole::LandmarkNavigation;
-
- if (node && node->hasTagName(asideTag))
- return AccessibilityRole::LandmarkComplementary;
-
- // The default role attribute value for the section element, region, became a landmark in ARIA 1.1.
- // The HTML AAM spec says it is "strongly recommended" that ATs only convey and provide navigation
- // for section elements which have names.
- if (node && node->hasTagName(sectionTag))
- return hasAttribute(aria_labelAttr) || hasAttribute(aria_labelledbyAttr) ? AccessibilityRole::LandmarkRegion : AccessibilityRole::TextGroup;
-
- if (node && node->hasTagName(addressTag))
- return AccessibilityRole::Group;
-
- if (node && node->hasTagName(blockquoteTag))
- return AccessibilityRole::Blockquote;
-
- if (node && node->hasTagName(captionTag))
- return AccessibilityRole::Caption;
+ auto treatStyleFormatGroupAsInline = is<RenderInline>(*m_renderer) ? TreatStyleFormatGroupAsInline::Yes : TreatStyleFormatGroupAsInline::No;
+ auto roleFromNode = determineAccessibilityRoleFromNode(treatStyleFormatGroupAsInline);
+ if (roleFromNode != AccessibilityRole::Unknown)
+ return roleFromNode;
- if (node && node->hasTagName(markTag))
- return AccessibilityRole::Mark;
-
- if (node && node->hasTagName(preTag))
- return AccessibilityRole::Pre;
-
- if (is<HTMLDetailsElement>(node))
- return AccessibilityRole::Details;
- if (is<HTMLSummaryElement>(node))
- return AccessibilityRole::Summary;
-
- // http://rawgit.com/w3c/aria/master/html-aam/html-aam.html
- // Output elements should be mapped to status role.
- if (isOutput())
- return AccessibilityRole::ApplicationStatus;
-
-#if ENABLE(VIDEO)
- if (is<HTMLVideoElement>(node))
- return AccessibilityRole::Video;
- if (is<HTMLAudioElement>(node))
- return AccessibilityRole::Audio;
-#endif
-
- // The HTML element should not be exposed as an element. That's what the RenderView element does.
- if (node && node->hasTagName(htmlTag))
- return AccessibilityRole::Ignored;
-
- // There should only be one banner/contentInfo per page. If header/footer are being used within an article or section
- // then it should not be exposed as whole page's banner/contentInfo
- if (node && node->hasTagName(headerTag) && !isDescendantOfElementType({ articleTag, sectionTag }))
- return AccessibilityRole::LandmarkBanner;
-
- // http://webkit.org/b/190138 Footers should become contentInfo's if scoped to body (and consequently become a landmark).
- // It should remain a footer if scoped to main, sectioning elements (article, section) or root sectioning element (blockquote, details, dialog, fieldset, figure, td).
- if (node && node->hasTagName(footerTag)) {
- if (!isDescendantOfElementType({ articleTag, sectionTag, mainTag, blockquoteTag, detailsTag, fieldsetTag, figureTag, tdTag }))
- return AccessibilityRole::LandmarkContentInfo;
- return AccessibilityRole::Footer;
- }
-
- // menu tags with toolbar type should have Toolbar role.
- if (node && node->hasTagName(menuTag) && equalLettersIgnoringASCIICase(getAttribute(typeAttr), "toolbar"))
- return AccessibilityRole::Toolbar;
-
- if (node && node->hasTagName(timeTag))
- return AccessibilityRole::Time;
-
- // If the element does not have role, but it has ARIA attributes, or accepts tab focus, accessibility should fallback to exposing it as a group.
- if (supportsARIAAttributes() || canSetFocusAttribute())
- return AccessibilityRole::Group;
-
if (m_renderer->isRenderBlockFlow())
return m_renderer->isAnonymousBlock() ? AccessibilityRole::TextGroup : AccessibilityRole::Group;
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (289247 => 289248)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2022-02-08 00:18:53 UTC (rev 289247)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2022-02-08 00:22:19 UTC (rev 289248)
@@ -237,8 +237,6 @@
bool renderObjectIsObservable(RenderObject&) const;
RenderObject* renderParentObject() const;
- bool isDescendantOfElementType(const QualifiedName& tagName) const;
- bool isDescendantOfElementType(const HashSet<QualifiedName>&) const;
bool isSVGImage() const;
void detachRemoteSVGRoot();