Title: [101183] trunk
Revision
101183
Author
hara...@chromium.org
Date
2011-11-25 15:34:42 -0800 (Fri, 25 Nov 2011)

Log Message

Implement the WebGLContextEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=72856

Reviewed by Adam Barth.

Source/WebCore:

This patch makes WebGLContextEvent constructable.
The spec: http://www.khronos.org/registry/webgl/specs/latest/#5.14

Test: fast/events/constructors/webgl-context-event-constructor.html

* html/canvas/WebGLContextEvent.cpp: Added an implementation of the WebGLContextEvent constructor.
(WebCore::WebGLContextEventInit::WebGLContextEventInit):
(WebCore::WebGLContextEvent::WebGLContextEvent):
* html/canvas/WebGLContextEvent.h: Added a definition of WebGLContextEventInit.
(WebCore::WebGLContextEvent::create):
* html/canvas/WebGLContextEvent.idl: Added [ConstructorTemplate=Event] IDL.

LayoutTests:

webgl-context-event-constructor.html checks the behavior of the WebGLContextEvent constructor.

* fast/dom/constructed-objects-prototypes-expected.txt: Added window.WebGLContextEvent.
* fast/events/constructors/webgl-context-event-constructor-expected.txt: Added.
* fast/events/constructors/webgl-context-event-constructor.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101182 => 101183)


--- trunk/LayoutTests/ChangeLog	2011-11-25 22:59:57 UTC (rev 101182)
+++ trunk/LayoutTests/ChangeLog	2011-11-25 23:34:42 UTC (rev 101183)
@@ -1,3 +1,16 @@
+2011-11-25  Kentaro Hara  <hara...@chromium.org>
+
+        Implement the WebGLContextEvent constructor
+        https://bugs.webkit.org/show_bug.cgi?id=72856
+
+        Reviewed by Adam Barth.
+
+        webgl-context-event-constructor.html checks the behavior of the WebGLContextEvent constructor.
+
+        * fast/dom/constructed-objects-prototypes-expected.txt: Added window.WebGLContextEvent.
+        * fast/events/constructors/webgl-context-event-constructor-expected.txt: Added.
+        * fast/events/constructors/webgl-context-event-constructor.html: Added.
+
 2011-11-25  Ryosuke Niwa  <rn...@webkit.org>
 
         Add missing results for Mac after r100949 and r100036.

Modified: trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt (101182 => 101183)


--- trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt	2011-11-25 22:59:57 UTC (rev 101182)
+++ trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt	2011-11-25 23:34:42 UTC (rev 101183)
@@ -39,6 +39,8 @@
 PASS (new inner.PopStateEvent()).constructor.isInner is true
 PASS (new inner.ProgressEvent()).isInner is true
 PASS (new inner.ProgressEvent()).constructor.isInner is true
+PASS (new inner.WebGLContextEvent()).isInner is true
+PASS (new inner.WebGLContextEvent()).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

Added: trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt (0 => 101183)


--- trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt	2011-11-25 23:34:42 UTC (rev 101183)
@@ -0,0 +1,32 @@
+This tests the constructor for the WebGLContextEvent DOM class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new WebGLContextEvent('eventType').bubbles is false
+PASS new WebGLContextEvent('eventType').cancelable is false
+PASS new WebGLContextEvent('eventType').statusMessage is ""
+PASS new WebGLContextEvent('eventType', { bubbles: false }).bubbles is false
+PASS new WebGLContextEvent('eventType', { bubbles: true }).bubbles is true
+PASS new WebGLContextEvent('eventType', { cancelable: false }).cancelable is false
+PASS new WebGLContextEvent('eventType', { cancelable: true }).cancelable is true
+PASS new WebGLContextEvent('eventType', { statusMessage: 'abcde' }).statusMessage is "abcde"
+PASS new WebGLContextEvent('eventType', { statusMessage: '' }).statusMessage is ""
+PASS new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage is "undefined"
+PASS new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage is "null"
+PASS new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage is "false"
+PASS new WebGLContextEvent('eventType', { statusMessage: true }).statusMessage is "true"
+PASS new WebGLContextEvent('eventType', { statusMessage: 12345 }).statusMessage is "12345"
+PASS new WebGLContextEvent('eventType', { statusMessage: 18446744073709551615 }).statusMessage is "18446744073709552000"
+PASS new WebGLContextEvent('eventType', { statusMessage: NaN }).statusMessage is "NaN"
+PASS new WebGLContextEvent('eventType', { statusMessage: [] }).statusMessage is ""
+PASS new WebGLContextEvent('eventType', { statusMessage: [1, 2, 3] }).statusMessage is "1,2,3"
+PASS new WebGLContextEvent('eventType', { statusMessage: {abcde: 12345} }).statusMessage is "[object Object]"
+PASS new WebGLContextEvent('eventType', { statusMessage: {valueOf: function () { return 'abcde'; } } }).statusMessage is "[object Object]"
+PASS new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).bubbles is true
+PASS new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).cancelable is true
+PASS new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).statusMessage is 'abcde'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html (0 => 101183)


--- trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html	2011-11-25 23:34:42 UTC (rev 101183)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("This tests the constructor for the WebGLContextEvent DOM class.");
+
+// No initializer is passed.
+shouldBe("new WebGLContextEvent('eventType').bubbles", "false");
+shouldBe("new WebGLContextEvent('eventType').cancelable", "false");
+shouldBeEqualToString("new WebGLContextEvent('eventType').statusMessage", "");
+
+// bubbles is passed.
+shouldBe("new WebGLContextEvent('eventType', { bubbles: false }).bubbles", "false");
+shouldBe("new WebGLContextEvent('eventType', { bubbles: true }).bubbles", "true");
+
+// cancelable is passed.
+shouldBe("new WebGLContextEvent('eventType', { cancelable: false }).cancelable", "false");
+shouldBe("new WebGLContextEvent('eventType', { cancelable: true }).cancelable", "true");
+
+// statusMessage is passed.
+// Strings.
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: 'abcde' }).statusMessage", "abcde");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: '' }).statusMessage", "");
+
+// Non-strings.
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage", "undefined");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage", "null");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage", "false");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: true }).statusMessage", "true");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: 12345 }).statusMessage", "12345");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: 18446744073709551615 }).statusMessage", "18446744073709552000");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: NaN }).statusMessage", "NaN");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: [] }).statusMessage", "");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: [1, 2, 3] }).statusMessage", "1,2,3");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: {abcde: 12345} }).statusMessage", "[object Object]");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: {valueOf: function () { return 'abcde'; } } }).statusMessage", "[object Object]");
+
+// All initializers are passed.
+shouldBe("new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).bubbles", "true");
+shouldBe("new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).cancelable", "true");
+shouldBe("new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).statusMessage", "'abcde'");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (101182 => 101183)


--- trunk/Source/WebCore/ChangeLog	2011-11-25 22:59:57 UTC (rev 101182)
+++ trunk/Source/WebCore/ChangeLog	2011-11-25 23:34:42 UTC (rev 101183)
@@ -1,3 +1,22 @@
+2011-11-25  Kentaro Hara  <hara...@chromium.org>
+
+        Implement the WebGLContextEvent constructor
+        https://bugs.webkit.org/show_bug.cgi?id=72856
+
+        Reviewed by Adam Barth.
+
+        This patch makes WebGLContextEvent constructable.
+        The spec: http://www.khronos.org/registry/webgl/specs/latest/#5.14
+
+        Test: fast/events/constructors/webgl-context-event-constructor.html
+
+        * html/canvas/WebGLContextEvent.cpp: Added an implementation of the WebGLContextEvent constructor.
+        (WebCore::WebGLContextEventInit::WebGLContextEventInit):
+        (WebCore::WebGLContextEvent::WebGLContextEvent):
+        * html/canvas/WebGLContextEvent.h: Added a definition of WebGLContextEventInit.
+        (WebCore::WebGLContextEvent::create):
+        * html/canvas/WebGLContextEvent.idl: Added [ConstructorTemplate=Event] IDL.
+
 2011-11-25  Jeff Timanus  <t...@chromium.org>
 
         [Chromium] The DrawingBuffer::bind method was incorrectly resetting the

Modified: trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp (101182 => 101183)


--- trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp	2011-11-25 22:59:57 UTC (rev 101182)
+++ trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp	2011-11-25 23:34:42 UTC (rev 101183)
@@ -30,6 +30,10 @@
 
 namespace WebCore {
 
+WebGLContextEventInit::WebGLContextEventInit()
+{
+}
+
 WebGLContextEvent::WebGLContextEvent()
 {
 }
@@ -40,6 +44,12 @@
 {
 }
 
+WebGLContextEvent::WebGLContextEvent(const AtomicString& type, const WebGLContextEventInit& initializer)
+    : Event(type, initializer)
+    , m_statusMessage(initializer.statusMessage)
+{
+}
+
 WebGLContextEvent::~WebGLContextEvent()
 {
 }

Modified: trunk/Source/WebCore/html/canvas/WebGLContextEvent.h (101182 => 101183)


--- trunk/Source/WebCore/html/canvas/WebGLContextEvent.h	2011-11-25 22:59:57 UTC (rev 101182)
+++ trunk/Source/WebCore/html/canvas/WebGLContextEvent.h	2011-11-25 23:34:42 UTC (rev 101183)
@@ -30,6 +30,12 @@
 
 namespace WebCore {
 
+struct WebGLContextEventInit : public EventInit {
+    WebGLContextEventInit();
+
+    String statusMessage;
+};
+
 class WebGLContextEvent : public Event {
 public:
     static PassRefPtr<WebGLContextEvent> create()
@@ -40,6 +46,10 @@
     {
         return adoptRef(new WebGLContextEvent(type, canBubble, cancelable, statusMessage));
     }
+    static PassRefPtr<WebGLContextEvent> create(const AtomicString& type, const WebGLContextEventInit& initializer)
+    {
+        return adoptRef(new WebGLContextEvent(type, initializer));
+    }
     virtual ~WebGLContextEvent();
 
     const String& statusMessage() const { return m_statusMessage; }
@@ -49,6 +59,7 @@
 private:
     WebGLContextEvent();
     WebGLContextEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& statusMessage);
+    WebGLContextEvent(const AtomicString&, const WebGLContextEventInit&);
 
     String m_statusMessage;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl (101182 => 101183)


--- trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl	2011-11-25 22:59:57 UTC (rev 101182)
+++ trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl	2011-11-25 23:34:42 UTC (rev 101183)
@@ -24,9 +24,12 @@
  */
 
 module html {
+
     interface [
         Conditional=WEBGL,
+        ConstructorTemplate=Event
     ] WebGLContextEvent : Event {
-        readonly attribute DOMString statusMessage;
+        readonly attribute [InitializedByConstructor] DOMString statusMessage;
     };
+
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to