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

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

Issue 755173004: Support presentational iframes and make use of them in the uber frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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.h" 5 #include "content/browser/accessibility/browser_accessibility.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } 672 }
673 673
674 // Note: WebAXStateReadonly being false means it's either a text control, 674 // Note: WebAXStateReadonly being false means it's either a text control,
675 // or contenteditable. We also check for editable text roles to cover 675 // or contenteditable. We also check for editable text roles to cover
676 // another element that has role=textbox set on it. 676 // another element that has role=textbox set on it.
677 return (!HasState(ui::AX_STATE_READ_ONLY) || 677 return (!HasState(ui::AX_STATE_READ_ONLY) ||
678 GetRole() == ui::AX_ROLE_TEXT_FIELD || 678 GetRole() == ui::AX_ROLE_TEXT_FIELD ||
679 GetRole() == ui::AX_ROLE_TEXT_AREA); 679 GetRole() == ui::AX_ROLE_TEXT_AREA);
680 } 680 }
681 681
682 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const {
683 if (GetRole() != ui::AX_ROLE_WEB_AREA &&
684 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) {
685 return false;
686 }
687
688 BrowserAccessibility* parent = GetParent();
aboxhall 2014/12/03 23:46:17 What is the parent going to be, out of curiosity?
dmazzoni 2014/12/17 18:30:27 Currently the parent is a scrollpane and the grand
689 if (!parent)
690 return false;
691
692 BrowserAccessibility* grandparent = parent->GetParent();
693 if (!grandparent)
694 return false;
695
696 return grandparent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL;
697 }
698
682 std::string BrowserAccessibility::GetTextRecursive() const { 699 std::string BrowserAccessibility::GetTextRecursive() const {
683 if (!name_.empty()) { 700 if (!name_.empty()) {
684 return name_; 701 return name_;
685 } 702 }
686 703
687 std::string result; 704 std::string result;
688 for (uint32 i = 0; i < PlatformChildCount(); ++i) 705 for (uint32 i = 0; i < PlatformChildCount(); ++i)
689 result += PlatformGetChild(i)->GetTextRecursive(); 706 result += PlatformGetChild(i)->GetTextRecursive();
690 return result; 707 return result;
691 } 708 }
692 709
693 int BrowserAccessibility::GetStaticTextLenRecursive() const { 710 int BrowserAccessibility::GetStaticTextLenRecursive() const {
694 if (GetRole() == ui::AX_ROLE_STATIC_TEXT) 711 if (GetRole() == ui::AX_ROLE_STATIC_TEXT)
695 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); 712 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size());
696 713
697 int len = 0; 714 int len = 0;
698 for (size_t i = 0; i < InternalChildCount(); ++i) 715 for (size_t i = 0; i < InternalChildCount(); ++i)
699 len += InternalGetChild(i)->GetStaticTextLenRecursive(); 716 len += InternalGetChild(i)->GetStaticTextLenRecursive();
700 return len; 717 return len;
701 } 718 }
702 719
703 } // namespace content 720 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698