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/accessibility/browser_accessibility_win.h" | 5 #include "chrome/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.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/accessibility/browser_accessibility_manager_win.h" | 10 #include "chrome/browser/accessibility/browser_accessibility_manager_win.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 gfx::Rect bounds = target->GetBoundsRect(); | 109 gfx::Rect bounds = target->GetBoundsRect(); |
110 *x_left = bounds.x(); | 110 *x_left = bounds.x(); |
111 *y_top = bounds.y(); | 111 *y_top = bounds.y(); |
112 *width = bounds.width(); | 112 *width = bounds.width(); |
113 *height = bounds.height(); | 113 *height = bounds.height(); |
114 | 114 |
115 return S_OK; | 115 return S_OK; |
116 } | 116 } |
117 | 117 |
118 STDMETHODIMP BrowserAccessibilityWin::accNavigate( | 118 STDMETHODIMP BrowserAccessibilityWin::accNavigate( |
119 LONG nav_dir, VARIANT start, VARIANT* end) { | 119 LONG nav_dir, VARIANT start, VARIANT* end) { |
Peter Kasting
2011/03/03 19:35:53
Nit: There are multiple different param indenting
| |
120 BrowserAccessibilityWin* target = GetTargetFromChildID(start); | 120 BrowserAccessibilityWin* target = GetTargetFromChildID(start); |
121 if (!target) | 121 if (!target) |
122 return E_INVALIDARG; | 122 return E_INVALIDARG; |
123 | 123 |
124 if ((nav_dir == NAVDIR_LASTCHILD || nav_dir == NAVDIR_FIRSTCHILD) && | 124 if ((nav_dir == NAVDIR_LASTCHILD || nav_dir == NAVDIR_FIRSTCHILD) && |
125 start.lVal != CHILDID_SELF) { | 125 start.lVal != CHILDID_SELF) { |
126 // MSAA states that navigating to first/last child can only be from self. | 126 // MSAA states that navigating to first/last child can only be from self. |
127 return E_INVALIDARG; | 127 return E_INVALIDARG; |
128 } | 128 } |
129 | 129 |
130 BrowserAccessibility* result = NULL; | 130 BrowserAccessibility* result = NULL; |
131 switch (nav_dir) { | 131 switch (nav_dir) { |
132 case NAVDIR_DOWN: | 132 case NAVDIR_DOWN: |
133 case NAVDIR_UP: | 133 case NAVDIR_UP: |
134 case NAVDIR_LEFT: | 134 case NAVDIR_LEFT: |
135 case NAVDIR_RIGHT: | 135 case NAVDIR_RIGHT: |
136 // These directions are not implemented, matching Mozilla and IE. | 136 // These directions are not implemented, matching Mozilla and IE. |
137 return E_NOTIMPL; | 137 return E_NOTIMPL; |
138 case NAVDIR_FIRSTCHILD: | 138 case NAVDIR_FIRSTCHILD: |
139 if (target->children_.size() > 0) | 139 if (!target->children_.empty()) |
140 result = target->children_[0]; | 140 result = target->children_[0]; |
141 break; | 141 break; |
142 case NAVDIR_LASTCHILD: | 142 case NAVDIR_LASTCHILD: |
143 if (target->children_.size() > 0) | 143 if (!target->children_.empty()) |
144 result = target->children_[target->children_.size() - 1]; | 144 result = target->children_[target->children_.size() - 1]; |
Peter Kasting
2011/03/03 19:35:53
Nit:
result = target->children_.back();
| |
145 break; | 145 break; |
146 case NAVDIR_NEXT: | 146 case NAVDIR_NEXT: |
147 result = target->GetNextSibling(); | 147 result = target->GetNextSibling(); |
148 break; | 148 break; |
149 case NAVDIR_PREVIOUS: | 149 case NAVDIR_PREVIOUS: |
150 result = target->GetPreviousSibling(); | 150 result = target->GetPreviousSibling(); |
151 break; | 151 break; |
152 } | 152 } |
153 | 153 |
154 if (!result) { | 154 if (!result) { |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1597 } | 1597 } |
1598 | 1598 |
1599 // The role should always be set. | 1599 // The role should always be set. |
1600 DCHECK(!role_name_.empty() || ia_role_); | 1600 DCHECK(!role_name_.empty() || ia_role_); |
1601 | 1601 |
1602 // If we didn't explicitly set the IAccessible2 role, make it the same | 1602 // If we didn't explicitly set the IAccessible2 role, make it the same |
1603 // as the MSAA role. | 1603 // as the MSAA role. |
1604 if (!ia2_role_) | 1604 if (!ia2_role_) |
1605 ia2_role_ = ia_role_; | 1605 ia2_role_ = ia_role_; |
1606 } | 1606 } |
OLD | NEW |