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

Unified Diff: content/shell/test_runner/accessibility_controller.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/test_runner/accessibility_controller.h ('k') | content/shell/test_runner/pixel_dump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/test_runner/accessibility_controller.cc
diff --git a/content/shell/test_runner/accessibility_controller.cc b/content/shell/test_runner/accessibility_controller.cc
index 233f8f0ec0e4c7650fef7313cf5c0b1b59c87c7c..639655fcef060023d18c7727c5deae6bd700e6c0 100644
--- a/content/shell/test_runner/accessibility_controller.cc
+++ b/content/shell/test_runner/accessibility_controller.cc
@@ -4,6 +4,8 @@
#include "content/shell/test_runner/accessibility_controller.h"
+#include <string>
+
#include "base/macros.h"
#include "content/shell/test_runner/web_view_test_proxy.h"
#include "gin/handle.h"
@@ -216,23 +218,25 @@ v8::Local<v8::Object> AccessibilityController::FocusedElement() {
if (!frame)
return v8::Local<v8::Object>();
+ // TODO(lukasza): Finish adding OOPIF support to the layout tests harness.
+ CHECK(frame->IsWebLocalFrame())
+ << "This function cannot be called if the main frame is not a "
+ "local frame.";
blink::WebAXObject focused_element =
- blink::WebAXObject::FromWebDocumentFocused(frame->GetDocument());
+ blink::WebAXObject::FromWebDocumentFocused(
+ frame->ToWebLocalFrame()->GetDocument());
if (focused_element.IsNull())
- focused_element = blink::WebAXObject::FromWebView(*web_view());
+ focused_element = GetAccessibilityObjectForMainFrame();
return elements_.GetOrCreate(focused_element);
}
v8::Local<v8::Object> AccessibilityController::RootElement() {
- blink::WebAXObject root_element =
- blink::WebAXObject::FromWebView(*web_view());
- return elements_.GetOrCreate(root_element);
+ return elements_.GetOrCreate(GetAccessibilityObjectForMainFrame());
}
v8::Local<v8::Object> AccessibilityController::AccessibleElementById(
const std::string& id) {
- blink::WebAXObject root_element =
- blink::WebAXObject::FromWebView(*web_view());
+ blink::WebAXObject root_element = GetAccessibilityObjectForMainFrame();
if (!root_element.UpdateLayoutAndCheckValidity())
return v8::Local<v8::Object>();
@@ -271,4 +275,16 @@ blink::WebView* AccessibilityController::web_view() {
return web_view_test_proxy_base_->web_view();
}
+blink::WebAXObject
+AccessibilityController::GetAccessibilityObjectForMainFrame() {
+ blink::WebFrame* frame = web_view()->MainFrame();
+
+ // TODO(lukasza): Finish adding OOPIF support to the layout tests harness.
+ CHECK(frame && frame->IsWebLocalFrame())
+ << "This function cannot be called if the main frame is not a "
+ "local frame.";
+ return blink::WebAXObject::FromWebDocument(
+ web_view()->MainFrame()->ToWebLocalFrame()->GetDocument());
+}
+
} // namespace test_runner
« no previous file with comments | « content/shell/test_runner/accessibility_controller.h ('k') | content/shell/test_runner/pixel_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698