Implement implicit value of aria-haspopup on combobox

According to the ARIA spec, the implicit value for aria-haspopup is
listbox. We were not exposing anything when there was no author-provided
value. This commit fixes that.

AX-Relnotes: Implement support for implicit value of aria-haspopup on
combobox

Bug: 1240964

Cq-Include-Trybots: luci.chromium.try:linux-trusty-rel,linux-xenial-rel
Change-Id: Ifcf1bd30c2d1e01628be546230b8271d4ccf2ec0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3103286
Commit-Queue: Joanmarie Diggs <jdiggs@igalia.com>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#913533}
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index 9dd3632..a063c529 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -578,6 +578,11 @@
 }
 
 IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
+                       AccessibilityAriaComboboxImplicitHasPopup) {
+  RunAriaTest(FILE_PATH_LITERAL("aria-combobox-implicit-haspopup.html"));
+}
+
+IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
                        AccessibilityAriaComboboxUneditable) {
   RunAriaTest(FILE_PATH_LITERAL("aria-combobox-uneditable.html"));
 }
diff --git a/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-auralinux.txt
new file mode 100644
index 0000000..9111ec9
--- /dev/null
+++ b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-auralinux.txt
@@ -0,0 +1,6 @@
+[document web]
+++[combo box] name='ComboBoxGrouping' haspopup:listbox
+++++[entry]
+++[combo box] name='TextFieldWithComboBox' haspopup:listbox
+++[combo box] name='ComboBoxMenuButton"' haspopup:listbox
+++++[static] name='Select'
diff --git a/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-blink.txt b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-blink.txt
new file mode 100644
index 0000000..4e9bcb8
--- /dev/null
+++ b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-blink.txt
@@ -0,0 +1,11 @@
+rootWebArea
+++genericContainer ignored
+++++genericContainer ignored
+++++++comboBoxGrouping name='ComboBoxGrouping' haspopup=listbox
+++++++++textField
+++++++++++genericContainer
+++++++textFieldWithComboBox name='TextFieldWithComboBox' haspopup=listbox
+++++++++genericContainer
+++++++comboBoxMenuButton name='ComboBoxMenuButton"' value='Select' haspopup=listbox
+++++++++staticText name='Select'
+++++++++++inlineTextBox name='Select'
diff --git a/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-mac.txt b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-mac.txt
new file mode 100644
index 0000000..07a92cb
--- /dev/null
+++ b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-mac.txt
@@ -0,0 +1,6 @@
+AXWebArea
+++AXComboBox AXDescription='ComboBoxGrouping'
+++++AXTextField
+++AXComboBox AXDescription='TextFieldWithComboBox'
+++AXComboBox AXDescription='ComboBoxMenuButton"' AXValue='Select'
+++++AXStaticText AXValue='Select'
diff --git a/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-win.txt b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-win.txt
new file mode 100644
index 0000000..7f68552b
--- /dev/null
+++ b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup-expected-win.txt
@@ -0,0 +1,6 @@
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
+++ROLE_SYSTEM_COMBOBOX name='ComboBoxGrouping' HASPOPUP haspopup:listbox
+++++ROLE_SYSTEM_TEXT FOCUSABLE
+++ROLE_SYSTEM_COMBOBOX name='TextFieldWithComboBox' FOCUSABLE HASPOPUP haspopup:listbox
+++ROLE_SYSTEM_COMBOBOX name='ComboBoxMenuButton"' value='Select' FOCUSABLE HASPOPUP haspopup:listbox
+++++ROLE_SYSTEM_STATICTEXT name='Select'
diff --git a/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup.html b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup.html
new file mode 100644
index 0000000..e03427e
--- /dev/null
+++ b/content/test/data/accessibility/aria/aria-combobox-implicit-haspopup.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<!--
+@WIN-ALLOW:haspopup*
+@AURALINUX-DENY:selectable-text
+@AURALINUX-ALLOW:haspopup:*
+@BLINK-ALLOW:haspopup*
+-->
+<html>
+  <body>
+    <div role="combobox" aria-label="ComboBoxGrouping"><input></div>
+    <input role="combobox" aria-label="TextFieldWithComboBox">
+    <div tabindex="0" role="combobox" aria-label=ComboBoxMenuButton">Select</div>
+  </body>
+</html>
diff --git a/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt
index 572a5373..7abf228b 100644
--- a/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt
+++ b/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt
@@ -1,6 +1,6 @@
 [document web]
 ++[combo box] haspopup:menu
-++[combo box]
+++[combo box] haspopup:listbox
 ++[combo box] haspopup:menu
 ++[combo box] haspopup:listbox
 ++[combo box] haspopup:grid
diff --git a/content/test/data/accessibility/aria/aria-haspopup-expected-blink.txt b/content/test/data/accessibility/aria/aria-haspopup-expected-blink.txt
index 11ae32b..3386ae2 100644
--- a/content/test/data/accessibility/aria/aria-haspopup-expected-blink.txt
+++ b/content/test/data/accessibility/aria/aria-haspopup-expected-blink.txt
@@ -2,7 +2,7 @@
 ++genericContainer ignored
 ++++genericContainer ignored
 ++++++comboBoxMenuButton haspopup=menu
-++++++comboBoxMenuButton
+++++++comboBoxMenuButton haspopup=listbox
 ++++++comboBoxMenuButton haspopup=menu
 ++++++comboBoxMenuButton haspopup=listbox
 ++++++comboBoxMenuButton haspopup=grid
diff --git a/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt b/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt
index a3e1617..4136cb0 100644
--- a/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt
+++ b/content/test/data/accessibility/aria/aria-haspopup-expected-mac.txt
@@ -1,6 +1,6 @@
 AXWebArea
 ++AXComboBox AXHasPopup=1 AXPopupValue='menu'
-++AXComboBox
+++AXComboBox AXHasPopup=1 AXPopupValue='listbox'
 ++AXComboBox AXHasPopup=1 AXPopupValue='menu'
 ++AXComboBox AXHasPopup=1 AXPopupValue='listbox'
 ++AXComboBox AXHasPopup=1 AXPopupValue='grid'
diff --git a/content/test/data/accessibility/aria/aria-haspopup-expected-win.txt b/content/test/data/accessibility/aria/aria-haspopup-expected-win.txt
index 5811881..981324a 100644
--- a/content/test/data/accessibility/aria/aria-haspopup-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-haspopup-expected-win.txt
@@ -1,6 +1,6 @@
 ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
 ++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP haspopup:menu
-++ROLE_SYSTEM_COMBOBOX FOCUSABLE
+++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP haspopup:listbox
 ++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP haspopup:menu
 ++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP haspopup:listbox
 ++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP haspopup:grid
diff --git a/content/test/data/accessibility/aria/aria-orientation-expected-win.txt b/content/test/data/accessibility/aria/aria-orientation-expected-win.txt
index 3d355e8..d8cc111 100644
--- a/content/test/data/accessibility/aria/aria-orientation-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-orientation-expected-win.txt
@@ -1,7 +1,7 @@
 ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++ROLE_SYSTEM_COMBOBOX
-++ROLE_SYSTEM_COMBOBOX IA2_STATE_HORIZONTAL
-++ROLE_SYSTEM_COMBOBOX IA2_STATE_VERTICAL
+++ROLE_SYSTEM_COMBOBOX HASPOPUP
+++ROLE_SYSTEM_COMBOBOX HASPOPUP IA2_STATE_HORIZONTAL
+++ROLE_SYSTEM_COMBOBOX HASPOPUP IA2_STATE_VERTICAL
 ++ROLE_SYSTEM_LIST IA2_STATE_VERTICAL
 ++ROLE_SYSTEM_LIST IA2_STATE_HORIZONTAL
 ++ROLE_SYSTEM_LIST IA2_STATE_VERTICAL
diff --git a/content/test/data/accessibility/event/aria-required-changed-expected-win.txt b/content/test/data/accessibility/event/aria-required-changed-expected-win.txt
index 908addffb..72f952d2 100644
--- a/content/test/data/accessibility/event/aria-required-changed-expected-win.txt
+++ b/content/test/data/accessibility/event/aria-required-changed-expected-win.txt
@@ -1,3 +1,3 @@
 EVENT_OBJECT_STATECHANGE on <div> role=ROLE_SYSTEM_CHECKBUTTON IA2_STATE_CHECKABLE,IA2_STATE_REQUIRED
-EVENT_OBJECT_STATECHANGE on <div> role=ROLE_SYSTEM_COMBOBOX
+EVENT_OBJECT_STATECHANGE on <div> role=ROLE_SYSTEM_COMBOBOX HASPOPUP
 EVENT_OBJECT_STATECHANGE on <div> role=ROLE_SYSTEM_RADIOBUTTON IA2_STATE_CHECKABLE PosInSet=1 SetSize=1
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc
index a57ae3d..baa8f74 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_object.cc
+++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -1125,6 +1125,8 @@
     node_data->SetHasPopup(HasPopup());
   else if (RoleValue() == ax::mojom::blink::Role::kPopUpButton)
     node_data->SetHasPopup(ax::mojom::blink::HasPopup::kMenu);
+  else if (ui::IsComboBox(RoleValue()))
+    node_data->SetHasPopup(ax::mojom::blink::HasPopup::kListbox);
 
   if (IsAutofillAvailable())
     node_data->AddState(ax::mojom::blink::State::kAutofillAvailable);
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
index 9270be5..910c990 100755
--- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
+++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -541,6 +541,7 @@
             # serialization. Please keep alphabetized.
             'ui::CanHaveInlineTextBoxChildren',
             'ui::IsCellOrTableHeader',
+            'ui::IsComboBox',
             'ui::IsContainerWithSelectableChildren',
             'ui::IsDialog',
             'ui::IsHeading',