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

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

Issue 2837603002: Content API changes to improve DOM stitching in ThreatDetails code. (Closed)
Patch Set: Use explicitly-sized int types in IPC definition Created 3 years, 6 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 | « content/public/renderer/render_frame.h ('k') | content/renderer/render_frame_impl.cc » ('j') | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/common/accessibility_messages.h" 16 #include "content/common/accessibility_messages.h"
17 #include "content/renderer/accessibility/blink_ax_enum_conversion.h" 17 #include "content/renderer/accessibility/blink_ax_enum_conversion.h"
18 #include "content/renderer/accessibility/render_accessibility_impl.h" 18 #include "content/renderer/accessibility/render_accessibility_impl.h"
19 #include "content/renderer/browser_plugin/browser_plugin.h" 19 #include "content/renderer/browser_plugin/browser_plugin.h"
20 #include "content/renderer/render_frame_impl.h" 20 #include "content/renderer/render_frame_impl.h"
21 #include "content/renderer/render_frame_proxy.h" 21 #include "content/renderer/render_frame_proxy.h"
22 #include "content/renderer/render_view_impl.h" 22 #include "content/renderer/render_view_impl.h"
23 #include "content/renderer/web_frame_utils.h"
24 #include "third_party/WebKit/public/platform/WebFloatRect.h" 23 #include "third_party/WebKit/public/platform/WebFloatRect.h"
25 #include "third_party/WebKit/public/platform/WebRect.h" 24 #include "third_party/WebKit/public/platform/WebRect.h"
26 #include "third_party/WebKit/public/platform/WebSize.h" 25 #include "third_party/WebKit/public/platform/WebSize.h"
27 #include "third_party/WebKit/public/platform/WebString.h" 26 #include "third_party/WebKit/public/platform/WebString.h"
28 #include "third_party/WebKit/public/platform/WebVector.h" 27 #include "third_party/WebKit/public/platform/WebVector.h"
29 #include "third_party/WebKit/public/web/WebAXEnums.h" 28 #include "third_party/WebKit/public/web/WebAXEnums.h"
30 #include "third_party/WebKit/public/web/WebAXObject.h" 29 #include "third_party/WebKit/public/web/WebAXObject.h"
31 #include "third_party/WebKit/public/web/WebDocument.h" 30 #include "third_party/WebKit/public/web/WebDocument.h"
32 #include "third_party/WebKit/public/web/WebElement.h" 31 #include "third_party/WebKit/public/web/WebElement.h"
33 #include "third_party/WebKit/public/web/WebFormControlElement.h" 32 #include "third_party/WebKit/public/web/WebFormControlElement.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // Get the tree ID for this frame and the parent frame. 281 // Get the tree ID for this frame and the parent frame.
283 WebLocalFrame* web_frame = document().GetFrame(); 282 WebLocalFrame* web_frame = document().GetFrame();
284 if (web_frame) { 283 if (web_frame) {
285 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame); 284 RenderFrame* render_frame = RenderFrame::FromWebFrame(web_frame);
286 tree_data->routing_id = render_frame->GetRoutingID(); 285 tree_data->routing_id = render_frame->GetRoutingID();
287 286
288 // Get the tree ID for the parent frame. 287 // Get the tree ID for the parent frame.
289 blink::WebFrame* parent_web_frame = web_frame->Parent(); 288 blink::WebFrame* parent_web_frame = web_frame->Parent();
290 if (parent_web_frame) { 289 if (parent_web_frame) {
291 tree_data->parent_routing_id = 290 tree_data->parent_routing_id =
292 GetRoutingIdForFrameOrProxy(parent_web_frame); 291 RenderFrame::GetRoutingIdForWebFrame(parent_web_frame);
293 } 292 }
294 } 293 }
295 294
296 return true; 295 return true;
297 } 296 }
298 297
299 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { 298 blink::WebAXObject BlinkAXTreeSource::GetRoot() const {
300 if (frozen_) 299 if (frozen_)
301 return root_; 300 return root_;
302 else 301 else
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element); 826 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element);
828 if (browser_plugin) { 827 if (browser_plugin) {
829 dst->AddContentIntAttribute( 828 dst->AddContentIntAttribute(
830 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID, 829 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID,
831 browser_plugin->browser_plugin_instance_id()); 830 browser_plugin->browser_plugin_instance_id());
832 } 831 }
833 832
834 // Frames and iframes. 833 // Frames and iframes.
835 WebFrame* frame = WebFrame::FromFrameOwnerElement(element); 834 WebFrame* frame = WebFrame::FromFrameOwnerElement(element);
836 if (frame) { 835 if (frame) {
837 dst->AddContentIntAttribute( 836 dst->AddContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID,
838 AX_CONTENT_ATTR_CHILD_ROUTING_ID, 837 RenderFrame::GetRoutingIdForWebFrame(frame));
839 GetRoutingIdForFrameOrProxy(frame));
840 } 838 }
841 } 839 }
842 840
843 // Add the ids of *indirect* children - those who are children of this node, 841 // Add the ids of *indirect* children - those who are children of this node,
844 // but whose parent is *not* this node. One example is a table 842 // but whose parent is *not* this node. One example is a table
845 // cell, which is a child of both a row and a column. Because the cell's 843 // cell, which is a child of both a row and a column. Because the cell's
846 // parent is the row, the row adds it as a child, and the column adds it 844 // parent is the row, the row adds it as a child, and the column adds it
847 // as an indirect child. 845 // as an indirect child.
848 int child_count = src.ChildCount(); 846 int child_count = src.ChildCount();
849 for (int i = 0; i < child_count; ++i) { 847 for (int i = 0; i < child_count; ++i) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 return WebAXObject(); 888 return WebAXObject();
891 889
892 WebDocument document = render_frame_->GetWebFrame()->GetDocument(); 890 WebDocument document = render_frame_->GetWebFrame()->GetDocument();
893 if (!document.IsNull()) 891 if (!document.IsNull())
894 return document.AccessibilityObject(); 892 return document.AccessibilityObject();
895 893
896 return WebAXObject(); 894 return WebAXObject();
897 } 895 }
898 896
899 } // namespace content 897 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/render_frame.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698