OLD | NEW |
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/accessibility/renderer_accessibility_complete.h" | 5 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // Loop over each event and generate an updated event message. | 201 // Loop over each event and generate an updated event message. |
202 for (size_t i = 0; i < src_events.size(); ++i) { | 202 for (size_t i = 0; i < src_events.size(); ++i) { |
203 AccessibilityHostMsg_EventParams& event = src_events[i]; | 203 AccessibilityHostMsg_EventParams& event = src_events[i]; |
204 if (event.event_type == ui::AX_EVENT_LAYOUT_COMPLETE) | 204 if (event.event_type == ui::AX_EVENT_LAYOUT_COMPLETE) |
205 had_layout_complete_messages = true; | 205 had_layout_complete_messages = true; |
206 | 206 |
207 WebAXObject obj = document.accessibilityObjectFromID(event.id); | 207 WebAXObject obj = document.accessibilityObjectFromID(event.id); |
208 | 208 |
209 // Make sure the object still exists. | 209 // Make sure the object still exists. |
210 if (!obj.updateBackingStoreAndCheckValidity()) | 210 if (!obj.updateLayoutAndCheckValidity()) |
211 continue; | 211 continue; |
212 | 212 |
213 // If it's ignored, find the first ancestor that's not ignored. | 213 // If it's ignored, find the first ancestor that's not ignored. |
214 while (!obj.isDetached() && obj.accessibilityIsIgnored()) | 214 while (!obj.isDetached() && obj.accessibilityIsIgnored()) |
215 obj = obj.parentObject(); | 215 obj = obj.parentObject(); |
216 | 216 |
217 // Make sure it's a descendant of our root node - exceptions include the | 217 // Make sure it's a descendant of our root node - exceptions include the |
218 // scroll area that's the parent of the main document (we ignore it), and | 218 // scroll area that's the parent of the main document (we ignore it), and |
219 // possibly nodes attached to a different document. | 219 // possibly nodes attached to a different document. |
220 if (!tree_source_.IsInTree(obj)) | 220 if (!tree_source_.IsInTree(obj)) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 if (input_element && input_element->isTextField()) | 386 if (input_element && input_element->isTextField()) |
387 input_element->setSelectionRange(start_offset, end_offset); | 387 input_element->setSelectionRange(start_offset, end_offset); |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 void RendererAccessibilityComplete::OnHitTest(gfx::Point point) { | 391 void RendererAccessibilityComplete::OnHitTest(gfx::Point point) { |
392 const WebDocument& document = GetMainDocument(); | 392 const WebDocument& document = GetMainDocument(); |
393 if (document.isNull()) | 393 if (document.isNull()) |
394 return; | 394 return; |
395 WebAXObject root_obj = document.accessibilityObject(); | 395 WebAXObject root_obj = document.accessibilityObject(); |
396 if (!root_obj.updateBackingStoreAndCheckValidity()) | 396 if (!root_obj.updateLayoutAndCheckValidity()) |
397 return; | 397 return; |
398 | 398 |
399 WebAXObject obj = root_obj.hitTest(point); | 399 WebAXObject obj = root_obj.hitTest(point); |
400 if (!obj.isDetached()) | 400 if (!obj.isDetached()) |
401 HandleAXEvent(obj, ui::AX_EVENT_HOVER); | 401 HandleAXEvent(obj, ui::AX_EVENT_HOVER); |
402 } | 402 } |
403 | 403 |
404 void RendererAccessibilityComplete::OnEventsAck() { | 404 void RendererAccessibilityComplete::OnEventsAck() { |
405 DCHECK(ack_pending_); | 405 DCHECK(ack_pending_); |
406 ack_pending_ = false; | 406 ack_pending_ = false; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 const WebDocument& document = GetMainDocument(); | 445 const WebDocument& document = GetMainDocument(); |
446 if (!document.isNull()) | 446 if (!document.isNull()) |
447 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_LAYOUT_COMPLETE); | 447 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_LAYOUT_COMPLETE); |
448 } | 448 } |
449 | 449 |
450 void RendererAccessibilityComplete::OnFatalError() { | 450 void RendererAccessibilityComplete::OnFatalError() { |
451 CHECK(false) << "Invalid accessibility tree."; | 451 CHECK(false) << "Invalid accessibility tree."; |
452 } | 452 } |
453 | 453 |
454 } // namespace content | 454 } // namespace content |
OLD | NEW |