Title: [140010] trunk
Revision
140010
Author
ale...@webkit.org
Date
2013-01-17 11:26:35 -0800 (Thu, 17 Jan 2013)

Log Message

Add ontransitionend attribute on HTML elements.
https://bugs.webkit.org/show_bug.cgi?id=107134

Reviewed by Simon Fraser.

Source/WebCore:

Add ontransitionend attribute on HTML elements to match the prefixed
attribute onwebkittransitionend. As it uses the same plumbing as a
regular event listener, it behaves the same which means that if
ontransitionend only is defined then only the code attached to this
attribute will be called, if only onwebkittransitionend is defined then
only the code attached to this attribute will be called and finally if
both attributes are defined then only the code attached to the
unprefixed attribute will be called.

Tests: transitions/transition-end-event-unprefixed-03.html
       transitions/transition-end-event-unprefixed-04.html

* html/HTMLAttributeNames.in:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseAttribute):
* page/DOMWindow.h:
(DOMWindow):
* page/DOMWindow.idl: only define the property if the unprefixing is
turn on.

LayoutTests:

Add tests to cover the new attribute. It also make sure that event if
we use the old attribute and the new one at the same time only the new
event handler will be called.

* transitions/transition-end-event-unprefixed-03-expected.txt: Added.
* transitions/transition-end-event-unprefixed-03.html: Added.
* transitions/transition-end-event-unprefixed-04-expected.txt: Added.
* transitions/transition-end-event-unprefixed-04.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140009 => 140010)


--- trunk/LayoutTests/ChangeLog	2013-01-17 19:25:58 UTC (rev 140009)
+++ trunk/LayoutTests/ChangeLog	2013-01-17 19:26:35 UTC (rev 140010)
@@ -1,3 +1,19 @@
+2013-01-17  Alexis Menard  <ale...@webkit.org>
+
+        Add ontransitionend attribute on HTML elements.
+        https://bugs.webkit.org/show_bug.cgi?id=107134
+
+        Reviewed by Simon Fraser.
+
+        Add tests to cover the new attribute. It also make sure that event if
+        we use the old attribute and the new one at the same time only the new
+        event handler will be called.
+
+        * transitions/transition-end-event-unprefixed-03-expected.txt: Added.
+        * transitions/transition-end-event-unprefixed-03.html: Added.
+        * transitions/transition-end-event-unprefixed-04-expected.txt: Added.
+        * transitions/transition-end-event-unprefixed-04.html: Added.
+
 2013-01-17  Andrei Bucur  <abu...@adobe.com>
 
         Widows and orphans test4 fails if isolated

Added: trunk/LayoutTests/transitions/transition-end-event-unprefixed-03-expected.txt (0 => 140010)


--- trunk/LayoutTests/transitions/transition-end-event-unprefixed-03-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-end-event-unprefixed-03-expected.txt	2013-01-17 19:26:35 UTC (rev 140010)
@@ -0,0 +1,4 @@
+Initiating a transition and catching the transition unprefixed event with the html attribute ontransitionend.
+
+PASS --- [Expected] Property: left Target: box1 Elapsed Time: 0.5
+

Added: trunk/LayoutTests/transitions/transition-end-event-unprefixed-03.html (0 => 140010)


--- trunk/LayoutTests/transitions/transition-end-event-unprefixed-03.html	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-end-event-unprefixed-03.html	2013-01-17 19:26:35 UTC (rev 140010)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+    .box {
+      position: relative;
+      left: 0;
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      background-color: blue;
+      transition-property: left;
+      transition-duration: 0.5s;
+      -webkit-transition-property: left;
+      -webkit-transition-duration: 0.5s;
+    }
+  </style>
+  <script src=""
+  <script type="text/_javascript_">
+
+    var expectedEndEvents = [
+      // [property-name, element-id, elapsed-time, listen]
+      ["left", "box1", 0.5, false]
+    ];
+
+    function setupTest()
+    {
+      var box = document.getElementById('box1');
+      box.style.left = '200px';
+    }
+
+    runTransitionTest(expectedEndEvents, setupTest);
+  </script>
+</head>
+<body>
+
+<p>Initiating a transition and catching the transition unprefixed event with the html attribute ontransitionend.</p>
+
+<div id="container">
+  <div id="box1" class="box" _ontransitionend_="recordTransitionEndEvent(event)" _onwebkittransitionend_="recordTransitionEndEvent(event)"></div>
+</div>
+
+<div id="result"></div>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/transitions/transition-end-event-unprefixed-04-expected.txt (0 => 140010)


--- trunk/LayoutTests/transitions/transition-end-event-unprefixed-04-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-end-event-unprefixed-04-expected.txt	2013-01-17 19:26:35 UTC (rev 140010)
@@ -0,0 +1,4 @@
+Initiating a transition and catching the transition unprefixed event with the html attribute ontransitionend.
+
+PASS --- [Expected] Property: left Target: box1 Elapsed Time: 0.5
+

Added: trunk/LayoutTests/transitions/transition-end-event-unprefixed-04.html (0 => 140010)


--- trunk/LayoutTests/transitions/transition-end-event-unprefixed-04.html	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-end-event-unprefixed-04.html	2013-01-17 19:26:35 UTC (rev 140010)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+    .box {
+      position: relative;
+      left: 0;
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      background-color: blue;
+      transition-property: left;
+      transition-duration: 0.5s;
+      -webkit-transition-property: left;
+      -webkit-transition-duration: 0.5s;
+    }
+  </style>
+  <script src=""
+  <script type="text/_javascript_">
+
+    var expectedEndEvents = [
+      // [property-name, element-id, elapsed-time, listen]
+      ["left", "box1", 0.5, false]
+    ];
+
+    function setupTest()
+    {
+      var box = document.getElementById('box1');
+      box.style.left = '200px';
+    }
+
+    runTransitionTest(expectedEndEvents, setupTest);
+  </script>
+</head>
+<body>
+
+<p>Initiating a transition and catching the transition unprefixed event with the html attribute ontransitionend.</p>
+
+<div id="container">
+  <div id="box1" class="box" _ontransitionend_="recordTransitionEndEvent(event)"></div>
+</div>
+
+<div id="result"></div>
+
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (140009 => 140010)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 19:25:58 UTC (rev 140009)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 19:26:35 UTC (rev 140010)
@@ -1,3 +1,30 @@
+2013-01-17  Alexis Menard  <ale...@webkit.org>
+
+        Add ontransitionend attribute on HTML elements.
+        https://bugs.webkit.org/show_bug.cgi?id=107134
+
+        Reviewed by Simon Fraser.
+
+        Add ontransitionend attribute on HTML elements to match the prefixed
+        attribute onwebkittransitionend. As it uses the same plumbing as a
+        regular event listener, it behaves the same which means that if
+        ontransitionend only is defined then only the code attached to this
+        attribute will be called, if only onwebkittransitionend is defined then
+        only the code attached to this attribute will be called and finally if
+        both attributes are defined then only the code attached to the
+        unprefixed attribute will be called.
+
+        Tests: transitions/transition-end-event-unprefixed-03.html
+               transitions/transition-end-event-unprefixed-04.html
+
+        * html/HTMLAttributeNames.in:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseAttribute):
+        * page/DOMWindow.h:
+        (DOMWindow):
+        * page/DOMWindow.idl: only define the property if the unprefixing is
+        turn on.
+
 2013-01-17  Andrei Bucur  <abu...@adobe.com>
 
         Widows and orphans test4 fails if isolated

Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (140009 => 140010)


--- trunk/Source/WebCore/html/HTMLAttributeNames.in	2013-01-17 19:25:58 UTC (rev 140009)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in	2013-01-17 19:26:35 UTC (rev 140010)
@@ -242,6 +242,7 @@
 ontouchmove
 ontouchend
 ontouchcancel
+ontransitionend
 onunload
 onvolumechange
 onwaiting

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (140009 => 140010)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2013-01-17 19:25:58 UTC (rev 140009)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2013-01-17 19:26:35 UTC (rev 140010)
@@ -312,6 +312,8 @@
         setAttributeEventListener(eventNames().webkitAnimationEndEvent, createAttributeEventListener(this, name, value));
     } else if (name == onwebkittransitionendAttr) {
         setAttributeEventListener(eventNames().webkitTransitionEndEvent, createAttributeEventListener(this, name, value));
+    } else if (name == ontransitionendAttr) {
+        setAttributeEventListener(eventNames().transitionendEvent, createAttributeEventListener(this, name, value));
     } else if (name == oninputAttr) {
         setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, name, value));
     } else if (name == oninvalidAttr) {

Modified: trunk/Source/WebCore/page/DOMWindow.h (140009 => 140010)


--- trunk/Source/WebCore/page/DOMWindow.h	2013-01-17 19:25:58 UTC (rev 140009)
+++ trunk/Source/WebCore/page/DOMWindow.h	2013-01-17 19:26:35 UTC (rev 140010)
@@ -349,6 +349,7 @@
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnimationIteration);
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd);
+        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(transitionend, transitionend);
 
         void captureEvents();
         void releaseEvents();

Modified: trunk/Source/WebCore/page/DOMWindow.idl (140009 => 140010)


--- trunk/Source/WebCore/page/DOMWindow.idl	2013-01-17 19:25:58 UTC (rev 140009)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2013-01-17 19:26:35 UTC (rev 140010)
@@ -297,6 +297,9 @@
     attribute EventListener onwebkitanimationiteration;
     attribute EventListener onwebkitanimationstart;
     attribute EventListener onwebkittransitionend;
+#if defined(ENABLE_CSS_TRANSFORMS_ANIMATIONS_TRANSITIONS_UNPREFIXED) && ENABLE_CSS_TRANSFORMS_ANIMATIONS_TRANSITIONS_UNPREFIXED
+    attribute EventListener ontransitionend;
+#endif
 #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
     attribute EventListener onorientationchange;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to