Chromium Code Reviews| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width()); | 485 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width()); |
| 486 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height()); | 486 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height()); |
| 487 | 487 |
| 488 const gfx::Size& max_offset = document.maximumScrollOffset(); | 488 const gfx::Size& max_offset = document.maximumScrollOffset(); |
| 489 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width()); | 489 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width()); |
| 490 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height()); | 490 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height()); |
| 491 | 491 |
| 492 if (node_to_frame_routing_id_map_ && !src.equals(GetRoot())) { | 492 if (node_to_frame_routing_id_map_ && !src.equals(GetRoot())) { |
| 493 WebLocalFrame* frame = document.frame(); | 493 WebLocalFrame* frame = document.frame(); |
| 494 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); | 494 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); |
| 495 RenderFrameProxy* render_frame_proxy = nullptr; | |
| 496 | |
| 495 if (render_frame) { | 497 if (render_frame) { |
| 496 (*node_to_frame_routing_id_map_)[dst->id] = | 498 (*node_to_frame_routing_id_map_)[dst->id] = |
| 497 render_frame->GetRoutingID(); | 499 render_frame->GetRoutingID(); |
| 498 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); | |
| 499 } else { | 500 } else { |
| 500 RenderFrameProxy* render_frame_proxy = | 501 render_frame_proxy = RenderFrameProxy::FromWebFrame(frame); |
| 501 RenderFrameProxy::FromWebFrame(frame); | |
| 502 if (render_frame_proxy) { | 502 if (render_frame_proxy) { |
| 503 (*node_to_frame_routing_id_map_)[dst->id] = | 503 (*node_to_frame_routing_id_map_)[dst->id] = |
| 504 render_frame_proxy->routing_id(); | 504 render_frame_proxy->routing_id(); |
| 505 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); | 505 } |
| 506 } | |
| 507 | |
| 508 if (render_frame || render_frame_proxy) { | |
| 509 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); | |
| 510 | |
| 511 WebAXObject anchorObject, focusObject; | |
|
dmazzoni
2015/06/22 19:23:21
You don't want this code inside this inner "if" bl
| |
| 512 int anchorOffset, focusOffset; | |
| 513 src.selection(anchorObject, anchorOffset, focusObject, focusOffset); | |
| 514 if (anchorObject && focusObject && | |
| 515 anchorOffset >= 0 && focusOffset >= 0) { | |
| 516 int anchorId = anchorObject.axObjectID(); | |
| 517 int focusId = focusObject.axObjectID(); | |
| 518 dst->AddIntAttribute(ui::AX_ATTR_OBJ_SEL_START, anchorId); | |
| 519 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, anchorOffset); | |
|
dmazzoni
2015/06/22 19:23:21
I think it's confusing to reuse TEXT_SEL_START.
A
| |
| 520 dst->AddIntAttribute(ui::AX_ATTR_OBJ_SEL_END, focusId); | |
| 521 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, focusOffset); | |
| 506 } | 522 } |
| 507 } | 523 } |
| 508 } | 524 } |
| 509 } | 525 } |
| 510 | 526 |
| 511 if (dst->role == ui::AX_ROLE_TABLE) { | 527 if (dst->role == ui::AX_ROLE_TABLE) { |
| 512 int column_count = src.columnCount(); | 528 int column_count = src.columnCount(); |
| 513 int row_count = src.rowCount(); | 529 int row_count = src.rowCount(); |
| 514 if (column_count > 0 && row_count > 0) { | 530 if (column_count > 0 && row_count > 0) { |
| 515 std::set<int32> unique_cell_id_set; | 531 std::set<int32> unique_cell_id_set; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 629 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
| 614 } | 630 } |
| 615 | 631 |
| 616 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 632 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 617 if (render_frame_ && render_frame_->GetWebFrame()) | 633 if (render_frame_ && render_frame_->GetWebFrame()) |
| 618 return render_frame_->GetWebFrame()->document(); | 634 return render_frame_->GetWebFrame()->document(); |
| 619 return WebDocument(); | 635 return WebDocument(); |
| 620 } | 636 } |
| 621 | 637 |
| 622 } // namespace content | 638 } // namespace content |
| OLD | NEW |