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

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 2806963002: Implement BrowserAccessibility accNavigate() in terms of AXPlatformNodeWin. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_win.h" 5 #include "content/browser/accessibility/browser_accessibility_win.h"
6 6
7 #include <UIAutomationClient.h> 7 #include <UIAutomationClient.h>
8 #include <UIAutomationCoreApi.h> 8 #include <UIAutomationCoreApi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 return E_FAIL; 484 return E_FAIL;
485 485
486 return GetPlatformNodeWin()->accLocation(x_left, y_top, width, height, 486 return GetPlatformNodeWin()->accLocation(x_left, y_top, width, height,
487 var_id); 487 var_id);
488 } 488 }
489 489
490 STDMETHODIMP BrowserAccessibilityWin::accNavigate(LONG nav_dir, 490 STDMETHODIMP BrowserAccessibilityWin::accNavigate(LONG nav_dir,
491 VARIANT start, 491 VARIANT start,
492 VARIANT* end) { 492 VARIANT* end) {
493 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_NAVIGATE); 493 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_NAVIGATE);
494 BrowserAccessibilityWin* target = GetTargetFromChildID(start); 494 BrowserAccessibilityWin* target = GetTargetFromChildID(start);
dougt 2017/04/08 06:49:30 I mentioned this elsewhere, I think we should do t
495 if (!target) 495 if (!target)
496 return E_INVALIDARG; 496 return E_INVALIDARG;
497 497
498 if ((nav_dir == NAVDIR_LASTCHILD || nav_dir == NAVDIR_FIRSTCHILD) && 498 // Forward all directions but NAVDIR_ to the platform node implementation.
499 start.lVal != CHILDID_SELF) { 499 if (nav_dir != NAVDIR_DOWN && nav_dir != NAVDIR_UP &&
500 // MSAA states that navigating to first/last child can only be from self. 500 nav_dir != NAVDIR_LEFT && nav_dir != NAVDIR_RIGHT) {
501 return E_INVALIDARG; 501 return target->GetPlatformNodeWin()->accNavigate(nav_dir, start, end);
502 } 502 }
503 503
504 uint32_t child_count = target->PlatformChildCount();
505 BrowserAccessibility* result = nullptr; 504 BrowserAccessibility* result = nullptr;
506 switch (nav_dir) { 505 switch (nav_dir) {
507 case NAVDIR_DOWN: 506 case NAVDIR_DOWN:
508 result = target->GetTableCell(GetTableRow() + GetTableRowSpan(), 507 result = target->GetTableCell(GetTableRow() + GetTableRowSpan(),
509 GetTableColumn()); 508 GetTableColumn());
510 break; 509 break;
511 case NAVDIR_UP: 510 case NAVDIR_UP:
512 result = target->GetTableCell(GetTableRow() - 1, GetTableColumn()); 511 result = target->GetTableCell(GetTableRow() - 1, GetTableColumn());
513 break; 512 break;
514 case NAVDIR_LEFT: 513 case NAVDIR_LEFT:
515 result = target->GetTableCell(GetTableRow(), GetTableColumn() - 1); 514 result = target->GetTableCell(GetTableRow(), GetTableColumn() - 1);
516 break; 515 break;
517 case NAVDIR_RIGHT: 516 case NAVDIR_RIGHT:
518 result = target->GetTableCell(GetTableRow(), 517 result = target->GetTableCell(GetTableRow(),
519 GetTableColumn() + GetTableColumnSpan()); 518 GetTableColumn() + GetTableColumnSpan());
520 break; 519 break;
521 case NAVDIR_FIRSTCHILD:
522 if (child_count > 0)
523 result = target->PlatformGetChild(0);
524 break;
525 case NAVDIR_LASTCHILD:
526 if (child_count > 0)
527 result = target->PlatformGetChild(child_count - 1);
528 break;
529 case NAVDIR_NEXT:
530 result = target->GetNextSibling();
531 break;
532 case NAVDIR_PREVIOUS:
533 result = target->GetPreviousSibling();
534 break;
535 } 520 }
536 521
537 if (!result) { 522 if (!result) {
538 end->vt = VT_EMPTY; 523 end->vt = VT_EMPTY;
539 return S_FALSE; 524 return S_FALSE;
540 } 525 }
541 526
542 end->vt = VT_DISPATCH; 527 end->vt = VT_DISPATCH;
543 end->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); 528 end->pdispVal = ToBrowserAccessibilityWin(result)->NewReference();
544 return S_OK; 529 return S_OK;
(...skipping 5071 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 return static_cast<BrowserAccessibilityWin*>(obj); 5601 return static_cast<BrowserAccessibilityWin*>(obj);
5617 } 5602 }
5618 5603
5619 const BrowserAccessibilityWin* 5604 const BrowserAccessibilityWin*
5620 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 5605 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
5621 DCHECK(!obj || obj->IsNative()); 5606 DCHECK(!obj || obj->IsNative());
5622 return static_cast<const BrowserAccessibilityWin*>(obj); 5607 return static_cast<const BrowserAccessibilityWin*>(obj);
5623 } 5608 }
5624 5609
5625 } // namespace content 5610 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698