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

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: Added unit tests. Created 5 years, 5 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 uint32 BrowserAccessibility::PlatformChildCount() const { 62 uint32 BrowserAccessibility::PlatformChildCount() const {
63 return PlatformIsLeaf() ? 0 : InternalChildCount(); 63 return PlatformIsLeaf() ? 0 : InternalChildCount();
64 } 64 }
65 65
66 bool BrowserAccessibility::IsNative() const { 66 bool BrowserAccessibility::IsNative() const {
67 return false; 67 return false;
68 } 68 }
69 69
70 bool BrowserAccessibility::IsDescendantOf( 70 bool BrowserAccessibility::IsDescendantOf(
71 BrowserAccessibility* ancestor) { 71 const BrowserAccessibility* ancestor) const {
72 if (this == ancestor) { 72 if (this == ancestor) {
73 return true; 73 return true;
74 } else if (GetParent()) { 74 } else if (GetParent()) {
75 return GetParent()->IsDescendantOf(ancestor); 75 return GetParent()->IsDescendantOf(ancestor);
76 } 76 }
77 77
78 return false; 78 return false;
79 } 79 }
80 80
81 BrowserAccessibility* BrowserAccessibility::PlatformGetChild( 81 BrowserAccessibility* BrowserAccessibility::PlatformGetChild(
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 608
609 bool BrowserAccessibility::IsEditableText() const { 609 bool BrowserAccessibility::IsEditableText() const {
610 // These roles don't have readonly set, but they're not editable text. 610 // These roles don't have readonly set, but they're not editable text.
611 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || 611 if (GetRole() == ui::AX_ROLE_SCROLL_AREA ||
612 GetRole() == ui::AX_ROLE_COLUMN || 612 GetRole() == ui::AX_ROLE_COLUMN ||
613 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { 613 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) {
614 return false; 614 return false;
615 } 615 }
616 616
617 // Note: WebAXStateReadonly being false means it's either a text control, 617 // Note: WebAXStateReadonly being false means it's either a text control,
618 // or contenteditable. We also check for editable text roles to cover 618 // or contenteditable. We also check for the text field role to cover
619 // another element that has role=textbox set on it. 619 // elements that have role=textbox set on it.
620 return (!HasState(ui::AX_STATE_READ_ONLY) || 620 return (!HasState(ui::AX_STATE_READ_ONLY) ||
621 GetRole() == ui::AX_ROLE_TEXT_FIELD); 621 GetRole() == ui::AX_ROLE_TEXT_FIELD);
622 } 622 }
623 623
624 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { 624 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const {
625 if (GetRole() != ui::AX_ROLE_WEB_AREA && 625 if (GetRole() != ui::AX_ROLE_WEB_AREA &&
626 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { 626 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) {
627 return false; 627 return false;
628 } 628 }
629 629
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 756 }
757 need_to_offset_web_area = true; 757 need_to_offset_web_area = true;
758 } 758 }
759 parent = parent->GetParentForBoundsCalculation(); 759 parent = parent->GetParentForBoundsCalculation();
760 } 760 }
761 761
762 return bounds; 762 return bounds;
763 } 763 }
764 764
765 } // namespace content 765 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698