diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-05-20 09:47:09 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-07 11:15:42 +0000 |
commit | 189d4fd8fad9e3c776873be51938cd31a42b6177 (patch) | |
tree | 6497caeff5e383937996768766ab3bb2081a40b2 /chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc | |
parent | 8bc75099d364490b22f43a7ce366b366c08f4164 (diff) | |
download | qtwebengine-chromium-189d4fd8fad9e3c776873be51938cd31a42b6177.tar.gz |
BASELINE: Update Chromium to 90.0.4430.221
Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc')
-rw-r--r-- | chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc | 71 |
1 files changed, 63 insertions, 8 deletions
diff --git a/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc b/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc index ba49fe98b82..cbc3c5ce561 100644 --- a/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc +++ b/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc @@ -160,6 +160,14 @@ bool AXPlatformNodeDelegateBase::IsLeaf() const { return !GetChildCount(); } +bool AXPlatformNodeDelegateBase::IsFocused() const { + return false; +} + +bool AXPlatformNodeDelegateBase::IsInvisibleOrIgnored() const { + return false; +} + bool AXPlatformNodeDelegateBase::IsToplevelBrowserWindow() { return false; } @@ -168,9 +176,38 @@ bool AXPlatformNodeDelegateBase::IsDescendantOfPlainTextField() const { return false; } -gfx::NativeViewAccessible AXPlatformNodeDelegateBase::GetClosestPlatformObject() - const { - return nullptr; +gfx::NativeViewAccessible +AXPlatformNodeDelegateBase::GetLowestPlatformAncestor() const { + AXPlatformNodeDelegateBase* current_delegate = + const_cast<AXPlatformNodeDelegateBase*>(this); + AXPlatformNodeDelegateBase* lowest_unignored_delegate = current_delegate; + if (lowest_unignored_delegate->IsInvisibleOrIgnored()) { + lowest_unignored_delegate = static_cast<AXPlatformNodeDelegateBase*>( + lowest_unignored_delegate->GetParentDelegate()); + } + DCHECK(!lowest_unignored_delegate || + !lowest_unignored_delegate->IsInvisibleOrIgnored()) + << "`AXPlatformNodeDelegateBase::GetParentDelegate()` should return " + "either an unignored object or nullptr."; + + // `highest_leaf_delegate` could be nullptr. + AXPlatformNodeDelegateBase* highest_leaf_delegate = lowest_unignored_delegate; + // For the purposes of this method, a leaf node does not include leaves in the + // internal accessibility tree, only in the platform exposed tree. + for (AXPlatformNodeDelegateBase* ancestor_delegate = + lowest_unignored_delegate; + ancestor_delegate; + ancestor_delegate = static_cast<AXPlatformNodeDelegateBase*>( + ancestor_delegate->GetParentDelegate())) { + if (ancestor_delegate->IsLeaf()) + highest_leaf_delegate = ancestor_delegate; + } + if (highest_leaf_delegate) + return highest_leaf_delegate->GetNativeViewAccessible(); + + if (lowest_unignored_delegate) + return lowest_unignored_delegate->GetNativeViewAccessible(); + return current_delegate->GetNativeViewAccessible(); } AXPlatformNodeDelegateBase::ChildIteratorBase::ChildIteratorBase( @@ -313,7 +350,7 @@ gfx::NativeViewAccessible AXPlatformNodeDelegateBase::HitTestSync( return nullptr; } -gfx::NativeViewAccessible AXPlatformNodeDelegateBase::GetFocus() { +gfx::NativeViewAccessible AXPlatformNodeDelegateBase::GetFocus() const { return nullptr; } @@ -439,13 +476,23 @@ base::Optional<int> AXPlatformNodeDelegateBase::GetTableCellRowSpan() const { base::Optional<int> AXPlatformNodeDelegateBase::GetTableCellAriaColIndex() const { - return GetData().GetIntAttribute( - ax::mojom::IntAttribute::kAriaCellColumnIndex); + if (GetData().HasIntAttribute( + ax::mojom::IntAttribute::kAriaCellColumnIndex)) { + return GetData().GetIntAttribute( + ax::mojom::IntAttribute::kAriaCellColumnIndex); + } + + return base::nullopt; } base::Optional<int> AXPlatformNodeDelegateBase::GetTableCellAriaRowIndex() const { - return GetData().GetIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex); + if (GetData().HasIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex)) { + return GetData().GetIntAttribute( + ax::mojom::IntAttribute::kAriaCellRowIndex); + } + + return base::nullopt; } base::Optional<int32_t> AXPlatformNodeDelegateBase::GetCellId( @@ -487,6 +534,14 @@ base::Optional<int> AXPlatformNodeDelegateBase::GetSetSize() const { return base::nullopt; } +SkColor AXPlatformNodeDelegateBase::GetColor() const { + return SK_ColorBLACK; +} + +SkColor AXPlatformNodeDelegateBase::GetBackgroundColor() const { + return SK_ColorWHITE; +} + bool AXPlatformNodeDelegateBase::AccessibilityPerformAction( const ui::AXActionData& data) { return false; @@ -553,7 +608,7 @@ bool AXPlatformNodeDelegateBase::IsWebContent() const { } bool AXPlatformNodeDelegateBase::HasVisibleCaretOrSelection() const { - return false; + return IsDescendantOfPlainTextField(); } AXPlatformNode* AXPlatformNodeDelegateBase::GetTargetNodeForRelation( |