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

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

Issue 1195223006: Reports the position of the caret and current selection in content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased with master. Created 5 years, 4 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
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 return PlatformIsLeaf() ? 0 : InternalChildCount(); 72 return PlatformIsLeaf() ? 0 : InternalChildCount();
73 } 73 }
74 74
75 bool BrowserAccessibility::IsNative() const { 75 bool BrowserAccessibility::IsNative() const {
76 return false; 76 return false;
77 } 77 }
78 78
79 bool BrowserAccessibility::IsDescendantOf( 79 bool BrowserAccessibility::IsDescendantOf(
80 BrowserAccessibility* ancestor) { 80 const BrowserAccessibility* ancestor) const {
81 if (this == ancestor) { 81 if (this == ancestor) {
82 return true; 82 return true;
83 } else if (GetParent()) { 83 } else if (GetParent()) {
84 return GetParent()->IsDescendantOf(ancestor); 84 return GetParent()->IsDescendantOf(ancestor);
85 } 85 }
86 86
87 return false; 87 return false;
88 } 88 }
89 89
90 BrowserAccessibility* BrowserAccessibility::PlatformGetChild( 90 BrowserAccessibility* BrowserAccessibility::PlatformGetChild(
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 bool BrowserAccessibility::IsEditableText() const { 620 bool BrowserAccessibility::IsEditableText() const {
621 // These roles don't have readonly set, but they're not editable text. 621 // These roles don't have readonly set, but they're not editable text.
622 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || 622 if (GetRole() == ui::AX_ROLE_SCROLL_AREA ||
623 GetRole() == ui::AX_ROLE_COLUMN || 623 GetRole() == ui::AX_ROLE_COLUMN ||
624 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { 624 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) {
625 return false; 625 return false;
626 } 626 }
627 627
628 // Note: WebAXStateReadonly being false means it's either a text control, 628 // Note: WebAXStateReadonly being false means it's either a text control,
629 // or contenteditable. We also check for editable text roles to cover 629 // or contenteditable. We also check for the text field role to cover
630 // another element that has role=textbox set on it. 630 // elements that have role=textbox set on it.
631 return (!HasState(ui::AX_STATE_READ_ONLY) || 631 return (!HasState(ui::AX_STATE_READ_ONLY) ||
632 GetRole() == ui::AX_ROLE_TEXT_FIELD); 632 GetRole() == ui::AX_ROLE_TEXT_FIELD);
633 } 633 }
634 634
635 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { 635 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const {
636 if (GetRole() != ui::AX_ROLE_WEB_AREA && 636 if (GetRole() != ui::AX_ROLE_WEB_AREA &&
637 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { 637 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) {
638 return false; 638 return false;
639 } 639 }
640 640
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 767 }
768 need_to_offset_web_area = true; 768 need_to_offset_web_area = true;
769 } 769 }
770 parent = parent->GetParentForBoundsCalculation(); 770 parent = parent->GetParentForBoundsCalculation();
771 } 771 }
772 772
773 return bounds; 773 return bounds;
774 } 774 }
775 775
776 } // namespace content 776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698