Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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) { | |
| 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(); | |
|
darin (slow to review)
2011/12/02 06:49:46
shouldn't toBrowserAccessibilityWin() start with a
| |
| 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); | |
|
M-A Ruel
2011/12/02 12:52:28
That works? Since you are putting the vtable inclu
| |
| 574 return S_OK; | |
| 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 Loading... | |
| 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 (!instance_active_) | |
| 733 return E_FAIL; | |
| 734 | |
| 735 if (!group_level || !similar_items_in_group || !position_in_group) | |
| 736 return E_INVALIDARG; | |
| 737 | |
| 738 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION && | |
| 739 parent_ && | |
| 740 parent_->role() == WebAccessibility::ROLE_LISTBOX) { | |
| 741 *group_level = 0; | |
| 742 *similar_items_in_group = parent_->child_count(); | |
| 743 *position_in_group = index_in_parent_ + 1; | |
| 744 return S_OK; | |
| 745 } | |
| 746 | |
| 747 return E_NOTIMPL; | |
| 748 } | |
| 749 | |
| 686 // | 750 // |
| 687 // IAccessibleImage methods. | 751 // IAccessibleImage methods. |
| 688 // | 752 // |
| 689 | 753 |
| 690 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { | 754 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { |
| 691 if (!instance_active_) | 755 if (!instance_active_) |
| 692 return E_FAIL; | 756 return E_FAIL; |
| 693 | 757 |
| 694 if (!desc) | 758 if (!desc) |
| 695 return E_INVALIDARG; | 759 return E_INVALIDARG; |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2328 } | 2392 } |
| 2329 | 2393 |
| 2330 // Expose the "display" and "tag" attributes. | 2394 // Expose the "display" and "tag" attributes. |
| 2331 StringAttributeToIA2(WebAccessibility::ATTR_DISPLAY, "display"); | 2395 StringAttributeToIA2(WebAccessibility::ATTR_DISPLAY, "display"); |
| 2332 StringAttributeToIA2(WebAccessibility::ATTR_HTML_TAG, "tag"); | 2396 StringAttributeToIA2(WebAccessibility::ATTR_HTML_TAG, "tag"); |
| 2333 StringAttributeToIA2(WebAccessibility::ATTR_ROLE, "xml-roles"); | 2397 StringAttributeToIA2(WebAccessibility::ATTR_ROLE, "xml-roles"); |
| 2334 | 2398 |
| 2335 // Expose "level" attribute for tree nodes. | 2399 // Expose "level" attribute for tree nodes. |
| 2336 IntAttributeToIA2(WebAccessibility::ATTR_HIERARCHICAL_LEVEL, "level"); | 2400 IntAttributeToIA2(WebAccessibility::ATTR_HIERARCHICAL_LEVEL, "level"); |
| 2337 | 2401 |
| 2402 // Expose the set size and position in set for listbox options. | |
| 2403 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION && | |
| 2404 parent_ && | |
| 2405 parent_->role() == WebAccessibility::ROLE_LISTBOX) { | |
| 2406 ia2_attributes_.push_back( | |
| 2407 L"setsize:" + base::IntToString16(parent_->child_count())); | |
| 2408 ia2_attributes_.push_back( | |
| 2409 L"setsize:" + base::IntToString16(index_in_parent_ + 1)); | |
| 2410 } | |
| 2411 | |
| 2338 // Expose live region attributes. | 2412 // Expose live region attributes. |
| 2339 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_STATUS, "live"); | 2413 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_STATUS, "live"); |
| 2340 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_RELEVANT, "relevant"); | 2414 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_RELEVANT, "relevant"); |
| 2341 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_ATOMIC, "atomic"); | 2415 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_ATOMIC, "atomic"); |
| 2342 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_BUSY, "busy"); | 2416 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_BUSY, "busy"); |
| 2343 | 2417 |
| 2344 // Expose container live region attributes. | 2418 // Expose container live region attributes. |
| 2345 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_STATUS, | 2419 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_STATUS, |
| 2346 "container-live"); | 2420 "container-live"); |
| 2347 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_RELEVANT, | 2421 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_RELEVANT, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2380 } | 2454 } |
| 2381 if (index >= 0) { | 2455 if (index >= 0) { |
| 2382 ia2_attributes_.push_back(string16(L"table-cell-index:") + | 2456 ia2_attributes_.push_back(string16(L"table-cell-index:") + |
| 2383 base::IntToString16(index)); | 2457 base::IntToString16(index)); |
| 2384 } | 2458 } |
| 2385 } else { | 2459 } else { |
| 2386 NOTREACHED(); | 2460 NOTREACHED(); |
| 2387 } | 2461 } |
| 2388 } | 2462 } |
| 2389 | 2463 |
| 2390 // If this is static text, put the text in the name rather than the value. | 2464 if (name_.empty() && |
| 2391 if (role_ == WebAccessibility::ROLE_STATIC_TEXT && name_.empty()) | 2465 (role_ == WebAccessibility::ROLE_LISTBOX_OPTION || |
| 2466 role_ == WebAccessibility::ROLE_STATIC_TEXT)) { | |
| 2392 name_.swap(value_); | 2467 name_.swap(value_); |
| 2468 } | |
| 2393 | 2469 |
| 2394 // If this object doesn't have a name but it does have a description, | 2470 // 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 | 2471 // use the description as its name - because some screen readers only |
| 2396 // announce the name. | 2472 // announce the name. |
| 2397 if (name_.empty()) | 2473 if (name_.empty()) |
| 2398 GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_); | 2474 GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_); |
| 2399 | 2475 |
| 2400 // If this doesn't have a value and is linked then set its value to the url | 2476 // 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. | 2477 // attribute. This allows screen readers to read an empty link's destination. |
| 2402 string16 url; | 2478 string16 url; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2436 manager_->NotifyAccessibilityEvent( | 2512 manager_->NotifyAccessibilityEvent( |
| 2437 ViewHostMsg_AccEvent::OBJECT_SHOW, this); | 2513 ViewHostMsg_AccEvent::OBJECT_SHOW, this); |
| 2438 } | 2514 } |
| 2439 | 2515 |
| 2440 // TODO(dmazzoni): Look into HIDE events, too. | 2516 // TODO(dmazzoni): Look into HIDE events, too. |
| 2441 | 2517 |
| 2442 old_text_ = previous_text_; | 2518 old_text_ = previous_text_; |
| 2443 previous_text_ = text; | 2519 previous_text_ = text; |
| 2444 } | 2520 } |
| 2445 | 2521 |
| 2522 // Fire events if the state has changed. | |
| 2523 if (!first_time_ && ia_state_ != old_ia_state_) { | |
| 2524 // Normally focus events are handled elsewhere, however | |
| 2525 // focus for managed descendants is platform-specific. | |
| 2526 // Fire a focus event if the focused descendant in a multi-select | |
| 2527 // list box changes. | |
| 2528 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION && | |
| 2529 (ia_state_ & STATE_SYSTEM_FOCUSABLE) && | |
| 2530 (ia_state_ & STATE_SYSTEM_SELECTABLE) && | |
| 2531 (ia_state_ & STATE_SYSTEM_FOCUSED) && | |
| 2532 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { | |
| 2533 ::NotifyWinEvent(EVENT_OBJECT_FOCUS, | |
| 2534 manager_->GetParentView(), | |
| 2535 OBJID_CLIENT, | |
| 2536 child_id()); | |
| 2537 } | |
| 2538 | |
| 2539 if ((ia_state_ & STATE_SYSTEM_SELECTED) && | |
| 2540 !(old_ia_state_ & STATE_SYSTEM_SELECTED)) { | |
| 2541 ::NotifyWinEvent(EVENT_OBJECT_SELECTIONADD, | |
| 2542 manager_->GetParentView(), | |
| 2543 OBJID_CLIENT, | |
| 2544 child_id()); | |
| 2545 } else if (!(ia_state_ & STATE_SYSTEM_SELECTED) && | |
| 2546 (old_ia_state_ & STATE_SYSTEM_SELECTED)) { | |
| 2547 ::NotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE, | |
| 2548 manager_->GetParentView(), | |
| 2549 OBJID_CLIENT, | |
| 2550 child_id()); | |
| 2551 } | |
| 2552 | |
| 2553 old_ia_state_ = ia_state_; | |
| 2554 } | |
| 2555 | |
| 2446 first_time_ = false; | 2556 first_time_ = false; |
| 2447 } | 2557 } |
| 2448 | 2558 |
| 2449 void BrowserAccessibilityWin::NativeAddReference() { | 2559 void BrowserAccessibilityWin::NativeAddReference() { |
| 2450 AddRef(); | 2560 AddRef(); |
| 2451 } | 2561 } |
| 2452 | 2562 |
| 2453 void BrowserAccessibilityWin::NativeReleaseReference() { | 2563 void BrowserAccessibilityWin::NativeReleaseReference() { |
| 2454 Release(); | 2564 Release(); |
| 2455 } | 2565 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2564 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( | 2674 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( |
| 2565 int32 renderer_id) { | 2675 int32 renderer_id) { |
| 2566 return manager_->GetFromRendererID(renderer_id)->toBrowserAccessibilityWin(); | 2676 return manager_->GetFromRendererID(renderer_id)->toBrowserAccessibilityWin(); |
| 2567 } | 2677 } |
| 2568 | 2678 |
| 2569 void BrowserAccessibilityWin::InitRoleAndState() { | 2679 void BrowserAccessibilityWin::InitRoleAndState() { |
| 2570 ia_state_ = 0; | 2680 ia_state_ = 0; |
| 2571 ia2_state_ = IA2_STATE_OPAQUE; | 2681 ia2_state_ = IA2_STATE_OPAQUE; |
| 2572 ia2_attributes_.clear(); | 2682 ia2_attributes_.clear(); |
| 2573 | 2683 |
| 2574 if ((state_ >> WebAccessibility::STATE_BUSY) & 1) | 2684 if (HasState(WebAccessibility::STATE_BUSY)) |
| 2575 ia_state_|= STATE_SYSTEM_BUSY; | 2685 ia_state_|= STATE_SYSTEM_BUSY; |
| 2576 if ((state_ >> WebAccessibility::STATE_CHECKED) & 1) | 2686 if (HasState(WebAccessibility::STATE_CHECKED)) |
| 2577 ia_state_ |= STATE_SYSTEM_CHECKED; | 2687 ia_state_ |= STATE_SYSTEM_CHECKED; |
| 2578 if ((state_ >> WebAccessibility::STATE_COLLAPSED) & 1) | 2688 if (HasState(WebAccessibility::STATE_COLLAPSED)) |
| 2579 ia_state_|= STATE_SYSTEM_COLLAPSED; | 2689 ia_state_|= STATE_SYSTEM_COLLAPSED; |
| 2580 if ((state_ >> WebAccessibility::STATE_EXPANDED) & 1) | 2690 if (HasState(WebAccessibility::STATE_EXPANDED)) |
| 2581 ia_state_|= STATE_SYSTEM_EXPANDED; | 2691 ia_state_|= STATE_SYSTEM_EXPANDED; |
| 2582 if ((state_ >> WebAccessibility::STATE_FOCUSABLE) & 1) | 2692 if (HasState(WebAccessibility::STATE_FOCUSABLE)) |
| 2583 ia_state_|= STATE_SYSTEM_FOCUSABLE; | 2693 ia_state_|= STATE_SYSTEM_FOCUSABLE; |
| 2584 if ((state_ >> WebAccessibility::STATE_HASPOPUP) & 1) | 2694 if (HasState(WebAccessibility::STATE_HASPOPUP)) |
| 2585 ia_state_|= STATE_SYSTEM_HASPOPUP; | 2695 ia_state_|= STATE_SYSTEM_HASPOPUP; |
| 2586 if ((state_ >> WebAccessibility::STATE_HOTTRACKED) & 1) | 2696 if (HasState(WebAccessibility::STATE_HOTTRACKED)) |
| 2587 ia_state_|= STATE_SYSTEM_HOTTRACKED; | 2697 ia_state_|= STATE_SYSTEM_HOTTRACKED; |
| 2588 if ((state_ >> WebAccessibility::STATE_INDETERMINATE) & 1) | 2698 if (HasState(WebAccessibility::STATE_INDETERMINATE)) |
| 2589 ia_state_|= STATE_SYSTEM_INDETERMINATE; | 2699 ia_state_|= STATE_SYSTEM_INDETERMINATE; |
| 2590 if ((state_ >> WebAccessibility::STATE_INVISIBLE) & 1) | 2700 if (HasState(WebAccessibility::STATE_INVISIBLE)) |
| 2591 ia_state_|= STATE_SYSTEM_INVISIBLE; | 2701 ia_state_|= STATE_SYSTEM_INVISIBLE; |
| 2592 if ((state_ >> WebAccessibility::STATE_LINKED) & 1) | 2702 if (HasState(WebAccessibility::STATE_LINKED)) |
| 2593 ia_state_|= STATE_SYSTEM_LINKED; | 2703 ia_state_|= STATE_SYSTEM_LINKED; |
| 2594 if ((state_ >> WebAccessibility::STATE_MULTISELECTABLE) & 1) | 2704 if (HasState(WebAccessibility::STATE_MULTISELECTABLE)) { |
| 2705 ia_state_|= STATE_SYSTEM_EXTSELECTABLE; | |
| 2595 ia_state_|= STATE_SYSTEM_MULTISELECTABLE; | 2706 ia_state_|= STATE_SYSTEM_MULTISELECTABLE; |
| 2707 } | |
| 2596 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. | 2708 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. |
| 2597 if ((state_ >> WebAccessibility::STATE_OFFSCREEN) & 1) | 2709 if (HasState(WebAccessibility::STATE_OFFSCREEN)) |
| 2598 ia_state_|= STATE_SYSTEM_OFFSCREEN; | 2710 ia_state_|= STATE_SYSTEM_OFFSCREEN; |
| 2599 if ((state_ >> WebAccessibility::STATE_PRESSED) & 1) | 2711 if (HasState(WebAccessibility::STATE_PRESSED)) |
| 2600 ia_state_|= STATE_SYSTEM_PRESSED; | 2712 ia_state_|= STATE_SYSTEM_PRESSED; |
| 2601 if ((state_ >> WebAccessibility::STATE_PROTECTED) & 1) | 2713 if (HasState(WebAccessibility::STATE_PROTECTED)) |
| 2602 ia_state_|= STATE_SYSTEM_PROTECTED; | 2714 ia_state_|= STATE_SYSTEM_PROTECTED; |
| 2603 if ((state_ >> WebAccessibility::STATE_REQUIRED) & 1) | 2715 if (HasState(WebAccessibility::STATE_REQUIRED)) |
| 2604 ia2_state_|= IA2_STATE_REQUIRED; | 2716 ia2_state_|= IA2_STATE_REQUIRED; |
| 2605 if ((state_ >> WebAccessibility::STATE_SELECTABLE) & 1) | 2717 if (HasState(WebAccessibility::STATE_SELECTABLE)) |
| 2606 ia_state_|= STATE_SYSTEM_SELECTABLE; | 2718 ia_state_|= STATE_SYSTEM_SELECTABLE; |
| 2607 if ((state_ >> WebAccessibility::STATE_SELECTED) & 1) | 2719 if (HasState(WebAccessibility::STATE_SELECTED)) |
| 2608 ia_state_|= STATE_SYSTEM_SELECTED; | 2720 ia_state_|= STATE_SYSTEM_SELECTED; |
| 2609 if ((state_ >> WebAccessibility::STATE_TRAVERSED) & 1) | 2721 if (HasState(WebAccessibility::STATE_TRAVERSED)) |
| 2610 ia_state_|= STATE_SYSTEM_TRAVERSED; | 2722 ia_state_|= STATE_SYSTEM_TRAVERSED; |
| 2611 if ((state_ >> WebAccessibility::STATE_UNAVAILABLE) & 1) | 2723 if (HasState(WebAccessibility::STATE_UNAVAILABLE)) |
| 2612 ia_state_|= STATE_SYSTEM_UNAVAILABLE; | 2724 ia_state_|= STATE_SYSTEM_UNAVAILABLE; |
| 2613 if ((state_ >> WebAccessibility::STATE_VERTICAL) & 1) { | 2725 if (HasState(WebAccessibility::STATE_VERTICAL)) { |
| 2614 ia2_state_|= IA2_STATE_VERTICAL; | 2726 ia2_state_|= IA2_STATE_VERTICAL; |
| 2615 } else { | 2727 } else { |
| 2616 ia2_state_|= IA2_STATE_HORIZONTAL; | 2728 ia2_state_|= IA2_STATE_HORIZONTAL; |
| 2617 } | 2729 } |
| 2618 if ((state_ >> WebAccessibility::STATE_VISITED) & 1) | 2730 if (HasState(WebAccessibility::STATE_VISITED)) |
| 2619 ia_state_|= STATE_SYSTEM_TRAVERSED; | 2731 ia_state_|= STATE_SYSTEM_TRAVERSED; |
| 2620 | 2732 |
| 2621 // The meaning of the readonly state on Windows is very different from | 2733 // The meaning of the readonly state on Windows is very different from |
| 2622 // the meaning of the readonly state in WebKit, so we ignore | 2734 // the meaning of the readonly state in WebKit, so we ignore |
| 2623 // WebAccessibility::STATE_READONLY, and instead just check the | 2735 // WebAccessibility::STATE_READONLY, and instead just check the |
| 2624 // aria readonly value, then there's additional logic below to set | 2736 // aria readonly value, then there's additional logic below to set |
| 2625 // the readonly state based on other criteria. | 2737 // the readonly state based on other criteria. |
| 2626 bool aria_readonly = false; | 2738 bool aria_readonly = false; |
| 2627 GetBoolAttribute(WebAccessibility::ATTR_ARIA_READONLY, &aria_readonly); | 2739 GetBoolAttribute(WebAccessibility::ATTR_ARIA_READONLY, &aria_readonly); |
| 2628 if (aria_readonly) | 2740 if (aria_readonly) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2781 break; | 2893 break; |
| 2782 case WebAccessibility::ROLE_LIST: | 2894 case WebAccessibility::ROLE_LIST: |
| 2783 ia_role_ = ROLE_SYSTEM_LIST; | 2895 ia_role_ = ROLE_SYSTEM_LIST; |
| 2784 ia_state_|= STATE_SYSTEM_READONLY; | 2896 ia_state_|= STATE_SYSTEM_READONLY; |
| 2785 break; | 2897 break; |
| 2786 case WebAccessibility::ROLE_LISTBOX: | 2898 case WebAccessibility::ROLE_LISTBOX: |
| 2787 ia_role_ = ROLE_SYSTEM_LIST; | 2899 ia_role_ = ROLE_SYSTEM_LIST; |
| 2788 break; | 2900 break; |
| 2789 case WebAccessibility::ROLE_LISTBOX_OPTION: | 2901 case WebAccessibility::ROLE_LISTBOX_OPTION: |
| 2790 ia_role_ = ROLE_SYSTEM_LISTITEM; | 2902 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 2903 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { | |
| 2904 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | |
| 2905 if (HasState(WebAccessibility::STATE_FOCUSED)) | |
| 2906 ia_state_|= STATE_SYSTEM_FOCUSED; | |
| 2907 } | |
| 2791 break; | 2908 break; |
| 2792 case WebAccessibility::ROLE_LIST_ITEM: | 2909 case WebAccessibility::ROLE_LIST_ITEM: |
| 2793 ia_role_ = ROLE_SYSTEM_LISTITEM; | 2910 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 2794 ia_state_|= STATE_SYSTEM_READONLY; | 2911 ia_state_|= STATE_SYSTEM_READONLY; |
| 2795 break; | 2912 break; |
| 2796 case WebAccessibility::ROLE_LIST_MARKER: | 2913 case WebAccessibility::ROLE_LIST_MARKER: |
| 2797 ia_role_ = ROLE_SYSTEM_TEXT; | 2914 ia_role_ = ROLE_SYSTEM_TEXT; |
| 2798 ia_state_|= STATE_SYSTEM_READONLY; | 2915 ia_state_|= STATE_SYSTEM_READONLY; |
| 2799 break; | 2916 break; |
| 2800 case WebAccessibility::ROLE_MATH: | 2917 case WebAccessibility::ROLE_MATH: |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2966 } | 3083 } |
| 2967 | 3084 |
| 2968 // The role should always be set. | 3085 // The role should always be set. |
| 2969 DCHECK(!role_name_.empty() || ia_role_); | 3086 DCHECK(!role_name_.empty() || ia_role_); |
| 2970 | 3087 |
| 2971 // If we didn't explicitly set the IAccessible2 role, make it the same | 3088 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 2972 // as the MSAA role. | 3089 // as the MSAA role. |
| 2973 if (!ia2_role_) | 3090 if (!ia2_role_) |
| 2974 ia2_role_ = ia_role_; | 3091 ia2_role_ = ia_role_; |
| 2975 } | 3092 } |
| OLD | NEW |