Bug 20571

Summary: Window object missing Animation/Transition event setter
Product: WebKit Reporter: Dean Jackson <dino>
Component: DOMAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 20361, 20572    
Attachments:
Description Flags
patch with testcases sam: review+

Description Dean Jackson 2008-08-29 19:02:57 PDT
When I landed Transition events I forgot to put a setter for the attributes on the Window object.
Comment 1 Dean Jackson 2008-08-29 19:07:07 PDT
Created attachment 23078 [details]
patch with testcases

This patch also includes a code cleanup since a lot of this file violated the coding guidelines and hence offended my eyes. Check the next comment for the "real" patch.

Also, not all the tests included here are directly relevant to the fix in the patch, but are the tests that should have been landed with the events in the first place.

Lastly, there is an outstanding bug that makes using window pretty annoying. The event dispatch code only fires a transition event if the document was notified of a listener. If you attach only to Window then the Document doesn't know, and hence nothing happens. I'll file a separate bug on that. The workaround is to attach a transition event listener anywhere on the document (even if it isn't in the right place and is empty).
Comment 2 Dean Jackson 2008-08-29 19:07:42 PDT
Here is the real meat of the patch (without coding style fixes):

diff --git a/WebCore/bindings/js/JSDOMWindowBase.cpp b/WebCore/bindings/js/JSDOMWindowBase.cpp
index 60ac671..7c3e4b2 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -749,6 +761,22 @@ void JSDOMWindowBase::put(ExecState* exec, const Identifier& propertyName, JSVal
       if (allowsAccessFrom(exec))
         setListener(exec, unloadEvent, value);
       return;
+    case OnWebKitAnimationStart:
+      if (allowsAccessFrom(exec))
+        setListener(exec, webkitAnimationStartEvent, value);
+       return;
+    case OnWebKitAnimationIteration:
+      if (allowsAccessFrom(exec))
+        setListener(exec, webkitAnimationIterationEvent, value);
+      return;
+    case OnWebKitAnimationEnd:
+      if (allowsAccessFrom(exec))
+        setListener(exec, webkitAnimationEndEvent, value);
+      return;
+    case OnWebKitTransitionEnd:
+      if (allowsAccessFrom(exec))
+        setListener(exec, webkitTransitionEndEvent, value);
+      return;
     default:



Comment 3 Darin Adler 2008-08-30 19:15:14 PDT
Comment on attachment 23078 [details]
patch with testcases

It'd be better to clean up the whitespace in a separate check-in first.
Comment 4 Sam Weinig 2008-08-31 19:35:56 PDT
Comment on attachment 23078 [details]
patch with testcases

In general, we prefer if the test cases JS try and match our coding styles, but it is just something to think about in the future.
Comment 5 Dean Jackson 2008-09-01 16:06:52 PDT
Code cleanup commit

Committed r36020
	M	WebCore/bindings/js/JSDOMWindowBase.cpp
	M	WebCore/ChangeLog

Comment 6 Dean Jackson 2008-09-01 16:34:37 PDT
Committed r36021
	M	WebCore/bindings/js/JSDOMWindowBase.cpp
	M	WebCore/ChangeLog
	M	LayoutTests/ChangeLog
	A	LayoutTests/transitions/transition-end-event-all-properties.html
	A	LayoutTests/transitions/transition-end-event-left-expected.txt
	A	LayoutTests/transitions/transition-end-event-window.html
	A	LayoutTests/transitions/transition-end-event-multiple-01.html
	A	LayoutTests/transitions/transition-end-event-multiple-02.html
	A	LayoutTests/transitions/transition-end-event-transform.html
	A	LayoutTests/transitions/transition-end-event-multiple-03.html
	A	LayoutTests/transitions/transition-end-event-multiple-04.html
	A	LayoutTests/transitions/transition-end-event-all-properties-expected.txt
	A	LayoutTests/transitions/transition-end-event-window-expected.txt
	A	LayoutTests/transitions/end-event-helpers.js
	A	LayoutTests/transitions/transition-end-event-container.html
	A	LayoutTests/transitions/transition-end-event-nested.html
	A	LayoutTests/transitions/transition-end-event-multiple-01-expected.txt
	A	LayoutTests/transitions/transition-end-event-multiple-02-expected.txt
	A	LayoutTests/transitions/transition-end-event-multiple-03-expected.txt
	A	LayoutTests/transitions/transition-end-event-transform-expected.txt
	A	LayoutTests/transitions/transition-end-event-attributes.html
	A	LayoutTests/transitions/transition-end-event-multiple-04-expected.txt
	A	LayoutTests/transitions/transition-end-event-left.html
	A	LayoutTests/transitions/transition-end-event-container-expected.txt
	A	LayoutTests/transitions/transition-end-event-nested-expected.txt
	A	LayoutTests/transitions/transition-end-event-attributes-expected.txt