| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 4 |
| 5 #include "chrome/browser/browser_accessibility_win.h" | 5 #include "chrome/browser/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_accessibility_manager_win.h" | 10 #include "chrome/browser/browser_accessibility_manager_win.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 index_in_parent_ = index_in_parent; | 39 index_in_parent_ = index_in_parent; |
| 40 | 40 |
| 41 renderer_id_ = src.id; | 41 renderer_id_ = src.id; |
| 42 name_ = src.name; | 42 name_ = src.name; |
| 43 value_ = src.value; | 43 value_ = src.value; |
| 44 attributes_ = src.attributes; | 44 attributes_ = src.attributes; |
| 45 html_attributes_ = src.html_attributes; | 45 html_attributes_ = src.html_attributes; |
| 46 location_ = src.location; | 46 location_ = src.location; |
| 47 InitRoleAndState(src.role, src.state); | 47 InitRoleAndState(src.role, src.state); |
| 48 | 48 |
| 49 // Expose headings levels to NVDA with the "level" object attribute. |
| 50 if (src.role == WebAccessibility::ROLE_HEADING && role_name_.size() == 2 && |
| 51 IsAsciiDigit(role_name_[1])) { |
| 52 html_attributes_.push_back(std::make_pair(L"level", role_name_.substr(1))); |
| 53 } |
| 54 |
| 49 // If this object doesn't have a name but it does have a description, | 55 // If this object doesn't have a name but it does have a description, |
| 50 // use the description as its name - because some screen readers only | 56 // use the description as its name - because some screen readers only |
| 51 // announce the name. | 57 // announce the name. |
| 52 if (name_.empty() && HasAttribute(WebAccessibility::ATTR_DESCRIPTION)) { | 58 if (name_.empty() && HasAttribute(WebAccessibility::ATTR_DESCRIPTION)) { |
| 53 GetAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_); | 59 GetAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_); |
| 54 } | 60 } |
| 55 | 61 |
| 56 instance_active_ = true; | 62 instance_active_ = true; |
| 57 } | 63 } |
| 58 | 64 |
| (...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 } | 1364 } |
| 1359 | 1365 |
| 1360 // The role should always be set. | 1366 // The role should always be set. |
| 1361 DCHECK(!role_name_.empty() || role_); | 1367 DCHECK(!role_name_.empty() || role_); |
| 1362 | 1368 |
| 1363 // If we didn't explicitly set the IAccessible2 role, make it the same | 1369 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 1364 // as the MSAA role. | 1370 // as the MSAA role. |
| 1365 if (!ia2_role_) | 1371 if (!ia2_role_) |
| 1366 ia2_role_ = role_; | 1372 ia2_role_ = role_; |
| 1367 } | 1373 } |
| OLD | NEW |