Index: content/renderer/accessibility/renderer_accessibility_complete.cc |
diff --git a/content/renderer/accessibility/renderer_accessibility_complete.cc b/content/renderer/accessibility/renderer_accessibility_complete.cc |
index fd647187b3dbe88fb97b8cdc7a5e3bc3f854dbaa..be1cde8418753012d1ee65d38d1c5dc4a35c93ae 100644 |
--- a/content/renderer/accessibility/renderer_accessibility_complete.cc |
+++ b/content/renderer/accessibility/renderer_accessibility_complete.cc |
@@ -171,16 +171,21 @@ void RendererAccessibilityComplete::SendPendingAccessibilityEvents() { |
// Generate an event message from each Blink event. |
std::vector<AccessibilityHostMsg_EventParams> event_msgs; |
+ // If there's a layout complete message, we need to send location changes. |
+ bool had_layout_complete_messages = false; |
aboxhall
2014/07/19 15:08:05
Why is this plural?
dmazzoni
2014/07/20 04:24:17
There could be more than one "layout complete" in
aboxhall
2014/07/21 01:33:47
Obviously not a deal-breaker, but to me had_layout
|
+ |
// Loop over each event and generate an updated event message. |
for (size_t i = 0; i < src_events.size(); ++i) { |
- AccessibilityHostMsg_EventParams& event = |
- src_events[i]; |
+ AccessibilityHostMsg_EventParams& event = src_events[i]; |
+ if (event.event_type == ui::AX_EVENT_LAYOUT_COMPLETE) |
+ had_layout_complete_messages = true; |
+ |
+ WebAXObject obj = document.accessibilityObjectFromID(event.id); |
- WebAXObject obj = document.accessibilityObjectFromID( |
- event.id); |
// Make sure the object still exists. |
if (!obj.updateBackingStoreAndCheckValidity()) |
continue; |
+ |
// Make sure it's a descendant of our root node - exceptions include the |
// scroll area that's the parent of the main document (we ignore it), and |
// possibly nodes attached to a different document. |
@@ -201,6 +206,13 @@ void RendererAccessibilityComplete::SendPendingAccessibilityEvents() { |
serializer_.SerializeChanges(obj, &event_msg.update); |
event_msgs.push_back(event_msg); |
+ // For each node in the update, set the location in our map from |
+ // ids to locations. |
+ for (size_t i = 0; i < event_msg.update.nodes.size(); ++i) { |
+ locations_[event_msg.update.nodes[i].id] = |
+ event_msg.update.nodes[i].location; |
+ } |
+ |
VLOG(0) << "Accessibility event: " << ui::ToString(event.event_type) |
<< " on node id " << event_msg.id |
<< "\n" << event_msg.update.ToString(); |
@@ -208,7 +220,8 @@ void RendererAccessibilityComplete::SendPendingAccessibilityEvents() { |
Send(new AccessibilityHostMsg_Events(routing_id(), event_msgs)); |
- SendLocationChanges(); |
+ if (had_layout_complete_messages) |
+ SendLocationChanges(); |
} |
void RendererAccessibilityComplete::SendLocationChanges() { |
@@ -240,6 +253,12 @@ void RendererAccessibilityComplete::SendLocationChanges() { |
// Save the new location. |
new_locations[id] = new_location; |
+ |
+ // Explore children of this object. |
aboxhall
2014/07/19 15:08:05
Oops! :)
dmazzoni
2014/07/20 04:24:17
Yup! Accidentally lost when refactoring, easy fix,
|
+ std::vector<blink::WebAXObject> children; |
+ tree_source_.GetChildren(obj, &children); |
+ for (size_t i = 0; i < children.size(); ++i) |
+ objs_to_explore.push(children[i]); |
} |
locations_.swap(new_locations); |