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

Side by Side Diff: content/renderer/accessibility/renderer_accessibility.cc

Issue 1347243005: Make selection changes in a text field invalidate accessibility tree root. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable RendererAccessibilityTest.TextSelectionShouldSendRoot for Android; all other tests in this … Created 5 years, 3 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/renderer/accessibility/renderer_accessibility.h" 5 #include "content/renderer/accessibility/renderer_accessibility.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // will update it. 179 // will update it.
180 // TODO(dmazzoni): remove this as soon as 180 // TODO(dmazzoni): remove this as soon as
181 // https://bugs.webkit.org/show_bug.cgi?id=73460 is fixed. 181 // https://bugs.webkit.org/show_bug.cgi?id=73460 is fixed.
182 last_scroll_offset_ = scroll_offset; 182 last_scroll_offset_ = scroll_offset;
183 if (!obj.equals(document.accessibilityObject())) { 183 if (!obj.equals(document.accessibilityObject())) {
184 HandleAXEvent(document.accessibilityObject(), 184 HandleAXEvent(document.accessibilityObject(),
185 ui::AX_EVENT_LAYOUT_COMPLETE); 185 ui::AX_EVENT_LAYOUT_COMPLETE);
186 } 186 }
187 } 187 }
188 188
189 if (event == ui::AX_EVENT_TEXT_SELECTION_CHANGED &&
190 obj.isFocused() &&
191 !obj.equals(document.accessibilityObject())) {
192 // Changing the text selection in a text field may invalidate
193 // the anchor/focus attributes on the tree root. Send a generic
194 // notification to have it updated.
195 HandleAXEvent(document.accessibilityObject(), event);
196 }
197
189 // Add the accessibility object to our cache and ensure it's valid. 198 // Add the accessibility object to our cache and ensure it's valid.
190 AccessibilityHostMsg_EventParams acc_event; 199 AccessibilityHostMsg_EventParams acc_event;
191 acc_event.id = obj.axID(); 200 acc_event.id = obj.axID();
192 acc_event.event_type = event; 201 acc_event.event_type = event;
193 202
194 // Discard duplicate accessibility events. 203 // Discard duplicate accessibility events.
195 for (uint32 i = 0; i < pending_events_.size(); ++i) { 204 for (uint32 i = 0; i < pending_events_.size(); ++i) {
196 if (pending_events_[i].id == acc_event.id && 205 if (pending_events_[i].id == acc_event.id &&
197 pending_events_[i].event_type == acc_event.event_type) { 206 pending_events_[i].event_type == acc_event.event_type) {
198 return; 207 return;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 #ifndef NDEBUG 556 #ifndef NDEBUG
548 LOG(WARNING) << "ShowContextMenu on invalid object id " << acc_obj_id; 557 LOG(WARNING) << "ShowContextMenu on invalid object id " << acc_obj_id;
549 #endif 558 #endif
550 return; 559 return;
551 } 560 }
552 561
553 obj.showContextMenu(); 562 obj.showContextMenu();
554 } 563 }
555 564
556 } // namespace content 565 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698