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
+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
__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.
{
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);
+}
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
#include "WebFrame.h"
#include "WebPage.h"
+#include <WebCore/AnimationController.h>
#include <WebCore/Frame.h>
#include <WebCore/HTMLFrameOwnerElement.h>
#include <WebCore/PlatformString.h>
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
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*);
_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.
#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 {
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));
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)
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 }
};
void invalidateWaitToDumpWatchdog();
void notifyDone();
+ unsigned numberOfActiveAnimations() const;
+ bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
+
private:
LayoutTestController(const std::string& testPathOrURL);