WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-92398-20120802110541.patch (text/plain), 154.86 KB, created by
Balazs Kelemen
on 2012-08-02 02:06:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Balazs Kelemen
Created:
2012-08-02 02:06:03 PDT
Size:
154.86 KB
patch
obsolete
>Subversion Revision: 124329 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 1def78a3562cb919591c377c1cac5357cbd9c243..74d6c815371202077a3fa0d2788c22ff539ac48c 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,128 @@ >+2012-08-02 Balazs Kelemen <kbalazs@webkit.org> >+ >+ All ports should support per test switching of pixel testing >+ https://bugs.webkit.org/show_bug.cgi?id=92398 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Teach all test drivers to accept a per test control of whether >+ to dump pixels. Drivers now accept a -p/--pixel-test argument >+ on the standart input that means that running the current >+ test as pixel test is allowed (even if the expected hash is >+ missing). Removed the --pixel-tests command line option since >+ there is no need for it anymore. >+ >+ * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp: >+ * DumpRenderTree/DumpRenderTree.gypi: >+ * DumpRenderTree/DumpRenderTree.h: >+ (TestCommand::TestCommand): >+ (TestCommand): >+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: >+ * DumpRenderTree/DumpRenderTreeCommon.cpp: Added. >+ (CommandTokenizer): >+ (CommandTokenizer::CommandTokenizer): >+ (CommandTokenizer::pump): >+ (CommandTokenizer::next): >+ (CommandTokenizer::hasNext): >+ (die): >+ (parseInputLine): >+ Common logic to parse the input line from the standard input (or from the command line >+ in standalone mode). Made it somewhat general so we can easily add more arguments if >+ there is a need. >+ >+ * DumpRenderTree/chromium/DumpRenderTree.cpp: >+ (runTest): >+ (main): >+ >+ * DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp. >+ * DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h. >+ * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp. >+ * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h. >+ Renamed these files with a Chromium suffix because they were clashing with the common ones used by other ports after adding the root >+ DumpRenderTree directory to the include path. >+ >+ * DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp: >+ * DumpRenderTree/chromium/TestShell.cpp: >+ (TestShell::TestShell): >+ (TestShell::runFileTest): >+ (TestShell::dump): >+ * DumpRenderTree/chromium/TestShell.h: >+ (TestParams::TestParams): >+ (TestShell): >+ * DumpRenderTree/efl/CMakeLists.txt: >+ * DumpRenderTree/efl/DumpRenderTree.cpp: >+ (parseCommandLineOptions): >+ (runTest): >+ (shouldDumpPixelsAndCompareWithExpected): >+ (main): >+ * DumpRenderTree/gtk/DumpRenderTree.cpp: >+ (initializeGlobalsFromCommandLineOptions): >+ (dump): >+ (runTest): >+ (main): >+ * DumpRenderTree/mac/DumpRenderTree.mm: >+ (initializeGlobalsFromCommandLineOptions): >+ (dumpRenderTree): >+ (dump): >+ (runTest): >+ * DumpRenderTree/qt/DumpRenderTree.pro: >+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp: >+ (WebCore::DumpRenderTree::DumpRenderTree): >+ (WebCore::DumpRenderTree::open): >+ (WebCore::DumpRenderTree::processLine): >+ (WebCore::DumpRenderTree::dump): >+ * DumpRenderTree/qt/DumpRenderTreeQt.h: >+ (DumpRenderTree): >+ * DumpRenderTree/qt/main.cpp: >+ (isOption): >+ (printUsage): >+ (main): >+ * DumpRenderTree/win/DumpRenderTree.cpp: >+ (dump): >+ (runTest): >+ (dllLauncherEntryPoint): >+ * DumpRenderTree/win/DumpRenderTree.vcproj: >+ * DumpRenderTree/wscript: >+ * DumpRenderTree/wx/DumpRenderTreeWx.cpp: >+ (dump): >+ (runTest): >+ (MyApp::OnInit): >+ * GNUmakefile.am: >+ >+ * Scripts/old-run-webkit-tests: >+ * Scripts/old-run-webkit-tests: >+ Pass --pixel-test before the hash. >+ >+ * Scripts/webkitpy/layout_tests/port/base.py: >+ (Port.should_run_as_pixel_test): Removed now that all ports supports it. >+ * Scripts/webkitpy/layout_tests/port/driver.py: >+ (Driver.cmd_line): Don't pass --pixel-tests anymore. >+ (Driver._command_from_driver_input): >+ * Scripts/webkitpy/layout_tests/port/qt.py: >+ (QtPort.should_run_as_pixel_test): >+ * Scripts/webkitpy/layout_tests/port/test.py: >+ (TestPort.should_run_as_pixel_test): >+ >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::TestController::TestController): >+ (WTR::TestController::initialize): >+ (WTR::TestCommand::TestCommand): >+ (TestCommand): >+ (WTR): >+ (CommandTokenizer): >+ (WTR::CommandTokenizer::CommandTokenizer): >+ (WTR::CommandTokenizer::pump): >+ (WTR::CommandTokenizer::next): >+ (WTR::CommandTokenizer::hasNext): >+ (WTR::die): >+ (WTR::parseInputLine): >+ (WTR::TestController::runTest): >+ * WebKitTestRunner/TestController.h: >+ (TestController): >+ Duplicate the logic for parsing the command line because >+ unfortunately there is no way to share code between >+ WebKitTestRunner and DumpRenderTree. >+ > 2012-08-01 Sheriff Bot <webkit.review.bot@gmail.com> > > Unreviewed, rolling out r124325. >diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp >index e38c8d8d49cc31ba4d14800662c9528453d41b2c..d550a47a8645640463072c776af096999cbc3794 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp >+++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp >@@ -133,6 +133,7 @@ > 'include_dirs': [ > '<(chromium_src_dir)', > '<(source_dir)/WebKit/chromium/public', >+ '<(tools_dir)/DumpRenderTree', > '<(DEPTH)', > ], > 'defines': [ >diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi >index f2bc73d7bdf6f74d145677d7dfc43ae35dd2c6a4..996c83d87b44bf057af4858e50c1ea97e058c2ae 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.gypi >+++ b/Tools/DumpRenderTree/DumpRenderTree.gypi >@@ -54,10 +54,12 @@ > 'chromium/WebViewHost.h', > ], > 'test_runner_files': [ >- 'chromium/TestRunner/AccessibilityController.cpp', >- 'chromium/TestRunner/AccessibilityController.h', >- 'chromium/TestRunner/AccessibilityUIElement.cpp', >- 'chromium/TestRunner/AccessibilityUIElement.h', >+ 'DumpRenderTree.h', >+ 'DumpRenderTreeCommon.cpp', >+ 'chromium/TestRunner/AccessibilityControllerChromium.cpp', >+ 'chromium/TestRunner/AccessibilityControllerChromium.h', >+ 'chromium/TestRunner/AccessibilityUIElementChromium.cpp', >+ 'chromium/TestRunner/AccessibilityUIElementChromium.h', > 'chromium/TestRunner/CppBoundClass.cpp', > 'chromium/TestRunner/CppBoundClass.h', > 'chromium/TestRunner/CppVariant.cpp', >diff --git a/Tools/DumpRenderTree/DumpRenderTree.h b/Tools/DumpRenderTree/DumpRenderTree.h >index 0e598be4ae3dd625f0b45efe6b28fa35f67f52f2..18d8cda0eb17fa83bee2089b6d485a649dbb8670 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.h >+++ b/Tools/DumpRenderTree/DumpRenderTree.h >@@ -65,4 +65,14 @@ extern RefPtr<LayoutTestController> gLayoutTestController; > void dump(); > void displayWebView(); > >+struct TestCommand { >+ TestCommand() : shouldDumpPixels(false) { } >+ >+ std::string pathOrURL; >+ bool shouldDumpPixels; >+ std::string expectedPixelHash; >+}; >+ >+TestCommand parseInputLine(const std::string&); >+ > #endif // DumpRenderTree_h >diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >index 83bffd44841aa122eeded4725134c6915200dd5e..481064eb05b335a3cf560d00dca626c93f28b8e6 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >+++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >@@ -89,6 +89,7 @@ > 8CCDA82A151A72D10003F937 /* SampleFont.sfont in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 8CCDA81F151A56550003F937 /* SampleFont.sfont */; }; > 9340994C08540CAE007F3BC8 /* DumpRenderTreePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */; }; > 9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9335435F03D75502008635CE /* WebKit.framework */; }; >+ 9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */; }; > A817090008B163EF00CCB9FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; }; > A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090308B164D300CCB9FB /* JavaScriptCore.framework */; }; > A84F608A08B136DA00E9745F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; }; >@@ -289,6 +290,7 @@ > 8CCDA81F151A56550003F937 /* SampleFont.sfont */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = SampleFont.sfont; path = fonts/SampleFont.sfont; sourceTree = "<group>"; }; > 9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; > 9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DumpRenderTreeCommon.cpp; sourceTree = "<group>"; }; > A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DumpRenderTree.h; sourceTree = "<group>"; }; > A817090308B164D300CCB9FB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; > A84F608908B136DA00E9745F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; >@@ -421,6 +423,7 @@ > 08FB7794FE84155DC02AAC07 /* DumpRenderTree */ = { > isa = PBXGroup; > children = ( >+ 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */, > 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */, > 1422A2750AF6F4BD00E1A883 /* Delegates */, > 1422A2690AF6F45200E1A883 /* Controllers */, >@@ -955,6 +958,7 @@ > 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */, > 3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */, > 80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */, >+ 9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >diff --git a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..48d832258b3821c47150f07a8034836395d4201e >--- /dev/null >+++ b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >@@ -0,0 +1,82 @@ >+#include "config.h" >+#include "DumpRenderTree.h" >+ >+#include <algorithm> >+#include <ctype.h> >+#include <stdio.h> >+#include <stdlib.h> >+#include <string> >+ >+class CommandTokenizer { >+public: >+ explicit CommandTokenizer(const std::string& input) >+ : m_input(input) >+ , m_posNextSeparator(0) >+ { >+ pump(); >+ } >+ >+ bool hasNext() const; >+ std::string next(); >+ >+private: >+ void pump(); >+ static const char kSeparator = '\''; >+ const std::string& m_input; >+ std::string m_next; >+ size_t m_posNextSeparator; >+}; >+ >+void CommandTokenizer::pump() >+{ >+ if (m_posNextSeparator == std::string::npos || m_posNextSeparator == m_input.size()) { >+ m_next = std::string(); >+ return; >+ } >+ size_t start = m_posNextSeparator ? m_posNextSeparator + 1 : 0; >+ m_posNextSeparator = m_input.find(kSeparator, start); >+ size_t size = m_posNextSeparator == std::string::npos ? std::string::npos : m_posNextSeparator - start; >+ m_next = std::string(m_input, start, size); >+} >+ >+std::string CommandTokenizer::next() >+{ >+ ASSERT(hasNext()); >+ >+ std::string oldNext = m_next; >+ pump(); >+ return oldNext; >+} >+ >+bool CommandTokenizer::hasNext() const >+{ >+ return !m_next.empty(); >+} >+ >+NO_RETURN static void die(const std::string& inputLine) >+{ >+ fprintf(stderr, "Unexpected input line: %s\n", inputLine.c_str()); >+ exit(1); >+} >+ >+TestCommand parseInputLine(const std::string& inputLine) >+{ >+ TestCommand result; >+ CommandTokenizer tokenizer(inputLine); >+ if (!tokenizer.hasNext()) >+ die(inputLine); >+ >+ result.pathOrURL = tokenizer.next(); >+ if (!tokenizer.hasNext()) >+ return result; >+ >+ std::string arg = tokenizer.next(); >+ if (arg != std::string("-p") && arg != std::string("--pixel-test")) >+ die(inputLine); >+ result.shouldDumpPixels = true; >+ >+ if (tokenizer.hasNext()) >+ result.expectedPixelHash = tokenizer.next(); >+ >+ return result; >+} >diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp >index 6155f441f5d8bb3c44e5179080dcb17445e89874..b55948436c28b54f2cf769be9ee9257d30192134 100644 >--- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp >@@ -29,6 +29,7 @@ > */ > > #include "config.h" >+#include "DumpRenderTree.h" > > #include "MockWebKitPlatformSupport.h" > #include "TestShell.h" >@@ -44,7 +45,6 @@ using namespace std; > static const char optionComplexText[] = "--complex-text"; > static const char optionDumpAllPixels[] = "--dump-all-pixels"; > static const char optionNotree[] = "--notree"; >-static const char optionPixelTests[] = "--pixel-tests"; > static const char optionThreaded[] = "--threaded"; > static const char optionDebugRenderTree[] = "--debug-render-tree"; > static const char optionDebugLayerTree[] = "--debug-layer-tree"; >@@ -85,17 +85,12 @@ private: > OwnPtr<MockWebKitPlatformSupport> m_mockPlatform; > }; > >-static void runTest(TestShell& shell, TestParams& params, const string& testName) >+static void runTest(TestShell& shell, TestParams& params, const string& inputLine) > { > int oldTimeoutMsec = shell.layoutTestTimeout(); >- params.pixelHash = ""; >- string pathOrURL = testName; >- string::size_type separatorPosition = pathOrURL.find("'"); >- if (separatorPosition != string::npos) { >- params.pixelHash = pathOrURL.substr(separatorPosition + 1); >- pathOrURL.erase(separatorPosition); >- } >- params.testUrl = webkit_support::CreateURLForPathOrURL(pathOrURL); >+ TestCommand command = parseInputLine(inputLine); >+ params.testUrl = webkit_support::CreateURLForPathOrURL(command.pathOrURL); >+ params.pixelHash = command.shouldDumpPixels; > webkit_support::SetCurrentDirectoryForFileURL(params.testUrl); > v8::V8::SetFlagsFromString(shell.javaScriptFlags().c_str(), shell.javaScriptFlags().length()); > if (shell.stressOpt() || shell.stressDeopt()) { >@@ -108,11 +103,11 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName > bool isLastLoad = (i == (v8::Testing::GetStressRuns() - 1)); > shell.setDumpWhenFinished(isLastLoad); > shell.resetTestController(); >- shell.runFileTest(params); >+ shell.runFileTest(params, command.shouldDumpPixels); > } > } else { > shell.resetTestController(); >- shell.runFileTest(params); >+ shell.runFileTest(params, command.shouldDumpPixels); > } > shell.setLayoutTestTimeout(oldTimeoutMsec); > } >@@ -146,8 +141,6 @@ int main(int argc, char* argv[]) > serverMode = true; > else if (argument == optionNotree) > params.dumpTree = false; >- else if (argument == optionPixelTests) >- params.dumpPixels = true; > else if (argument == optionDebugRenderTree) > params.debugRenderTree = true; > else if (argument == optionDebugLayerTree) >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp >deleted file mode 100644 >index c6e4404c2c3472b3b68cf2209b07afc6f96a2cbf..0000000000000000000000000000000000000000 >--- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp >+++ /dev/null >@@ -1,149 +0,0 @@ >-/* >- * Copyright (C) 2010 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "AccessibilityController.h" >- >-#include "WebAccessibilityObject.h" >-#include "WebFrame.h" >-#include "WebView.h" >-#include "platform/WebString.h" >- >-using namespace WebKit; >- >-AccessibilityController::AccessibilityController() >- : m_logAccessibilityEvents(false) >-{ >- >- bindMethod("logAccessibilityEvents", &AccessibilityController::logAccessibilityEventsCallback); >- bindMethod("addNotificationListener", &AccessibilityController::addNotificationListenerCallback); >- bindMethod("removeNotificationListener", &AccessibilityController::removeNotificationListenerCallback); >- >- bindProperty("focusedElement", &AccessibilityController::focusedElementGetterCallback); >- bindProperty("rootElement", &AccessibilityController::rootElementGetterCallback); >- >- bindFallbackMethod(&AccessibilityController::fallbackCallback); >-} >- >-void AccessibilityController::bindToJavascript(WebFrame* frame, const WebString& classname) >-{ >- WebAccessibilityObject::enableAccessibility(); >- CppBoundClass::bindToJavascript(frame, classname); >-} >- >-void AccessibilityController::reset() >-{ >- m_rootElement = WebAccessibilityObject(); >- m_focusedElement = WebAccessibilityObject(); >- m_elements.clear(); >- >- m_logAccessibilityEvents = false; >-} >- >-void AccessibilityController::setFocusedElement(const WebAccessibilityObject& focusedElement) >-{ >- m_focusedElement = focusedElement; >-} >- >-AccessibilityUIElement* AccessibilityController::getFocusedElement() >-{ >- if (m_focusedElement.isNull()) >- m_focusedElement = m_webView->accessibilityObject(); >- return m_elements.getOrCreate(m_focusedElement); >-} >- >-AccessibilityUIElement* AccessibilityController::getRootElement() >-{ >- if (m_rootElement.isNull()) >- m_rootElement = m_webView->accessibilityObject(); >- return m_elements.createRoot(m_rootElement); >-} >- >-bool AccessibilityController::shouldLogAccessibilityEvents() >-{ >- return m_logAccessibilityEvents; >-} >- >-void AccessibilityController::notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName) >-{ >- // Call notification listeners on the element. >- AccessibilityUIElement* element = m_elements.getOrCreate(target); >- element->notificationReceived(notificationName); >- >- // Call global notification listeners. >- size_t callbackCount = m_notificationCallbacks.size(); >- for (size_t i = 0; i < callbackCount; i++) { >- CppVariant arguments[2]; >- arguments[0].set(*element->getAsCppVariant()); >- arguments[1].set(notificationName); >- CppVariant invokeResult; >- m_notificationCallbacks[i].invokeDefault(arguments, 2, invokeResult); >- } >-} >- >-void AccessibilityController::logAccessibilityEventsCallback(const CppArgumentList&, CppVariant* result) >-{ >- m_logAccessibilityEvents = true; >- result->setNull(); >-} >- >-void AccessibilityController::addNotificationListenerCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- if (arguments.size() < 1 || !arguments[0].isObject()) { >- result->setNull(); >- return; >- } >- >- m_notificationCallbacks.push_back(arguments[0]); >- result->setNull(); >-} >- >-void AccessibilityController::removeNotificationListenerCallback(const CppArgumentList&, CppVariant* result) >-{ >- // FIXME: Implement this. >- result->setNull(); >-} >- >-void AccessibilityController::focusedElementGetterCallback(CppVariant* result) >-{ >- result->set(*(getFocusedElement()->getAsCppVariant())); >-} >- >-void AccessibilityController::rootElementGetterCallback(CppVariant* result) >-{ >- result->set(*(getRootElement()->getAsCppVariant())); >-} >- >-void AccessibilityController::fallbackCallback(const CppArgumentList&, CppVariant* result) >-{ >- printf("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on " >- "AccessibilityController\n"); >- result->setNull(); >-} >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h >deleted file mode 100644 >index 96725953608b487403c2aa21a624e864fd70eeed..0000000000000000000000000000000000000000 >--- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h >+++ /dev/null >@@ -1,84 +0,0 @@ >-/* >- * Copyright (C) 2010 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef AccessibilityController_h >-#define AccessibilityController_h >- >-#include "AccessibilityUIElement.h" >-#include "CppBoundClass.h" >- >-namespace WebKit { >-class WebAccessibilityObject; >-class WebFrame; >-class WebView; >-} >- >-class AccessibilityController : public CppBoundClass { >-public: >- AccessibilityController(); >- >- // Shadow to include accessibility initialization. >- void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname); >- void reset(); >- >- void setFocusedElement(const WebKit::WebAccessibilityObject&); >- AccessibilityUIElement* getFocusedElement(); >- AccessibilityUIElement* getRootElement(); >- >- bool shouldLogAccessibilityEvents(); >- >- 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; >- >- // Bound methods and properties >- void logAccessibilityEventsCallback(const CppArgumentList&, CppVariant*); >- void fallbackCallback(const CppArgumentList&, CppVariant*); >- void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); >- void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*); >- >- void focusedElementGetterCallback(CppVariant*); >- void rootElementGetterCallback(CppVariant*); >- >- WebKit::WebAccessibilityObject m_focusedElement; >- WebKit::WebAccessibilityObject m_rootElement; >- >- AccessibilityUIElementList m_elements; >- >- std::vector<CppVariant> m_notificationCallbacks; >- >- WebKit::WebView* m_webView; >-}; >- >-#endif // AccessibilityController_h >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..b1d2948aebab32982492754582458307314bcded >--- /dev/null >+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp >@@ -0,0 +1,149 @@ >+/* >+ * Copyright (C) 2010 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "AccessibilityControllerChromium.h" >+ >+#include "WebAccessibilityObject.h" >+#include "WebFrame.h" >+#include "WebView.h" >+#include "platform/WebString.h" >+ >+using namespace WebKit; >+ >+AccessibilityController::AccessibilityController() >+ : m_logAccessibilityEvents(false) >+{ >+ >+ bindMethod("logAccessibilityEvents", &AccessibilityController::logAccessibilityEventsCallback); >+ bindMethod("addNotificationListener", &AccessibilityController::addNotificationListenerCallback); >+ bindMethod("removeNotificationListener", &AccessibilityController::removeNotificationListenerCallback); >+ >+ bindProperty("focusedElement", &AccessibilityController::focusedElementGetterCallback); >+ bindProperty("rootElement", &AccessibilityController::rootElementGetterCallback); >+ >+ bindFallbackMethod(&AccessibilityController::fallbackCallback); >+} >+ >+void AccessibilityController::bindToJavascript(WebFrame* frame, const WebString& classname) >+{ >+ WebAccessibilityObject::enableAccessibility(); >+ CppBoundClass::bindToJavascript(frame, classname); >+} >+ >+void AccessibilityController::reset() >+{ >+ m_rootElement = WebAccessibilityObject(); >+ m_focusedElement = WebAccessibilityObject(); >+ m_elements.clear(); >+ >+ m_logAccessibilityEvents = false; >+} >+ >+void AccessibilityController::setFocusedElement(const WebAccessibilityObject& focusedElement) >+{ >+ m_focusedElement = focusedElement; >+} >+ >+AccessibilityUIElement* AccessibilityController::getFocusedElement() >+{ >+ if (m_focusedElement.isNull()) >+ m_focusedElement = m_webView->accessibilityObject(); >+ return m_elements.getOrCreate(m_focusedElement); >+} >+ >+AccessibilityUIElement* AccessibilityController::getRootElement() >+{ >+ if (m_rootElement.isNull()) >+ m_rootElement = m_webView->accessibilityObject(); >+ return m_elements.createRoot(m_rootElement); >+} >+ >+bool AccessibilityController::shouldLogAccessibilityEvents() >+{ >+ return m_logAccessibilityEvents; >+} >+ >+void AccessibilityController::notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName) >+{ >+ // Call notification listeners on the element. >+ AccessibilityUIElement* element = m_elements.getOrCreate(target); >+ element->notificationReceived(notificationName); >+ >+ // Call global notification listeners. >+ size_t callbackCount = m_notificationCallbacks.size(); >+ for (size_t i = 0; i < callbackCount; i++) { >+ CppVariant arguments[2]; >+ arguments[0].set(*element->getAsCppVariant()); >+ arguments[1].set(notificationName); >+ CppVariant invokeResult; >+ m_notificationCallbacks[i].invokeDefault(arguments, 2, invokeResult); >+ } >+} >+ >+void AccessibilityController::logAccessibilityEventsCallback(const CppArgumentList&, CppVariant* result) >+{ >+ m_logAccessibilityEvents = true; >+ result->setNull(); >+} >+ >+void AccessibilityController::addNotificationListenerCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ if (arguments.size() < 1 || !arguments[0].isObject()) { >+ result->setNull(); >+ return; >+ } >+ >+ m_notificationCallbacks.push_back(arguments[0]); >+ result->setNull(); >+} >+ >+void AccessibilityController::removeNotificationListenerCallback(const CppArgumentList&, CppVariant* result) >+{ >+ // FIXME: Implement this. >+ result->setNull(); >+} >+ >+void AccessibilityController::focusedElementGetterCallback(CppVariant* result) >+{ >+ result->set(*(getFocusedElement()->getAsCppVariant())); >+} >+ >+void AccessibilityController::rootElementGetterCallback(CppVariant* result) >+{ >+ result->set(*(getRootElement()->getAsCppVariant())); >+} >+ >+void AccessibilityController::fallbackCallback(const CppArgumentList&, CppVariant* result) >+{ >+ printf("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on " >+ "AccessibilityController\n"); >+ result->setNull(); >+} >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h >new file mode 100644 >index 0000000000000000000000000000000000000000..11c082b3e808c1f630eb85184e6e8fb3e816f498 >--- /dev/null >+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h >@@ -0,0 +1,84 @@ >+/* >+ * Copyright (C) 2010 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef AccessibilityControllerChromium_h >+#define AccessibilityControllerChromium_h >+ >+#include "AccessibilityUIElementChromium.h" >+#include "CppBoundClass.h" >+ >+namespace WebKit { >+class WebAccessibilityObject; >+class WebFrame; >+class WebView; >+} >+ >+class AccessibilityController : public CppBoundClass { >+public: >+ AccessibilityController(); >+ >+ // Shadow to include accessibility initialization. >+ void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname); >+ void reset(); >+ >+ void setFocusedElement(const WebKit::WebAccessibilityObject&); >+ AccessibilityUIElement* getFocusedElement(); >+ AccessibilityUIElement* getRootElement(); >+ >+ bool shouldLogAccessibilityEvents(); >+ >+ 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; >+ >+ // Bound methods and properties >+ void logAccessibilityEventsCallback(const CppArgumentList&, CppVariant*); >+ void fallbackCallback(const CppArgumentList&, CppVariant*); >+ void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); >+ void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*); >+ >+ void focusedElementGetterCallback(CppVariant*); >+ void rootElementGetterCallback(CppVariant*); >+ >+ WebKit::WebAccessibilityObject m_focusedElement; >+ WebKit::WebAccessibilityObject m_rootElement; >+ >+ AccessibilityUIElementList m_elements; >+ >+ std::vector<CppVariant> m_notificationCallbacks; >+ >+ WebKit::WebView* m_webView; >+}; >+ >+#endif // AccessibilityControllerChromium_h >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp >deleted file mode 100644 >index 583806585b481ee141abe484b7e2484e8847ec18..0000000000000000000000000000000000000000 >--- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp >+++ /dev/null >@@ -1,862 +0,0 @@ >-/* >- * Copyright (C) 2010 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "AccessibilityUIElement.h" >- >-#include "WebAccessibilityObject.h" >-#include "platform/WebCString.h" >-#include "platform/WebPoint.h" >-#include "platform/WebRect.h" >-#include "platform/WebString.h" >-#include <wtf/Assertions.h> >- >-using namespace WebKit; >-using namespace std; >- >-// Map role value to string, matching Safari/Mac platform implementation to >-// avoid rebaselining layout tests. >-static string roleToString(WebAccessibilityRole role) >-{ >- string result = "AXRole: AX"; >- switch (role) { >- case WebAccessibilityRoleButton: >- return result.append("Button"); >- case WebAccessibilityRoleRadioButton: >- return result.append("RadioButton"); >- case WebAccessibilityRoleCheckBox: >- return result.append("CheckBox"); >- case WebAccessibilityRoleSlider: >- return result.append("Slider"); >- case WebAccessibilityRoleTabGroup: >- return result.append("TabGroup"); >- case WebAccessibilityRoleTextField: >- return result.append("TextField"); >- case WebAccessibilityRoleStaticText: >- return result.append("StaticText"); >- case WebAccessibilityRoleTextArea: >- return result.append("TextArea"); >- case WebAccessibilityRoleScrollArea: >- return result.append("ScrollArea"); >- case WebAccessibilityRolePopUpButton: >- return result.append("PopUpButton"); >- case WebAccessibilityRoleMenuButton: >- return result.append("MenuButton"); >- case WebAccessibilityRoleTable: >- return result.append("Table"); >- case WebAccessibilityRoleApplication: >- return result.append("Application"); >- case WebAccessibilityRoleGroup: >- return result.append("Group"); >- case WebAccessibilityRoleRadioGroup: >- return result.append("RadioGroup"); >- case WebAccessibilityRoleList: >- return result.append("List"); >- case WebAccessibilityRoleScrollBar: >- return result.append("ScrollBar"); >- case WebAccessibilityRoleValueIndicator: >- return result.append("ValueIndicator"); >- case WebAccessibilityRoleImage: >- return result.append("Image"); >- case WebAccessibilityRoleMenuBar: >- return result.append("MenuBar"); >- case WebAccessibilityRoleMenu: >- return result.append("Menu"); >- case WebAccessibilityRoleMenuItem: >- return result.append("MenuItem"); >- case WebAccessibilityRoleColumn: >- return result.append("Column"); >- case WebAccessibilityRoleRow: >- return result.append("Row"); >- case WebAccessibilityRoleToolbar: >- return result.append("Toolbar"); >- case WebAccessibilityRoleBusyIndicator: >- return result.append("BusyIndicator"); >- case WebAccessibilityRoleProgressIndicator: >- return result.append("ProgressIndicator"); >- case WebAccessibilityRoleWindow: >- return result.append("Window"); >- case WebAccessibilityRoleDrawer: >- return result.append("Drawer"); >- case WebAccessibilityRoleSystemWide: >- return result.append("SystemWide"); >- case WebAccessibilityRoleOutline: >- return result.append("Outline"); >- case WebAccessibilityRoleIncrementor: >- return result.append("Incrementor"); >- case WebAccessibilityRoleBrowser: >- return result.append("Browser"); >- case WebAccessibilityRoleComboBox: >- return result.append("ComboBox"); >- case WebAccessibilityRoleSplitGroup: >- return result.append("SplitGroup"); >- case WebAccessibilityRoleSplitter: >- return result.append("Splitter"); >- case WebAccessibilityRoleColorWell: >- return result.append("ColorWell"); >- case WebAccessibilityRoleGrowArea: >- return result.append("GrowArea"); >- case WebAccessibilityRoleSheet: >- return result.append("Sheet"); >- case WebAccessibilityRoleHelpTag: >- return result.append("HelpTag"); >- case WebAccessibilityRoleMatte: >- return result.append("Matte"); >- case WebAccessibilityRoleRuler: >- return result.append("Ruler"); >- case WebAccessibilityRoleRulerMarker: >- return result.append("RulerMarker"); >- case WebAccessibilityRoleLink: >- return result.append("Link"); >- case WebAccessibilityRoleDisclosureTriangle: >- return result.append("DisclosureTriangle"); >- case WebAccessibilityRoleGrid: >- return result.append("Grid"); >- case WebAccessibilityRoleCell: >- return result.append("Cell"); >- case WebAccessibilityRoleColumnHeader: >- return result.append("ColumnHeader"); >- case WebAccessibilityRoleRowHeader: >- return result.append("RowHeader"); >- case WebAccessibilityRoleWebCoreLink: >- // Maps to Link role. >- return result.append("Link"); >- case WebAccessibilityRoleImageMapLink: >- return result.append("ImageMapLink"); >- case WebAccessibilityRoleImageMap: >- return result.append("ImageMap"); >- case WebAccessibilityRoleListMarker: >- return result.append("ListMarker"); >- case WebAccessibilityRoleWebArea: >- return result.append("WebArea"); >- case WebAccessibilityRoleHeading: >- return result.append("Heading"); >- case WebAccessibilityRoleListBox: >- return result.append("ListBox"); >- case WebAccessibilityRoleListBoxOption: >- return result.append("ListBoxOption"); >- case WebAccessibilityRoleTableHeaderContainer: >- return result.append("TableHeaderContainer"); >- case WebAccessibilityRoleDefinitionListTerm: >- return result.append("DefinitionListTerm"); >- case WebAccessibilityRoleDefinitionListDefinition: >- return result.append("DefinitionListDefinition"); >- case WebAccessibilityRoleAnnotation: >- return result.append("Annotation"); >- case WebAccessibilityRoleSliderThumb: >- return result.append("SliderThumb"); >- case WebAccessibilityRoleLandmarkApplication: >- return result.append("LandmarkApplication"); >- case WebAccessibilityRoleLandmarkBanner: >- return result.append("LandmarkBanner"); >- case WebAccessibilityRoleLandmarkComplementary: >- return result.append("LandmarkComplementary"); >- case WebAccessibilityRoleLandmarkContentInfo: >- return result.append("LandmarkContentInfo"); >- case WebAccessibilityRoleLandmarkMain: >- return result.append("LandmarkMain"); >- case WebAccessibilityRoleLandmarkNavigation: >- return result.append("LandmarkNavigation"); >- case WebAccessibilityRoleLandmarkSearch: >- return result.append("LandmarkSearch"); >- case WebAccessibilityRoleApplicationLog: >- return result.append("ApplicationLog"); >- case WebAccessibilityRoleApplicationMarquee: >- return result.append("ApplicationMarquee"); >- case WebAccessibilityRoleApplicationStatus: >- return result.append("ApplicationStatus"); >- case WebAccessibilityRoleApplicationTimer: >- return result.append("ApplicationTimer"); >- case WebAccessibilityRoleDocument: >- return result.append("Document"); >- case WebAccessibilityRoleDocumentArticle: >- return result.append("DocumentArticle"); >- case WebAccessibilityRoleDocumentNote: >- return result.append("DocumentNote"); >- case WebAccessibilityRoleDocumentRegion: >- return result.append("DocumentRegion"); >- case WebAccessibilityRoleUserInterfaceTooltip: >- return result.append("UserInterfaceTooltip"); >- default: >- // Also matches WebAccessibilityRoleUnknown. >- return result.append("Unknown"); >- } >-} >- >-string getDescription(const WebAccessibilityObject& object) >-{ >- string description = object.accessibilityDescription().utf8(); >- return description.insert(0, "AXDescription: "); >-} >- >-string getHelpText(const WebAccessibilityObject& object) >-{ >- string helpText = object.helpText().utf8(); >- return helpText.insert(0, "AXHelp: "); >-} >- >-string getStringValue(const WebAccessibilityObject& object) >-{ >- string value = object.stringValue().utf8(); >- return value.insert(0, "AXValue: "); >-} >- >-string getRole(const WebAccessibilityObject& object) >-{ >- return roleToString(object.roleValue()); >-} >- >-string getTitle(const WebAccessibilityObject& object) >-{ >- string title = object.title().utf8(); >- return title.insert(0, "AXTitle: "); >-} >- >-string getOrientation(const WebAccessibilityObject& object) >-{ >- if (object.isVertical()) >- return "AXOrientation: AXVerticalOrientation"; >- >- return "AXOrientation: AXHorizontalOrientation"; >-} >- >-string getAttributes(const WebAccessibilityObject& object) >-{ >- // FIXME: Concatenate all attributes of the AccessibilityObject. >- string attributes(getTitle(object)); >- attributes.append("\n"); >- attributes.append(getRole(object)); >- attributes.append("\n"); >- attributes.append(getDescription(object)); >- return attributes; >-} >- >- >-// Collects attributes into a string, delimited by dashes. Used by all methods >-// that output lists of attributes: attributesOfLinkedUIElementsCallback, >-// AttributesOfChildrenCallback, etc. >-class AttributesCollector { >-public: >- void collectAttributes(const WebAccessibilityObject& object) >- { >- m_attributes.append("\n------------\n"); >- m_attributes.append(getAttributes(object)); >- } >- >- string attributes() const { return m_attributes; } >- >-private: >- string m_attributes; >-}; >- >-AccessibilityUIElement::AccessibilityUIElement(const WebAccessibilityObject& object, Factory* factory) >- : m_accessibilityObject(object) >- , m_factory(factory) >-{ >- >- ASSERT(factory); >- >- // >- // Properties >- // >- >- bindProperty("role", &AccessibilityUIElement::roleGetterCallback); >- bindProperty("title", &AccessibilityUIElement::titleGetterCallback); >- bindProperty("description", &AccessibilityUIElement::descriptionGetterCallback); >- bindProperty("helpText", &AccessibilityUIElement::helpTextGetterCallback); >- bindProperty("stringValue", &AccessibilityUIElement::stringValueGetterCallback); >- bindProperty("x", &AccessibilityUIElement::xGetterCallback); >- bindProperty("y", &AccessibilityUIElement::yGetterCallback); >- bindProperty("width", &AccessibilityUIElement::widthGetterCallback); >- bindProperty("height", &AccessibilityUIElement::heightGetterCallback); >- bindProperty("intValue", &AccessibilityUIElement::intValueGetterCallback); >- bindProperty("minValue", &AccessibilityUIElement::minValueGetterCallback); >- bindProperty("maxValue", &AccessibilityUIElement::maxValueGetterCallback); >- bindProperty("childrenCount", &AccessibilityUIElement::childrenCountGetterCallback); >- bindProperty("insertionPointLineNumber", &AccessibilityUIElement::insertionPointLineNumberGetterCallback); >- bindProperty("selectedTextRange", &AccessibilityUIElement::selectedTextRangeGetterCallback); >- bindProperty("isEnabled", &AccessibilityUIElement::isEnabledGetterCallback); >- bindProperty("isRequired", &AccessibilityUIElement::isRequiredGetterCallback); >- bindProperty("isFocused", &AccessibilityUIElement::isFocusedGetterCallback); >- bindProperty("isFocusable", &AccessibilityUIElement::isFocusableGetterCallback); >- bindProperty("isSelected", &AccessibilityUIElement::isSelectedGetterCallback); >- bindProperty("isSelectable", &AccessibilityUIElement::isSelectableGetterCallback); >- bindProperty("isMultiSelectable", &AccessibilityUIElement::isMultiSelectableGetterCallback); >- bindProperty("isSelectedOptionActive", &AccessibilityUIElement::isSelectedOptionActiveGetterCallback); >- bindProperty("isExpanded", &AccessibilityUIElement::isExpandedGetterCallback); >- bindProperty("isChecked", &AccessibilityUIElement::isCheckedGetterCallback); >- bindProperty("isVisible", &AccessibilityUIElement::isVisibleGetterCallback); >- bindProperty("isOffScreen", &AccessibilityUIElement::isOffScreenGetterCallback); >- bindProperty("isCollapsed", &AccessibilityUIElement::isCollapsedGetterCallback); >- bindProperty("hasPopup", &AccessibilityUIElement::hasPopupGetterCallback); >- bindProperty("isValid", &AccessibilityUIElement::isValidGetterCallback); >- bindProperty("orientation", &AccessibilityUIElement::orientationGetterCallback); >- >- // >- // Methods >- // >- >- bindMethod("allAttributes", &AccessibilityUIElement::allAttributesCallback); >- bindMethod("attributesOfLinkedUIElements", &AccessibilityUIElement::attributesOfLinkedUIElementsCallback); >- bindMethod("attributesOfDocumentLinks", &AccessibilityUIElement::attributesOfDocumentLinksCallback); >- bindMethod("attributesOfChildren", &AccessibilityUIElement::attributesOfChildrenCallback); >- bindMethod("lineForIndex", &AccessibilityUIElement::lineForIndexCallback); >- bindMethod("boundsForRange", &AccessibilityUIElement::boundsForRangeCallback); >- bindMethod("stringForRange", &AccessibilityUIElement::stringForRangeCallback); >- bindMethod("childAtIndex", &AccessibilityUIElement::childAtIndexCallback); >- bindMethod("elementAtPoint", &AccessibilityUIElement::elementAtPointCallback); >- bindMethod("attributesOfColumnHeaders", &AccessibilityUIElement::attributesOfColumnHeadersCallback); >- bindMethod("attributesOfRowHeaders", &AccessibilityUIElement::attributesOfRowHeadersCallback); >- bindMethod("attributesOfColumns", &AccessibilityUIElement::attributesOfColumnsCallback); >- bindMethod("attributesOfRows", &AccessibilityUIElement::attributesOfRowsCallback); >- bindMethod("attributesOfVisibleCells", &AccessibilityUIElement::attributesOfVisibleCellsCallback); >- bindMethod("attributesOfHeader", &AccessibilityUIElement::attributesOfHeaderCallback); >- bindMethod("indexInTable", &AccessibilityUIElement::indexInTableCallback); >- bindMethod("rowIndexRange", &AccessibilityUIElement::rowIndexRangeCallback); >- bindMethod("columnIndexRange", &AccessibilityUIElement::columnIndexRangeCallback); >- bindMethod("cellForColumnAndRow", &AccessibilityUIElement::cellForColumnAndRowCallback); >- bindMethod("titleUIElement", &AccessibilityUIElement::titleUIElementCallback); >- bindMethod("setSelectedTextRange", &AccessibilityUIElement::setSelectedTextRangeCallback); >- bindMethod("attributeValue", &AccessibilityUIElement::attributeValueCallback); >- bindMethod("isAttributeSettable", &AccessibilityUIElement::isAttributeSettableCallback); >- bindMethod("isActionSupported", &AccessibilityUIElement::isActionSupportedCallback); >- bindMethod("parentElement", &AccessibilityUIElement::parentElementCallback); >- bindMethod("increment", &AccessibilityUIElement::incrementCallback); >- bindMethod("decrement", &AccessibilityUIElement::decrementCallback); >- bindMethod("showMenu", &AccessibilityUIElement::showMenuCallback); >- bindMethod("press", &AccessibilityUIElement::pressCallback); >- bindMethod("isEqual", &AccessibilityUIElement::isEqualCallback); >- bindMethod("addNotificationListener", &AccessibilityUIElement::addNotificationListenerCallback); >- bindMethod("removeNotificationListener", &AccessibilityUIElement::removeNotificationListenerCallback); >- bindMethod("takeFocus", &AccessibilityUIElement::takeFocusCallback); >- bindMethod("scrollToMakeVisible", &AccessibilityUIElement::scrollToMakeVisibleCallback); >- bindMethod("scrollToMakeVisibleWithSubFocus", &AccessibilityUIElement::scrollToMakeVisibleWithSubFocusCallback); >- bindMethod("scrollToGlobalPoint", &AccessibilityUIElement::scrollToGlobalPointCallback); >- >- bindFallbackMethod(&AccessibilityUIElement::fallbackCallback); >-} >- >-AccessibilityUIElement* AccessibilityUIElement::getChildAtIndex(unsigned index) >-{ >- return m_factory->getOrCreate(accessibilityObject().childAt(index)); >-} >- >-bool AccessibilityUIElement::isEqual(const WebKit::WebAccessibilityObject& other) >-{ >- return accessibilityObject().equals(other); >-} >- >-void AccessibilityUIElement::notificationReceived(const char* notificationName) >-{ >- size_t callbackCount = m_notificationCallbacks.size(); >- for (size_t i = 0; i < callbackCount; i++) { >- CppVariant notificationNameArgument; >- notificationNameArgument.set(notificationName); >- CppVariant invokeResult; >- m_notificationCallbacks[i].invokeDefault(¬ificationNameArgument, 1, invokeResult); >- } >-} >- >-// >-// Properties >-// >- >-void AccessibilityUIElement::roleGetterCallback(CppVariant* result) >-{ >- result->set(getRole(accessibilityObject())); >-} >- >-void AccessibilityUIElement::titleGetterCallback(CppVariant* result) >-{ >- result->set(getTitle(accessibilityObject())); >-} >- >-void AccessibilityUIElement::descriptionGetterCallback(CppVariant* result) >-{ >- result->set(getDescription(accessibilityObject())); >-} >- >-void AccessibilityUIElement::helpTextGetterCallback(CppVariant* result) >-{ >- result->set(getHelpText(accessibilityObject())); >-} >- >-void AccessibilityUIElement::stringValueGetterCallback(CppVariant* result) >-{ >- result->set(getStringValue(accessibilityObject())); >-} >- >-void AccessibilityUIElement::xGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().boundingBoxRect().x); >-} >- >-void AccessibilityUIElement::yGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().boundingBoxRect().y); >-} >- >-void AccessibilityUIElement::widthGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().boundingBoxRect().width); >-} >- >-void AccessibilityUIElement::heightGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().boundingBoxRect().height); >-} >- >-void AccessibilityUIElement::intValueGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().valueForRange()); >-} >- >-void AccessibilityUIElement::minValueGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().minValueForRange()); >-} >- >-void AccessibilityUIElement::maxValueGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().maxValueForRange()); >-} >- >-void AccessibilityUIElement::childrenCountGetterCallback(CppVariant* result) >-{ >- int count = 1; // Root object always has only one child, the WebView. >- if (!isRoot()) >- count = accessibilityObject().childCount(); >- result->set(count); >-} >- >-void AccessibilityUIElement::insertionPointLineNumberGetterCallback(CppVariant* result) >-{ >- WebVector<int> lineBreaks; >- accessibilityObject().lineBreaks(lineBreaks); >- int cursor = accessibilityObject().selectionEnd(); >- int line = 0; >- while (line < static_cast<int>(lineBreaks.size()) && lineBreaks[line] <= cursor) >- line++; >- result->set(line); >-} >- >-void AccessibilityUIElement::selectedTextRangeGetterCallback(CppVariant* result) >-{ >- // FIXME: Implement this. >- result->set(std::string()); >-} >- >-void AccessibilityUIElement::isEnabledGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isEnabled()); >-} >- >-void AccessibilityUIElement::isRequiredGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isRequired()); >-} >- >-void AccessibilityUIElement::isFocusedGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isFocused()); >-} >- >-void AccessibilityUIElement::isFocusableGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().canSetFocusAttribute()); >-} >- >-void AccessibilityUIElement::isSelectedGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isSelected()); >-} >- >-void AccessibilityUIElement::isSelectableGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().canSetSelectedAttribute()); >-} >- >-void AccessibilityUIElement::isMultiSelectableGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isMultiSelectable()); >-} >- >-void AccessibilityUIElement::isSelectedOptionActiveGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isSelectedOptionActive()); >-} >- >-void AccessibilityUIElement::isExpandedGetterCallback(CppVariant* result) >-{ >- result->set(!accessibilityObject().isCollapsed()); >-} >- >-void AccessibilityUIElement::isCheckedGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isChecked()); >-} >- >-void AccessibilityUIElement::isVisibleGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isVisible()); >-} >- >-void AccessibilityUIElement::isOffScreenGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isOffScreen()); >-} >- >-void AccessibilityUIElement::isCollapsedGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isCollapsed()); >-} >- >-void AccessibilityUIElement::hasPopupGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().ariaHasPopup()); >-} >- >-void AccessibilityUIElement::isValidGetterCallback(CppVariant* result) >-{ >- result->set(accessibilityObject().isValid()); >-} >- >-void AccessibilityUIElement::orientationGetterCallback(CppVariant* result) >-{ >- result->set(getOrientation(accessibilityObject())); >-} >- >-// >-// Methods >-// >- >-void AccessibilityUIElement::allAttributesCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->set(getAttributes(accessibilityObject())); >-} >- >-void AccessibilityUIElement::attributesOfLinkedUIElementsCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfDocumentLinksCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfChildrenCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- AttributesCollector collector; >- unsigned size = accessibilityObject().childCount(); >- for (unsigned i = 0; i < size; ++i) >- collector.collectAttributes(accessibilityObject().childAt(i)); >- result->set(collector.attributes()); >-} >- >-void AccessibilityUIElement::parametrizedAttributeNamesCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::lineForIndexCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::boundsForRangeCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::stringForRangeCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::childAtIndexCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- if (!arguments.size() || !arguments[0].isNumber()) { >- result->setNull(); >- return; >- } >- >- AccessibilityUIElement* child = getChildAtIndex(arguments[0].toInt32()); >- if (!child) { >- result->setNull(); >- return; >- } >- >- result->set(*(child->getAsCppVariant())); >-} >- >-void AccessibilityUIElement::elementAtPointCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfRowHeadersCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfColumnsCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfRowsCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfVisibleCellsCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributesOfHeaderCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::indexInTableCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::rowIndexRangeCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::columnIndexRangeCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::cellForColumnAndRowCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::titleUIElementCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::setSelectedTextRangeCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::attributeValueCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::isAttributeSettableCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- if (arguments.size() < 1 && !arguments[0].isString()) { >- result->setNull(); >- return; >- } >- >- string attribute = arguments[0].toString(); >- bool settable = false; >- if (attribute == "AXValue") >- settable = accessibilityObject().canSetValueAttribute(); >- result->set(settable); >-} >- >-void AccessibilityUIElement::isActionSupportedCallback(const CppArgumentList&, CppVariant* result) >-{ >- // This one may be really hard to implement. >- // Not exposed by AccessibilityObject. >- result->setNull(); >-} >- >-void AccessibilityUIElement::parentElementCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::incrementCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::decrementCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::showMenuCallback(const CppArgumentList&, CppVariant* result) >-{ >- result->setNull(); >-} >- >-void AccessibilityUIElement::pressCallback(const CppArgumentList&, CppVariant* result) >-{ >- accessibilityObject().performDefaultAction(); >- result->setNull(); >-} >- >-void AccessibilityUIElement::isEqualCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- if (arguments.size() < 1 || !arguments[0].isObject()) { >- result->setNull(); >- return; >- } >- >- result->set(arguments[0].isEqual(*getAsCppVariant())); >-} >- >-void AccessibilityUIElement::addNotificationListenerCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- if (arguments.size() < 1 || !arguments[0].isObject()) { >- result->setNull(); >- return; >- } >- >- m_notificationCallbacks.push_back(arguments[0]); >- result->setNull(); >-} >- >-void AccessibilityUIElement::removeNotificationListenerCallback(const CppArgumentList&, CppVariant* result) >-{ >- // FIXME: Implement this. >- result->setNull(); >-} >- >-void AccessibilityUIElement::takeFocusCallback(const CppArgumentList&, CppVariant* result) >-{ >- accessibilityObject().setFocused(true); >- result->setNull(); >-} >- >-void AccessibilityUIElement::scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant* result) >-{ >- accessibilityObject().scrollToMakeVisible(); >- result->setNull(); >-} >- >-void AccessibilityUIElement::scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- result->setNull(); >- >- if (arguments.size() != 4 >- || !arguments[0].isNumber() >- || !arguments[1].isNumber() >- || !arguments[2].isNumber() >- || !arguments[3].isNumber()) >- return; >- >- int x = arguments[0].toInt32(); >- int y = arguments[1].toInt32(); >- int width = arguments[2].toInt32(); >- int height = arguments[3].toInt32(); >- accessibilityObject().scrollToMakeVisibleWithSubFocus(WebRect(x, y, width, height)); >- result->setNull(); >-} >- >-void AccessibilityUIElement::scrollToGlobalPointCallback(const CppArgumentList& arguments, CppVariant* result) >-{ >- result->setNull(); >- >- if (arguments.size() != 2 >- || !arguments[0].isNumber() >- || !arguments[1].isNumber()) >- return; >- >- int x = arguments[0].toInt32(); >- int y = arguments[1].toInt32(); >- >- accessibilityObject().scrollToGlobalPoint(WebPoint(x, y)); >- result->setNull(); >-} >- >-void AccessibilityUIElement::fallbackCallback(const CppArgumentList &, CppVariant* result) >-{ >- // FIXME: Implement this. >- result->setNull(); >-} >- >-RootAccessibilityUIElement::RootAccessibilityUIElement(const WebAccessibilityObject &object, Factory *factory) >- : AccessibilityUIElement(object, factory) { } >- >-AccessibilityUIElement* RootAccessibilityUIElement::getChildAtIndex(unsigned index) >-{ >- if (index) >- return 0; >- >- return factory()->getOrCreate(accessibilityObject()); >-} >- >- >-AccessibilityUIElementList ::~AccessibilityUIElementList() >-{ >- clear(); >-} >- >-void AccessibilityUIElementList::clear() >-{ >- for (ElementList::iterator i = m_elements.begin(); i != m_elements.end(); ++i) >- delete (*i); >- m_elements.clear(); >-} >- >-AccessibilityUIElement* AccessibilityUIElementList::getOrCreate(const WebAccessibilityObject& object) >-{ >- if (object.isNull()) >- return 0; >- >- size_t elementCount = m_elements.size(); >- for (size_t i = 0; i < elementCount; i++) { >- if (m_elements[i]->isEqual(object)) >- return m_elements[i]; >- } >- >- AccessibilityUIElement* element = new AccessibilityUIElement(object, this); >- m_elements.append(element); >- return element; >-} >- >-AccessibilityUIElement* AccessibilityUIElementList::createRoot(const WebAccessibilityObject& object) >-{ >- AccessibilityUIElement* element = new RootAccessibilityUIElement(object, this); >- m_elements.append(element); >- return element; >-} >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h >deleted file mode 100644 >index 8ae6d412ff19d1e9db033a953eb6401d547c8991..0000000000000000000000000000000000000000 >--- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h >+++ /dev/null >@@ -1,167 +0,0 @@ >-/* >- * Copyright (C) 2010 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef AccessibilityUIElement_h >-#define AccessibilityUIElement_h >- >-#include "CppBoundClass.h" >-#include "WebAccessibilityObject.h" >-#include <vector> >-#include <wtf/Vector.h> >- >-class AccessibilityUIElement : public CppBoundClass { >-public: >- class Factory { >- public: >- virtual ~Factory() { } >- virtual AccessibilityUIElement* getOrCreate(const WebKit::WebAccessibilityObject&) = 0; >- }; >- >- AccessibilityUIElement(const WebKit::WebAccessibilityObject&, Factory*); >- >- virtual AccessibilityUIElement* getChildAtIndex(unsigned); >- virtual bool isRoot() const { return false; } >- virtual bool isEqual(const WebKit::WebAccessibilityObject&); >- >- virtual void notificationReceived(const char *notificationName); >- >-protected: >- const WebKit::WebAccessibilityObject& accessibilityObject() const { return m_accessibilityObject; } >- >- Factory* factory() const { return m_factory; } >- >-private: >- // Bound properties. >- void roleGetterCallback(CppVariant*); >- void titleGetterCallback(CppVariant*); >- void descriptionGetterCallback(CppVariant*); >- void helpTextGetterCallback(CppVariant*); >- void stringValueGetterCallback(CppVariant*); >- void xGetterCallback(CppVariant*); >- void yGetterCallback(CppVariant*); >- void widthGetterCallback(CppVariant*); >- void heightGetterCallback(CppVariant*); >- void intValueGetterCallback(CppVariant*); >- void minValueGetterCallback(CppVariant*); >- void maxValueGetterCallback(CppVariant*); >- void childrenCountGetterCallback(CppVariant*); >- void insertionPointLineNumberGetterCallback(CppVariant*); >- void selectedTextRangeGetterCallback(CppVariant*); >- void isEnabledGetterCallback(CppVariant*); >- void isRequiredGetterCallback(CppVariant*); >- void isFocusedGetterCallback(CppVariant*); >- void isFocusableGetterCallback(CppVariant*); >- void isSelectedGetterCallback(CppVariant*); >- void isSelectableGetterCallback(CppVariant*); >- void isMultiSelectableGetterCallback(CppVariant*); >- void isSelectedOptionActiveGetterCallback(CppVariant*); >- void isExpandedGetterCallback(CppVariant*); >- void isCheckedGetterCallback(CppVariant*); >- void isVisibleGetterCallback(CppVariant*); >- void isOffScreenGetterCallback(CppVariant*); >- void isCollapsedGetterCallback(CppVariant*); >- void hasPopupGetterCallback(CppVariant*); >- void isValidGetterCallback(CppVariant*); >- void orientationGetterCallback(CppVariant*); >- >- // Bound methods. >- void allAttributesCallback(const CppArgumentList&, CppVariant*); >- void attributesOfLinkedUIElementsCallback(const CppArgumentList&, CppVariant*); >- void attributesOfDocumentLinksCallback(const CppArgumentList&, CppVariant*); >- void attributesOfChildrenCallback(const CppArgumentList&, CppVariant*); >- void parametrizedAttributeNamesCallback(const CppArgumentList&, CppVariant*); >- void lineForIndexCallback(const CppArgumentList&, CppVariant*); >- void boundsForRangeCallback(const CppArgumentList&, CppVariant*); >- void stringForRangeCallback(const CppArgumentList&, CppVariant*); >- void childAtIndexCallback(const CppArgumentList&, CppVariant*); >- void elementAtPointCallback(const CppArgumentList&, CppVariant*); >- void attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant*); >- void attributesOfRowHeadersCallback(const CppArgumentList&, CppVariant*); >- void attributesOfColumnsCallback(const CppArgumentList&, CppVariant*); >- void attributesOfRowsCallback(const CppArgumentList&, CppVariant*); >- void attributesOfVisibleCellsCallback(const CppArgumentList&, CppVariant*); >- void attributesOfHeaderCallback(const CppArgumentList&, CppVariant*); >- void indexInTableCallback(const CppArgumentList&, CppVariant*); >- void rowIndexRangeCallback(const CppArgumentList&, CppVariant*); >- void columnIndexRangeCallback(const CppArgumentList&, CppVariant*); >- void cellForColumnAndRowCallback(const CppArgumentList&, CppVariant*); >- void titleUIElementCallback(const CppArgumentList&, CppVariant*); >- void setSelectedTextRangeCallback(const CppArgumentList&, CppVariant*); >- void attributeValueCallback(const CppArgumentList&, CppVariant*); >- void isAttributeSettableCallback(const CppArgumentList&, CppVariant*); >- void isActionSupportedCallback(const CppArgumentList&, CppVariant*); >- void parentElementCallback(const CppArgumentList&, CppVariant*); >- void incrementCallback(const CppArgumentList&, CppVariant*); >- void decrementCallback(const CppArgumentList&, CppVariant*); >- void showMenuCallback(const CppArgumentList&, CppVariant*); >- void pressCallback(const CppArgumentList&, CppVariant*); >- void isEqualCallback(const CppArgumentList&, CppVariant*); >- void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); >- void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*); >- void takeFocusCallback(const CppArgumentList&, CppVariant*); >- void scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant*); >- void scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList&, CppVariant*); >- void scrollToGlobalPointCallback(const CppArgumentList&, CppVariant*); >- >- void fallbackCallback(const CppArgumentList&, CppVariant*); >- >- WebKit::WebAccessibilityObject m_accessibilityObject; >- Factory* m_factory; >- std::vector<CppVariant> m_notificationCallbacks; >-}; >- >- >-class RootAccessibilityUIElement : public AccessibilityUIElement { >-public: >- RootAccessibilityUIElement(const WebKit::WebAccessibilityObject&, Factory*); >- >- virtual AccessibilityUIElement* getChildAtIndex(unsigned); >- virtual bool isRoot() const { return true; } >-}; >- >- >-// Provides simple lifetime management of the AccessibilityUIElement instances: >-// all AccessibilityUIElements ever created from the controller are stored in >-// a list and cleared explicitly. >-class AccessibilityUIElementList : public AccessibilityUIElement::Factory { >-public: >- AccessibilityUIElementList() { } >- virtual ~AccessibilityUIElementList(); >- >- void clear(); >- virtual AccessibilityUIElement* getOrCreate(const WebKit::WebAccessibilityObject&); >- AccessibilityUIElement* createRoot(const WebKit::WebAccessibilityObject&); >- >-private: >- typedef Vector<AccessibilityUIElement*> ElementList; >- ElementList m_elements; >-}; >- >-#endif // AccessibilityUIElement_h >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..c56b151e65aaaa9bac1e9e9a17a4879f28dd6b8f >--- /dev/null >+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp >@@ -0,0 +1,862 @@ >+/* >+ * Copyright (C) 2010 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "AccessibilityUIElementChromium.h" >+ >+#include "WebAccessibilityObject.h" >+#include "platform/WebCString.h" >+#include "platform/WebPoint.h" >+#include "platform/WebRect.h" >+#include "platform/WebString.h" >+#include <wtf/Assertions.h> >+ >+using namespace WebKit; >+using namespace std; >+ >+// Map role value to string, matching Safari/Mac platform implementation to >+// avoid rebaselining layout tests. >+static string roleToString(WebAccessibilityRole role) >+{ >+ string result = "AXRole: AX"; >+ switch (role) { >+ case WebAccessibilityRoleButton: >+ return result.append("Button"); >+ case WebAccessibilityRoleRadioButton: >+ return result.append("RadioButton"); >+ case WebAccessibilityRoleCheckBox: >+ return result.append("CheckBox"); >+ case WebAccessibilityRoleSlider: >+ return result.append("Slider"); >+ case WebAccessibilityRoleTabGroup: >+ return result.append("TabGroup"); >+ case WebAccessibilityRoleTextField: >+ return result.append("TextField"); >+ case WebAccessibilityRoleStaticText: >+ return result.append("StaticText"); >+ case WebAccessibilityRoleTextArea: >+ return result.append("TextArea"); >+ case WebAccessibilityRoleScrollArea: >+ return result.append("ScrollArea"); >+ case WebAccessibilityRolePopUpButton: >+ return result.append("PopUpButton"); >+ case WebAccessibilityRoleMenuButton: >+ return result.append("MenuButton"); >+ case WebAccessibilityRoleTable: >+ return result.append("Table"); >+ case WebAccessibilityRoleApplication: >+ return result.append("Application"); >+ case WebAccessibilityRoleGroup: >+ return result.append("Group"); >+ case WebAccessibilityRoleRadioGroup: >+ return result.append("RadioGroup"); >+ case WebAccessibilityRoleList: >+ return result.append("List"); >+ case WebAccessibilityRoleScrollBar: >+ return result.append("ScrollBar"); >+ case WebAccessibilityRoleValueIndicator: >+ return result.append("ValueIndicator"); >+ case WebAccessibilityRoleImage: >+ return result.append("Image"); >+ case WebAccessibilityRoleMenuBar: >+ return result.append("MenuBar"); >+ case WebAccessibilityRoleMenu: >+ return result.append("Menu"); >+ case WebAccessibilityRoleMenuItem: >+ return result.append("MenuItem"); >+ case WebAccessibilityRoleColumn: >+ return result.append("Column"); >+ case WebAccessibilityRoleRow: >+ return result.append("Row"); >+ case WebAccessibilityRoleToolbar: >+ return result.append("Toolbar"); >+ case WebAccessibilityRoleBusyIndicator: >+ return result.append("BusyIndicator"); >+ case WebAccessibilityRoleProgressIndicator: >+ return result.append("ProgressIndicator"); >+ case WebAccessibilityRoleWindow: >+ return result.append("Window"); >+ case WebAccessibilityRoleDrawer: >+ return result.append("Drawer"); >+ case WebAccessibilityRoleSystemWide: >+ return result.append("SystemWide"); >+ case WebAccessibilityRoleOutline: >+ return result.append("Outline"); >+ case WebAccessibilityRoleIncrementor: >+ return result.append("Incrementor"); >+ case WebAccessibilityRoleBrowser: >+ return result.append("Browser"); >+ case WebAccessibilityRoleComboBox: >+ return result.append("ComboBox"); >+ case WebAccessibilityRoleSplitGroup: >+ return result.append("SplitGroup"); >+ case WebAccessibilityRoleSplitter: >+ return result.append("Splitter"); >+ case WebAccessibilityRoleColorWell: >+ return result.append("ColorWell"); >+ case WebAccessibilityRoleGrowArea: >+ return result.append("GrowArea"); >+ case WebAccessibilityRoleSheet: >+ return result.append("Sheet"); >+ case WebAccessibilityRoleHelpTag: >+ return result.append("HelpTag"); >+ case WebAccessibilityRoleMatte: >+ return result.append("Matte"); >+ case WebAccessibilityRoleRuler: >+ return result.append("Ruler"); >+ case WebAccessibilityRoleRulerMarker: >+ return result.append("RulerMarker"); >+ case WebAccessibilityRoleLink: >+ return result.append("Link"); >+ case WebAccessibilityRoleDisclosureTriangle: >+ return result.append("DisclosureTriangle"); >+ case WebAccessibilityRoleGrid: >+ return result.append("Grid"); >+ case WebAccessibilityRoleCell: >+ return result.append("Cell"); >+ case WebAccessibilityRoleColumnHeader: >+ return result.append("ColumnHeader"); >+ case WebAccessibilityRoleRowHeader: >+ return result.append("RowHeader"); >+ case WebAccessibilityRoleWebCoreLink: >+ // Maps to Link role. >+ return result.append("Link"); >+ case WebAccessibilityRoleImageMapLink: >+ return result.append("ImageMapLink"); >+ case WebAccessibilityRoleImageMap: >+ return result.append("ImageMap"); >+ case WebAccessibilityRoleListMarker: >+ return result.append("ListMarker"); >+ case WebAccessibilityRoleWebArea: >+ return result.append("WebArea"); >+ case WebAccessibilityRoleHeading: >+ return result.append("Heading"); >+ case WebAccessibilityRoleListBox: >+ return result.append("ListBox"); >+ case WebAccessibilityRoleListBoxOption: >+ return result.append("ListBoxOption"); >+ case WebAccessibilityRoleTableHeaderContainer: >+ return result.append("TableHeaderContainer"); >+ case WebAccessibilityRoleDefinitionListTerm: >+ return result.append("DefinitionListTerm"); >+ case WebAccessibilityRoleDefinitionListDefinition: >+ return result.append("DefinitionListDefinition"); >+ case WebAccessibilityRoleAnnotation: >+ return result.append("Annotation"); >+ case WebAccessibilityRoleSliderThumb: >+ return result.append("SliderThumb"); >+ case WebAccessibilityRoleLandmarkApplication: >+ return result.append("LandmarkApplication"); >+ case WebAccessibilityRoleLandmarkBanner: >+ return result.append("LandmarkBanner"); >+ case WebAccessibilityRoleLandmarkComplementary: >+ return result.append("LandmarkComplementary"); >+ case WebAccessibilityRoleLandmarkContentInfo: >+ return result.append("LandmarkContentInfo"); >+ case WebAccessibilityRoleLandmarkMain: >+ return result.append("LandmarkMain"); >+ case WebAccessibilityRoleLandmarkNavigation: >+ return result.append("LandmarkNavigation"); >+ case WebAccessibilityRoleLandmarkSearch: >+ return result.append("LandmarkSearch"); >+ case WebAccessibilityRoleApplicationLog: >+ return result.append("ApplicationLog"); >+ case WebAccessibilityRoleApplicationMarquee: >+ return result.append("ApplicationMarquee"); >+ case WebAccessibilityRoleApplicationStatus: >+ return result.append("ApplicationStatus"); >+ case WebAccessibilityRoleApplicationTimer: >+ return result.append("ApplicationTimer"); >+ case WebAccessibilityRoleDocument: >+ return result.append("Document"); >+ case WebAccessibilityRoleDocumentArticle: >+ return result.append("DocumentArticle"); >+ case WebAccessibilityRoleDocumentNote: >+ return result.append("DocumentNote"); >+ case WebAccessibilityRoleDocumentRegion: >+ return result.append("DocumentRegion"); >+ case WebAccessibilityRoleUserInterfaceTooltip: >+ return result.append("UserInterfaceTooltip"); >+ default: >+ // Also matches WebAccessibilityRoleUnknown. >+ return result.append("Unknown"); >+ } >+} >+ >+string getDescription(const WebAccessibilityObject& object) >+{ >+ string description = object.accessibilityDescription().utf8(); >+ return description.insert(0, "AXDescription: "); >+} >+ >+string getHelpText(const WebAccessibilityObject& object) >+{ >+ string helpText = object.helpText().utf8(); >+ return helpText.insert(0, "AXHelp: "); >+} >+ >+string getStringValue(const WebAccessibilityObject& object) >+{ >+ string value = object.stringValue().utf8(); >+ return value.insert(0, "AXValue: "); >+} >+ >+string getRole(const WebAccessibilityObject& object) >+{ >+ return roleToString(object.roleValue()); >+} >+ >+string getTitle(const WebAccessibilityObject& object) >+{ >+ string title = object.title().utf8(); >+ return title.insert(0, "AXTitle: "); >+} >+ >+string getOrientation(const WebAccessibilityObject& object) >+{ >+ if (object.isVertical()) >+ return "AXOrientation: AXVerticalOrientation"; >+ >+ return "AXOrientation: AXHorizontalOrientation"; >+} >+ >+string getAttributes(const WebAccessibilityObject& object) >+{ >+ // FIXME: Concatenate all attributes of the AccessibilityObject. >+ string attributes(getTitle(object)); >+ attributes.append("\n"); >+ attributes.append(getRole(object)); >+ attributes.append("\n"); >+ attributes.append(getDescription(object)); >+ return attributes; >+} >+ >+ >+// Collects attributes into a string, delimited by dashes. Used by all methods >+// that output lists of attributes: attributesOfLinkedUIElementsCallback, >+// AttributesOfChildrenCallback, etc. >+class AttributesCollector { >+public: >+ void collectAttributes(const WebAccessibilityObject& object) >+ { >+ m_attributes.append("\n------------\n"); >+ m_attributes.append(getAttributes(object)); >+ } >+ >+ string attributes() const { return m_attributes; } >+ >+private: >+ string m_attributes; >+}; >+ >+AccessibilityUIElement::AccessibilityUIElement(const WebAccessibilityObject& object, Factory* factory) >+ : m_accessibilityObject(object) >+ , m_factory(factory) >+{ >+ >+ ASSERT(factory); >+ >+ // >+ // Properties >+ // >+ >+ bindProperty("role", &AccessibilityUIElement::roleGetterCallback); >+ bindProperty("title", &AccessibilityUIElement::titleGetterCallback); >+ bindProperty("description", &AccessibilityUIElement::descriptionGetterCallback); >+ bindProperty("helpText", &AccessibilityUIElement::helpTextGetterCallback); >+ bindProperty("stringValue", &AccessibilityUIElement::stringValueGetterCallback); >+ bindProperty("x", &AccessibilityUIElement::xGetterCallback); >+ bindProperty("y", &AccessibilityUIElement::yGetterCallback); >+ bindProperty("width", &AccessibilityUIElement::widthGetterCallback); >+ bindProperty("height", &AccessibilityUIElement::heightGetterCallback); >+ bindProperty("intValue", &AccessibilityUIElement::intValueGetterCallback); >+ bindProperty("minValue", &AccessibilityUIElement::minValueGetterCallback); >+ bindProperty("maxValue", &AccessibilityUIElement::maxValueGetterCallback); >+ bindProperty("childrenCount", &AccessibilityUIElement::childrenCountGetterCallback); >+ bindProperty("insertionPointLineNumber", &AccessibilityUIElement::insertionPointLineNumberGetterCallback); >+ bindProperty("selectedTextRange", &AccessibilityUIElement::selectedTextRangeGetterCallback); >+ bindProperty("isEnabled", &AccessibilityUIElement::isEnabledGetterCallback); >+ bindProperty("isRequired", &AccessibilityUIElement::isRequiredGetterCallback); >+ bindProperty("isFocused", &AccessibilityUIElement::isFocusedGetterCallback); >+ bindProperty("isFocusable", &AccessibilityUIElement::isFocusableGetterCallback); >+ bindProperty("isSelected", &AccessibilityUIElement::isSelectedGetterCallback); >+ bindProperty("isSelectable", &AccessibilityUIElement::isSelectableGetterCallback); >+ bindProperty("isMultiSelectable", &AccessibilityUIElement::isMultiSelectableGetterCallback); >+ bindProperty("isSelectedOptionActive", &AccessibilityUIElement::isSelectedOptionActiveGetterCallback); >+ bindProperty("isExpanded", &AccessibilityUIElement::isExpandedGetterCallback); >+ bindProperty("isChecked", &AccessibilityUIElement::isCheckedGetterCallback); >+ bindProperty("isVisible", &AccessibilityUIElement::isVisibleGetterCallback); >+ bindProperty("isOffScreen", &AccessibilityUIElement::isOffScreenGetterCallback); >+ bindProperty("isCollapsed", &AccessibilityUIElement::isCollapsedGetterCallback); >+ bindProperty("hasPopup", &AccessibilityUIElement::hasPopupGetterCallback); >+ bindProperty("isValid", &AccessibilityUIElement::isValidGetterCallback); >+ bindProperty("orientation", &AccessibilityUIElement::orientationGetterCallback); >+ >+ // >+ // Methods >+ // >+ >+ bindMethod("allAttributes", &AccessibilityUIElement::allAttributesCallback); >+ bindMethod("attributesOfLinkedUIElements", &AccessibilityUIElement::attributesOfLinkedUIElementsCallback); >+ bindMethod("attributesOfDocumentLinks", &AccessibilityUIElement::attributesOfDocumentLinksCallback); >+ bindMethod("attributesOfChildren", &AccessibilityUIElement::attributesOfChildrenCallback); >+ bindMethod("lineForIndex", &AccessibilityUIElement::lineForIndexCallback); >+ bindMethod("boundsForRange", &AccessibilityUIElement::boundsForRangeCallback); >+ bindMethod("stringForRange", &AccessibilityUIElement::stringForRangeCallback); >+ bindMethod("childAtIndex", &AccessibilityUIElement::childAtIndexCallback); >+ bindMethod("elementAtPoint", &AccessibilityUIElement::elementAtPointCallback); >+ bindMethod("attributesOfColumnHeaders", &AccessibilityUIElement::attributesOfColumnHeadersCallback); >+ bindMethod("attributesOfRowHeaders", &AccessibilityUIElement::attributesOfRowHeadersCallback); >+ bindMethod("attributesOfColumns", &AccessibilityUIElement::attributesOfColumnsCallback); >+ bindMethod("attributesOfRows", &AccessibilityUIElement::attributesOfRowsCallback); >+ bindMethod("attributesOfVisibleCells", &AccessibilityUIElement::attributesOfVisibleCellsCallback); >+ bindMethod("attributesOfHeader", &AccessibilityUIElement::attributesOfHeaderCallback); >+ bindMethod("indexInTable", &AccessibilityUIElement::indexInTableCallback); >+ bindMethod("rowIndexRange", &AccessibilityUIElement::rowIndexRangeCallback); >+ bindMethod("columnIndexRange", &AccessibilityUIElement::columnIndexRangeCallback); >+ bindMethod("cellForColumnAndRow", &AccessibilityUIElement::cellForColumnAndRowCallback); >+ bindMethod("titleUIElement", &AccessibilityUIElement::titleUIElementCallback); >+ bindMethod("setSelectedTextRange", &AccessibilityUIElement::setSelectedTextRangeCallback); >+ bindMethod("attributeValue", &AccessibilityUIElement::attributeValueCallback); >+ bindMethod("isAttributeSettable", &AccessibilityUIElement::isAttributeSettableCallback); >+ bindMethod("isActionSupported", &AccessibilityUIElement::isActionSupportedCallback); >+ bindMethod("parentElement", &AccessibilityUIElement::parentElementCallback); >+ bindMethod("increment", &AccessibilityUIElement::incrementCallback); >+ bindMethod("decrement", &AccessibilityUIElement::decrementCallback); >+ bindMethod("showMenu", &AccessibilityUIElement::showMenuCallback); >+ bindMethod("press", &AccessibilityUIElement::pressCallback); >+ bindMethod("isEqual", &AccessibilityUIElement::isEqualCallback); >+ bindMethod("addNotificationListener", &AccessibilityUIElement::addNotificationListenerCallback); >+ bindMethod("removeNotificationListener", &AccessibilityUIElement::removeNotificationListenerCallback); >+ bindMethod("takeFocus", &AccessibilityUIElement::takeFocusCallback); >+ bindMethod("scrollToMakeVisible", &AccessibilityUIElement::scrollToMakeVisibleCallback); >+ bindMethod("scrollToMakeVisibleWithSubFocus", &AccessibilityUIElement::scrollToMakeVisibleWithSubFocusCallback); >+ bindMethod("scrollToGlobalPoint", &AccessibilityUIElement::scrollToGlobalPointCallback); >+ >+ bindFallbackMethod(&AccessibilityUIElement::fallbackCallback); >+} >+ >+AccessibilityUIElement* AccessibilityUIElement::getChildAtIndex(unsigned index) >+{ >+ return m_factory->getOrCreate(accessibilityObject().childAt(index)); >+} >+ >+bool AccessibilityUIElement::isEqual(const WebKit::WebAccessibilityObject& other) >+{ >+ return accessibilityObject().equals(other); >+} >+ >+void AccessibilityUIElement::notificationReceived(const char* notificationName) >+{ >+ size_t callbackCount = m_notificationCallbacks.size(); >+ for (size_t i = 0; i < callbackCount; i++) { >+ CppVariant notificationNameArgument; >+ notificationNameArgument.set(notificationName); >+ CppVariant invokeResult; >+ m_notificationCallbacks[i].invokeDefault(¬ificationNameArgument, 1, invokeResult); >+ } >+} >+ >+// >+// Properties >+// >+ >+void AccessibilityUIElement::roleGetterCallback(CppVariant* result) >+{ >+ result->set(getRole(accessibilityObject())); >+} >+ >+void AccessibilityUIElement::titleGetterCallback(CppVariant* result) >+{ >+ result->set(getTitle(accessibilityObject())); >+} >+ >+void AccessibilityUIElement::descriptionGetterCallback(CppVariant* result) >+{ >+ result->set(getDescription(accessibilityObject())); >+} >+ >+void AccessibilityUIElement::helpTextGetterCallback(CppVariant* result) >+{ >+ result->set(getHelpText(accessibilityObject())); >+} >+ >+void AccessibilityUIElement::stringValueGetterCallback(CppVariant* result) >+{ >+ result->set(getStringValue(accessibilityObject())); >+} >+ >+void AccessibilityUIElement::xGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().boundingBoxRect().x); >+} >+ >+void AccessibilityUIElement::yGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().boundingBoxRect().y); >+} >+ >+void AccessibilityUIElement::widthGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().boundingBoxRect().width); >+} >+ >+void AccessibilityUIElement::heightGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().boundingBoxRect().height); >+} >+ >+void AccessibilityUIElement::intValueGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().valueForRange()); >+} >+ >+void AccessibilityUIElement::minValueGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().minValueForRange()); >+} >+ >+void AccessibilityUIElement::maxValueGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().maxValueForRange()); >+} >+ >+void AccessibilityUIElement::childrenCountGetterCallback(CppVariant* result) >+{ >+ int count = 1; // Root object always has only one child, the WebView. >+ if (!isRoot()) >+ count = accessibilityObject().childCount(); >+ result->set(count); >+} >+ >+void AccessibilityUIElement::insertionPointLineNumberGetterCallback(CppVariant* result) >+{ >+ WebVector<int> lineBreaks; >+ accessibilityObject().lineBreaks(lineBreaks); >+ int cursor = accessibilityObject().selectionEnd(); >+ int line = 0; >+ while (line < static_cast<int>(lineBreaks.size()) && lineBreaks[line] <= cursor) >+ line++; >+ result->set(line); >+} >+ >+void AccessibilityUIElement::selectedTextRangeGetterCallback(CppVariant* result) >+{ >+ // FIXME: Implement this. >+ result->set(std::string()); >+} >+ >+void AccessibilityUIElement::isEnabledGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isEnabled()); >+} >+ >+void AccessibilityUIElement::isRequiredGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isRequired()); >+} >+ >+void AccessibilityUIElement::isFocusedGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isFocused()); >+} >+ >+void AccessibilityUIElement::isFocusableGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().canSetFocusAttribute()); >+} >+ >+void AccessibilityUIElement::isSelectedGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isSelected()); >+} >+ >+void AccessibilityUIElement::isSelectableGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().canSetSelectedAttribute()); >+} >+ >+void AccessibilityUIElement::isMultiSelectableGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isMultiSelectable()); >+} >+ >+void AccessibilityUIElement::isSelectedOptionActiveGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isSelectedOptionActive()); >+} >+ >+void AccessibilityUIElement::isExpandedGetterCallback(CppVariant* result) >+{ >+ result->set(!accessibilityObject().isCollapsed()); >+} >+ >+void AccessibilityUIElement::isCheckedGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isChecked()); >+} >+ >+void AccessibilityUIElement::isVisibleGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isVisible()); >+} >+ >+void AccessibilityUIElement::isOffScreenGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isOffScreen()); >+} >+ >+void AccessibilityUIElement::isCollapsedGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isCollapsed()); >+} >+ >+void AccessibilityUIElement::hasPopupGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().ariaHasPopup()); >+} >+ >+void AccessibilityUIElement::isValidGetterCallback(CppVariant* result) >+{ >+ result->set(accessibilityObject().isValid()); >+} >+ >+void AccessibilityUIElement::orientationGetterCallback(CppVariant* result) >+{ >+ result->set(getOrientation(accessibilityObject())); >+} >+ >+// >+// Methods >+// >+ >+void AccessibilityUIElement::allAttributesCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->set(getAttributes(accessibilityObject())); >+} >+ >+void AccessibilityUIElement::attributesOfLinkedUIElementsCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfDocumentLinksCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfChildrenCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ AttributesCollector collector; >+ unsigned size = accessibilityObject().childCount(); >+ for (unsigned i = 0; i < size; ++i) >+ collector.collectAttributes(accessibilityObject().childAt(i)); >+ result->set(collector.attributes()); >+} >+ >+void AccessibilityUIElement::parametrizedAttributeNamesCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::lineForIndexCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::boundsForRangeCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::stringForRangeCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::childAtIndexCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ if (!arguments.size() || !arguments[0].isNumber()) { >+ result->setNull(); >+ return; >+ } >+ >+ AccessibilityUIElement* child = getChildAtIndex(arguments[0].toInt32()); >+ if (!child) { >+ result->setNull(); >+ return; >+ } >+ >+ result->set(*(child->getAsCppVariant())); >+} >+ >+void AccessibilityUIElement::elementAtPointCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfRowHeadersCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfColumnsCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfRowsCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfVisibleCellsCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributesOfHeaderCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::indexInTableCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::rowIndexRangeCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::columnIndexRangeCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::cellForColumnAndRowCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::titleUIElementCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::setSelectedTextRangeCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::attributeValueCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::isAttributeSettableCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ if (arguments.size() < 1 && !arguments[0].isString()) { >+ result->setNull(); >+ return; >+ } >+ >+ string attribute = arguments[0].toString(); >+ bool settable = false; >+ if (attribute == "AXValue") >+ settable = accessibilityObject().canSetValueAttribute(); >+ result->set(settable); >+} >+ >+void AccessibilityUIElement::isActionSupportedCallback(const CppArgumentList&, CppVariant* result) >+{ >+ // This one may be really hard to implement. >+ // Not exposed by AccessibilityObject. >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::parentElementCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::incrementCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::decrementCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::showMenuCallback(const CppArgumentList&, CppVariant* result) >+{ >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::pressCallback(const CppArgumentList&, CppVariant* result) >+{ >+ accessibilityObject().performDefaultAction(); >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::isEqualCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ if (arguments.size() < 1 || !arguments[0].isObject()) { >+ result->setNull(); >+ return; >+ } >+ >+ result->set(arguments[0].isEqual(*getAsCppVariant())); >+} >+ >+void AccessibilityUIElement::addNotificationListenerCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ if (arguments.size() < 1 || !arguments[0].isObject()) { >+ result->setNull(); >+ return; >+ } >+ >+ m_notificationCallbacks.push_back(arguments[0]); >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::removeNotificationListenerCallback(const CppArgumentList&, CppVariant* result) >+{ >+ // FIXME: Implement this. >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::takeFocusCallback(const CppArgumentList&, CppVariant* result) >+{ >+ accessibilityObject().setFocused(true); >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant* result) >+{ >+ accessibilityObject().scrollToMakeVisible(); >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ result->setNull(); >+ >+ if (arguments.size() != 4 >+ || !arguments[0].isNumber() >+ || !arguments[1].isNumber() >+ || !arguments[2].isNumber() >+ || !arguments[3].isNumber()) >+ return; >+ >+ int x = arguments[0].toInt32(); >+ int y = arguments[1].toInt32(); >+ int width = arguments[2].toInt32(); >+ int height = arguments[3].toInt32(); >+ accessibilityObject().scrollToMakeVisibleWithSubFocus(WebRect(x, y, width, height)); >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::scrollToGlobalPointCallback(const CppArgumentList& arguments, CppVariant* result) >+{ >+ result->setNull(); >+ >+ if (arguments.size() != 2 >+ || !arguments[0].isNumber() >+ || !arguments[1].isNumber()) >+ return; >+ >+ int x = arguments[0].toInt32(); >+ int y = arguments[1].toInt32(); >+ >+ accessibilityObject().scrollToGlobalPoint(WebPoint(x, y)); >+ result->setNull(); >+} >+ >+void AccessibilityUIElement::fallbackCallback(const CppArgumentList &, CppVariant* result) >+{ >+ // FIXME: Implement this. >+ result->setNull(); >+} >+ >+RootAccessibilityUIElement::RootAccessibilityUIElement(const WebAccessibilityObject &object, Factory *factory) >+ : AccessibilityUIElement(object, factory) { } >+ >+AccessibilityUIElement* RootAccessibilityUIElement::getChildAtIndex(unsigned index) >+{ >+ if (index) >+ return 0; >+ >+ return factory()->getOrCreate(accessibilityObject()); >+} >+ >+ >+AccessibilityUIElementList ::~AccessibilityUIElementList() >+{ >+ clear(); >+} >+ >+void AccessibilityUIElementList::clear() >+{ >+ for (ElementList::iterator i = m_elements.begin(); i != m_elements.end(); ++i) >+ delete (*i); >+ m_elements.clear(); >+} >+ >+AccessibilityUIElement* AccessibilityUIElementList::getOrCreate(const WebAccessibilityObject& object) >+{ >+ if (object.isNull()) >+ return 0; >+ >+ size_t elementCount = m_elements.size(); >+ for (size_t i = 0; i < elementCount; i++) { >+ if (m_elements[i]->isEqual(object)) >+ return m_elements[i]; >+ } >+ >+ AccessibilityUIElement* element = new AccessibilityUIElement(object, this); >+ m_elements.append(element); >+ return element; >+} >+ >+AccessibilityUIElement* AccessibilityUIElementList::createRoot(const WebAccessibilityObject& object) >+{ >+ AccessibilityUIElement* element = new RootAccessibilityUIElement(object, this); >+ m_elements.append(element); >+ return element; >+} >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1b48a53b602e381e4e129235ad425415ecb42736 >--- /dev/null >+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h >@@ -0,0 +1,167 @@ >+/* >+ * Copyright (C) 2010 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef AccessibilityUIElementChromium_h >+#define AccessibilityUIElementChromium_h >+ >+#include "CppBoundClass.h" >+#include "WebAccessibilityObject.h" >+#include <vector> >+#include <wtf/Vector.h> >+ >+class AccessibilityUIElement : public CppBoundClass { >+public: >+ class Factory { >+ public: >+ virtual ~Factory() { } >+ virtual AccessibilityUIElement* getOrCreate(const WebKit::WebAccessibilityObject&) = 0; >+ }; >+ >+ AccessibilityUIElement(const WebKit::WebAccessibilityObject&, Factory*); >+ >+ virtual AccessibilityUIElement* getChildAtIndex(unsigned); >+ virtual bool isRoot() const { return false; } >+ virtual bool isEqual(const WebKit::WebAccessibilityObject&); >+ >+ virtual void notificationReceived(const char *notificationName); >+ >+protected: >+ const WebKit::WebAccessibilityObject& accessibilityObject() const { return m_accessibilityObject; } >+ >+ Factory* factory() const { return m_factory; } >+ >+private: >+ // Bound properties. >+ void roleGetterCallback(CppVariant*); >+ void titleGetterCallback(CppVariant*); >+ void descriptionGetterCallback(CppVariant*); >+ void helpTextGetterCallback(CppVariant*); >+ void stringValueGetterCallback(CppVariant*); >+ void xGetterCallback(CppVariant*); >+ void yGetterCallback(CppVariant*); >+ void widthGetterCallback(CppVariant*); >+ void heightGetterCallback(CppVariant*); >+ void intValueGetterCallback(CppVariant*); >+ void minValueGetterCallback(CppVariant*); >+ void maxValueGetterCallback(CppVariant*); >+ void childrenCountGetterCallback(CppVariant*); >+ void insertionPointLineNumberGetterCallback(CppVariant*); >+ void selectedTextRangeGetterCallback(CppVariant*); >+ void isEnabledGetterCallback(CppVariant*); >+ void isRequiredGetterCallback(CppVariant*); >+ void isFocusedGetterCallback(CppVariant*); >+ void isFocusableGetterCallback(CppVariant*); >+ void isSelectedGetterCallback(CppVariant*); >+ void isSelectableGetterCallback(CppVariant*); >+ void isMultiSelectableGetterCallback(CppVariant*); >+ void isSelectedOptionActiveGetterCallback(CppVariant*); >+ void isExpandedGetterCallback(CppVariant*); >+ void isCheckedGetterCallback(CppVariant*); >+ void isVisibleGetterCallback(CppVariant*); >+ void isOffScreenGetterCallback(CppVariant*); >+ void isCollapsedGetterCallback(CppVariant*); >+ void hasPopupGetterCallback(CppVariant*); >+ void isValidGetterCallback(CppVariant*); >+ void orientationGetterCallback(CppVariant*); >+ >+ // Bound methods. >+ void allAttributesCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfLinkedUIElementsCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfDocumentLinksCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfChildrenCallback(const CppArgumentList&, CppVariant*); >+ void parametrizedAttributeNamesCallback(const CppArgumentList&, CppVariant*); >+ void lineForIndexCallback(const CppArgumentList&, CppVariant*); >+ void boundsForRangeCallback(const CppArgumentList&, CppVariant*); >+ void stringForRangeCallback(const CppArgumentList&, CppVariant*); >+ void childAtIndexCallback(const CppArgumentList&, CppVariant*); >+ void elementAtPointCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfRowHeadersCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfColumnsCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfRowsCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfVisibleCellsCallback(const CppArgumentList&, CppVariant*); >+ void attributesOfHeaderCallback(const CppArgumentList&, CppVariant*); >+ void indexInTableCallback(const CppArgumentList&, CppVariant*); >+ void rowIndexRangeCallback(const CppArgumentList&, CppVariant*); >+ void columnIndexRangeCallback(const CppArgumentList&, CppVariant*); >+ void cellForColumnAndRowCallback(const CppArgumentList&, CppVariant*); >+ void titleUIElementCallback(const CppArgumentList&, CppVariant*); >+ void setSelectedTextRangeCallback(const CppArgumentList&, CppVariant*); >+ void attributeValueCallback(const CppArgumentList&, CppVariant*); >+ void isAttributeSettableCallback(const CppArgumentList&, CppVariant*); >+ void isActionSupportedCallback(const CppArgumentList&, CppVariant*); >+ void parentElementCallback(const CppArgumentList&, CppVariant*); >+ void incrementCallback(const CppArgumentList&, CppVariant*); >+ void decrementCallback(const CppArgumentList&, CppVariant*); >+ void showMenuCallback(const CppArgumentList&, CppVariant*); >+ void pressCallback(const CppArgumentList&, CppVariant*); >+ void isEqualCallback(const CppArgumentList&, CppVariant*); >+ void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); >+ void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*); >+ void takeFocusCallback(const CppArgumentList&, CppVariant*); >+ void scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant*); >+ void scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList&, CppVariant*); >+ void scrollToGlobalPointCallback(const CppArgumentList&, CppVariant*); >+ >+ void fallbackCallback(const CppArgumentList&, CppVariant*); >+ >+ WebKit::WebAccessibilityObject m_accessibilityObject; >+ Factory* m_factory; >+ std::vector<CppVariant> m_notificationCallbacks; >+}; >+ >+ >+class RootAccessibilityUIElement : public AccessibilityUIElement { >+public: >+ RootAccessibilityUIElement(const WebKit::WebAccessibilityObject&, Factory*); >+ >+ virtual AccessibilityUIElement* getChildAtIndex(unsigned); >+ virtual bool isRoot() const { return true; } >+}; >+ >+ >+// Provides simple lifetime management of the AccessibilityUIElement instances: >+// all AccessibilityUIElements ever created from the controller are stored in >+// a list and cleared explicitly. >+class AccessibilityUIElementList : public AccessibilityUIElement::Factory { >+public: >+ AccessibilityUIElementList() { } >+ virtual ~AccessibilityUIElementList(); >+ >+ void clear(); >+ virtual AccessibilityUIElement* getOrCreate(const WebKit::WebAccessibilityObject&); >+ AccessibilityUIElement* createRoot(const WebKit::WebAccessibilityObject&); >+ >+private: >+ typedef Vector<AccessibilityUIElement*> ElementList; >+ ElementList m_elements; >+}; >+ >+#endif // AccessibilityUIElementChromium_h >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp >index 6c23a28739c6521b4a16a726c9edc033bd1605e0..ccec086aa5af66d06514a515e6ab5d7b78f6f81e 100644 >--- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp >+++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp >@@ -31,7 +31,7 @@ > #include "config.h" > #include "TestInterfaces.h" > >-#include "AccessibilityController.h" >+#include "AccessibilityControllerChromium.h" > #include "EventSender.h" > #include "GamepadController.h" > #include "TextInputController.h" >diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp >index f122e1d2bee32a54115a333eaf0bdeb69ceebadc..e53a1f2d8763f0644cc3b607f61397cbf6feeb25 100644 >--- a/Tools/DumpRenderTree/chromium/TestShell.cpp >+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp >@@ -106,6 +106,7 @@ TestShell::TestShell() > , m_testIsPreparing(false) > , m_focusedWidget(0) > , m_devTools(0) >+ , m_dumpPixelsForCurrentTest(false) > , m_allowExternalPages(false) > , m_acceleratedCompositingForVideoEnabled(false) > , m_threadedCompositingEnabled(false) >@@ -232,13 +233,16 @@ void TestShell::resetWebSettings(WebView& webView) > m_prefs.applyTo(&webView); > } > >-void TestShell::runFileTest(const TestParams& params) >+void TestShell::runFileTest(const TestParams& params, bool shouldDumpPixels) > { > ASSERT(params.testUrl.isValid()); >+ m_dumpPixelsForCurrentTest = shouldDumpPixels; > m_testIsPreparing = true; > m_params = params; > string testUrl = m_params.testUrl.spec(); > >+ m_layoutTestController->setShouldGeneratePixelResults(shouldDumpPixels); >+ > if (testUrl.find("loading/") != string::npos > || testUrl.find("loading\\") != string::npos) > m_layoutTestController->setShouldDumpFrameLoadCallbacks(true); >@@ -603,7 +607,7 @@ void TestShell::dump() > if (dumpedAnything && m_params.printSeparators) > m_printer.handleTextFooter(); > >- if (m_params.dumpPixels && shouldGeneratePixelResults) { >+ if (m_dumpPixelsForCurrentTest && shouldGeneratePixelResults) { > // Image output: we write the image data to the file given on the > // command line (for the dump pixels argument), and the MD5 sum to > // stdout. >diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h >index dbfc1d1c9a13b1ccc1ed8cf4ae8bf98feb61b942..005d374a29a61c50e0c715c9eb3f3c853b088338 100644 >--- a/Tools/DumpRenderTree/chromium/TestShell.h >+++ b/Tools/DumpRenderTree/chromium/TestShell.h >@@ -31,7 +31,7 @@ > #ifndef TestShell_h > #define TestShell_h > >-#include "AccessibilityController.h" >+#include "AccessibilityControllerChromium.h" > #include "GamepadController.h" > #include "LayoutTestController.h" > #include "NotificationPresenter.h" >@@ -63,7 +63,6 @@ class WebPermissions; > > struct TestParams { > bool dumpTree; >- bool dumpPixels; > bool debugRenderTree; > bool debugLayerTree; > bool printSeparators; >@@ -72,7 +71,6 @@ struct TestParams { > > TestParams() > : dumpTree(true) >- , dumpPixels(false) > , debugRenderTree(false) > , debugLayerTree(false) > , printSeparators(false) { } >@@ -103,7 +101,7 @@ public: > WebPermissions* webPermissions() { return m_webPermissions.get(); } > > void bindJSObjectsToWindow(WebKit::WebFrame*); >- void runFileTest(const TestParams&); >+ void runFileTest(const TestParams&, bool shouldDumpPixelTests); > void callJSGC(); > void resetTestController(); > void waitTestFinished(); >@@ -224,6 +222,7 @@ private: > #endif > > TestParams m_params; >+ bool m_dumpPixelsForCurrentTest; > int m_timeout; // timeout value in millisecond > bool m_allowExternalPages; > bool m_acceleratedCompositingForVideoEnabled; >diff --git a/Tools/DumpRenderTree/efl/CMakeLists.txt b/Tools/DumpRenderTree/efl/CMakeLists.txt >index e1dacf901ba0625a5a1e807ec6b9453434984caa..067dbd32b7aa91f5a547cb7be57ff4bdf5999329 100644 >--- a/Tools/DumpRenderTree/efl/CMakeLists.txt >+++ b/Tools/DumpRenderTree/efl/CMakeLists.txt >@@ -1,4 +1,5 @@ > SET(DumpRenderTree_SOURCES >+ ${TOOLS_DIR}/DumpRenderTree/DumpRenderTreeCommon.cpp > ${TOOLS_DIR}/DumpRenderTree/CyclicRedundancyCheck.cpp > ${TOOLS_DIR}/DumpRenderTree/GCController.cpp > ${TOOLS_DIR}/DumpRenderTree/LayoutTestController.cpp >diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >index d6255fdc99793d7a80934df273ba86f043fcf907..9a47e448fb7f2c08c180080a751d6810614cd6fb 100644 >--- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >@@ -65,7 +65,7 @@ extern Ewk_History_Item* prevTestBFItem; > RefPtr<LayoutTestController> gLayoutTestController; > volatile bool done = false; > >-static int dumpPixels = false; >+static bool dumpPixelsForCurrentTest; > static int dumpTree = true; > static int printSeparators = true; > static int useX11Window = false; >@@ -193,7 +193,6 @@ static bool parseCommandLineOptions(int argc, char** argv) > { > static const option options[] = { > {"notree", no_argument, &dumpTree, false}, >- {"pixel-tests", no_argument, &dumpPixels, true}, > {"tree", no_argument, &dumpTree, true}, > {"gui", no_argument, &useX11Window, true}, > {0, 0, 0, 0} >@@ -211,32 +210,6 @@ static bool parseCommandLineOptions(int argc, char** argv) > return true; > } > >-static String getFinalTestURL(const String& testURL) >-{ >- const size_t hashSeparatorPos = testURL.find("'"); >- if (hashSeparatorPos != notFound) >- return getFinalTestURL(testURL.left(hashSeparatorPos)); >- >- // Convert the path into a full file URL if it does not look >- // like an HTTP/S URL (doesn't start with http:// or https://). >- if (!testURL.startsWith("http://") && !testURL.startsWith("https://")) { >- char* cFilePath = ecore_file_realpath(testURL.utf8().data()); >- const String filePath = String::fromUTF8(cFilePath); >- free(cFilePath); >- >- if (ecore_file_exists(filePath.utf8().data())) >- return String("file://") + filePath; >- } >- >- return testURL; >-} >- >-static String getExpectedPixelHash(const String& testURL) >-{ >- const size_t hashSeparatorPos = testURL.find("'"); >- return (hashSeparatorPos != notFound) ? testURL.substring(hashSeparatorPos + 1) : String(); >-} >- > static inline bool isGlobalHistoryTest(const String& cTestPathOrURL) > { > return cTestPathOrURL.contains("/globalhistory/"); >@@ -268,13 +241,13 @@ static void createLayoutTestController(const String& testURL, const String& expe > } > } > >-static void runTest(const char* cTestPathOrURL) >+static void runTest(const char* inputLine) > { >- const String testPathOrURL = String::fromUTF8(cTestPathOrURL); >- ASSERT(!testPathOrURL.isEmpty()); >- >- const String testURL = getFinalTestURL(testPathOrURL); >- const String expectedPixelHash = getExpectedPixelHash(testPathOrURL); >+ TestCommand command = parseInputLine(inputLine); >+ const String testURL(command.pathOrURL.c_str()); >+ ASSERT(!testURL.isEmpty()); >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; >+ const String expectedPixelHash(command.expectedPixelHash.c_str()); > > browser->resetDefaultsToConsistentValues(); > createLayoutTestController(testURL, expectedPixelHash); >@@ -352,7 +325,7 @@ static bool shouldDumpFrameScrollPosition() > > static bool shouldDumpPixelsAndCompareWithExpected() > { >- return dumpPixels && gLayoutTestController->generatePixelResults() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive(); >+ return dumpPixelsForCurrentTest && gLayoutTestController->generatePixelResults() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive(); > } > > static bool shouldDumpBackForwardList() >@@ -461,7 +434,7 @@ int main(int argc, char** argv) > printSeparators = true; > runTestingServerLoop(); > } else { >- printSeparators = (optind < argc - 1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) > runTest(argv[i]); > } >diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >index 57cd05917e822558b48376e0102d800a6bcfccda..ebda5cfb23189fc2a795c4c9805e0bcbeaf5cf87 100644 >--- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >@@ -73,7 +73,7 @@ extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame); > > volatile bool done; > static bool printSeparators; >-static int dumpPixels; >+static bool dumpPixelsForCurrentTest; > static int dumpTree = 1; > static int useTimeoutWatchdog = 1; > >@@ -544,7 +544,6 @@ static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[]) > { > struct option options[] = { > {"notree", no_argument, &dumpTree, false}, >- {"pixel-tests", no_argument, &dumpPixels, true}, > {"tree", no_argument, &dumpTree, true}, > {"no-timeout", no_argument, &useTimeoutWatchdog, false}, > {NULL, 0, NULL, 0} >@@ -624,7 +623,7 @@ void dump() > } > } > >- if (dumpPixels >+ if (dumpPixelsForCurrentTest > && gLayoutTestController->generatePixelResults() > && !gLayoutTestController->dumpDOMAsWebArchive() > && !gLayoutTestController->dumpSourceAsWebArchive()) { >@@ -687,18 +686,13 @@ static void sendPixelResultsEOF() > fflush(stderr); > } > >-static void runTest(const string& testPathOrURL) >+static void runTest(const string& inputLine) > { > ASSERT(!testPathOrURL.empty()); > >- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. >- string testURL(testPathOrURL); >- string expectedPixelHash; >- size_t separatorPos = testURL.find("'"); >- if (separatorPos != string::npos) { >- testURL = string(testPathOrURL, 0, separatorPos); >- expectedPixelHash = string(testPathOrURL, separatorPos + 1); >- } >+ TestCommand command = parseInputLine(inputLine); >+ string& testURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; > > // Convert the path into a full file URL if it does not look > // like an HTTP/S URL (doesn't start with http:// or https://). >@@ -712,7 +706,7 @@ static void runTest(const string& testPathOrURL) > > resetDefaultsToConsistentValues(); > >- gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash); >+ gLayoutTestController = LayoutTestController::create(testURL, command.expectedPixelHash); > topLoadingFrame = 0; > done = false; > >@@ -1447,7 +1441,7 @@ int main(int argc, char* argv[]) > printSeparators = true; > runTestingServerLoop(); > } else { >- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc-1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) > runTest(argv[i]); > } >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index abba535eddc88a39490294fd451a391968fcc3d1..3f9d4266451facbe11509620355979032bebe6fb 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -140,7 +140,7 @@ static HistoryDelegate *historyDelegate; > PolicyDelegate *policyDelegate; > StorageTrackerDelegate *storageDelegate; > >-static int dumpPixels; >+static bool dumpPixelsForCurrentTest; > static int threaded; > static int dumpTree = YES; > static int useTimeoutWatchdog = YES; >@@ -780,7 +780,6 @@ static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[] > { > struct option options[] = { > {"notree", no_argument, &dumpTree, NO}, >- {"pixel-tests", no_argument, &dumpPixels, YES}, > {"tree", no_argument, &dumpTree, YES}, > {"threaded", no_argument, &threaded, YES}, > {"complex-text", no_argument, &forceComplexText, YES}, >@@ -849,7 +848,7 @@ void dumpRenderTree(int argc, const char *argv[]) > initializeGlobalsFromCommandLineOptions(argc, argv); > prepareConsistentTestingEnvironment(); > addTestPluginsToPluginSearchPath(argv[0]); >- if (dumpPixels) >+ if (dumpPixelsForCurrentTest) > installSignalHandlers(); > > if (forceComplexText) >@@ -874,7 +873,7 @@ void dumpRenderTree(int argc, const char *argv[]) > printSeparators = YES; > runTestingServerLoop(); > } else { >- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) > runTest(argv[i]); > } >@@ -1195,7 +1194,7 @@ void dump() > } > } > >- if (dumpPixels && gLayoutTestController->generatePixelResults()) >+ if (dumpPixelsForCurrentTest && gLayoutTestController->generatePixelResults()) > // FIXME: when isPrinting is set, dump the image with page separators. > dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash()); > >@@ -1276,19 +1275,13 @@ static void resetWebViewToConsistentStateBeforeTesting() > [mainFrame _clearOpener]; > } > >-static void runTest(const string& testPathOrURL) >+static void runTest(const string& inputLine) > { >- ASSERT(!testPathOrURL.empty()); >- >- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. >- string pathOrURL(testPathOrURL); >- string expectedPixelHash; >- >- size_t separatorPos = pathOrURL.find("'"); >- if (separatorPos != string::npos) { >- pathOrURL = string(testPathOrURL, 0, separatorPos); >- expectedPixelHash = string(testPathOrURL, separatorPos + 1); >- } >+ ASSERT(!inputLine.empty()); >+ >+ TestCommand command = parseInputLine(inputLine); >+ const string& pathOrURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; > > NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()]; > if (!pathOrURLString) { >@@ -1310,7 +1303,7 @@ static void runTest(const string& testPathOrURL) > > resetWebViewToConsistentStateBeforeTesting(); > >- gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash); >+ gLayoutTestController = LayoutTestController::create(testURL, command.expectedPixelHash); > topLoadingFrame = nil; > ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop! > releaseAndZero(&draggingInfo); >diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro >index f47fb4344b9ef83a5aa46bb5683d9231494aa125..833870bcac9a82edcee81ed5dba31910acf0f0f2 100644 >--- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro >+++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro >@@ -25,6 +25,7 @@ contains(DEFINES, HAVE_FONTCONFIG=1): PKGCONFIG += fontconfig > > HEADERS += \ > $$PWD/../WorkQueue.h \ >+ $$PWD/../DumpRenderTree.h \ > DumpRenderTreeQt.h \ > EventSenderQt.h \ > TextInputControllerQt.h \ >@@ -36,6 +37,7 @@ HEADERS += \ > > SOURCES += \ > $$PWD/../WorkQueue.cpp \ >+ $$PWD/../DumpRenderTreeCommon.cpp \ > DumpRenderTreeQt.cpp \ > EventSenderQt.cpp \ > TextInputControllerQt.cpp \ >diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >index 0ecf622f3f8dda56c4c88cefcf08a3c98cf237c4..8a9cda121838fe647e07beab831f34fdacb21b79 100755 >--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >@@ -30,6 +30,7 @@ > */ > > #include "config.h" >+#include "DumpRenderTree.h" > > #include "DumpRenderTreeQt.h" > #include "DumpRenderTreeSupportQt.h" >@@ -388,8 +389,7 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) > } > > DumpRenderTree::DumpRenderTree() >- : m_dumpPixelsForAllTests(false) >- , m_stdin(0) >+ : m_stdin(0) > , m_enableTextOutput(false) > , m_standAloneMode(false) > , m_graphicsBased(false) >@@ -604,10 +604,8 @@ void DumpRenderTree::open(const QUrl& url) > if (isWebInspectorTest(url)) > layoutTestController()->showWebInspector(); > >- if (isDumpAsTextTest(url)) { >+ if (isDumpAsTextTest(url)) > layoutTestController()->dumpAsText(); >- setDumpPixelsForAllTests(false); >- } > > if (isGlobalHistoryTest(url)) > layoutTestController()->dumpHistoryCallbacks(); >@@ -690,44 +688,27 @@ void DumpRenderTree::loadNextTestInStandAloneMode() > > void DumpRenderTree::processLine(const QString &input) > { >- QString line = input; >- >- m_dumpPixelsForCurrentTest = false; >- m_expectedHash = QString(); >- // single quote marks the pixel dump hash >- int indexOfFirstSeparator = line.indexOf('\''); >- int indexOfSecondSeparator = line.indexOf('\'', indexOfFirstSeparator + 1); >- if (indexOfFirstSeparator > -1) { >- int indexOfPixelHash = indexOfFirstSeparator + 1; >- >- // NRWT passes --pixel-test if we should dump pixels for the test. >- const QString expectedArg(QLatin1String("--pixel-test")); >- QString argTest = line.mid(indexOfFirstSeparator + 1, expectedArg.length()); >- if (argTest == expectedArg) { >- m_dumpPixelsForCurrentTest = true; >- indexOfPixelHash = indexOfSecondSeparator == -1 ? -1 : indexOfSecondSeparator + 1; >- } >- if (indexOfPixelHash != -1 && indexOfPixelHash < line.size()) >- m_expectedHash = line.mid(indexOfPixelHash); >- line.remove(indexOfFirstSeparator, line.length()); >- } >- >- if (line.startsWith(QLatin1String("http:")) >- || line.startsWith(QLatin1String("https:")) >- || line.startsWith(QLatin1String("file:")) >- || line == QLatin1String("about:blank")) { >- open(QUrl(line)); >+ TestCommand command = parseInputLine(std::string(input.toLatin1().constData())); >+ QString pathOrURL = QLatin1String(command.pathOrURL.c_str()); >+ m_dumpPixelsForCurrentTest = command.shouldDumpPixels; >+ m_expectedHash = QLatin1String(command.expectedPixelHash.c_str()); >+ >+ if (pathOrURL.startsWith(QLatin1String("http:")) >+ || pathOrURL.startsWith(QLatin1String("https:")) >+ || pathOrURL.startsWith(QLatin1String("file:")) >+ || pathOrURL == QLatin1String("about:blank")) { >+ open(QUrl(pathOrURL)); > } else { >- QFileInfo fi(line); >+ QFileInfo fi(pathOrURL); > > if (!fi.exists()) { > QDir currentDir = QDir::currentPath(); > > // Try to be smart about where the test is located > if (currentDir.dirName() == QLatin1String("LayoutTests")) >- fi = QFileInfo(currentDir, line.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); >- else if (!line.contains(QLatin1String("LayoutTests"))) >- fi = QFileInfo(currentDir, line.prepend(QLatin1String("LayoutTests/"))); >+ fi = QFileInfo(currentDir, pathOrURL.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); >+ else if (!pathOrURL.contains(QLatin1String("LayoutTests"))) >+ fi = QFileInfo(currentDir, pathOrURL.prepend(QLatin1String("LayoutTests/"))); > > if (!fi.exists()) { > emit ready(); >@@ -741,11 +722,6 @@ void DumpRenderTree::processLine(const QString &input) > fflush(stdout); > } > >-void DumpRenderTree::setDumpPixelsForAllTests(bool dump) >-{ >- m_dumpPixelsForAllTests = dump; >-} >- > void DumpRenderTree::closeRemainingWindows() > { > foreach (QObject* widget, windows) >@@ -961,7 +937,7 @@ void DumpRenderTree::dump() > fputs("#EOF\n", stdout); > fputs("#EOF\n", stderr); > >- if ((m_dumpPixelsForAllTests || m_dumpPixelsForCurrentTest) && !m_controller->shouldDumpAsText()) { >+ if (m_dumpPixelsForCurrentTest && !m_controller->shouldDumpAsText()) { > QImage image; > if (!m_controller->isPrinting()) { > image = QImage(m_page->viewportSize(), QImage::Format_ARGB32); >diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h >index c4f92983f915cca6a8898adefb562c8d2dd91da0..a9cf3cd733dba07ad11c109d3e4b0b7ea97e283c 100644 >--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h >+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h >@@ -82,8 +82,6 @@ public: > void setGraphicsBased(bool flag) { m_graphicsBased = flag; } > bool isGraphicsBased() { return m_graphicsBased; } > >- void setDumpPixelsForAllTests(bool); >- > void closeRemainingWindows(); > void resetToConsistentStateBeforeTesting(const QUrl&); > >@@ -142,7 +140,6 @@ private: > QString dumpFrameScrollPosition(QWebFrame* frame); > LayoutTestController *m_controller; > >- bool m_dumpPixelsForAllTests; > bool m_dumpPixelsForCurrentTest; > QString m_expectedHash; > QStringList m_standAloneModeTestList; >diff --git a/Tools/DumpRenderTree/qt/main.cpp b/Tools/DumpRenderTree/qt/main.cpp >index 64d2b16b37ce61423788381464de3d4e264031c9..684cfa8f70d78bea6ca1a4fa612c9591e1b92322 100644 >--- a/Tools/DumpRenderTree/qt/main.cpp >+++ b/Tools/DumpRenderTree/qt/main.cpp >@@ -66,11 +66,11 @@ void messageHandler(QtMsgType type, const char *message) > // do nothing > } > >-// We only support -v or --pixel-tests or --stdout or --stderr or -, all the others will be >+// We only support -v or --stdout or --stderr or -, all the others will be > // pass as test case name (even -abc.html is a valid test case name) > bool isOption(const QString& str) > { >- return str == QString("-v") || str == QString("--pixel-tests") >+ return str == QString("-v") > || str == QString("--stdout") || str == QString("--stderr") > || str == QString("--timeout") || str == QString("--no-timeout") > || str == QString("-"); >@@ -89,8 +89,8 @@ QString takeOptionValue(QStringList& arguments, int index) > > void printUsage() > { >- fprintf(stderr, "Usage: DumpRenderTree [-v|--pixel-tests] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n"); >- fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n"); >+ fprintf(stderr, "Usage: DumpRenderTree [-v] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n"); >+ fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v] dirpath\n"); > fflush(stderr); > } > >@@ -158,13 +158,7 @@ int main(int argc, char* argv[]) > > WebCore::DumpRenderTree dumper; > >- int index = args.indexOf(QLatin1String("--pixel-tests")); >- if (index != -1) { >- dumper.setDumpPixelsForAllTests(true); >- args.removeAt(index); >- } >- >- index = args.indexOf(QLatin1String("--stdout")); >+ int index = args.indexOf(QLatin1String("--stdout")); > if (index != -1) { > QString fileName = takeOptionValue(args, index); > dumper.setRedirectOutputFileName(fileName); >diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >index f402a02ca362c5279de5a5c8c1e0ce9df362abad..312430d56989548bc3ecad13f8df183096c17c85 100644 >--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >@@ -80,7 +80,7 @@ static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS"; > const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow"; > > static bool dumpTree = true; >-static bool dumpPixels; >+static bool dumpPixelsForCurrentTest; > static bool dumpAllPixels; > static bool printSeparators; > static bool leakChecking = false; >@@ -759,7 +759,7 @@ void dump() > fflush(stderr); > } > >- if (dumpPixels >+ if (dumpPixelsForCurrentTest > && gLayoutTestController->generatePixelResults() > && !gLayoutTestController->dumpDOMAsWebArchive() > && !gLayoutTestController->dumpSourceAsWebArchive()) >@@ -948,20 +948,14 @@ static void sizeWebViewForCurrentTest() > ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); > } > >-static void runTest(const string& testPathOrURL) >+static void runTest(const string& inputLine) > { >+ TestCommand command = parseInputLine(inputLine); >+ const string& pathOrURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; >+ > static BSTR methodBStr = SysAllocString(TEXT("GET")); > >- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. >- string pathOrURL(testPathOrURL); >- string expectedPixelHash; >- >- size_t separatorPos = pathOrURL.find("'"); >- if (separatorPos != string::npos) { >- pathOrURL = string(testPathOrURL, 0, separatorPos); >- expectedPixelHash = string(testPathOrURL, separatorPos + 1); >- } >- > BSTR urlBStr; > > CFStringRef str = CFStringCreateWithCString(0, pathOrURL.c_str(), kCFStringEncodingWindowsLatin1); >@@ -983,7 +977,7 @@ static void runTest(const string& testPathOrURL) > > CFRelease(url); > >- ::gLayoutTestController = LayoutTestController::create(pathOrURL, expectedPixelHash); >+ ::gLayoutTestController = LayoutTestController::create(pathOrURL, command.expectedPixelHash); > done = false; > topLoadingFrame = 0; > >@@ -1337,11 +1331,6 @@ extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, cons > continue; > } > >- if (!stricmp(argv[i], "--pixel-tests")) { >- dumpPixels = true; >- continue; >- } >- > if (!stricmp(argv[i], "--complex-text")) { > forceComplexText = true; > continue; >diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj >index 4843c390e7c6b52e24e2b377065478d076c097fa..7e242a1cde4a2fccc1a2471b6169b3e33eadcdcd 100644 >--- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj >+++ b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj >@@ -563,6 +563,10 @@ > > > </File> > <File >+ RelativePath="..\DumpRenderTreeCommon.cpp" >+ > >+ </File> >+ <File > RelativePath="..\DumpRenderTreePrefix.h" > > > </File> >diff --git a/Tools/DumpRenderTree/wscript b/Tools/DumpRenderTree/wscript >index 645c7d641598afe2f14e163ad4ccef27c528b764..b32929450b28aa8892c33e3be0d96f0e6e113418 100644 >--- a/Tools/DumpRenderTree/wscript >+++ b/Tools/DumpRenderTree/wscript >@@ -40,6 +40,7 @@ include_paths = [ > 'wx' > ] > sources = [ >+ 'DumpRenderTreeCommon.cpp', > 'LayoutTestController.cpp', > 'WorkQueue.cpp', > 'wx/DumpRenderTreeWx.cpp', >diff --git a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp >index 31add11a2eb74d1f4d8329479f419f107ffba88f..45b852d88ab9bda291fb1ed277aca751dfd35097 100644 >--- a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp >+++ b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp >@@ -50,7 +50,7 @@ > volatile bool done = true; > volatile bool notified = false; > static bool printSeparators = true; >-static int dumpPixels; >+static int dumpPixelsForCurrentTest; > static int dumpTree = 1; > time_t startTime; // to detect timeouts / failed tests > >@@ -203,7 +203,7 @@ void dump() > } > } > >- if (dumpPixels >+ if (dumpPixelsForCurrentTest > && gLayoutTestController->generatePixelResults() > && !gLayoutTestController->dumpDOMAsWebArchive() > && !gLayoutTestController->dumpSourceAsWebArchive()) { >@@ -218,26 +218,21 @@ void dump() > gLayoutTestController.clear(); > } > >-static void runTest(const wxString testPathOrURL) >+static void runTest(const wxString inputLine) > { > done = false; > time(&startTime); >- string pathOrURLString(testPathOrURL.char_str()); >- string pathOrURL(pathOrURLString); >- string expectedPixelHash; >- >- size_t separatorPos = pathOrURL.find("'"); >- if (separatorPos != string::npos) { >- pathOrURL = string(pathOrURLString, 0, separatorPos); >- expectedPixelHash = string(pathOrURLString, separatorPos + 1); >- } >+ >+ TestCommand command = parseInputLine(std::string(inputLine.ToAscii())); >+ string& pathOrURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; > > // CURL isn't happy if we don't have a protocol. > size_t http = pathOrURL.find("http://"); > if (http == string::npos) > pathOrURL.insert(0, "file://"); > >- gLayoutTestController = LayoutTestController::create(pathOrURL, expectedPixelHash); >+ gLayoutTestController = LayoutTestController::create(pathOrURL, command.expectedPixelHash); > if (!gLayoutTestController) { > wxTheApp->ExitMainLoop(); > } >@@ -282,11 +277,6 @@ bool MyApp::OnInit() > continue; > } > >- if (!option.CmpNoCase(_T("--pixel-tests"))) { >- dumpPixels = true; >- continue; >- } >- > if (!option.CmpNoCase(_T("--tree"))) { > dumpTree = true; > continue; >@@ -323,7 +313,7 @@ bool MyApp::OnInit() > } > > } else { >- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) { > runTest(wxTheApp->argv[1]); > } >diff --git a/Tools/GNUmakefile.am b/Tools/GNUmakefile.am >index df9a71f18f95807ef4fd6f7d7c27d311fa321ac2..f85a9d12eb7454231522511062ee27f5a4089d42 100644 >--- a/Tools/GNUmakefile.am >+++ b/Tools/GNUmakefile.am >@@ -106,6 +106,7 @@ endif > > Programs_DumpRenderTree_SOURCES = \ > Tools/DumpRenderTree/DumpRenderTree.h \ >+ Tools/DumpRenderTree/DumpRenderTreeCommon.cpp \ > Tools/DumpRenderTree/DumpRenderTreePrefix.h \ > Tools/DumpRenderTree/AccessibilityController.cpp \ > Tools/DumpRenderTree/AccessibilityController.h \ >diff --git a/Tools/Scripts/old-run-webkit-tests b/Tools/Scripts/old-run-webkit-tests >index 09443c87c02f1e8cf5bde6d1b045c4db9bab0882..18ae056a159466a52f37ee2694645db3e87463e2 100755 >--- a/Tools/Scripts/old-run-webkit-tests >+++ b/Tools/Scripts/old-run-webkit-tests >@@ -748,12 +748,16 @@ for my $test (@tests) { > print $tests_run_fh "$test\n"; > > # Try to read expected hash file for pixel tests >- my $suffixExpectedHash = ""; >- if ($pixelTests && !$resetResults) { >- my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); >- if (my $expectedHash = readChecksumFromPng(File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png"))) { >- # Format expected hash into a suffix string that is appended to the path / URL passed to DRT. >- $suffixExpectedHash = "'$expectedHash"; >+ my $suffixPixelTest = ""; >+ if ($pixelTests) { >+ # ' is the separator between arguments. >+ $suffixPixelTest = "'--pixel-test"; >+ if (!$resetResults) { >+ my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); >+ if (my $expectedHash = readChecksumFromPng(File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png"))) { >+ # Format expected hash into a suffix string that is appended to the path / URL passed to DRT. >+ $suffixPixelTest = "'--pixel-test'$expectedHash"; >+ } > } > } > >@@ -789,11 +793,11 @@ for my $test (@tests) { > } elsif ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\//) { > my $path = canonpath($test); > $path =~ s/^http\/tests\///; >- print OUT "http://127.0.0.1:$httpdPort/$path$suffixExpectedHash\n"; >+ print OUT "http://127.0.0.1:$httpdPort/$path$suffixPixelTest\n"; > } elsif ($test =~ /^http\/tests\/ssl\//) { > my $path = canonpath($test); > $path =~ s/^http\/tests\///; >- print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixExpectedHash\n"; >+ print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixPixelTest\n"; > } else { > my $testPath = "$testDirectory/$test"; > if (isCygwin()) { >@@ -801,7 +805,7 @@ for my $test (@tests) { > } else { > $testPath = canonpath($testPath); > } >- print OUT "$testPath$suffixExpectedHash\n"; >+ print OUT "$testPath$suffixPixelTest\n"; > } > } else { > my $testPath = "$testDirectory/$test"; >@@ -810,7 +814,7 @@ for my $test (@tests) { > } else { > $testPath = canonpath($testPath); > } >- print OUT "$testPath$suffixExpectedHash\n" if defined $testPath; >+ print OUT "$testPath$suffixPixelTest\n" if defined $testPath; > } > > # DumpRenderTree is expected to dump two "blocks" to stdout for each test. >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py >index ad70f042de9ecb60063bea6f50c285bf9efd9c12..94215624fe27ea425aa73e891577cc5e6e990e29 100755 >--- a/Tools/Scripts/webkitpy/layout_tests/port/base.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py >@@ -1277,21 +1277,9 @@ class Port(object): > return suite.args > return [] > >- def supports_switching_pixel_tests_per_test(self): >- if self.get_option('webkit_test_runner'): >- return True >- return self._supports_switching_pixel_tests_per_test() >- >- def _supports_switching_pixel_tests_per_test(self): >- # FIXME: all ports should support it. >- return False >- > def should_run_as_pixel_test(self, test_input): > if not self._options.pixel_tests: > return False >- if not self.supports_switching_pixel_tests_per_test(): >- # Cannot do more filtering without this. >- return True > if self._options.pixel_test_directories: > return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) > return self._should_run_as_pixel_test(test_input) >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/driver.py b/Tools/Scripts/webkitpy/layout_tests/port/driver.py >index 781823b8d670a6eb8e52e0768be664b11d63033c..2021587fbb4da6d59baf2678cf0002c4e172d607 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/driver.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/driver.py >@@ -293,8 +293,6 @@ class Driver(object): > > cmd.extend(self._port.get_option('additional_drt_flag', [])) > >- if pixel_tests and not self._port.supports_switching_pixel_tests_per_test(): >- cmd.append('--pixel-tests') > cmd.extend(per_test_args) > > cmd.append('-') >@@ -335,11 +333,9 @@ class Driver(object): > > assert not driver_input.image_hash or driver_input.should_run_pixel_test > >+ # ' is the separator between arguments. > if driver_input.should_run_pixel_test: >- if self._port.supports_switching_pixel_tests_per_test(): >- # We did not start the driver with --pixel-tests, instead we specify it per test. >- # "'" is the separator of command fields. >- command += "'" + '--pixel-test' >+ command += "'--pixel-test" > if driver_input.image_hash: > command += "'" + driver_input.image_hash > return command + "\n" >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt.py b/Tools/Scripts/webkitpy/layout_tests/port/qt.py >index e239c7e3aaf6f602b0c351ec22dcfa68064ea269..6e7b0988d5a77efc5fc372fa7516783400a69f08 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/qt.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/qt.py >@@ -184,6 +184,3 @@ class QtPort(Port): > return False > return result > >- def _supports_switching_pixel_tests_per_test(self): >- return True >- >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/test.py b/Tools/Scripts/webkitpy/layout_tests/port/test.py >index 5714661fd203676839d6c76f4735bec8132b89b8..0cd171f3bca6abebdb21b98e2a45c21a14a90112 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/test.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/test.py >@@ -513,10 +513,6 @@ class TestPort(Port): > VirtualTestSuite('virtual/skipped', 'failures/expected', ['--virtual-arg2']), > ] > >- def supports_switching_pixel_tests_per_test(self): >- # Let it true so we can test the --pixel-test-directory option. >- return True >- > > class TestDriver(Driver): > """Test/Dummy implementation of the DumpRenderTree interface.""" >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index d0232992731d1bc971268fc3931f4b70ab367ac7..e1ed5d9f852fdde3b91b27a8a402e464f80b5527 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -35,7 +35,11 @@ > #include <WebKit2/WKPagePrivate.h> > #include <WebKit2/WKPreferencesPrivate.h> > #include <WebKit2/WKRetainPtr.h> >+#include <algorithm> > #include <cstdio> >+#include <ctype.h> >+#include <stdlib.h> >+#include <string> > #include <wtf/PassOwnPtr.h> > > #if PLATFORM(MAC) >@@ -67,8 +71,7 @@ TestController& TestController::shared() > } > > TestController::TestController(int argc, const char* argv[]) >- : m_dumpPixelsForAllTests(false) >- , m_verbose(false) >+ : m_verbose(false) > , m_printSeparators(false) > , m_usingServerMode(false) > , m_gcBetweenTests(false) >@@ -267,10 +270,6 @@ void TestController::initialize(int argc, const char* argv[]) > continue; > } > >- if (argument == "--pixel-tests") { >- m_dumpPixelsForAllTests = true; >- continue; >- } > if (argument == "--verbose") { > m_verbose = true; > continue; >@@ -504,7 +503,89 @@ bool TestController::resetStateToConsistentValues() > return m_doneResetting; > } > >-bool TestController::runTest(const char* test) >+struct TestCommand { >+ TestCommand() : shouldDumpPixels(false) { } >+ >+ std::string pathOrURL; >+ bool shouldDumpPixels; >+ std::string expectedPixelHash; >+}; >+ >+class CommandTokenizer { >+public: >+ explicit CommandTokenizer(const std::string& input) >+ : m_input(input) >+ , m_posNextSeparator(0) >+ { >+ pump(); >+ } >+ >+ bool hasNext() const; >+ std::string next(); >+ >+private: >+ void pump(); >+ static const char kSeparator = '\''; >+ const std::string& m_input; >+ std::string m_next; >+ size_t m_posNextSeparator; >+}; >+ >+void CommandTokenizer::pump() >+{ >+ if (m_posNextSeparator == std::string::npos || m_posNextSeparator == m_input.size()) { >+ m_next = std::string(); >+ return; >+ } >+ size_t start = m_posNextSeparator ? m_posNextSeparator + 1 : 0; >+ m_posNextSeparator = m_input.find(kSeparator, start); >+ size_t size = m_posNextSeparator == std::string::npos ? std::string::npos : m_posNextSeparator - start; >+ m_next = std::string(m_input, start, size); >+} >+ >+std::string CommandTokenizer::next() >+{ >+ ASSERT(hasNext()); >+ >+ std::string oldNext = m_next; >+ pump(); >+ return oldNext; >+} >+ >+bool CommandTokenizer::hasNext() const >+{ >+ return !m_next.empty(); >+} >+ >+NO_RETURN static void die(const std::string& inputLine) >+{ >+ fprintf(stderr, "Unexpected input line: %s\n", inputLine.c_str()); >+ exit(1); >+} >+ >+TestCommand parseInputLine(const std::string& inputLine) >+{ >+ TestCommand result; >+ CommandTokenizer tokenizer(inputLine); >+ if (!tokenizer.hasNext()) >+ die(inputLine); >+ >+ result.pathOrURL = tokenizer.next(); >+ if (!tokenizer.hasNext()) >+ return result; >+ >+ std::string arg = tokenizer.next(); >+ if (arg != std::string("-p") && arg != std::string("--pixel-test")) >+ die(inputLine); >+ result.shouldDumpPixels = true; >+ >+ if (tokenizer.hasNext()) >+ result.expectedPixelHash = tokenizer.next(); >+ >+ return result; >+} >+ >+bool TestController::runTest(const char* inputLine) > { > if (!resetStateToConsistentValues()) { > #if PLATFORM(MAC) >@@ -517,32 +598,13 @@ bool TestController::runTest(const char* test) > return false; > } > >- bool dumpPixelsTest = m_dumpPixelsForAllTests; >- std::string command(test); >- std::string pathOrURL = command; >- std::string expectedPixelHash; >- size_t firstSeparatorPos = command.find_first_of('\''); >- size_t secondSeparatorPos = command.find_first_of('\'', firstSeparatorPos + 1); >- if (firstSeparatorPos != std::string::npos) { >- pathOrURL = std::string(command, 0, firstSeparatorPos); >- size_t pixelHashPos = firstSeparatorPos + 1; >- >- // NRWT passes --pixel-test if we should dump pixels for the test. >- const std::string expectedPixelTestArg("--pixel-test"); >- std::string argTest = std::string(command, firstSeparatorPos + 1, expectedPixelTestArg.size()); >- if (argTest == expectedPixelTestArg) { >- dumpPixelsTest = true; >- pixelHashPos = secondSeparatorPos == std::string::npos ? std::string::npos : secondSeparatorPos + 1; >- } >- if (pixelHashPos != std::string::npos && pixelHashPos < command.size()) >- expectedPixelHash = std::string(command, pixelHashPos); >- } >+ TestCommand command = parseInputLine(std::string(inputLine)); > > m_state = RunningTest; > >- m_currentInvocation = adoptPtr(new TestInvocation(pathOrURL)); >- if (dumpPixelsTest) >- m_currentInvocation->setIsPixelTest(expectedPixelHash); >+ m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL)); >+ if (command.shouldDumpPixels) >+ m_currentInvocation->setIsPixelTest(command.expectedPixelHash); > > m_currentInvocation->invoke(); > m_currentInvocation.clear(); >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index a99e16ea87027c34f07b8962b098c2334d9421bd..5e20d611b469df187c378ee62ed0cac318daed21 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -104,7 +104,6 @@ private: > > OwnPtr<TestInvocation> m_currentInvocation; > >- bool m_dumpPixelsForAllTests; > bool m_verbose; > bool m_printSeparators; > bool m_usingServerMode;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 92398
:
154700
|
155320
|
155325
|
155474
|
155489
|
155513
|
155519
|
155569
|
155580
| 156011