diff options
author | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 02:33:31 +0000 |
---|---|---|
committer | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 02:33:31 +0000 |
commit | d98d47f08a0fe13528a58d1c70b42df3fcbb98bf (patch) | |
tree | 00cff4b213631129013d11ebda3aeb382c484b64 | |
parent | 75388dacd2169d6e4719f6074f34959f20aeb5c1 (diff) | |
download | chromium_src-d98d47f08a0fe13528a58d1c70b42df3fcbb98bf.zip chromium_src-d98d47f08a0fe13528a58d1c70b42df3fcbb98bf.tar.gz chromium_src-d98d47f08a0fe13528a58d1c70b42df3fcbb98bf.tar.bz2 |
Add layoutTestController.counterValueForElementById
Now we can test CSS counters with dumpAsText().
The corresponding upstream bug:
https://bugs.webkit.org/show_bug.cgi?id=30555
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/338056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30554 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/webkit_glue.cc | 14 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 6 | ||||
-rw-r--r-- | webkit/tools/layout_tests/test_expectations.txt | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 15 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 4 |
5 files changed, 39 insertions, 4 deletions
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 9a2d1fd..233170c 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -139,6 +139,20 @@ std::wstring DumpRenderer(WebFrame* web_frame) { return StringToStdWString(frameText); } +bool CounterValueForElementById(WebFrame* web_frame, const std::string& id, + std::wstring* counter_value) { + WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame); + WebCore::Frame* frame = webFrameImpl->frame(); + + WebCore::Element* element = + frame->document()->getElementById(WebCore::AtomicString(id.c_str())); + if (!element) + return false; + WebCore::String counterValue = WebCore::counterValueForElement(element); + *counter_value = StringToStdWString(counterValue); + return true; +} + std::wstring DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame); WebCore::IntSize offset = webFrameImpl->frameview()->scrollOffset(); diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index d4d506a..ba5d405 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -58,6 +58,12 @@ std::wstring DumpFramesAsText(WebKit::WebFrame* web_frame, bool recursive); // Returns the renderer's description of its tree (its externalRepresentation). std::wstring DumpRenderer(WebKit::WebFrame* web_frame); +// Fill the value of counter in the element specified by the id into +// counter_value. Return false when the specified id doesn't exist. +bool CounterValueForElementById(WebKit::WebFrame* web_frame, + const std::string& id, + std::wstring* counter_value); + // Returns a dump of the scroll position of the webframe. std::wstring DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive); diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt index 912a92d..cba30da 100644 --- a/webkit/tools/layout_tests/test_expectations.txt +++ b/webkit/tools/layout_tests/test_expectations.txt @@ -3060,10 +3060,6 @@ BUG24063 : LayoutTests/fast/dom/Window/window-postmessage-clone.html = FAIL BUG24182 DEBUG SLOW : LayoutTests/fast/forms/input-implicit-length-limit.html = PASS BUG24182 DEBUG SLOW : LayoutTests/fast/forms/input-maxlength.html = PASS -// Webkit update: 49221:49245 -BUG_HAMAJI WIN LINUX : LayoutTests/fast/css/counters/t1204-increment-00-c-o.html = FAIL -BUG_HAMAJI WIN LINUX : LayoutTests/fast/css/counters/t1204-increment-01-c-o.html = FAIL - // Failing after r28267 BUG24116 SLOW : LayoutTests/http/tests/loading/gmail-assert-on-load.html = FAIL diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index db50fac..fbedf9c 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -22,6 +22,7 @@ #include "webkit/api/public/WebURL.h" #include "webkit/api/public/WebView.h" #include "webkit/glue/dom_operations.h" +#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" #include "webkit/tools/test_shell/simple_database_system.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" @@ -117,6 +118,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) : BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccessFromOrigin); BindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases); BindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale); + BindMethod("counterValueForElementById", &LayoutTestController::counterValueForElementById); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -992,6 +994,19 @@ void LayoutTestController::setPOSIXLocale(const CppArgumentList& args, } } +void LayoutTestController::counterValueForElementById( + const CppArgumentList& args, CppVariant* result) { + result->SetNull(); + if (args.size() < 1 || !args[0].isString()) + return; + std::wstring counterValue; + if (!webkit_glue::CounterValueForElementById(shell_->webView()->mainFrame(), + args[0].ToString(), + &counterValue)) + return; + result->Set(WideToUTF8(counterValue)); +} + void LayoutTestController::LogErrorToConsole(const std::string& text) { shell_->delegate()->didAddMessageToConsole( WebConsoleMessage(WebConsoleMessage::LevelError, diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 7f9f628..d84d5cb 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -205,6 +205,10 @@ class LayoutTestController : public CppBoundClass { // Resets between tests. void setPOSIXLocale(const CppArgumentList& args, CppVariant* result); + // Gets the value of the counter in the element specified by its ID. + void counterValueForElementById( + const CppArgumentList& args, CppVariant* result); + public: // The following methods are not exposed to JavaScript. void SetWorkQueueFrozen(bool frozen) { work_queue_.set_frozen(frozen); } |