[Chromium] AccessibilityController shouldn't know anything about TestShell
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 04:00:50 +0000 (04:00 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 04:00:50 +0000 (04:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91441

Reviewed by Tony Chang.

This patch is a precursor to moving AccessibilityController.cpp into TestRunner.a.

* DumpRenderTree/chromium/AccessibilityController.cpp:
(AccessibilityController::AccessibilityController):
(AccessibilityController::getFocusedElement):
(AccessibilityController::getRootElement):
* DumpRenderTree/chromium/AccessibilityController.h:
(WebKit):
(AccessibilityController):
(AccessibilityController::setWebView):
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::initialize):
(TestShell::createMainWindow):
(TestShell::~TestShell):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122804 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/chromium/AccessibilityController.cpp
Tools/DumpRenderTree/chromium/AccessibilityController.h
Tools/DumpRenderTree/chromium/TestShell.cpp

index a473001..c7eceb0 100644 (file)
@@ -1,5 +1,27 @@
 2012-07-16  Adam Barth  <abarth@webkit.org>
 
+        [Chromium] AccessibilityController shouldn't know anything about TestShell
+        https://bugs.webkit.org/show_bug.cgi?id=91441
+
+        Reviewed by Tony Chang.
+
+        This patch is a precursor to moving AccessibilityController.cpp into TestRunner.a.
+
+        * DumpRenderTree/chromium/AccessibilityController.cpp:
+        (AccessibilityController::AccessibilityController):
+        (AccessibilityController::getFocusedElement):
+        (AccessibilityController::getRootElement):
+        * DumpRenderTree/chromium/AccessibilityController.h:
+        (WebKit):
+        (AccessibilityController):
+        (AccessibilityController::setWebView):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::initialize):
+        (TestShell::createMainWindow):
+        (TestShell::~TestShell):
+
+2012-07-16  Adam Barth  <abarth@webkit.org>
+
         [Chromium] Introduce TestInterfaces to hold all the JavaScript interfaces needed for LayoutTests
         https://bugs.webkit.org/show_bug.cgi?id=91312
 
index 860a747..6cb52cd 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "AccessibilityController.h"
 
-#include "TestShell.h"
 #include "WebAccessibilityObject.h"
 #include "WebFrame.h"
 #include "platform/WebString.h"
@@ -39,9 +38,8 @@
 
 using namespace WebKit;
 
-AccessibilityController::AccessibilityController(TestShell* shell)
+AccessibilityController::AccessibilityController()
     : m_logAccessibilityEvents(false)
-    , m_shell(shell)
 {
 
     bindMethod("logAccessibilityEvents", &AccessibilityController::logAccessibilityEventsCallback);
@@ -77,14 +75,14 @@ void AccessibilityController::setFocusedElement(const WebAccessibilityObject& fo
 AccessibilityUIElement* AccessibilityController::getFocusedElement()
 {
     if (m_focusedElement.isNull())
-        m_focusedElement = m_shell->webView()->accessibilityObject();
+        m_focusedElement = m_webView->accessibilityObject();
     return m_elements.getOrCreate(m_focusedElement);
 }
 
 AccessibilityUIElement* AccessibilityController::getRootElement()
 {
     if (m_rootElement.isNull())
-        m_rootElement = m_shell->webView()->accessibilityObject();
+        m_rootElement = m_webView->accessibilityObject();
     return m_elements.createRoot(m_rootElement);
 }
 
index 954edb9..9672595 100644 (file)
 namespace WebKit {
 class WebAccessibilityObject;
 class WebFrame;
+class WebView;
 }
 
-class TestShell;
-
 class AccessibilityController : public CppBoundClass {
 public:
-    explicit AccessibilityController(TestShell*);
+    AccessibilityController();
 
     // Shadow to include accessibility initialization.
     void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname);
@@ -57,6 +56,8 @@ public:
 
     void notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName);
 
+    void setWebView(WebKit::WebView* webView) { m_webView = webView; }
+
 private:
     // If true, will log all accessibility notifications.
     bool m_logAccessibilityEvents;
@@ -77,7 +78,7 @@ private:
 
     std::vector<CppVariant> m_notificationCallbacks;
 
-    TestShell* m_shell;
+    WebKit::WebView* m_webView;
 };
 
 #endif // AccessibilityController_h
index a3df8d4..9d1b213 100644 (file)
@@ -146,7 +146,7 @@ TestShell::TestShell()
 void TestShell::initialize()
 {
     m_webPermissions = adoptPtr(new WebPermissions(this));
-    m_accessibilityController = adoptPtr(new AccessibilityController(this));
+    m_accessibilityController = adoptPtr(new AccessibilityController());
     m_testInterfaces = adoptPtr(new TestInterfaces());
     m_layoutTestController = adoptPtr(new LayoutTestController(this));
     m_eventSender = adoptPtr(new EventSender(this));
@@ -175,15 +175,13 @@ void TestShell::createMainWindow()
     m_drtDevToolsAgent = adoptPtr(new DRTDevToolsAgent);
     m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get()));
     m_webView = m_webViewHost->webView();
+    m_accessibilityController->setWebView(m_webView);
     m_drtDevToolsAgent->setWebView(m_webView);
 }
 
 TestShell::~TestShell()
 {
-    // Note: DevTools are closed together with all the other windows in the
-    // windows list.
-
-    // Destroy the WebView before its WebViewHost.
+    m_accessibilityController->setWebView(0);
     m_drtDevToolsAgent->setWebView(0);
 }