| 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 2e72dde7fb93f06c9dc7286caa3fb991f9d2c826..e7765d4673e5af509c58a5cdbba4516e6d6aed1e 100644
|
| --- a/content/renderer/accessibility/renderer_accessibility_complete.cc
|
| +++ b/content/renderer/accessibility/renderer_accessibility_complete.cc
|
| @@ -177,16 +177,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;
|
| +
|
| // 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.
|
| @@ -207,6 +212,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();
|
| @@ -214,7 +226,8 @@ void RendererAccessibilityComplete::SendPendingAccessibilityEvents() {
|
|
|
| Send(new AccessibilityHostMsg_Events(routing_id(), event_msgs));
|
|
|
| - SendLocationChanges();
|
| + if (had_layout_complete_messages)
|
| + SendLocationChanges();
|
| }
|
|
|
| void RendererAccessibilityComplete::SendLocationChanges() {
|
| @@ -246,6 +259,12 @@ void RendererAccessibilityComplete::SendLocationChanges() {
|
|
|
| // Save the new location.
|
| new_locations[id] = new_location;
|
| +
|
| + // Explore children of this object.
|
| + 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);
|
|
|
|
|