Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility.cc |
| diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc |
| index 06f810608ca84573a7973ccc9c5d4038b91a0dbd..5c51a8864ff681d2c85c47366f8af88ab1a0a41c 100644 |
| --- a/content/browser/accessibility/browser_accessibility.cc |
| +++ b/content/browser/accessibility/browser_accessibility.cc |
| @@ -128,6 +128,11 @@ bool BrowserAccessibility::IsDescendantOf( |
| return false; |
| } |
| +bool BrowserAccessibility::IsDocument() const { |
| + return GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || |
| + GetRole() == ui::AX_ROLE_WEB_AREA; |
| +} |
|
dougt
2017/06/28 19:43:20
I would add this to https://cs.chromium.org/chromi
|
| + |
| bool BrowserAccessibility::IsTextOnlyObject() const { |
| return GetRole() == ui::AX_ROLE_STATIC_TEXT || |
| GetRole() == ui::AX_ROLE_LINE_BREAK || |
| @@ -958,6 +963,14 @@ bool BrowserAccessibility::IsNativeTextControl() const { |
| return html_tag == "textarea"; |
| } |
| +// In general we should use IsEditBox() instead if we want to check for |
| +// something that has a caret and the user can edit. |
| +// TODO(aleventhal) this name is confusing because it returns true for combobox, |
| +// and we should take a look at why a combobox is considered a text control. The |
| +// ARIA spec says a combobox would contain (but not be) a text field. It looks |
| +// like a mistake may have been made in that comboboxes have been considered a |
| +// kind of textbox. Find an appropriate name for this function, and consider |
| +// returning false for comboboxes it doesn't break existing websites. |
| bool BrowserAccessibility::IsSimpleTextControl() const { |
| // Time fields, color wells and spinner buttons might also use text fields as |
| // constituent parts, but they are not considered text fields as a whole. |
| @@ -972,6 +985,11 @@ bool BrowserAccessibility::IsSimpleTextControl() const { |
| } |
| } |
| +bool BrowserAccessibility::IsEditBox() const { |
| + return GetRole() == ui::AX_ROLE_TEXT_FIELD || |
| + GetRole() == ui::AX_ROLE_SEARCH_BOX; |
| +} |
| + |
| // Indicates if this object is at the root of a rich edit text control. |
| bool BrowserAccessibility::IsRichTextControl() const { |
| return HasState(ui::AX_STATE_RICHLY_EDITABLE) && |