diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-22 22:08:40 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-22 22:08:40 +0000 |
commit | af91a57c0203abee45565f47b5d9086e42acafba (patch) | |
tree | 7cc4db4b0eec56b116d2e4e43cb98e629967cd2a /webkit | |
parent | fa2738d71ffcd2c451ecbb27fa35af8534d5482c (diff) | |
download | chromium_src-af91a57c0203abee45565f47b5d9086e42acafba.zip chromium_src-af91a57c0203abee45565f47b5d9086e42acafba.tar.gz chromium_src-af91a57c0203abee45565f47b5d9086e42acafba.tar.bz2 |
Adds support for pauseAnimationAtTimeOnElementWithId and
pauseTransitionAtTimeOnElementWithId to layout test controller so that
we can pass a couple of additional tests.
BUG=5801
TEST=none
Review URL: http://codereview.chromium.org/16216
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
9 files changed, 122 insertions, 7 deletions
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/README b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/README index f154f41..09634c7 100644 --- a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/README +++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/README @@ -1,3 +1,7 @@ +animation-drt-api-multiple-keyframes.html +----------------------------------------- +Text rendering differences between us and WebKit. + keyframes-rule.html ------------------------------ typeof(window.CSSStyleDeclaration) returns Object in JSC and function in V8. diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.checksum b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.checksum new file mode 100644 index 0000000..b09b286 --- /dev/null +++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.checksum @@ -0,0 +1 @@ +f16bb81da234c651213e5cf37c9bc6cb
\ No newline at end of file diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.png b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.png Binary files differnew file mode 100644 index 0000000..881ec92 --- /dev/null +++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.png diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.txt b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.txt new file mode 100644 index 0000000..f80c071 --- /dev/null +++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/animations/animation-drt-api-multiple-keyframes-expected.txt @@ -0,0 +1,11 @@ +layer at (0,0) size 800x600 + RenderView at (0,0) size 800x600 +layer at (0,0) size 800x316 + RenderBlock {HTML} at (0,0) size 800x316 + RenderBody {BODY} at (0,21) size 800x295 + RenderBlock {H1} at (0,0) size 800x74 + RenderText {#text} at (0,0) size 799x73 + text run at (0,0) width 799: "Test for DRT pauseAnimationAtTimeOnElementWithId()" + text run at (0,37) width 597: "API on animations with multiple keyframes" +layer at (15,116) size 200x200 + RenderBlock (relative positioned) {DIV} at (0,95) size 200x200 [bgcolor=#FF0000] diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index a488573..da1a961 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -7,6 +7,7 @@ #include "base/compiler_specific.h" MSVC_PUSH_WARNING_LEVEL(0); +#include "AnimationController.h" #include "FrameLoader.h" #include "FrameTree.h" #include "Document.h" @@ -794,5 +795,50 @@ void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info) { } } -} // webkit_glue +bool PauseAnimationAtTimeOnElementWithId(WebView* view, + const std::string& animation_name, + double time, + const std::string& element_id) { + WebFrame* web_frame = view->GetMainFrame(); + if (!web_frame) + return false; + WebCore::Frame* frame = static_cast<WebFrameImpl*>(web_frame)->frame(); + WebCore::AnimationController* controller = frame->animation(); + if (!controller) + return false; + + WebCore::Element* element = + frame->document()->getElementById(StdStringToString(element_id)); + if (!element) + return false; + + return controller->pauseAnimationAtTime(element->renderer(), + StdStringToString(animation_name), + time); +} + +bool PauseTransitionAtTimeOnElementWithId(WebView* view, + const std::string& property_name, + double time, + const std::string& element_id) { + WebFrame* web_frame = view->GetMainFrame(); + if (!web_frame) + return false; + + WebCore::Frame* frame = static_cast<WebFrameImpl*>(web_frame)->frame(); + WebCore::AnimationController* controller = frame->animation(); + if (!controller) + return false; + + WebCore::Element* element = + frame->document()->getElementById(StdStringToString(element_id)); + if (!element) + return false; + + return controller->pauseTransitionAtTime(element->renderer(), + StdStringToString(property_name), + time); +} + +} // webkit_glue diff --git a/webkit/glue/dom_operations.h b/webkit/glue/dom_operations.h index 20d5585..d1512c1 100644 --- a/webkit/glue/dom_operations.h +++ b/webkit/glue/dom_operations.h @@ -171,7 +171,22 @@ bool ParseIconSizes(const std::wstring& text, // WebApplicationInfo for details as to where each field comes from. void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info); +// Invokes pauseAnimationAtTime on the AnimationController associated with the +// |view|s main frame. +// This is used by test shell. +bool PauseAnimationAtTimeOnElementWithId(WebView* view, + const std::string& animation_name, + double time, + const std::string& element_id); + +// Invokes pauseTransitionAtTime on the AnimationController associated with the +// |view|s main frame. +// This is used by test shell. +bool PauseTransitionAtTimeOnElementWithId(WebView* view, + const std::string& property_name, + double time, + const std::string& element_id); + } // namespace webkit_glue #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ - diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index 242336d..c5140a7d 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -1733,12 +1733,9 @@ LINUX WIN : LayoutTests/svg/custom/pattern-cycle-detection.svg = FAIL WIN : LayoutTests/svg/custom/stroke-fallback.svg = FAIL // Merge 39143:39309 -LayoutTests/animations/animation-drt-api-multiple-keyframes.html = FAIL -// Timing sensitive -LayoutTests/animations/combo-transform-translate+scale.html = FAIL PASS -LayoutTests/animations/keyframes-from-missing.html = FAIL +// This test needs to be rebaselined on Mac/Linux. +LINUX MAC : LayoutTests/animations/animation-drt-api-multiple-keyframes.html = FAIL LayoutTests/animations/keyframes-rule.html = FAIL -LayoutTests/animations/keyframes-to-missing.html = FAIL LayoutTests/fast/dom/object-embed-plugin-scripting.html = FAIL LayoutTests/fast/js/regexp-no-extensions.html = FAIL LayoutTests/fast/regex/quantified-assertions.html = FAIL diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index c6a3588..df1a774 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -14,6 +14,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/string_util.h" +#include "webkit/glue/dom_operations.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webpreferences.h" #include "webkit/glue/webview.h" @@ -97,6 +98,8 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvisionalFrameLoads); BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInsertDeleteEnabled); BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSelectTrailingWhitespaceEnabled); + BindMethod("pauseAnimationAtTimeOnElementWithId", &LayoutTestController::pauseAnimationAtTimeOnElementWithId); + BindMethod("pauseTransitionAtTimeOnElementWithId", &LayoutTestController::pauseTransitionAtTimeOnElementWithId); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -568,6 +571,39 @@ void LayoutTestController::setSelectTrailingWhitespaceEnabled( result->SetNull(); } +void LayoutTestController::pauseAnimationAtTimeOnElementWithId( + const CppArgumentList& args, + CppVariant* result) { + if (args.size() > 2 && args[0].isString() && args[1].isNumber() && + args[2].isString()) { + std::string animation_name = args[0].ToString(); + double time = args[1].ToDouble(); + std::string element_id = args[2].ToString(); + + result->Set( + webkit_glue::PauseAnimationAtTimeOnElementWithId( + shell_->webView(), animation_name, time, element_id)); + } else { + result->Set(false); + } +} + +void LayoutTestController::pauseTransitionAtTimeOnElementWithId( + const CppArgumentList& args, + CppVariant* result) { + if (args.size() > 2 && args[0].isString() && args[1].isNumber() && + args[2].isString()) { + std::string property_name = args[0].ToString(); + double time = args[1].ToDouble(); + std::string element_id = args[2].ToString(); + + webkit_glue::PauseTransitionAtTimeOnElementWithId( + shell_->webView(), property_name, time, element_id); + } else { + result->Set(false); + } +} + // // Unimplemented stubs // diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 3cc4e31..d0f8f05 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -133,6 +133,11 @@ class LayoutTestController : public CppBoundClass { void setSelectTrailingWhitespaceEnabled(const CppArgumentList& args, CppVariant* result); + void pauseAnimationAtTimeOnElementWithId(const CppArgumentList& args, + CppVariant* result); + void pauseTransitionAtTimeOnElementWithId(const CppArgumentList& args, + CppVariant* result); + // The following are only stubs. TODO(pamg): Implement any of these that // are needed to pass the layout tests. void dumpAsWebArchive(const CppArgumentList& args, CppVariant* result); |