Index: content/renderer/accessibility/render_accessibility_impl.cc |
diff --git a/content/renderer/accessibility/render_accessibility_impl.cc b/content/renderer/accessibility/render_accessibility_impl.cc |
index 74e35013b4fc00b461cd3ed2b5d03c84aa3de3c8..ec3aad56fc4e8ee17e241f4de1b2bd72d38e80cf 100644 |
--- a/content/renderer/accessibility/render_accessibility_impl.cc |
+++ b/content/renderer/accessibility/render_accessibility_impl.cc |
@@ -25,6 +25,7 @@ |
#include "third_party/WebKit/public/web/WebInputElement.h" |
#include "third_party/WebKit/public/web/WebLocalFrame.h" |
#include "third_party/WebKit/public/web/WebSettings.h" |
+#include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
#include "third_party/WebKit/public/web/WebView.h" |
#include "ui/accessibility/ax_node.h" |
@@ -78,6 +79,7 @@ RenderAccessibilityImpl::RenderAccessibilityImpl(RenderFrameImpl* render_frame) |
last_scroll_offset_(gfx::Size()), |
ack_pending_(false), |
reset_token_(0), |
+ during_action_(false), |
weak_factory_(this) { |
WebView* web_view = render_frame_->GetRenderView()->GetWebView(); |
WebSettings* settings = web_view->settings(); |
@@ -107,6 +109,7 @@ RenderAccessibilityImpl::~RenderAccessibilityImpl() { |
bool RenderAccessibilityImpl::OnMessageReceived(const IPC::Message& message) { |
bool handled = true; |
+ during_action_ = true; |
IPC_BEGIN_MESSAGE_MAP(RenderAccessibilityImpl, message) |
IPC_MESSAGE_HANDLER(AccessibilityMsg_SetFocus, OnSetFocus) |
IPC_MESSAGE_HANDLER(AccessibilityMsg_DoDefaultAction, OnDoDefaultAction) |
@@ -125,6 +128,7 @@ bool RenderAccessibilityImpl::OnMessageReceived(const IPC::Message& message) { |
IPC_MESSAGE_HANDLER(AccessibilityMsg_FatalError, OnFatalError) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
+ during_action_ = false; |
return handled; |
} |
@@ -211,6 +215,13 @@ void RenderAccessibilityImpl::HandleAXEvent( |
acc_event.id = obj.axID(); |
acc_event.event_type = event; |
+ if (blink::WebUserGestureIndicator::isProcessingUserGesture()) |
+ acc_event.event_from = ui::AX_EVENT_FROM_USER; |
+ else if (during_action_) |
+ acc_event.event_from = ui::AX_EVENT_FROM_ACTION; |
+ else |
+ acc_event.event_from = ui::AX_EVENT_FROM_PAGE; |
+ |
// Discard duplicate accessibility events. |
for (uint32_t i = 0; i < pending_events_.size(); ++i) { |
if (pending_events_[i].id == acc_event.id && |
@@ -324,6 +335,7 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() { |
AccessibilityHostMsg_EventParams event_msg; |
event_msg.event_type = event.event_type; |
event_msg.id = event.id; |
+ event_msg.event_from = event.event_from; |
if (!serializer_.SerializeChanges(obj, &event_msg.update)) { |
LOG(ERROR) << "Failed to serialize one accessibility event."; |
continue; |