OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink_ax_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, | 496 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, |
497 src.estimatedLoadingProgress()); | 497 src.estimatedLoadingProgress()); |
498 | 498 |
499 const WebDocumentType& doctype = document.doctype(); | 499 const WebDocumentType& doctype = document.doctype(); |
500 if (!doctype.isNull()) { | 500 if (!doctype.isNull()) { |
501 dst->AddStringAttribute( | 501 dst->AddStringAttribute( |
502 ui::AX_ATTR_DOC_DOCTYPE, | 502 ui::AX_ATTR_DOC_DOCTYPE, |
503 UTF16ToUTF8(base::StringPiece16(doctype.name()))); | 503 UTF16ToUTF8(base::StringPiece16(doctype.name()))); |
504 } | 504 } |
505 | 505 |
| 506 WebAXObject anchor_object, focus_object; |
| 507 int anchor_offset, focus_offset; |
| 508 src.selection(anchor_object, anchor_offset, focus_object, focus_offset); |
| 509 if (!anchor_object.isNull() && !focus_object.isNull() && |
| 510 anchor_offset >= 0 && focus_offset >= 0) { |
| 511 int32 anchor_id = anchor_object.axID(); |
| 512 int32 focus_id = focus_object.axID(); |
| 513 dst->AddIntAttribute(ui::AX_ATTR_ANCHOR_OBJECT_ID, anchor_id); |
| 514 dst->AddIntAttribute(ui::AX_ATTR_ANCHOR_OFFSET, anchor_offset); |
| 515 dst->AddIntAttribute(ui::AX_ATTR_FOCUS_OBJECT_ID, focus_id); |
| 516 dst->AddIntAttribute(ui::AX_ATTR_FOCUS_OFFSET, focus_offset); |
| 517 } |
| 518 |
506 // Get the tree ID for this frame and possibly the parent frame. | 519 // Get the tree ID for this frame and possibly the parent frame. |
507 WebLocalFrame* web_frame = document.frame(); | 520 WebLocalFrame* web_frame = document.frame(); |
508 if (web_frame) { | 521 if (web_frame) { |
509 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); | 522 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); |
510 dst->AddContentIntAttribute( | 523 dst->AddContentIntAttribute( |
511 AX_CONTENT_ATTR_ROUTING_ID, | 524 AX_CONTENT_ATTR_ROUTING_ID, |
512 render_frame->GetRoutingID()); | 525 render_frame->GetRoutingID()); |
513 | 526 |
514 // Get the tree ID for the parent frame, if it's remote. | 527 // Get the tree ID for the parent frame, if it's remote. |
515 // (If it's local, it's already part of this same tree.) | 528 // (If it's local, it's already part of this same tree.) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 } | 657 } |
645 } | 658 } |
646 | 659 |
647 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 660 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
648 if (render_frame_ && render_frame_->GetWebFrame()) | 661 if (render_frame_ && render_frame_->GetWebFrame()) |
649 return render_frame_->GetWebFrame()->document(); | 662 return render_frame_->GetWebFrame()->document(); |
650 return WebDocument(); | 663 return WebDocument(); |
651 } | 664 } |
652 | 665 |
653 } // namespace content | 666 } // namespace content |
OLD | NEW |