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

Unified Diff: content/renderer/render_widget.cc

Issue 868933002: [Contextual Search] Check ARIA Roles before triggering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move ARIA role-list helper to Blink. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index d9dbe21ce1cbb745540202a7b985521962c3e388..a4e0b0bebc5516925a958479b3da9e103ef6192a 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -71,6 +71,7 @@
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/skia/include/core/SkShader.h"
+#include "ui/accessibility/ax_enums.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/frame_time.h"
#include "ui/gfx/geometry/point_conversions.h"
@@ -2193,12 +2194,31 @@ void RenderWidget::showUnhandledTapUIIfNeeded(
bool page_changed) {
DCHECK(handling_input_event_);
bool should_trigger = !page_changed && tapped_node.isTextNode() &&
- !tapped_node.isContentEditable();
+ !tapped_node.isContentEditable() &&
+ !isInteractive(tapped_node);
if (should_trigger) {
Send(new ViewHostMsg_ShowUnhandledTapUIIfNeeded(routing_id_,
tapped_position.x, tapped_position.y));
}
}
+
+bool RenderWidget::isInteractive(const WebNode& node) const {
+ WebNode curNode = node;
+ do {
+ if (curNode.isFocusable())
dmazzoni 2015/01/30 07:34:20 This isn't going to work, because <body> is focusa
Donn Denman 2015/02/02 21:14:15 I'm surprised I didn't see this when testing it ou
dmazzoni 2015/02/02 21:19:52 I'm not sure I know a better way from the blink pu
+ return true;
+ if (curNode.isElementNode()) {
+ const blink::WebElement& element = curNode.toConst<blink::WebElement>();
+ blink::WebString role = element.getAttribute("role");
+ if (role.length() > 0) {
dmazzoni 2015/01/30 07:34:20 nit: !role.isEmpty()
Donn Denman 2015/02/02 21:14:15 Done.
+ if (blink::WebAXObject::includesARIAWidgetRole(role))
+ return true;
+ }
+ }
+ curNode = curNode.parentNode();
+ } while (!curNode.isNull());
+ return false;
+}
#endif
void RenderWidget::didHandleGestureEvent(
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698