Commit 5c2308c3 authored by mjs@apple.com's avatar mjs@apple.com

2010-07-11 Maciej Stachowiak <mjs@apple.com>

        Reviewed by Dan Bernstein.

        Implement animation-related methods for WebKitTestRunner
        https://bugs.webkit.org/show_bug.cgi?id=42053

        * WebCore.exp.in: Export Document::getElementById for WebKit2's benefit.
2010-07-11  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        Implement animation-related methods for WebKitTestRunner
        https://bugs.webkit.org/show_bug.cgi?id=42053
        
        Implemented numberOfActiveAnimatiosn and pauseAnimationAtTimeOnElementWithId. Many
        animation tests were hanging otherwise.

        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::numberOfActiveAnimations):
        (WTR::LayoutTestController::pauseAnimationAtTimeOnElementWithId):
        (WTR::numberOfActiveAnimationsCallback):
        (WTR::pauseAnimationAtTimeOnElementWithIdCallback):
        (WTR::LayoutTestController::staticFunctions):
        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
2010-07-11  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        Implement animation-related methods for WebKitTestRunner
        https://bugs.webkit.org/show_bug.cgi?id=42053

        Implemented some helpers for WebKitTestRunner;
        
        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
        (WKBundleFrameGetNumberOfActiveAnimations):
        (WKBundleFramePauseAnimationOnElementWithId):
        * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
        * WebProcess/WebPage/WebFrame.cpp:
        (WebKit::WebFrame::numberOfActiveAnimations):
        (WebKit::WebFrame::pauseAnimationOnElementWithId):
        * WebProcess/WebPage/WebFrame.h:
        * mac/WebKit2.exp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63063 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4ba135e5
2010-07-11 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
Implement animation-related methods for WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=42053
* WebCore.exp.in: Export Document::getElementById for WebKit2's benefit.
2010-07-11 Adam Barth <abarth@webkit.org>
Rubber-stamped by Eric Seidel
......@@ -959,6 +959,7 @@ __ZNK7WebCore7IntRectcv7_NSRectEv
__ZNK7WebCore7IntSizecv7_NSSizeEv
__ZNK7WebCore8Document11completeURLERKNS_6StringE
__ZNK7WebCore8Document13axObjectCacheEv
__ZNK7WebCore8Document14getElementByIdERKNS_12AtomicStringE
__ZNK7WebCore8Document20cacheDocumentElementEv
__ZNK7WebCore8Document31displayStringModifiedByEncodingERKNS_6StringE
__ZNK7WebCore8Document4bodyEv
......
2010-07-11 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
Implement animation-related methods for WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=42053
Implemented some helpers for WebKitTestRunner;
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameGetNumberOfActiveAnimations):
(WKBundleFramePauseAnimationOnElementWithId):
* WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::numberOfActiveAnimations):
(WebKit::WebFrame::pauseAnimationOnElementWithId):
* WebProcess/WebPage/WebFrame.h:
* mac/WebKit2.exp:
2010-07-10 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
......
......@@ -53,3 +53,13 @@ WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef)
{
return toRef(toWK(frameRef)->childFrames().releaseRef());
}
unsigned WKBundleFrameGetNumberOfActiveAnimations(WKBundleFrameRef frameRef)
{
return toWK(frameRef)->numberOfActiveAnimations();
}
bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frameRef, WKStringRef name, WKStringRef elementID, double time)
{
return toWK(frameRef)->pauseAnimationOnElementWithId(toWK(name), toWK(elementID), time);
}
......@@ -45,6 +45,10 @@ WK_EXPORT WKStringRef WKBundleFrameCopyInnerText(WKBundleFrameRef frame);
WK_EXPORT WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frame);
WK_EXPORT unsigned WKBundleFrameGetNumberOfActiveAnimations(WKBundleFrameRef frame);
WK_EXPORT bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frame, WKStringRef name, WKStringRef elementID, double time);
#ifdef __cplusplus
}
#endif
......
......@@ -26,6 +26,7 @@
#include "WebFrame.h"
#include "WebPage.h"
#include <WebCore/AnimationController.h>
#include <WebCore/Frame.h>
#include <WebCore/HTMLFrameOwnerElement.h>
#include <WebCore/PlatformString.h>
......@@ -211,4 +212,36 @@ PassRefPtr<ImmutableArray> WebFrame::childFrames()
return ImmutableArray::adopt(array, size, &callbacks);
}
unsigned WebFrame::numberOfActiveAnimations()
{
if (!m_coreFrame)
return 0;
AnimationController* controller = m_coreFrame->animation();
if (!controller)
return 0;
return controller->numberOfActiveAnimations();
}
bool WebFrame::pauseAnimationOnElementWithId(const String& animationName, const String& elementID, double time)
{
if (!m_coreFrame)
return false;
AnimationController* controller = m_coreFrame->animation();
if (!controller)
return false;
if (!m_coreFrame->document())
return false;
Node* coreNode = m_coreFrame->document()->getElementById(elementID);
if (!coreNode || !coreNode->renderer())
return false;
return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
}
} // namespace WebKit
......@@ -69,6 +69,9 @@ public:
WebCore::String innerText() const;
PassRefPtr<ImmutableArray> childFrames();
unsigned numberOfActiveAnimations();
bool pauseAnimationOnElementWithId(const WebCore::String& animationName, const WebCore::String& elementID, double time);
private:
static PassRefPtr<WebFrame> create(WebPage*, const WebCore::String& frameName, WebCore::HTMLFrameOwnerElement*);
WebFrame(WebPage*, const WebCore::String& frameName, WebCore::HTMLFrameOwnerElement*);
......
......@@ -5,8 +5,10 @@ _WKArrayRelease
_WKArrayRetain
_WKBundleFrameCopyChildFrames
_WKBundleFrameCopyInnerText
_WKBundleFrameGetNumberOfActiveAnimations
_WKBundleFrameGetURL
_WKBundleFrameIsMainFrame
_WKBundleFramePauseAnimationOnElementWithId
_WKBundlePageCopyRenderTreeExternalRepresentation
_WKBundlePageGetMainFrame
_WKBundlePageSetLoaderClient
......
2010-07-11 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
Implement animation-related methods for WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=42053
Implemented numberOfActiveAnimatiosn and pauseAnimationAtTimeOnElementWithId. Many
animation tests were hanging otherwise.
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::numberOfActiveAnimations):
(WTR::LayoutTestController::pauseAnimationAtTimeOnElementWithId):
(WTR::numberOfActiveAnimationsCallback):
(WTR::pauseAnimationAtTimeOnElementWithIdCallback):
(WTR::LayoutTestController::staticFunctions):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
2010-07-11 Daniel Bates <dbates@rim.com>
Reviewed by David Kilzer.
......
......@@ -28,6 +28,10 @@
#include "InjectedBundlePage.h"
#include <JavaScriptCore/JSRetainPtr.h>
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKStringCF.h>
#include <WebKit2/WebKit2.h>
namespace WTR {
......@@ -88,6 +92,23 @@ void LayoutTestController::notifyDone()
m_waitToDump = false;
}
unsigned LayoutTestController::numberOfActiveAnimations() const
{
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
return WKBundleFrameGetNumberOfActiveAnimations(mainFrame);
}
bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
{
RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, elementId));
WKRetainPtr<WKStringRef> idWK(AdoptWK, WKStringCreateWithCFString(idCF.get()));
RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, animationName));
WKRetainPtr<WKStringRef> nameWK(AdoptWK, WKStringCreateWithCFString(nameCF.get()));
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
return WKBundleFramePauseAnimationOnElementWithId(mainFrame, nameWK.get(), idWK.get(), time);
}
static JSValueRef dumpAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
......@@ -109,6 +130,31 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}
static JSValueRef numberOfActiveAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount)
return JSValueMakeUndefined(context);
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(context, controller->numberOfActiveAnimations());
}
static JSValueRef pauseAnimationAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount != 3)
return JSValueMakeUndefined(context);
JSRetainPtr<JSStringRef> animationName(Adopt, JSValueToStringCopy(context, arguments[0], exception));
ASSERT(!*exception);
double time = JSValueToNumber(context, arguments[1], exception);
ASSERT(!*exception);
JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception));
ASSERT(!*exception);
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
return JSValueMakeBoolean(context, controller->pauseAnimationAtTimeOnElementWithId(animationName.get(), time, elementId.get()));
}
// Object Finalization
static void layoutTestControllerObjectFinalize(JSObjectRef object)
......@@ -147,6 +193,8 @@ JSStaticFunction* LayoutTestController::staticFunctions()
static JSStaticFunction staticFunctions[] = {
{ "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "waitUntilDone", waitUntilDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
......
......@@ -50,6 +50,9 @@ public:
void invalidateWaitToDumpWatchdog();
void notifyDone();
unsigned numberOfActiveAnimations() const;
bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
private:
LayoutTestController(const std::string& testPathOrURL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment