diff options
author | dtseng <dtseng@chromium.org> | 2015-04-06 17:04:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-07 00:05:38 +0000 |
commit | 36318aa45e02cf0b5cf871bf38bbe47f3431cc8d (patch) | |
tree | 1f18218ecfb531bdd4797d4bfc3c4980b8725c90 | |
parent | 38125cee3b20bcad023fcf96786951d36c091727 (diff) | |
download | chromium_src-36318aa45e02cf0b5cf871bf38bbe47f3431cc8d.zip chromium_src-36318aa45e02cf0b5cf871bf38bbe47f3431cc8d.tar.gz chromium_src-36318aa45e02cf0b5cf871bf38bbe47f3431cc8d.tar.bz2 |
Add an event to notify accessibility when a permissions bubble gets shown.
BUG=381338
TEST=ctrl+alt+z; navigate to html5demos.com/geo; observe speech is as expected (reads contents of bubble).
Review URL: https://codereview.chromium.org/1055883002
Cr-Commit-Position: refs/heads/master@{#323982}
5 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js index 3e6fe19..5b4e23d 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js @@ -83,3 +83,13 @@ AutomationPredicate.linebreak = function(first, second) { return fl.top != sl.top || (fl.top + fl.height != sl.top + sl.height); }; + +/** + * Leaf nodes that should be ignored. + * @param {chrome.automation.AutomationNode} node + * @return {boolean} + */ +AutomationPredicate.shouldIgnoreLeaf = function(node) { + return AutomationPredicate.leaf(node) && + node.role == chrome.automation.RoleType.client; +}; diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js index b0f4e59..4275a1c 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js @@ -113,6 +113,8 @@ AutomationUtil.findNextNode = function(cur, dir, pred) { return null; cur = next; next = AutomationUtil.findNodePre(next, dir, pred); + if (next && AutomationPredicate.shouldIgnoreLeaf(next)) + next = null; } while (!next); return next; }; diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js index 7d7aa55..1d90039 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js @@ -195,7 +195,7 @@ Output.RULES = { speak: '@describe_slider($value, $name)' }, staticText: { - speak: '$value' + speak: '$value $name' }, tab: { speak: '@describe_tab($name)' diff --git a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc index ba6c1c4..fcfdf13 100644 --- a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc +++ b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc @@ -167,6 +167,7 @@ class PermissionsBubbleDelegateView : public views::BubbleDelegateView, const gfx::FontList& GetTitleFontList() const override; base::string16 GetWindowTitle() const override; void OnWidgetDestroying(views::Widget* widget) override; + void GetAccessibleState(ui::AXViewState* state) override; // ButtonListener: void ButtonPressed(views::Button* button, const ui::Event& event) override; @@ -349,6 +350,11 @@ void PermissionsBubbleDelegateView::OnWidgetDestroying(views::Widget* widget) { } } +void PermissionsBubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { + views::BubbleDelegateView::GetAccessibleState(state); + state->role = ui::AX_ROLE_ALERT_DIALOG; +} + void PermissionsBubbleDelegateView::ButtonPressed(views::Button* button, const ui::Event& event) { if (!owner_) diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc index 55ce980..a2070c0 100644 --- a/ui/views/bubble/bubble_delegate.cc +++ b/ui/views/bubble/bubble_delegate.cc @@ -305,6 +305,13 @@ void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { else anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); } + + if (widget == GetWidget() && visible) { + ui::AXViewState state; + GetAccessibleState(&state); + if (state.role == ui::AX_ROLE_ALERT_DIALOG) + NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); + } } } // namespace views |