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

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

Issue 268543008: Cross-process iframe accessibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "content/renderer/accessibility/blink_ax_enum_conversion.h" 12 #include "content/renderer/accessibility/blink_ax_enum_conversion.h"
13 #include "content/renderer/render_view_impl.h" 13 #include "content/renderer/render_view_impl.h"
14 #include "third_party/WebKit/public/platform/WebRect.h" 14 #include "third_party/WebKit/public/platform/WebRect.h"
15 #include "third_party/WebKit/public/platform/WebSize.h" 15 #include "third_party/WebKit/public/platform/WebSize.h"
16 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
17 #include "third_party/WebKit/public/platform/WebVector.h" 17 #include "third_party/WebKit/public/platform/WebVector.h"
18 #include "third_party/WebKit/public/web/WebAXEnums.h" 18 #include "third_party/WebKit/public/web/WebAXEnums.h"
19 #include "third_party/WebKit/public/web/WebAXObject.h" 19 #include "third_party/WebKit/public/web/WebAXObject.h"
20 #include "third_party/WebKit/public/web/WebDocument.h" 20 #include "third_party/WebKit/public/web/WebDocument.h"
21 #include "third_party/WebKit/public/web/WebDocumentType.h" 21 #include "third_party/WebKit/public/web/WebDocumentType.h"
22 #include "third_party/WebKit/public/web/WebElement.h" 22 #include "third_party/WebKit/public/web/WebElement.h"
23 #include "third_party/WebKit/public/web/WebFormControlElement.h" 23 #include "third_party/WebKit/public/web/WebFormControlElement.h"
24 #include "third_party/WebKit/public/web/WebInputElement.h" 24 #include "third_party/WebKit/public/web/WebInputElement.h"
25 #include "third_party/WebKit/public/web/WebLocalFrame.h" 25 #include "third_party/WebKit/public/web/WebLocalFrame.h"
26 #include "third_party/WebKit/public/web/WebNode.h" 26 #include "third_party/WebKit/public/web/WebNode.h"
27 #include "third_party/WebKit/public/web/WebView.h" 27 #include "third_party/WebKit/public/web/WebView.h"
28 28
29
29 using base::ASCIIToUTF16; 30 using base::ASCIIToUTF16;
30 using base::UTF16ToUTF8; 31 using base::UTF16ToUTF8;
31 using blink::WebAXObject; 32 using blink::WebAXObject;
32 using blink::WebDocument; 33 using blink::WebDocument;
33 using blink::WebDocumentType; 34 using blink::WebDocumentType;
34 using blink::WebElement; 35 using blink::WebElement;
36 using blink::WebFrame;
35 using blink::WebLocalFrame; 37 using blink::WebLocalFrame;
36 using blink::WebNode; 38 using blink::WebNode;
37 using blink::WebVector; 39 using blink::WebVector;
38 using blink::WebView; 40 using blink::WebView;
39 41
40 namespace content { 42 namespace content {
41 43
42 namespace { 44 namespace {
43 45
44 // Returns true if |ancestor| is the first unignored parent of |child|, 46 // Returns true if |ancestor| is the first unignored parent of |child|,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 95
94 } // Anonymous namespace 96 } // Anonymous namespace
95 97
96 BlinkAXTreeSource::BlinkAXTreeSource(RenderViewImpl* render_view) 98 BlinkAXTreeSource::BlinkAXTreeSource(RenderViewImpl* render_view)
97 : render_view_(render_view) { 99 : render_view_(render_view) {
98 } 100 }
99 101
100 BlinkAXTreeSource::~BlinkAXTreeSource() { 102 BlinkAXTreeSource::~BlinkAXTreeSource() {
101 } 103 }
102 104
105 void BlinkAXTreeSource::CollectChildFrameIdMapping(
106 std::map<int32, int>* guest_instance_ids,
107 std::map<int32, int>* frame_routing_ids) {
108 guest_instance_ids_ = guest_instance_ids;
109 frame_routing_ids_ = frame_routing_ids;
110 }
111
103 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { 112 blink::WebAXObject BlinkAXTreeSource::GetRoot() const {
104 return GetMainDocument().accessibilityObject(); 113 return GetMainDocument().accessibilityObject();
105 } 114 }
106 115
107 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const { 116 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const {
108 return GetMainDocument().accessibilityObjectFromID(id); 117 return GetMainDocument().accessibilityObjectFromID(id);
109 } 118 }
110 119
111 int32 BlinkAXTreeSource::GetId(blink::WebAXObject node) const { 120 int32 BlinkAXTreeSource::GetId(blink::WebAXObject node) const {
112 return node.axID(); 121 return node.axID();
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X, scroll_offset.width()); 440 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X, scroll_offset.width());
432 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scroll_offset.height()); 441 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scroll_offset.height());
433 442
434 const gfx::Size& min_offset = document.frame()->minimumScrollOffset(); 443 const gfx::Size& min_offset = document.frame()->minimumScrollOffset();
435 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width()); 444 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width());
436 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height()); 445 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height());
437 446
438 const gfx::Size& max_offset = document.frame()->maximumScrollOffset(); 447 const gfx::Size& max_offset = document.frame()->maximumScrollOffset();
439 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width()); 448 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width());
440 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height()); 449 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height());
450
451 if (frame_routing_ids_ && !src.equals(GetRoot())) {
452 WebFrame* frame = document.frame();
453 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
454 frame_routing_ids_->insert(std::pair<int32, int>(
455 dst->id, render_frame->GetRoutingID()));
456 }
441 } 457 }
442 458
443 if (dst->role == ui::AX_ROLE_TABLE) { 459 if (dst->role == ui::AX_ROLE_TABLE) {
444 int column_count = src.columnCount(); 460 int column_count = src.columnCount();
445 int row_count = src.rowCount(); 461 int row_count = src.rowCount();
446 if (column_count > 0 && row_count > 0) { 462 if (column_count > 0 && row_count > 0) {
447 std::set<int32> unique_cell_id_set; 463 std::set<int32> unique_cell_id_set;
448 std::vector<int32> cell_ids; 464 std::vector<int32> cell_ids;
449 std::vector<int32> unique_cell_ids; 465 std::vector<int32> unique_cell_ids;
450 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count); 466 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 WebLocalFrame* main_frame = 560 WebLocalFrame* main_frame =
545 view ? view->mainFrame()->toWebLocalFrame() : NULL; 561 view ? view->mainFrame()->toWebLocalFrame() : NULL;
546 562
547 if (main_frame) 563 if (main_frame)
548 return main_frame->document(); 564 return main_frame->document();
549 565
550 return WebDocument(); 566 return WebDocument();
551 } 567 }
552 568
553 } // namespace content 569 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698