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

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

Issue 2763043002: Implement BrowserAccessibility accLocation in terms of AXPlatformNodeWin. (Closed)
Patch Set: Implement BrowserAccessibility accLocation in terms of AXPlatformNodeWin. 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 | « content/browser/accessibility/browser_accessibility_win.h ('k') | no next file » | 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 476
477 STDMETHODIMP BrowserAccessibilityWin::accLocation(LONG* x_left, 477 STDMETHODIMP BrowserAccessibilityWin::accLocation(LONG* x_left,
478 LONG* y_top, 478 LONG* y_top,
479 LONG* width, 479 LONG* width,
480 LONG* height, 480 LONG* height,
481 VARIANT var_id) { 481 VARIANT var_id) {
482 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_LOCATION); 482 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_LOCATION);
483 if (!instance_active()) 483 if (!instance_active())
484 return E_FAIL; 484 return E_FAIL;
485 485
486 if (!x_left || !y_top || !width || !height) 486 return GetPlatformNodeWin()->accLocation(x_left, y_top, width, height,
487 return E_INVALIDARG; 487 var_id);
488
489 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id);
490 if (!target)
491 return E_INVALIDARG;
492
493 gfx::Rect bounds = target->GetScreenBoundsRect();
494 *x_left = bounds.x();
495 *y_top = bounds.y();
496 *width = bounds.width();
497 *height = bounds.height();
498
499 return S_OK;
500 } 488 }
501 489
502 STDMETHODIMP BrowserAccessibilityWin::accNavigate(LONG nav_dir, 490 STDMETHODIMP BrowserAccessibilityWin::accNavigate(LONG nav_dir,
503 VARIANT start, 491 VARIANT start,
504 VARIANT* end) { 492 VARIANT* end) {
505 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_NAVIGATE); 493 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_NAVIGATE);
506 BrowserAccessibilityWin* target = GetTargetFromChildID(start); 494 BrowserAccessibilityWin* target = GetTargetFromChildID(start);
507 if (!target) 495 if (!target)
508 return E_INVALIDARG; 496 return E_INVALIDARG;
509 497
(...skipping 4520 matching lines...) Expand 10 before | Expand all | Expand 10 after
5030 } 5018 }
5031 5019
5032 void BrowserAccessibilityWin::FireNativeEvent(LONG win_event_type) const { 5020 void BrowserAccessibilityWin::FireNativeEvent(LONG win_event_type) const {
5033 (new BrowserAccessibilityEventWin( 5021 (new BrowserAccessibilityEventWin(
5034 BrowserAccessibilityEvent::FromTreeChange, 5022 BrowserAccessibilityEvent::FromTreeChange,
5035 ui::AX_EVENT_NONE, 5023 ui::AX_EVENT_NONE,
5036 win_event_type, 5024 win_event_type,
5037 this))->Fire(); 5025 this))->Fire();
5038 } 5026 }
5039 5027
5028 ui::AXPlatformNodeWin* BrowserAccessibilityWin::GetPlatformNodeWin() const {
5029 DCHECK(platform_node_);
5030 return static_cast<ui::AXPlatformNodeWin*>(platform_node_);
5031 }
5032
5040 void BrowserAccessibilityWin::InitRoleAndState() { 5033 void BrowserAccessibilityWin::InitRoleAndState() {
5041 int32_t ia_role = 0; 5034 int32_t ia_role = 0;
5042 int32_t ia_state = 0; 5035 int32_t ia_state = 0;
5043 base::string16 role_name; 5036 base::string16 role_name;
5044 int32_t ia2_role = 0; 5037 int32_t ia2_role = 0;
5045 int32_t ia2_state = IA2_STATE_OPAQUE; 5038 int32_t ia2_state = IA2_STATE_OPAQUE;
5046 5039
5047 if (HasState(ui::AX_STATE_BUSY)) 5040 if (HasState(ui::AX_STATE_BUSY))
5048 ia_state |= STATE_SYSTEM_BUSY; 5041 ia_state |= STATE_SYSTEM_BUSY;
5049 if (HasState(ui::AX_STATE_CHECKED)) 5042 if (HasState(ui::AX_STATE_CHECKED))
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
5623 return static_cast<BrowserAccessibilityWin*>(obj); 5616 return static_cast<BrowserAccessibilityWin*>(obj);
5624 } 5617 }
5625 5618
5626 const BrowserAccessibilityWin* 5619 const BrowserAccessibilityWin*
5627 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 5620 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
5628 DCHECK(!obj || obj->IsNative()); 5621 DCHECK(!obj || obj->IsNative());
5629 return static_cast<const BrowserAccessibilityWin*>(obj); 5622 return static_cast<const BrowserAccessibilityWin*>(obj);
5630 } 5623 }
5631 5624
5632 } // namespace content 5625 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698