Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | |
| 5 #ifndef CONTENT_COMMON_ACCESSIBILITY_MODE_ENUMS_H_ | 4 #ifndef CONTENT_COMMON_ACCESSIBILITY_MODE_ENUMS_H_ |
| 6 #define CONTENT_COMMON_ACCESSIBILITY_MODE_ENUMS_H_ | 5 #define CONTENT_COMMON_ACCESSIBILITY_MODE_ENUMS_H_ |
| 7 | |
| 8 // Note: keep enums in content/browser/resources/accessibility/accessibility.js | 6 // Note: keep enums in content/browser/resources/accessibility/accessibility.js |
| 9 // in sync with these two enums. | 7 // in sync with these two enums. |
| 10 enum AccessibilityModeFlag { | 8 enum AccessibilityMode : int { |
|
danakj
2017/02/17 00:30:39
If this were an enum, then I think what you want i
dougt
2017/02/17 17:46:48
I do see your point about "not being a list of thi
danakj
2017/02/17 17:50:57
That sounds fair, LGTM. I do suggest "enum class"
dougt
2017/02/17 22:30:12
Moving to enum class would mean many/all of our un
| |
| 11 // Native accessibility APIs, specific to each platform, are enabled. | 9 // Native accessibility APIs, specific to each platform, are enabled. |
| 12 // When this flag is set that indicates the presence of a third-party | 10 // When this mode is set that indicates the presence of a third-party |
| 13 // client accessing Chrome via accessibility APIs. However, unless one | 11 // client accessing Chrome via accessibility APIs. However, unless one |
| 14 // of the flags below is set, the contents of web pages will not be | 12 // of the modes below is set, the contents of web pages will not be |
| 15 // accessible. | 13 // accessible. |
| 16 ACCESSIBILITY_MODE_FLAG_NATIVE_APIS = 1 << 0, | 14 NATIVE_APIS = 1 << 0, |
| 17 | 15 |
| 18 // The renderer process will generate an accessibility tree containing | 16 // The renderer process will generate an accessibility tree containing |
| 19 // basic information about all nodes, including role, name, value, | 17 // basic information about all nodes, including role, name, value, |
| 20 // state, and location. This is the minimum flag required in order for | 18 // state, and location. This is the minimum mode required in order for |
| 21 // web contents to be accessible, and the remaining flags are meaningless | 19 // web contents to be accessible, and the remaining modes are meaningless |
| 22 // unless this one is set. | 20 // unless this one is set. |
| 23 // | 21 // |
| 24 // Note that sometimes this flag will be set when | 22 // Note that sometimes this mode will be set when NATIVE_APIS is not, when the |
| 25 // ACCESSIBILITY_MODE_FLAG_NATIVE_APIS is not, when the content layer embedder | 23 // content layer embedder is providing accessibility support via some other |
| 26 // is providing accessibility support via some other mechanism other than | 24 // mechanism other than what's implemented in content/browser. |
| 27 // what's implemented in content/browser. | 25 WEB_CONTENTS = 1 << 1, |
| 28 ACCESSIBILITY_MODE_FLAG_WEB_CONTENTS = 1 << 1, | |
| 29 | 26 |
| 30 // The accessibility tree will contain inline text boxes, which are | 27 // The accessibility tree will contain inline text boxes, which are |
| 31 // necessary to expose information about line breaks and word boundaries. | 28 // necessary to expose information about line breaks and word boundaries. |
| 32 // Without this flag, you can retrieve the plaintext value of a text field | 29 // Without this mode, you can retrieve the plaintext value of a text field |
| 33 // but not the information about how it's broken down into lines. | 30 // but not the information about how it's broken down into lines. |
| 34 // | 31 // |
| 35 // Note that when this flag is off it's still possible to request inline | 32 // Note that when this mode is off it's still possible to request inline |
| 36 // text boxes for a specific node on-demand, asynchronously. | 33 // text boxes for a specific node on-demand, asynchronously. |
| 37 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES = 1 << 2, | 34 INLINE_TEXT_BOXES = 1 << 2, |
| 38 | 35 |
| 39 // The accessibility tree will contain extra accessibility | 36 // The accessibility tree will contain extra accessibility |
| 40 // attributes typically only needed by screen readers and other | 37 // attributes typically only needed by screen readers and other |
| 41 // assistive technology for blind users. Examples include text style | 38 // assistive technology for blind users. Examples include text style |
| 42 // attributes, table cell information, live region properties, range | 39 // attributes, table cell information, live region properties, range |
| 43 // values, and relationship attributes. | 40 // values, and relationship attributes. |
| 44 ACCESSIBILITY_MODE_FLAG_SCREEN_READER = 1 << 3, | 41 SCREEN_READER = 1 << 3, |
| 45 | 42 |
| 46 // The accessibility tree will contain the HTML tag name and HTML attributes | 43 // The accessibility tree will contain the HTML tag name and HTML attributes |
| 47 // for all accessibility nodes that come from web content. | 44 // for all accessibility nodes that come from web content. |
| 48 ACCESSIBILITY_MODE_FLAG_HTML = 1 << 4, | 45 HTML = 1 << 4, |
| 46 | |
| 47 OFF = 0, | |
| 48 | |
| 49 COMPLETE = | |
| 50 NATIVE_APIS | WEB_CONTENTS | INLINE_TEXT_BOXES | SCREEN_READER | HTML, | |
| 51 | |
| 52 WEB_CONTENTS_ONLY = WEB_CONTENTS | INLINE_TEXT_BOXES | SCREEN_READER | HTML | |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 typedef int AccessibilityMode; | 55 inline AccessibilityMode operator|(AccessibilityMode a, AccessibilityMode b) { |
| 56 return static_cast<AccessibilityMode>(int(a) | int(b)); | |
|
dmazzoni
2017/02/17 00:21:50
nit: use static_cast<int>(a), etc.
dougt
2017/02/17 22:30:12
Done.
| |
| 57 } | |
| 52 | 58 |
| 53 const AccessibilityMode AccessibilityModeOff = 0; | 59 inline AccessibilityMode& operator|=(AccessibilityMode& a, |
| 60 AccessibilityMode b) { | |
| 61 return a = a | b; | |
| 62 } | |
| 54 | 63 |
| 55 const AccessibilityMode ACCESSIBILITY_MODE_COMPLETE = | 64 inline AccessibilityMode operator^(AccessibilityMode a, AccessibilityMode b) { |
| 56 ACCESSIBILITY_MODE_FLAG_NATIVE_APIS | | 65 return static_cast<AccessibilityMode>(int(a) ^ int(b)); |
|
dmazzoni
2017/02/17 00:21:50
same
dougt
2017/02/17 22:30:12
Done.
| |
| 57 ACCESSIBILITY_MODE_FLAG_WEB_CONTENTS | | 66 } |
| 58 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES | | |
| 59 ACCESSIBILITY_MODE_FLAG_SCREEN_READER | | |
| 60 ACCESSIBILITY_MODE_FLAG_HTML; | |
| 61 | 67 |
| 62 const AccessibilityMode ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY = | 68 inline AccessibilityMode& operator^=(AccessibilityMode& a, |
| 63 ACCESSIBILITY_MODE_FLAG_WEB_CONTENTS | | 69 AccessibilityMode b) { |
| 64 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES | | 70 return a = a ^ b; |
| 65 ACCESSIBILITY_MODE_FLAG_SCREEN_READER | | 71 } |
| 66 ACCESSIBILITY_MODE_FLAG_HTML; | |
| 67 | 72 |
| 68 #endif // CONTENT_COMMON_ACCESSIBILITY_MODE_ENUMS_H_ | 73 #endif // CONTENT_COMMON_ACCESSIBILITY_MODE_ENUMS_H_ |
| OLD | NEW |