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

Side by Side Diff: content/renderer/accessibility/blink_ax_tree_source.cc

Issue 1195223006: Reports the position of the caret and current selection in content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased with master. Created 5 years, 4 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
OLDNEW
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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, 506 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS,
507 src.estimatedLoadingProgress()); 507 src.estimatedLoadingProgress());
508 508
509 const WebDocumentType& doctype = document.doctype(); 509 const WebDocumentType& doctype = document.doctype();
510 if (!doctype.isNull()) { 510 if (!doctype.isNull()) {
511 dst->AddStringAttribute( 511 dst->AddStringAttribute(
512 ui::AX_ATTR_DOC_DOCTYPE, 512 ui::AX_ATTR_DOC_DOCTYPE,
513 UTF16ToUTF8(base::StringPiece16(doctype.name()))); 513 UTF16ToUTF8(base::StringPiece16(doctype.name())));
514 } 514 }
515 515
516 WebAXObject anchor_object, focus_object;
517 int anchor_offset, focus_offset;
518 src.selection(anchor_object, anchor_offset, focus_object, focus_offset);
519 if (!anchor_object.isNull() && !focus_object.isNull() &&
520 anchor_offset >= 0 && focus_offset >= 0) {
521 int32 anchor_id = anchor_object.axID();
522 int32 focus_id = focus_object.axID();
523 dst->AddIntAttribute(ui::AX_ATTR_ANCHOR_OBJECT_ID, anchor_id);
524 dst->AddIntAttribute(ui::AX_ATTR_ANCHOR_OFFSET, anchor_offset);
525 dst->AddIntAttribute(ui::AX_ATTR_FOCUS_OBJECT_ID, focus_id);
526 dst->AddIntAttribute(ui::AX_ATTR_FOCUS_OFFSET, focus_offset);
527 }
516 } 528 }
517 529
518 if (dst->role == ui::AX_ROLE_TABLE) { 530 if (dst->role == ui::AX_ROLE_TABLE) {
519 int column_count = src.columnCount(); 531 int column_count = src.columnCount();
520 int row_count = src.rowCount(); 532 int row_count = src.rowCount();
521 if (column_count > 0 && row_count > 0) { 533 if (column_count > 0 && row_count > 0) {
522 std::set<int32> unique_cell_id_set; 534 std::set<int32> unique_cell_id_set;
523 std::vector<int32> cell_ids; 535 std::vector<int32> cell_ids;
524 std::vector<int32> unique_cell_ids; 536 std::vector<int32> unique_cell_ids;
525 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count); 537 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 647 }
636 } 648 }
637 649
638 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { 650 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const {
639 if (render_frame_ && render_frame_->GetWebFrame()) 651 if (render_frame_ && render_frame_->GetWebFrame())
640 return render_frame_->GetWebFrame()->document(); 652 return render_frame_->GetWebFrame()->document();
641 return WebDocument(); 653 return WebDocument();
642 } 654 }
643 655
644 } // namespace content 656 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698