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

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

Issue 8588036: Improve support for multiselect list box accessibility on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "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 "base/win/enum_variant.h"
10 #include "base/win/scoped_comptr.h" 11 #include "base/win/scoped_comptr.h"
11 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 12 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
12 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
13 #include "net/base/escape.h" 14 #include "net/base/escape.h"
14 #include "ui/base/accessibility/accessible_text_utils.h" 15 #include "ui/base/accessibility/accessible_text_utils.h"
15 16
16 using webkit_glue::WebAccessibility; 17 using webkit_glue::WebAccessibility;
17 18
18 // The GUID for the ISimpleDOM service is not defined in the IDL files. 19 // The GUID for the ISimpleDOM service is not defined in the IDL files.
19 // This is taken directly from the Mozilla sources 20 // This is taken directly from the Mozilla sources
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 BrowserAccessibilityWin* BrowserAccessibility::toBrowserAccessibilityWin() { 163 BrowserAccessibilityWin* BrowserAccessibility::toBrowserAccessibilityWin() {
163 return static_cast<BrowserAccessibilityWin*>(this); 164 return static_cast<BrowserAccessibilityWin*>(this);
164 } 165 }
165 166
166 BrowserAccessibilityWin::BrowserAccessibilityWin() 167 BrowserAccessibilityWin::BrowserAccessibilityWin()
167 : ia_role_(0), 168 : ia_role_(0),
168 ia_state_(0), 169 ia_state_(0),
169 ia2_role_(0), 170 ia2_role_(0),
170 ia2_state_(0), 171 ia2_state_(0),
171 first_time_(true) { 172 first_time_(true),
173 old_ia_state_(0) {
172 } 174 }
173 175
174 BrowserAccessibilityWin::~BrowserAccessibilityWin() { 176 BrowserAccessibilityWin::~BrowserAccessibilityWin() {
175 for (size_t i = 0; i < relations_.size(); ++i) 177 for (size_t i = 0; i < relations_.size(); ++i)
176 relations_[i]->Release(); 178 relations_[i]->Release();
177 } 179 }
178 180
179 // 181 //
180 // IAccessible methods. 182 // IAccessible methods.
181 // 183 //
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 524
523 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic( 525 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(
524 BSTR* help_file, VARIANT var_id, LONG* topic_id) { 526 BSTR* help_file, VARIANT var_id, LONG* topic_id) {
525 return E_NOTIMPL; 527 return E_NOTIMPL;
526 } 528 }
527 529
528 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { 530 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) {
529 if (!instance_active_) 531 if (!instance_active_)
530 return E_FAIL; 532 return E_FAIL;
531 533
532 return E_NOTIMPL; 534 if (role_ != WebAccessibility::ROLE_LISTBOX)
535 return E_NOTIMPL;
536
537 unsigned long selected_count = 0;
538 for (size_t i = 0; i < children_.size(); i++) {
David Tseng 2011/11/30 19:07:09 nit: ++i and elsewhere below.
dmazzoni 2011/11/30 19:55:39 Done.
539 if (children_[i]->HasState(WebAccessibility::STATE_SELECTED))
540 selected_count++;
541 }
542
543 if (selected_count == 0) {
544 selected->vt = VT_EMPTY;
545 return S_OK;
546 }
547
548 if (selected_count == 1) {
549 for (size_t i = 0; i < children_.size(); i++) {
550 if (children_[i]->HasState(WebAccessibility::STATE_SELECTED)) {
551 selected->vt = VT_DISPATCH;
552 selected->pdispVal =
553 children_[i]->toBrowserAccessibilityWin()->NewReference();
554 return S_OK;
555 }
556 }
557 }
558
559 // Multiple items are selected.
560 base::win::EnumVariant* enum_variant =
561 new base::win::EnumVariant(selected_count);
562 enum_variant->AddRef();
563 unsigned long index = 0;
564 for (size_t i = 0; i < children_.size(); i++) {
565 if (children_[i]->HasState(WebAccessibility::STATE_SELECTED)) {
566 enum_variant->ItemAt(index)->vt = VT_DISPATCH;
567 enum_variant->ItemAt(index)->pdispVal =
568 children_[i]->toBrowserAccessibilityWin()->NewReference();
569 index++;
570 }
571 }
572 selected->vt = VT_UNKNOWN;
573 selected->punkVal = static_cast<base::win::IUnknownImpl*>(enum_variant);
574 return S_OK;
David Tseng 2011/11/30 19:07:09 Could we integrate these three loops? Perhaps chec
dmazzoni 2011/11/30 19:55:39 The multiple attribute indicates whether selecting
533 } 575 }
534 576
535 STDMETHODIMP BrowserAccessibilityWin::accSelect( 577 STDMETHODIMP BrowserAccessibilityWin::accSelect(
536 LONG flags_sel, VARIANT var_id) { 578 LONG flags_sel, VARIANT var_id) {
537 if (!instance_active_) 579 if (!instance_active_)
538 return E_FAIL; 580 return E_FAIL;
539 581
540 if (flags_sel & SELFLAG_TAKEFOCUS) { 582 if (flags_sel & SELFLAG_TAKEFOCUS) {
541 manager_->SetFocus(this, true); 583 manager_->SetFocus(this, true);
542 return S_OK; 584 return S_OK;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return S_FALSE; 718 return S_FALSE;
677 719
678 for (long i = 0; i < count; ++i) { 720 for (long i = 0; i < count; ++i) {
679 relations_[i]->AddRef(); 721 relations_[i]->AddRef();
680 relations[i] = relations_[i]; 722 relations[i] = relations_[i];
681 } 723 }
682 724
683 return S_OK; 725 return S_OK;
684 } 726 }
685 727
728 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition(
729 LONG* group_level,
730 LONG* similar_items_in_group,
731 LONG* position_in_group) {
732 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION &&
733 parent_ &&
734 parent_->role() == WebAccessibility::ROLE_LISTBOX) {
735 *group_level = 0;
David Tseng 2011/11/30 19:07:09 Do we need to check for the validity of these poin
dmazzoni 2011/11/30 19:55:39 Good catch, done.
736 *similar_items_in_group = parent_->child_count();
737 *position_in_group = index_in_parent_ + 1;
738 return S_OK;
739 }
740
741 return E_NOTIMPL;
742 }
743
686 // 744 //
687 // IAccessibleImage methods. 745 // IAccessibleImage methods.
688 // 746 //
689 747
690 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { 748 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) {
691 if (!instance_active_) 749 if (!instance_active_)
692 return E_FAIL; 750 return E_FAIL;
693 751
694 if (!desc) 752 if (!desc)
695 return E_INVALIDARG; 753 return E_INVALIDARG;
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 } 2386 }
2329 2387
2330 // Expose the "display" and "tag" attributes. 2388 // Expose the "display" and "tag" attributes.
2331 StringAttributeToIA2(WebAccessibility::ATTR_DISPLAY, "display"); 2389 StringAttributeToIA2(WebAccessibility::ATTR_DISPLAY, "display");
2332 StringAttributeToIA2(WebAccessibility::ATTR_HTML_TAG, "tag"); 2390 StringAttributeToIA2(WebAccessibility::ATTR_HTML_TAG, "tag");
2333 StringAttributeToIA2(WebAccessibility::ATTR_ROLE, "xml-roles"); 2391 StringAttributeToIA2(WebAccessibility::ATTR_ROLE, "xml-roles");
2334 2392
2335 // Expose "level" attribute for tree nodes. 2393 // Expose "level" attribute for tree nodes.
2336 IntAttributeToIA2(WebAccessibility::ATTR_HIERARCHICAL_LEVEL, "level"); 2394 IntAttributeToIA2(WebAccessibility::ATTR_HIERARCHICAL_LEVEL, "level");
2337 2395
2396 // Expose the set size and position in set for listbox options.
2397 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION &&
2398 parent_ &&
2399 parent_->role() == WebAccessibility::ROLE_LISTBOX) {
2400 ia2_attributes_.push_back(
2401 L"setsize:" + base::IntToString16(parent_->child_count()));
2402 ia2_attributes_.push_back(
2403 L"setsize:" + base::IntToString16(index_in_parent_ + 1));
2404 }
2405
2338 // Expose live region attributes. 2406 // Expose live region attributes.
2339 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_STATUS, "live"); 2407 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_STATUS, "live");
2340 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_RELEVANT, "relevant"); 2408 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_RELEVANT, "relevant");
2341 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_ATOMIC, "atomic"); 2409 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_ATOMIC, "atomic");
2342 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_BUSY, "busy"); 2410 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_BUSY, "busy");
2343 2411
2344 // Expose container live region attributes. 2412 // Expose container live region attributes.
2345 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_STATUS, 2413 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_STATUS,
2346 "container-live"); 2414 "container-live");
2347 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_RELEVANT, 2415 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_RELEVANT,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 } 2448 }
2381 if (index >= 0) { 2449 if (index >= 0) {
2382 ia2_attributes_.push_back(string16(L"table-cell-index:") + 2450 ia2_attributes_.push_back(string16(L"table-cell-index:") +
2383 base::IntToString16(index)); 2451 base::IntToString16(index));
2384 } 2452 }
2385 } else { 2453 } else {
2386 NOTREACHED(); 2454 NOTREACHED();
2387 } 2455 }
2388 } 2456 }
2389 2457
2390 // If this is static text, put the text in the name rather than the value. 2458 if (name_.empty() &&
2391 if (role_ == WebAccessibility::ROLE_STATIC_TEXT && name_.empty()) 2459 (role_ == WebAccessibility::ROLE_LISTBOX_OPTION ||
2460 role_ == WebAccessibility::ROLE_STATIC_TEXT)) {
2392 name_.swap(value_); 2461 name_.swap(value_);
2462 }
2393 2463
2394 // If this object doesn't have a name but it does have a description, 2464 // If this object doesn't have a name but it does have a description,
2395 // use the description as its name - because some screen readers only 2465 // use the description as its name - because some screen readers only
2396 // announce the name. 2466 // announce the name.
2397 if (name_.empty()) 2467 if (name_.empty())
2398 GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_); 2468 GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_);
2399 2469
2400 // If this doesn't have a value and is linked then set its value to the url 2470 // If this doesn't have a value and is linked then set its value to the url
2401 // attribute. This allows screen readers to read an empty link's destination. 2471 // attribute. This allows screen readers to read an empty link's destination.
2402 string16 url; 2472 string16 url;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 manager_->NotifyAccessibilityEvent( 2506 manager_->NotifyAccessibilityEvent(
2437 ViewHostMsg_AccEvent::OBJECT_SHOW, this); 2507 ViewHostMsg_AccEvent::OBJECT_SHOW, this);
2438 } 2508 }
2439 2509
2440 // TODO(dmazzoni): Look into HIDE events, too. 2510 // TODO(dmazzoni): Look into HIDE events, too.
2441 2511
2442 old_text_ = previous_text_; 2512 old_text_ = previous_text_;
2443 previous_text_ = text; 2513 previous_text_ = text;
2444 } 2514 }
2445 2515
2516 // Fire events if the state has changed.
2517 if (!first_time_ && ia_state_ != old_ia_state_) {
2518 // Normally focus events are handled elsewhere, however
2519 // focus for managed descendants is platform-specific.
2520 // Fire a focus event if the focused descendant in a multi-select
2521 // list box changes.
2522 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION &&
2523 (ia_state_ & STATE_SYSTEM_FOCUSABLE) &&
2524 (ia_state_ & STATE_SYSTEM_SELECTABLE) &&
2525 (ia_state_ & STATE_SYSTEM_FOCUSED) &&
2526 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) {
2527 ::NotifyWinEvent(EVENT_OBJECT_FOCUS,
2528 manager_->GetParentView(),
2529 OBJID_CLIENT,
2530 child_id());
2531 }
2532
2533 if ((ia_state_ & STATE_SYSTEM_SELECTED) &&
2534 !(old_ia_state_ & STATE_SYSTEM_SELECTED)) {
2535 ::NotifyWinEvent(EVENT_OBJECT_SELECTIONADD,
2536 manager_->GetParentView(),
2537 OBJID_CLIENT,
2538 child_id());
2539 } else if (!(ia_state_ & STATE_SYSTEM_SELECTED) &&
2540 (old_ia_state_ & STATE_SYSTEM_SELECTED)) {
2541 ::NotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE,
2542 manager_->GetParentView(),
2543 OBJID_CLIENT,
2544 child_id());
2545 }
2546
2547 old_ia_state_ = ia_state_;
2548 }
2549
2446 first_time_ = false; 2550 first_time_ = false;
2447 } 2551 }
2448 2552
2449 void BrowserAccessibilityWin::NativeAddReference() { 2553 void BrowserAccessibilityWin::NativeAddReference() {
2450 AddRef(); 2554 AddRef();
2451 } 2555 }
2452 2556
2453 void BrowserAccessibilityWin::NativeReleaseReference() { 2557 void BrowserAccessibilityWin::NativeReleaseReference() {
2454 Release(); 2558 Release();
2455 } 2559 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( 2668 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID(
2565 int32 renderer_id) { 2669 int32 renderer_id) {
2566 return manager_->GetFromRendererID(renderer_id)->toBrowserAccessibilityWin(); 2670 return manager_->GetFromRendererID(renderer_id)->toBrowserAccessibilityWin();
2567 } 2671 }
2568 2672
2569 void BrowserAccessibilityWin::InitRoleAndState() { 2673 void BrowserAccessibilityWin::InitRoleAndState() {
2570 ia_state_ = 0; 2674 ia_state_ = 0;
2571 ia2_state_ = IA2_STATE_OPAQUE; 2675 ia2_state_ = IA2_STATE_OPAQUE;
2572 ia2_attributes_.clear(); 2676 ia2_attributes_.clear();
2573 2677
2574 if ((state_ >> WebAccessibility::STATE_BUSY) & 1) 2678 if (HasState(WebAccessibility::STATE_BUSY))
2575 ia_state_|= STATE_SYSTEM_BUSY; 2679 ia_state_|= STATE_SYSTEM_BUSY;
2576 if ((state_ >> WebAccessibility::STATE_CHECKED) & 1) 2680 if (HasState(WebAccessibility::STATE_CHECKED))
2577 ia_state_ |= STATE_SYSTEM_CHECKED; 2681 ia_state_ |= STATE_SYSTEM_CHECKED;
2578 if ((state_ >> WebAccessibility::STATE_COLLAPSED) & 1) 2682 if (HasState(WebAccessibility::STATE_COLLAPSED))
2579 ia_state_|= STATE_SYSTEM_COLLAPSED; 2683 ia_state_|= STATE_SYSTEM_COLLAPSED;
2580 if ((state_ >> WebAccessibility::STATE_EXPANDED) & 1) 2684 if (HasState(WebAccessibility::STATE_EXPANDED))
2581 ia_state_|= STATE_SYSTEM_EXPANDED; 2685 ia_state_|= STATE_SYSTEM_EXPANDED;
2582 if ((state_ >> WebAccessibility::STATE_FOCUSABLE) & 1) 2686 if (HasState(WebAccessibility::STATE_FOCUSABLE))
2583 ia_state_|= STATE_SYSTEM_FOCUSABLE; 2687 ia_state_|= STATE_SYSTEM_FOCUSABLE;
2584 if ((state_ >> WebAccessibility::STATE_HASPOPUP) & 1) 2688 if (HasState(WebAccessibility::STATE_HASPOPUP))
2585 ia_state_|= STATE_SYSTEM_HASPOPUP; 2689 ia_state_|= STATE_SYSTEM_HASPOPUP;
2586 if ((state_ >> WebAccessibility::STATE_HOTTRACKED) & 1) 2690 if (HasState(WebAccessibility::STATE_HOTTRACKED))
2587 ia_state_|= STATE_SYSTEM_HOTTRACKED; 2691 ia_state_|= STATE_SYSTEM_HOTTRACKED;
2588 if ((state_ >> WebAccessibility::STATE_INDETERMINATE) & 1) 2692 if (HasState(WebAccessibility::STATE_INDETERMINATE))
2589 ia_state_|= STATE_SYSTEM_INDETERMINATE; 2693 ia_state_|= STATE_SYSTEM_INDETERMINATE;
2590 if ((state_ >> WebAccessibility::STATE_INVISIBLE) & 1) 2694 if (HasState(WebAccessibility::STATE_INVISIBLE))
2591 ia_state_|= STATE_SYSTEM_INVISIBLE; 2695 ia_state_|= STATE_SYSTEM_INVISIBLE;
2592 if ((state_ >> WebAccessibility::STATE_LINKED) & 1) 2696 if (HasState(WebAccessibility::STATE_LINKED))
2593 ia_state_|= STATE_SYSTEM_LINKED; 2697 ia_state_|= STATE_SYSTEM_LINKED;
2594 if ((state_ >> WebAccessibility::STATE_MULTISELECTABLE) & 1) 2698 if (HasState(WebAccessibility::STATE_MULTISELECTABLE)) {
2699 ia_state_|= STATE_SYSTEM_EXTSELECTABLE;
2595 ia_state_|= STATE_SYSTEM_MULTISELECTABLE; 2700 ia_state_|= STATE_SYSTEM_MULTISELECTABLE;
2701 }
2596 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. 2702 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect.
2597 if ((state_ >> WebAccessibility::STATE_OFFSCREEN) & 1) 2703 if (HasState(WebAccessibility::STATE_OFFSCREEN))
2598 ia_state_|= STATE_SYSTEM_OFFSCREEN; 2704 ia_state_|= STATE_SYSTEM_OFFSCREEN;
2599 if ((state_ >> WebAccessibility::STATE_PRESSED) & 1) 2705 if (HasState(WebAccessibility::STATE_PRESSED))
2600 ia_state_|= STATE_SYSTEM_PRESSED; 2706 ia_state_|= STATE_SYSTEM_PRESSED;
2601 if ((state_ >> WebAccessibility::STATE_PROTECTED) & 1) 2707 if (HasState(WebAccessibility::STATE_PROTECTED))
2602 ia_state_|= STATE_SYSTEM_PROTECTED; 2708 ia_state_|= STATE_SYSTEM_PROTECTED;
2603 if ((state_ >> WebAccessibility::STATE_REQUIRED) & 1) 2709 if (HasState(WebAccessibility::STATE_REQUIRED))
2604 ia2_state_|= IA2_STATE_REQUIRED; 2710 ia2_state_|= IA2_STATE_REQUIRED;
2605 if ((state_ >> WebAccessibility::STATE_SELECTABLE) & 1) 2711 if (HasState(WebAccessibility::STATE_SELECTABLE))
2606 ia_state_|= STATE_SYSTEM_SELECTABLE; 2712 ia_state_|= STATE_SYSTEM_SELECTABLE;
2607 if ((state_ >> WebAccessibility::STATE_SELECTED) & 1) 2713 if (HasState(WebAccessibility::STATE_SELECTED))
2608 ia_state_|= STATE_SYSTEM_SELECTED; 2714 ia_state_|= STATE_SYSTEM_SELECTED;
2609 if ((state_ >> WebAccessibility::STATE_TRAVERSED) & 1) 2715 if (HasState(WebAccessibility::STATE_TRAVERSED))
2610 ia_state_|= STATE_SYSTEM_TRAVERSED; 2716 ia_state_|= STATE_SYSTEM_TRAVERSED;
2611 if ((state_ >> WebAccessibility::STATE_UNAVAILABLE) & 1) 2717 if (HasState(WebAccessibility::STATE_UNAVAILABLE))
2612 ia_state_|= STATE_SYSTEM_UNAVAILABLE; 2718 ia_state_|= STATE_SYSTEM_UNAVAILABLE;
2613 if ((state_ >> WebAccessibility::STATE_VERTICAL) & 1) { 2719 if (HasState(WebAccessibility::STATE_VERTICAL)) {
2614 ia2_state_|= IA2_STATE_VERTICAL; 2720 ia2_state_|= IA2_STATE_VERTICAL;
2615 } else { 2721 } else {
2616 ia2_state_|= IA2_STATE_HORIZONTAL; 2722 ia2_state_|= IA2_STATE_HORIZONTAL;
2617 } 2723 }
2618 if ((state_ >> WebAccessibility::STATE_VISITED) & 1) 2724 if (HasState(WebAccessibility::STATE_VISITED))
2619 ia_state_|= STATE_SYSTEM_TRAVERSED; 2725 ia_state_|= STATE_SYSTEM_TRAVERSED;
2620 2726
2621 // The meaning of the readonly state on Windows is very different from 2727 // The meaning of the readonly state on Windows is very different from
2622 // the meaning of the readonly state in WebKit, so we ignore 2728 // the meaning of the readonly state in WebKit, so we ignore
2623 // WebAccessibility::STATE_READONLY, and instead just check the 2729 // WebAccessibility::STATE_READONLY, and instead just check the
2624 // aria readonly value, then there's additional logic below to set 2730 // aria readonly value, then there's additional logic below to set
2625 // the readonly state based on other criteria. 2731 // the readonly state based on other criteria.
2626 bool aria_readonly = false; 2732 bool aria_readonly = false;
2627 GetBoolAttribute(WebAccessibility::ATTR_ARIA_READONLY, &aria_readonly); 2733 GetBoolAttribute(WebAccessibility::ATTR_ARIA_READONLY, &aria_readonly);
2628 if (aria_readonly) 2734 if (aria_readonly)
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 break; 2887 break;
2782 case WebAccessibility::ROLE_LIST: 2888 case WebAccessibility::ROLE_LIST:
2783 ia_role_ = ROLE_SYSTEM_LIST; 2889 ia_role_ = ROLE_SYSTEM_LIST;
2784 ia_state_|= STATE_SYSTEM_READONLY; 2890 ia_state_|= STATE_SYSTEM_READONLY;
2785 break; 2891 break;
2786 case WebAccessibility::ROLE_LISTBOX: 2892 case WebAccessibility::ROLE_LISTBOX:
2787 ia_role_ = ROLE_SYSTEM_LIST; 2893 ia_role_ = ROLE_SYSTEM_LIST;
2788 break; 2894 break;
2789 case WebAccessibility::ROLE_LISTBOX_OPTION: 2895 case WebAccessibility::ROLE_LISTBOX_OPTION:
2790 ia_role_ = ROLE_SYSTEM_LISTITEM; 2896 ia_role_ = ROLE_SYSTEM_LISTITEM;
2897 if (ia_state_ & STATE_SYSTEM_SELECTABLE) {
2898 ia_state_ |= STATE_SYSTEM_FOCUSABLE;
2899 if (HasState(WebAccessibility::STATE_FOCUSED))
2900 ia_state_|= STATE_SYSTEM_FOCUSED;
2901 }
2791 break; 2902 break;
2792 case WebAccessibility::ROLE_LIST_ITEM: 2903 case WebAccessibility::ROLE_LIST_ITEM:
2793 ia_role_ = ROLE_SYSTEM_LISTITEM; 2904 ia_role_ = ROLE_SYSTEM_LISTITEM;
2794 ia_state_|= STATE_SYSTEM_READONLY; 2905 ia_state_|= STATE_SYSTEM_READONLY;
2795 break; 2906 break;
2796 case WebAccessibility::ROLE_LIST_MARKER: 2907 case WebAccessibility::ROLE_LIST_MARKER:
2797 ia_role_ = ROLE_SYSTEM_TEXT; 2908 ia_role_ = ROLE_SYSTEM_TEXT;
2798 ia_state_|= STATE_SYSTEM_READONLY; 2909 ia_state_|= STATE_SYSTEM_READONLY;
2799 break; 2910 break;
2800 case WebAccessibility::ROLE_MATH: 2911 case WebAccessibility::ROLE_MATH:
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 } 3077 }
2967 3078
2968 // The role should always be set. 3079 // The role should always be set.
2969 DCHECK(!role_name_.empty() || ia_role_); 3080 DCHECK(!role_name_.empty() || ia_role_);
2970 3081
2971 // If we didn't explicitly set the IAccessible2 role, make it the same 3082 // If we didn't explicitly set the IAccessible2 role, make it the same
2972 // as the MSAA role. 3083 // as the MSAA role.
2973 if (!ia2_role_) 3084 if (!ia2_role_)
2974 ia2_role_ = ia_role_; 3085 ia2_role_ = ia_role_;
2975 } 3086 }
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win.h ('k') | content/renderer/renderer_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698