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

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

Issue 510123003: AX: Remove WebLocalFrame dependency from BlinkAXTreeSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_frame_impl.h" 13 #include "content/renderer/render_frame_impl.h"
14 #include "content/renderer/render_view_impl.h" 14 #include "content/renderer/render_view_impl.h"
15 #include "third_party/WebKit/public/platform/WebRect.h" 15 #include "third_party/WebKit/public/platform/WebRect.h"
16 #include "third_party/WebKit/public/platform/WebSize.h" 16 #include "third_party/WebKit/public/platform/WebSize.h"
17 #include "third_party/WebKit/public/platform/WebString.h" 17 #include "third_party/WebKit/public/platform/WebString.h"
18 #include "third_party/WebKit/public/platform/WebVector.h" 18 #include "third_party/WebKit/public/platform/WebVector.h"
19 #include "third_party/WebKit/public/web/WebAXEnums.h" 19 #include "third_party/WebKit/public/web/WebAXEnums.h"
20 #include "third_party/WebKit/public/web/WebAXObject.h" 20 #include "third_party/WebKit/public/web/WebAXObject.h"
21 #include "third_party/WebKit/public/web/WebDocument.h" 21 #include "third_party/WebKit/public/web/WebDocument.h"
22 #include "third_party/WebKit/public/web/WebDocumentType.h" 22 #include "third_party/WebKit/public/web/WebDocumentType.h"
23 #include "third_party/WebKit/public/web/WebElement.h" 23 #include "third_party/WebKit/public/web/WebElement.h"
24 #include "third_party/WebKit/public/web/WebFormControlElement.h" 24 #include "third_party/WebKit/public/web/WebFormControlElement.h"
25 #include "third_party/WebKit/public/web/WebInputElement.h" 25 #include "third_party/WebKit/public/web/WebInputElement.h"
26 #include "third_party/WebKit/public/web/WebLocalFrame.h"
27 #include "third_party/WebKit/public/web/WebNode.h" 26 #include "third_party/WebKit/public/web/WebNode.h"
28 #include "third_party/WebKit/public/web/WebView.h" 27 #include "third_party/WebKit/public/web/WebView.h"
29 28
30 using base::ASCIIToUTF16; 29 using base::ASCIIToUTF16;
31 using base::UTF16ToUTF8; 30 using base::UTF16ToUTF8;
32 using blink::WebAXObject; 31 using blink::WebAXObject;
33 using blink::WebDocument; 32 using blink::WebDocument;
34 using blink::WebDocumentType; 33 using blink::WebDocumentType;
35 using blink::WebElement; 34 using blink::WebElement;
36 using blink::WebFrame; 35 using blink::WebFrame;
37 using blink::WebLocalFrame;
38 using blink::WebNode; 36 using blink::WebNode;
39 using blink::WebVector; 37 using blink::WebVector;
40 using blink::WebView; 38 using blink::WebView;
41 39
42 namespace content { 40 namespace content {
43 41
44 namespace { 42 namespace {
45 43
46 // Returns true if |ancestor| is the first unignored parent of |child|, 44 // Returns true if |ancestor| is the first unignored parent of |child|,
47 // which means that when walking up the parent chain from |child|, 45 // which means that when walking up the parent chain from |child|,
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded()); 430 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded());
433 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, 431 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS,
434 src.estimatedLoadingProgress()); 432 src.estimatedLoadingProgress());
435 433
436 const WebDocumentType& doctype = document.doctype(); 434 const WebDocumentType& doctype = document.doctype();
437 if (!doctype.isNull()) { 435 if (!doctype.isNull()) {
438 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE, 436 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE,
439 UTF16ToUTF8(doctype.name())); 437 UTF16ToUTF8(doctype.name()));
440 } 438 }
441 439
442 const gfx::Size& scroll_offset = document.frame()->scrollOffset(); 440 const gfx::Size& scroll_offset = document.scrollOffset();
443 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X, scroll_offset.width()); 441 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X, scroll_offset.width());
444 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scroll_offset.height()); 442 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scroll_offset.height());
445 443
446 const gfx::Size& min_offset = document.frame()->minimumScrollOffset(); 444 const gfx::Size& min_offset = document.minimumScrollOffset();
447 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width()); 445 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width());
448 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height()); 446 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height());
449 447
450 const gfx::Size& max_offset = document.frame()->maximumScrollOffset(); 448 const gfx::Size& max_offset = document.maximumScrollOffset();
451 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width()); 449 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width());
452 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height()); 450 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height());
453 } 451 }
454 452
455 if (dst->role == ui::AX_ROLE_TABLE) { 453 if (dst->role == ui::AX_ROLE_TABLE) {
456 int column_count = src.columnCount(); 454 int column_count = src.columnCount();
457 int row_count = src.rowCount(); 455 int row_count = src.rowCount();
458 if (column_count > 0 && row_count > 0) { 456 if (column_count > 0 && row_count > 0) {
459 std::set<int32> unique_cell_id_set; 457 std::set<int32> unique_cell_id_set;
460 std::vector<int32> cell_ids; 458 std::vector<int32> cell_ids;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { 552 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const {
555 WebView* view = render_frame_->render_view()->GetWebView(); 553 WebView* view = render_frame_->render_view()->GetWebView();
556 WebFrame* main_frame = view ? view->mainFrame() : NULL; 554 WebFrame* main_frame = view ? view->mainFrame() : NULL;
557 555
558 if (main_frame) 556 if (main_frame)
559 return main_frame->document(); 557 return main_frame->document();
560 return WebDocument(); 558 return WebDocument();
561 } 559 }
562 560
563 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698