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

Unified Diff: content/renderer/accessibility/renderer_accessibility_complete.h

Issue 222073002: Revert of Refactor content/renderer/accessibility to use AXTreeSerializer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/accessibility/renderer_accessibility_complete.h
diff --git a/content/renderer/accessibility/renderer_accessibility_complete.h b/content/renderer/accessibility/renderer_accessibility_complete.h
index 16eeeae5db631fc4f9c94cb2f625d9ce416fe99b..2511e3e89c2bfc4d82873e28f7381653e05bbd9b 100644
--- a/content/renderer/accessibility/renderer_accessibility_complete.h
+++ b/content/renderer/accessibility/renderer_accessibility_complete.h
@@ -11,12 +11,10 @@
#include "base/containers/hash_tables.h"
#include "base/memory/weak_ptr.h"
#include "content/public/renderer/render_view_observer.h"
-#include "content/renderer/accessibility/blink_ax_tree_source.h"
#include "content/renderer/accessibility/renderer_accessibility.h"
#include "third_party/WebKit/public/web/WebAXEnums.h"
#include "third_party/WebKit/public/web/WebAXObject.h"
#include "ui/accessibility/ax_node_data.h"
-#include "ui/accessibility/ax_tree_serializer.h"
namespace blink {
class WebDocument;
@@ -52,6 +50,20 @@
void HandleAXEvent(const blink::WebAXObject& obj, ui::AXEvent event);
+ // In order to keep track of what nodes the browser knows about, we keep a
+ // representation of the browser tree - just IDs and parent/child
+ // relationships.
+ struct CONTENT_EXPORT BrowserTreeNode {
+ BrowserTreeNode();
+ virtual ~BrowserTreeNode();
+ int32 id;
+ gfx::Rect location;
+ BrowserTreeNode* parent;
+ std::vector<BrowserTreeNode*> children;
+ };
+
+ virtual BrowserTreeNode* CreateBrowserTreeNode();
+
protected:
// Send queued events from the renderer to the browser.
void SendPendingAccessibilityEvents();
@@ -62,6 +74,19 @@
void SendLocationChanges();
private:
+ // Serialize the given accessibility object |obj| and append it to
+ // |dst|, and then recursively also serialize any *new* children of
+ // |obj|, based on what object ids we know the browser already has.
+ // The set of ids serialized is added to |ids_serialized|, and any
+ // ids previously in that set are not serialized again.
+ void SerializeChangedNodes(const blink::WebAXObject& obj,
+ std::vector<ui::AXNodeData>* dst,
+ std::set<int>* ids_serialized);
+
+ // Clear the given node and recursively delete all of its descendants
+ // from the browser tree. (Does not delete |browser_node|).
+ void ClearBrowserTreeNode(BrowserTreeNode* browser_node);
+
// Handlers for messages from the browser to the renderer.
void OnDoDefaultAction(int acc_obj_id);
void OnEventsAck();
@@ -82,6 +107,13 @@
const blink::WebAXObject& src,
ui::AXNodeData* dst);
+ // Build a tree of serializable ui::AXNodeData nodes to send to the
+ // browser process, given a WebAXObject node from Blink.
+ // Modifies |dst| in-place, it's assumed to be empty.
+ void BuildAccessibilityTree(const blink::WebAXObject& src,
+ bool include_children,
+ ui::AXNodeData* dst);
+
// So we can queue up tasks to be executed later.
base::WeakPtrFactory<RendererAccessibilityComplete> weak_factory_;
@@ -89,14 +121,11 @@
// sent to the browser.
std::vector<AccessibilityHostMsg_EventParams> pending_events_;
- // The adapter that exposes Blink's accessibility tree to AXTreeSerializer.
- BlinkAXTreeSource tree_source_;
+ // Our representation of the browser tree.
+ BrowserTreeNode* browser_root_;
- // The serializer that sends accessibility messages to the browser process.
- ui::AXTreeSerializer<blink::WebAXObject> serializer_;
-
- // Current location of every object, so we can detect when it moves.
- base::hash_map<int, gfx::Rect> locations_;
+ // A map from IDs to nodes in the browser tree.
+ base::hash_map<int32, BrowserTreeNode*> browser_id_map_;
// The most recently observed scroll offset of the root document element.
// TODO(dmazzoni): remove once https://bugs.webkit.org/show_bug.cgi?id=73460

Powered by Google App Engine
This is Rietveld 408576698