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

Unified Diff: components/test_runner/accessibility_controller.cc

Issue 1705853002: NOT FOR REVIEW. ax tree focus with debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed crash Created 4 years, 10 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
« no previous file with comments | « components/test_runner/accessibility_controller.h ('k') | components/test_runner/web_test_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/accessibility_controller.cc
diff --git a/components/test_runner/accessibility_controller.cc b/components/test_runner/accessibility_controller.cc
index f6fd849ba0b417aa17511fe2195874b6926c83c0..9d660b8c3a12839cf57a87d6de33168922606de1 100644
--- a/components/test_runner/accessibility_controller.cc
+++ b/components/test_runner/accessibility_controller.cc
@@ -8,6 +8,7 @@
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebKit.h"
@@ -140,8 +141,6 @@ AccessibilityController::AccessibilityController()
AccessibilityController::~AccessibilityController() {}
void AccessibilityController::Reset() {
- root_element_ = blink::WebAXObject();
- focused_element_ = blink::WebAXObject();
elements_.Clear();
notification_callback_.Reset();
log_accessibility_events_ = false;
@@ -154,11 +153,6 @@ void AccessibilityController::Install(blink::WebFrame* frame) {
AccessibilityControllerBindings::Install(weak_factory_.GetWeakPtr(), frame);
}
-void AccessibilityController::SetFocusedElement(
- const blink::WebAXObject& focused_element) {
- focused_element_ = focused_element;
-}
-
bool AccessibilityController::ShouldLogAccessibilityEvents() {
return log_accessibility_events_;
}
@@ -228,27 +222,31 @@ void AccessibilityController::UnsetNotificationListener() {
}
v8::Local<v8::Object> AccessibilityController::FocusedElement() {
- if (focused_element_.isNull())
- focused_element_ = web_view_->accessibilityObject();
- return elements_.GetOrCreate(focused_element_);
+ blink::WebFrame* frame = web_view_->mainFrame();
+ if (!frame)
+ return v8::Local<v8::Object>();
+
+ blink::WebAXObject focused_element =
+ frame->document().focusedAccessibilityObject();
+ if (focused_element.isNull())
+ focused_element = web_view_->accessibilityObject();
+ return elements_.GetOrCreate(focused_element);
}
v8::Local<v8::Object> AccessibilityController::RootElement() {
- if (root_element_.isNull())
- root_element_ = web_view_->accessibilityObject();
- return elements_.GetOrCreate(root_element_);
+ blink::WebAXObject root_element = web_view_->accessibilityObject();
+ return elements_.GetOrCreate(root_element);
}
v8::Local<v8::Object>
AccessibilityController::AccessibleElementById(const std::string& id) {
- if (root_element_.isNull())
- root_element_ = web_view_->accessibilityObject();
+ blink::WebAXObject root_element = web_view_->accessibilityObject();
- if (!root_element_.updateLayoutAndCheckValidity())
+ if (!root_element.updateLayoutAndCheckValidity())
return v8::Local<v8::Object>();
return FindAccessibleElementByIdRecursive(
- root_element_, blink::WebString::fromUTF8(id.c_str()));
+ root_element, blink::WebString::fromUTF8(id.c_str()));
}
v8::Local<v8::Object>
« no previous file with comments | « components/test_runner/accessibility_controller.h ('k') | components/test_runner/web_test_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698