Implement a WebKitAnimationEvent constructor.

https://bugs.webkit.org/show_bug.cgi?id=67825

Source/WebCore:

Patch by Kentaro Hara <haraken@google.com> on 2011-09-08
Reviewed by Sam Weinig.

There is no spec for the WebKitAnimationEvent constructor
since it is WebKit-specific. However, based on the current
IDL of initWebKitAnimationEvent(), the constructor IDL
should be as follows.

[Constructor(DOMString type, optional WebKitAnimationEventInit eventInitDict)]
interface WebKitAnimationEvent : Event {
    ...;
}

dictionary WebKitAnimationEventInit : EventInit {
    DOMString animationName;
    double elapsedTime;
}

Test: fast/events/constructors/webkit-animation-event-constructor.html

* bindings/generic/EventConstructors.h: Added a definition for the WebKitAnimationEvent constructor.
* bindings/js/JSEventConstructors.cpp: Added #includes for WebKitAnimationEvent.
* dom/WebKitAnimationEvent.cpp:
(WebCore::WebKitAnimationEventInit::WebKitAnimationEventInit):
(WebCore::WebKitAnimationEvent::WebKitAnimationEvent):
* dom/WebKitAnimationEvent.h: Added a definition for WebKitAnimationEventInit.
(WebCore::WebKitAnimationEvent::create):
* dom/WebKitAnimationEvent.idl: Makes WebKitAnimationEvent constructible.

LayoutTests:

Checks the behavior of the WebKitAnimationEvent constructor.

Patch by Kentaro Hara <haraken@google.com> on 2011-09-08
Reviewed by Sam Weinig.

* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/events/constructors/webkit-animation-event-constructor-expected.txt: Added.
* fast/events/constructors/webkit-animation-event-constructor.html: Added.
* platform/chromium/test_expectations.txt: Skipped webkit-animation-event-constructor.html, since V8 does not yet have the WebKitAnimationEvent constructor.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d857643c
2011-09-08 Kentaro Hara <haraken@google.com>
Implement a WebKitAnimationEvent constructor.
https://bugs.webkit.org/show_bug.cgi?id=67825
Checks the behavior of the WebKitAnimationEvent constructor.
Reviewed by Sam Weinig.
* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/events/constructors/webkit-animation-event-constructor-expected.txt: Added.
* fast/events/constructors/webkit-animation-event-constructor.html: Added.
* platform/chromium/test_expectations.txt: Skipped webkit-animation-event-constructor.html, since V8 does not yet have the WebKitAnimationEvent constructor.
2011-09-09 Csaba Osztrogonác <ossy@webkit.org>
[Qt] Unreviewed gardening after r94857. Add platform specific expected files.
......@@ -21,6 +21,8 @@ PASS (new inner.Option()).isInner is true
PASS (new inner.Option()).constructor.isInner is true
PASS (new inner.ProgressEvent()).isInner is true
PASS (new inner.ProgressEvent()).constructor.isInner is true
PASS (new inner.WebKitAnimationEvent()).isInner is true
PASS (new inner.WebKitAnimationEvent()).constructor.isInner is true
PASS (new inner.WebKitCSSMatrix()).isInner is true
PASS (new inner.WebKitCSSMatrix()).constructor.isInner is true
PASS (new inner.WebKitPoint()).isInner is true
......
This tests the constructor for the WebKitAnimationEvent DOM class.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS new WebKitAnimationEvent('eventType').bubbles is false
PASS new WebKitAnimationEvent('eventType').cancelable is false
PASS new WebKitAnimationEvent('eventType').animationName is ""
PASS new WebKitAnimationEvent('eventType').elapsedTime is 0
PASS new WebKitAnimationEvent('eventType', { bubbles: false }).bubbles is false
PASS new WebKitAnimationEvent('eventType', { bubbles: true }).bubbles is true
PASS new WebKitAnimationEvent('eventType', { cancelable: false }).cancelable is false
PASS new WebKitAnimationEvent('eventType', { cancelable: true }).cancelable is true
PASS new WebKitAnimationEvent('eventType', { animationName: 'doremi' }).animationName is "doremi"
PASS new WebKitAnimationEvent('eventType', { animationName: '' }).animationName is ""
PASS new WebKitAnimationEvent('eventType', { animationName: undefined }).animationName is "undefined"
PASS new WebKitAnimationEvent('eventType', { animationName: null }).animationName is "null"
PASS new WebKitAnimationEvent('eventType', { animationName: false }).animationName is "false"
PASS new WebKitAnimationEvent('eventType', { animationName: true }).animationName is "true"
PASS new WebKitAnimationEvent('eventType', { animationName: 12345 }).animationName is "12345"
PASS new WebKitAnimationEvent('eventType', { animationName: 18446744073709551615 }).animationName is "18446744073709552000"
PASS new WebKitAnimationEvent('eventType', { animationName: NaN }).animationName is "NaN"
PASS new WebKitAnimationEvent('eventType', { animationName: [] }).animationName is ""
PASS new WebKitAnimationEvent('eventType', { animationName: [1, 2, 3] }).animationName is "1,2,3"
PASS new WebKitAnimationEvent('eventType', { animationName: {doremi: 12345} }).animationName is "[object Object]"
PASS new WebKitAnimationEvent('eventType', { animationName: {valueOf: function () { return 'doremi'; } } }).animationName is "[object Object]"
PASS new WebKitAnimationEvent('eventType', { elapsedTime: 0 }).elapsedTime is 0
PASS new WebKitAnimationEvent('eventType', { elapsedTime: 123.45 }).elapsedTime is 123.45
PASS new WebKitAnimationEvent('eventType', { elapsedTime: -123.45 }).elapsedTime is -123.45
PASS new WebKitAnimationEvent('eventType', { elapsedTime: 18446744073709551615 }).elapsedTime is 18446744073709551615
PASS new WebKitAnimationEvent('eventType', { elapsedTime: NaN }).elapsedTime is NaN
PASS new WebKitAnimationEvent('eventType', { elapsedTime: Infinity }).elapsedTime is Infinity
PASS new WebKitAnimationEvent('eventType', { elapsedTime: -Infinity }).elapsedTime is -Infinity
PASS new WebKitAnimationEvent('eventType', { elapsedTime: undefined }).elapsedTime is NaN
PASS new WebKitAnimationEvent('eventType', { elapsedTime: null }).elapsedTime is 0
PASS new WebKitAnimationEvent('eventType', { elapsedTime: false }).elapsedTime is 0
PASS new WebKitAnimationEvent('eventType', { elapsedTime: true }).elapsedTime is 1
PASS new WebKitAnimationEvent('eventType', { elapsedTime: '' }).elapsedTime is 0
PASS new WebKitAnimationEvent('eventType', { elapsedTime: 'doremi' }).elapsedTime is NaN
PASS new WebKitAnimationEvent('eventType', { elapsedTime: [] }).elapsedTime is 0
PASS new WebKitAnimationEvent('eventType', { elapsedTime: [123.45] }).elapsedTime is 123.45
PASS new WebKitAnimationEvent('eventType', { elapsedTime: [123.45, 678.90] }).elapsedTime is NaN
PASS new WebKitAnimationEvent('eventType', { elapsedTime: {doremi: 123.45} }).elapsedTime is NaN
PASS new WebKitAnimationEvent('eventType', { elapsedTime: {valueOf: function () { return 123.45 } } }).elapsedTime is 123.45
PASS new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).bubbles is true
PASS new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).cancelable is true
PASS new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).animationName is 'doremi'
PASS new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).elapsedTime is 123.45
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests the constructor for the WebKitAnimationEvent DOM class.");
// No initializer is passed.
shouldBe("new WebKitAnimationEvent('eventType').bubbles", "false");
shouldBe("new WebKitAnimationEvent('eventType').cancelable", "false");
shouldBeEqualToString("new WebKitAnimationEvent('eventType').animationName", "");
shouldBe("new WebKitAnimationEvent('eventType').elapsedTime", "0");
// bubbles is passed.
shouldBe("new WebKitAnimationEvent('eventType', { bubbles: false }).bubbles", "false");
shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true }).bubbles", "true");
// cancelable is passed.
shouldBe("new WebKitAnimationEvent('eventType', { cancelable: false }).cancelable", "false");
shouldBe("new WebKitAnimationEvent('eventType', { cancelable: true }).cancelable", "true");
// animationName is passed.
// Strings.
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: 'doremi' }).animationName", "doremi");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: '' }).animationName", "");
// Non-strings.
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: undefined }).animationName", "undefined");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: null }).animationName", "null");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: false }).animationName", "false");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: true }).animationName", "true");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: 12345 }).animationName", "12345");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: 18446744073709551615 }).animationName", "18446744073709552000");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: NaN }).animationName", "NaN");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: [] }).animationName", "");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: [1, 2, 3] }).animationName", "1,2,3");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: {doremi: 12345} }).animationName", "[object Object]");
shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: {valueOf: function () { return 'doremi'; } } }).animationName", "[object Object]");
// elapsedTime is passed.
// Numeric values.
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 0 }).elapsedTime", "0");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 123.45 }).elapsedTime", "123.45");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: -123.45 }).elapsedTime", "-123.45");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 18446744073709551615 }).elapsedTime", "18446744073709551615");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: NaN }).elapsedTime", "NaN");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: Infinity }).elapsedTime", "Infinity");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: -Infinity }).elapsedTime", "-Infinity");
// Non-numeric values.
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: undefined }).elapsedTime", "NaN");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: null }).elapsedTime", "0");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: false }).elapsedTime", "0");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: true }).elapsedTime", "1");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: '' }).elapsedTime", "0");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 'doremi' }).elapsedTime", "NaN");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: [] }).elapsedTime", "0");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: [123.45] }).elapsedTime", "123.45");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: [123.45, 678.90] }).elapsedTime", "NaN");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: {doremi: 123.45} }).elapsedTime", "NaN");
shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: {valueOf: function () { return 123.45 } } }).elapsedTime", "123.45");
// All initializers are passed.
shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).bubbles", "true");
shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).cancelable", "true");
shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).animationName", "'doremi'");
shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).elapsedTime", "123.45");
var successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -63,6 +63,9 @@ BUGPKASTING SKIP : animations/animation-api-1.html = TEXT
BUGWK60877 SKIP : loader/navigation-while-deferring-loads.html = FAIL
BUGWK60877 SKIP : loader/load-defer-resume-crash.html = FAIL
// This will soon be fixed after implementing a WebKitAnimationEvent constructor for V8.
BUGWK67825 : fast/events/constructors/webkit-animation-event-constructor.html = FAIL
// CSS3 Selectors3 test suite
BUGCR89468 : css3/selectors3 = PASS FAIL
......
2011-09-08 Kentaro Hara <haraken@google.com>
Implement a WebKitAnimationEvent constructor.
https://bugs.webkit.org/show_bug.cgi?id=67825
Reviewed by Sam Weinig.
There is no spec for the WebKitAnimationEvent constructor
since it is WebKit-specific. However, based on the current
IDL of initWebKitAnimationEvent(), the constructor IDL
should be as follows.
[Constructor(DOMString type, optional WebKitAnimationEventInit eventInitDict)]
interface WebKitAnimationEvent : Event {
...;
}
dictionary WebKitAnimationEventInit : EventInit {
DOMString animationName;
double elapsedTime;
}
Test: fast/events/constructors/webkit-animation-event-constructor.html
* bindings/generic/EventConstructors.h: Added a definition for the WebKitAnimationEvent constructor.
* bindings/js/JSEventConstructors.cpp: Added #includes for WebKitAnimationEvent.
* dom/WebKitAnimationEvent.cpp:
(WebCore::WebKitAnimationEventInit::WebKitAnimationEventInit):
(WebCore::WebKitAnimationEvent::WebKitAnimationEvent):
* dom/WebKitAnimationEvent.h: Added a definition for WebKitAnimationEventInit.
(WebCore::WebKitAnimationEvent::create):
* dom/WebKitAnimationEvent.idl: Makes WebKitAnimationEvent constructible.
2011-09-08 Abhishek Arya <inferno@chromium.org>
:before content rendering issues with list markers and run-ins.
......@@ -51,11 +51,20 @@ namespace WebCore {
FILL_PROPERTY(total) \
DICTIONARY_END(ProgressEvent)
#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_WEBKIT_ANIMATION_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
\
DICTIONARY_START(WebKitAnimationEvent) \
FILL_PARENT_PROPERTIES(Event) \
FILL_PROPERTY(animationName) \
FILL_PROPERTY(elapsedTime) \
DICTIONARY_END(WebKitAnimationEvent)
#define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_WEBKIT_ANIMATION_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
} // namespace WebCore
......
......@@ -32,7 +32,9 @@
#include "JSDictionary.h"
#include "JSEvent.h"
#include "JSProgressEvent.h"
#include "JSWebKitAnimationEvent.h"
#include "ProgressEvent.h"
#include "WebKitAnimationEvent.h"
#include <runtime/Error.h>
using namespace JSC;
......
......@@ -30,11 +30,24 @@
namespace WebCore {
WebKitAnimationEventInit::WebKitAnimationEventInit()
: animationName()
, elapsedTime(0.0)
{
}
WebKitAnimationEvent::WebKitAnimationEvent()
: m_elapsedTime(0.0)
{
}
WebKitAnimationEvent::WebKitAnimationEvent(const AtomicString& type, const WebKitAnimationEventInit& initializer)
: Event(type, initializer)
, m_animationName(initializer.animationName)
, m_elapsedTime(initializer.elapsedTime)
{
}
WebKitAnimationEvent::WebKitAnimationEvent(const AtomicString& type, const String& animationName, double elapsedTime)
: Event(type, true, true)
, m_animationName(animationName)
......
......@@ -29,39 +29,51 @@
#include "Event.h"
namespace WebCore {
class WebKitAnimationEvent : public Event {
public:
static PassRefPtr<WebKitAnimationEvent> create()
{
return adoptRef(new WebKitAnimationEvent);
}
static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
{
return adoptRef(new WebKitAnimationEvent(type, animationName, elapsedTime));
}
virtual ~WebKitAnimationEvent();
void initWebKitAnimationEvent(const AtomicString& type,
bool canBubbleArg,
bool cancelableArg,
const String& animationName,
double elapsedTime);
const String& animationName() const;
double elapsedTime() const;
virtual bool isWebKitAnimationEvent() const { return true; }
private:
WebKitAnimationEvent();
WebKitAnimationEvent(const AtomicString& type, const String& animationName, double elapsedTime);
struct WebKitAnimationEventInit : public EventInit {
WebKitAnimationEventInit();
String animationName;
double elapsedTime;
};
class WebKitAnimationEvent : public Event {
public:
static PassRefPtr<WebKitAnimationEvent> create()
{
return adoptRef(new WebKitAnimationEvent);
}
static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
{
return adoptRef(new WebKitAnimationEvent(type, animationName, elapsedTime));
}
static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const WebKitAnimationEventInit& initializer)
{
return adoptRef(new WebKitAnimationEvent(type, initializer));
}
virtual ~WebKitAnimationEvent();
void initWebKitAnimationEvent(const AtomicString& type,
bool canBubbleArg,
bool cancelableArg,
const String& animationName,
double elapsedTime);
const String& animationName() const;
double elapsedTime() const;
virtual bool isWebKitAnimationEvent() const { return true; }
private:
WebKitAnimationEvent();
WebKitAnimationEvent(const AtomicString& type, const String& animationName, double elapsedTime);
WebKitAnimationEvent(const AtomicString&, const WebKitAnimationEventInit&);
String m_animationName;
double m_elapsedTime;
};
String m_animationName;
double m_elapsedTime;
};
} // namespace WebCore
#endif // WebKitAnimationEvent_h
......@@ -25,7 +25,10 @@
module events {
interface WebKitAnimationEvent : Event {
interface [
CanBeConstructed,
CustomConstructFunction
] WebKitAnimationEvent : Event {
readonly attribute DOMString animationName;
readonly attribute double elapsedTime;
void initWebKitAnimationEvent(in [Optional=CallWithDefaultValue] DOMString typeArg,
......
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