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

Side by Side 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, 10 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "third_party/WebKit/public/web/WebFrameWidget.h" 64 #include "third_party/WebKit/public/web/WebFrameWidget.h"
65 #include "third_party/WebKit/public/web/WebLocalFrame.h" 65 #include "third_party/WebKit/public/web/WebLocalFrame.h"
66 #include "third_party/WebKit/public/web/WebNode.h" 66 #include "third_party/WebKit/public/web/WebNode.h"
67 #include "third_party/WebKit/public/web/WebPagePopup.h" 67 #include "third_party/WebKit/public/web/WebPagePopup.h"
68 #include "third_party/WebKit/public/web/WebPopupMenu.h" 68 #include "third_party/WebKit/public/web/WebPopupMenu.h"
69 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" 69 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h"
70 #include "third_party/WebKit/public/web/WebRange.h" 70 #include "third_party/WebKit/public/web/WebRange.h"
71 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 71 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
72 #include "third_party/WebKit/public/web/WebView.h" 72 #include "third_party/WebKit/public/web/WebView.h"
73 #include "third_party/skia/include/core/SkShader.h" 73 #include "third_party/skia/include/core/SkShader.h"
74 #include "ui/accessibility/ax_enums.h"
74 #include "ui/base/ui_base_switches.h" 75 #include "ui/base/ui_base_switches.h"
75 #include "ui/gfx/frame_time.h" 76 #include "ui/gfx/frame_time.h"
76 #include "ui/gfx/geometry/point_conversions.h" 77 #include "ui/gfx/geometry/point_conversions.h"
77 #include "ui/gfx/geometry/rect_conversions.h" 78 #include "ui/gfx/geometry/rect_conversions.h"
78 #include "ui/gfx/geometry/size_conversions.h" 79 #include "ui/gfx/geometry/size_conversions.h"
79 #include "ui/gfx/skia_util.h" 80 #include "ui/gfx/skia_util.h"
80 #include "ui/gl/gl_switches.h" 81 #include "ui/gl/gl_switches.h"
81 #include "ui/surface/transport_dib.h" 82 #include "ui/surface/transport_dib.h"
82 83
83 #if defined(OS_ANDROID) 84 #if defined(OS_ANDROID)
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 UpdateCompositionInfo(true); 2187 UpdateCompositionInfo(true);
2187 } 2188 }
2188 2189
2189 #if defined(OS_ANDROID) 2190 #if defined(OS_ANDROID)
2190 void RenderWidget::showUnhandledTapUIIfNeeded( 2191 void RenderWidget::showUnhandledTapUIIfNeeded(
2191 const WebPoint& tapped_position, 2192 const WebPoint& tapped_position,
2192 const WebNode& tapped_node, 2193 const WebNode& tapped_node,
2193 bool page_changed) { 2194 bool page_changed) {
2194 DCHECK(handling_input_event_); 2195 DCHECK(handling_input_event_);
2195 bool should_trigger = !page_changed && tapped_node.isTextNode() && 2196 bool should_trigger = !page_changed && tapped_node.isTextNode() &&
2196 !tapped_node.isContentEditable(); 2197 !tapped_node.isContentEditable() &&
2198 !isInteractive(tapped_node);
2197 if (should_trigger) { 2199 if (should_trigger) {
2198 Send(new ViewHostMsg_ShowUnhandledTapUIIfNeeded(routing_id_, 2200 Send(new ViewHostMsg_ShowUnhandledTapUIIfNeeded(routing_id_,
2199 tapped_position.x, tapped_position.y)); 2201 tapped_position.x, tapped_position.y));
2200 } 2202 }
2201 } 2203 }
2204
2205 bool RenderWidget::isInteractive(const WebNode& node) const {
2206 WebNode curNode = node;
2207 do {
2208 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
2209 return true;
2210 if (curNode.isElementNode()) {
2211 const blink::WebElement& element = curNode.toConst<blink::WebElement>();
2212 blink::WebString role = element.getAttribute("role");
2213 if (role.length() > 0) {
dmazzoni 2015/01/30 07:34:20 nit: !role.isEmpty()
Donn Denman 2015/02/02 21:14:15 Done.
2214 if (blink::WebAXObject::includesARIAWidgetRole(role))
2215 return true;
2216 }
2217 }
2218 curNode = curNode.parentNode();
2219 } while (!curNode.isNull());
2220 return false;
2221 }
2202 #endif 2222 #endif
2203 2223
2204 void RenderWidget::didHandleGestureEvent( 2224 void RenderWidget::didHandleGestureEvent(
2205 const WebGestureEvent& event, 2225 const WebGestureEvent& event,
2206 bool event_cancelled) { 2226 bool event_cancelled) {
2207 #if defined(OS_ANDROID) || defined(USE_AURA) 2227 #if defined(OS_ANDROID) || defined(USE_AURA)
2208 if (event_cancelled) 2228 if (event_cancelled)
2209 return; 2229 return;
2210 if (event.type == WebInputEvent::GestureTap) { 2230 if (event.type == WebInputEvent::GestureTap) {
2211 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); 2231 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2448 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2429 video_hole_frames_.AddObserver(frame); 2449 video_hole_frames_.AddObserver(frame);
2430 } 2450 }
2431 2451
2432 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2452 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2433 video_hole_frames_.RemoveObserver(frame); 2453 video_hole_frames_.RemoveObserver(frame);
2434 } 2454 }
2435 #endif // defined(VIDEO_HOLE) 2455 #endif // defined(VIDEO_HOLE)
2436 2456
2437 } // namespace content 2457 } // namespace content
OLDNEW
« 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