Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: ui/accessibility/platform/ax_platform_node_win.cc

Issue 1811403002: IAccessible::get_accChild should only return a descendant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <atlbase.h> 5 #include <atlbase.h>
6 #include <atlcom.h> 6 #include <atlcom.h>
7 #include <limits.h> 7 #include <limits.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 *disp_child = this; 326 *disp_child = this;
327 (*disp_child)->AddRef(); 327 (*disp_child)->AddRef();
328 return S_OK; 328 return S_OK;
329 } 329 }
330 330
331 if (child_id >= 1 && child_id <= delegate_->GetChildCount()) { 331 if (child_id >= 1 && child_id <= delegate_->GetChildCount()) {
332 // Positive child ids are a 1-based child index, used by clients 332 // Positive child ids are a 1-based child index, used by clients
333 // that want to enumerate all immediate children. 333 // that want to enumerate all immediate children.
334 *disp_child = delegate_->ChildAtIndex(child_id - 1); 334 *disp_child = delegate_->ChildAtIndex(child_id - 1);
335 if (!(*disp_child)) 335 if (!(*disp_child))
336 return E_FAIL; 336 return E_INVALIDARG;
337 (*disp_child)->AddRef(); 337 (*disp_child)->AddRef();
338 return S_OK; 338 return S_OK;
339 } 339 }
340 340
341 if (child_id >= 0) 341 if (child_id >= 0)
342 return E_FAIL; 342 return E_INVALIDARG;
343 343
344 // Negative child ids can be used to map to any descendant. 344 // Negative child ids can be used to map to any descendant.
345 AXPlatformNodeWin* child = static_cast<AXPlatformNodeWin*>( 345 AXPlatformNodeWin* child = static_cast<AXPlatformNodeWin*>(
346 GetFromUniqueId(-child_id)); 346 GetFromUniqueId(-child_id));
347 if (child && !IsDescendant(child))
348 child = nullptr;
349
347 if (child) { 350 if (child) {
348 *disp_child = child; 351 *disp_child = child;
349 (*disp_child)->AddRef(); 352 (*disp_child)->AddRef();
350 return S_OK; 353 return S_OK;
351 } 354 }
352 355
353 *disp_child = nullptr; 356 *disp_child = nullptr;
354 return E_FAIL; 357 return E_INVALIDARG;
355 } 358 }
356 359
357 STDMETHODIMP AXPlatformNodeWin::get_accChildCount(LONG* child_count) { 360 STDMETHODIMP AXPlatformNodeWin::get_accChildCount(LONG* child_count) {
358 COM_OBJECT_VALIDATE_1_ARG(child_count); 361 COM_OBJECT_VALIDATE_1_ARG(child_count);
359 *child_count = delegate_->GetChildCount(); 362 *child_count = delegate_->GetChildCount();
360 return S_OK; 363 return S_OK;
361 } 364 }
362 365
363 STDMETHODIMP AXPlatformNodeWin::get_accDefaultAction( 366 STDMETHODIMP AXPlatformNodeWin::get_accDefaultAction(
364 VARIANT var_id, BSTR* def_action) { 367 VARIANT var_id, BSTR* def_action) {
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 LONG start_offset, 1130 LONG start_offset,
1128 ui::TextBoundaryDirection direction) { 1131 ui::TextBoundaryDirection direction) {
1129 HandleSpecialTextOffset(text, &start_offset); 1132 HandleSpecialTextOffset(text, &start_offset);
1130 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); 1133 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary);
1131 std::vector<int32_t> line_breaks; 1134 std::vector<int32_t> line_breaks;
1132 return static_cast<LONG>(ui::FindAccessibleTextBoundary( 1135 return static_cast<LONG>(ui::FindAccessibleTextBoundary(
1133 text, line_breaks, boundary, start_offset, direction)); 1136 text, line_breaks, boundary, start_offset, direction));
1134 } 1137 }
1135 1138
1136 } // namespace ui 1139 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_base.cc ('k') | ui/accessibility/platform/ax_platform_node_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698