2010-07-14 Marcus Bulach <bulach@chromium.org>
authorbulach@chromium.org <bulach@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Aug 2010 09:41:14 +0000 (09:41 +0000)
committerbulach@chromium.org <bulach@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Aug 2010 09:41:14 +0000 (09:41 +0000)
        Reviewed by darin@apple.com.

        Removes DontCheckEnums from some IDLs and fixes the corresponding enums.
        https://bugs.webkit.org/show_bug.cgi?id=42278

        This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=42250: it fixes some IDL/.h and enables generating compile-time checks for enums.

        * fast/events/init-events-expected.txt:
        * fast/events/script-tests/init-events.js:
        (createEventHelper): splits event creation so that we can test without init.
        (testInitEvent): adds test for OverflowEvent creation.
2010-07-14  Marcus Bulach  <bulach@chromium.org>

        Reviewed by darin@apple.com.

        Removes DontCheckEnums from some IDLs and fixes the corresponding enums.
        https://bugs.webkit.org/show_bug.cgi?id=42278

        This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=42250: it fixes some IDL/.h and enables generating compile-time checks for enums.

        Tests: idls should generate valid code.

        * dom/Node.h:
        (WebCore::Node::):
        * dom/Node.idl:
        * dom/OverflowEvent.h:
        (WebCore::OverflowEvent::):
        * dom/OverflowEvent.idl:
        * html/FileReader.cpp:
        (WebCore::FileReader::readyState):
        * html/FileReader.h:
        (WebCore::FileReader::):
        * html/FileReader.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65226 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/init-events-expected.txt
LayoutTests/fast/events/overflow-events.html
LayoutTests/fast/events/script-tests/init-events.js
WebCore/ChangeLog
WebCore/dom/Node.h
WebCore/dom/Node.idl
WebCore/dom/OverflowEvent.h
WebCore/dom/OverflowEvent.idl
WebCore/html/FileReader.cpp
WebCore/html/FileReader.h
WebCore/html/FileReader.idl

index e354c2d..0d64c39 100644 (file)
@@ -1,3 +1,17 @@
+2010-07-14  Marcus Bulach  <bulach@chromium.org>
+
+        Reviewed by darin@apple.com.
+
+        Removes DontCheckEnums from some IDLs and fixes the corresponding enums.
+        https://bugs.webkit.org/show_bug.cgi?id=42278
+
+        This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=42250: it fixes some IDL/.h and enables generating compile-time checks for enums.
+
+        * fast/events/init-events-expected.txt:
+        * fast/events/script-tests/init-events.js:
+        (createEventHelper): splits event creation so that we can test without init.
+        (testInitEvent): adds test for OverflowEvent creation.
+
 2010-08-12  Philippe Normand  <pnormand@igalia.com>
 
         Reviewed by Martin Robinson.
index 82e2ba9..59fa9e5 100644 (file)
@@ -116,6 +116,7 @@ PASS testInitEvent('Overflow', '1001, false, false').horizontalOverflow is false
 PASS testInitEvent('Overflow', '1001, true, false').horizontalOverflow is true
 PASS testInitEvent('Overflow', '1001, false, false').verticalOverflow is false
 PASS testInitEvent('Overflow', '1001, false, true').verticalOverflow is true
+PASS createEventHelper('Overflow').orient is OverflowEvent.VERTICAL
 PASS testInitEvent('Progress', '"a", false, false, false, 1001, 1002').type is 'a'
 PASS testInitEvent('Progress', 'null, false, false, false, 1001, 1002').type is 'null'
 PASS testInitEvent('Progress', '"a", false, false, false, 1001, 1002').bubbles is false
index acc480b..6a5952f 100644 (file)
@@ -1,80 +1,79 @@
 <html>
 <head>
-       <script>
-               function overflowChanged(event) {
-                   var result = [event.orient, event.horizontalOverflow, event.verticalOverflow];
+  <script>
+    function overflowChanged(event) {
+        var result = [event.orient, event.horizontalOverflow, event.verticalOverflow];
 
-            if ('' + result == testResults[currentTest++])
-                numSuccessful ++;
-            
-            if (testResults.length == numSuccessful)
-                document.getElementById('result').innerHTML = "SUCCESS";
-               }
-               
-               function forceLayout() {
-                       document.body.offsetTop;                    
-               }
-               
-               function runTest() {
-                   if (window.layoutTestController)
-                       layoutTestController.dumpAsText();
-                       
-                   testResults = [[1, true, false],
-                                  [1, false, false],
-                                  [0, false, true],
-                                  [0, false, false],
-                                  [2, true, true],
-                                  [2, false, false],
-                                  [0, false, true],
-                                  [2, true, false],                            
-                                  [2, false, true]];
-                                  
-                   currentTest = 0;
-                   numSuccessful = 0;
-                   
-                       var c = document.getElementById('container');
-                       c.addEventListener('overflowchanged', overflowChanged, false);
-                       
-                       forceLayout();
-                       document.getElementById('child').style.width='200px';
+        if ('' + result == testResults[currentTest++])
+            numSuccessful ++;
+        if (testResults.length == numSuccessful)
+            document.getElementById('result').innerHTML = "SUCCESS";
+    }
 
-                       forceLayout();
-                       document.getElementById('child').style.width='50px';
-                       forceLayout();
+    function forceLayout() {
+        document.body.offsetTop;
+    }
 
-                       document.getElementById('child').style.height='200px';
-                       forceLayout();
-                       document.getElementById('child').style.height='50px';
-                       forceLayout();
+    function runTest() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
 
-            forceLayout();
-                       document.getElementById('child').style.width='200px';
-                       document.getElementById('child').style.height='200px';
-                       forceLayout();
+        testResults = [[OverflowEvent.HORIZONTAL, true, false],
+                       [OverflowEvent.HORIZONTAL, false, false],
+                       [OverflowEvent.VERTICAL, false, true],
+                       [OverflowEvent.VERTICAL, false, false],
+                       [OverflowEvent.BOTH, true, true],
+                       [OverflowEvent.BOTH, false, false],
+                       [OverflowEvent.VERTICAL, false, true],
+                       [OverflowEvent.BOTH, true, false],
+                       [OverflowEvent.BOTH, false, true]];
 
-                       document.getElementById('child').style.width='50px';
-                       document.getElementById('child').style.height='50px';
-                       forceLayout();          
+        currentTest = 0;
+        numSuccessful = 0;
 
-                       document.getElementById('child').style.height='200px';
-                       forceLayout();          
+        var c = document.getElementById('container');
+        c.addEventListener('overflowchanged', overflowChanged, false);
 
-                       document.getElementById('child').style.width='200px';
-                       document.getElementById('child').style.height='50px';
-                       forceLayout();          
+        forceLayout();
+        document.getElementById('child').style.width='200px';
 
-                       document.getElementById('child').style.width='50px';
-                       document.getElementById('child').style.height='200px';
-                       forceLayout();          
+        forceLayout();
+        document.getElementById('child').style.width='50px';
+        forceLayout();
 
-               }
-       </script>
+        document.getElementById('child').style.height='200px';
+        forceLayout();
+        document.getElementById('child').style.height='50px';
+        forceLayout();
+
+        forceLayout();
+        document.getElementById('child').style.width='200px';
+        document.getElementById('child').style.height='200px';
+        forceLayout();
+
+        document.getElementById('child').style.width='50px';
+        document.getElementById('child').style.height='50px';
+        forceLayout();
+
+        document.getElementById('child').style.height='200px';
+        forceLayout();
+
+        document.getElementById('child').style.width='200px';
+        document.getElementById('child').style.height='50px';
+        forceLayout();
+
+        document.getElementById('child').style.width='50px';
+        document.getElementById('child').style.height='200px';
+        forceLayout();
+
+    }
+  </script>
 </head>
 <body onload="runTest()">
-       <div id="container" style="width:100; height:100px; border: solid red 2px; overflow: hidden">
-               <div id="child" style="margin-top: 30px; margin-left: 30px; width:50px; height:50px; border: solid blue 2px;"></div>
-       </div>
-       This tests that overflowchanged events are fired correctly. If the test is successful, the text "SUCCESS" should be shown below.
-       <div id="result">FAILURE</div>
+    <div id="container" style="width:100; height:100px; border: solid red 2px; overflow: hidden">
+        <div id="child" style="margin-top: 30px; margin-left: 30px; width:50px; height:50px; border: solid blue 2px;"></div>
+    </div>
+    This tests that overflowchanged events are fired correctly. If the test is successful, the text "SUCCESS" should be shown below.
+    <div id="result">FAILURE</div>
 </body>
 </html>
index 0a32407..3382856 100644 (file)
@@ -1,8 +1,14 @@
 description("This tests the init functions for all the event DOM classes that have them.");
 
-function testInitEvent(prefix, argumentString)
+function createEventHelper(prefix)
 {
     var event = document.createEvent(prefix + "Event");
+    return event;
+}
+
+function testInitEvent(prefix, argumentString)
+{
+    var event = createEventHelper(prefix);
     var initExpression = "event.init" + prefix + "Event(" + argumentString + ")";
     eval(initExpression);
     return event;
@@ -133,6 +139,7 @@ shouldBe("testInitEvent('Overflow', '1001, false, false').horizontalOverflow", "
 shouldBe("testInitEvent('Overflow', '1001, true, false').horizontalOverflow", "true");
 shouldBe("testInitEvent('Overflow', '1001, false, false').verticalOverflow", "false");
 shouldBe("testInitEvent('Overflow', '1001, false, true').verticalOverflow", "true");
+shouldBe("createEventHelper('Overflow').orient", "OverflowEvent.VERTICAL");
 
 shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').type", "'a'");
 shouldBe("testInitEvent('Progress', 'null, false, false, false, 1001, 1002').type", "'null'");
index 0c13fa2..61fb74e 100644 (file)
@@ -1,3 +1,26 @@
+2010-07-14  Marcus Bulach  <bulach@chromium.org>
+
+        Reviewed by darin@apple.com.
+
+        Removes DontCheckEnums from some IDLs and fixes the corresponding enums.
+        https://bugs.webkit.org/show_bug.cgi?id=42278
+
+        This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=42250: it fixes some IDL/.h and enables generating compile-time checks for enums.
+
+        Tests: idls should generate valid code.
+
+        * dom/Node.h:
+        (WebCore::Node::):
+        * dom/Node.idl:
+        * dom/OverflowEvent.h:
+        (WebCore::OverflowEvent::):
+        * dom/OverflowEvent.idl:
+        * html/FileReader.cpp:
+        (WebCore::FileReader::readyState):
+        * html/FileReader.h:
+        (WebCore::FileReader::):
+        * html/FileReader.idl:
+
 2010-08-12  Alejandro G. Castro  <alex@igalia.com>
 
         Reviewed by David Levin.
index b808ad7..3f3184d 100644 (file)
@@ -86,14 +86,6 @@ enum StyleChangeType {
     SyntheticStyleChange = 3 << nodeStyleChangeShift
 };
 
-const unsigned short DOCUMENT_POSITION_EQUIVALENT = 0x00;
-const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
-const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
-const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
-const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
-const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
-const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
-
 // this class implements nodes, which can have a parent but no children:
 class Node : public EventTarget, public TreeShared<Node>, public ScriptWrappable {
     friend class Document;
@@ -113,7 +105,16 @@ public:
         NOTATION_NODE = 12,
         XPATH_NAMESPACE_NODE = 13
     };
-    
+    enum DocumentPosition {
+        DOCUMENT_POSITION_EQUIVALENT = 0x00,
+        DOCUMENT_POSITION_DISCONNECTED = 0x01,
+        DOCUMENT_POSITION_PRECEDING = 0x02,
+        DOCUMENT_POSITION_FOLLOWING = 0x04,
+        DOCUMENT_POSITION_CONTAINS = 0x08,
+        DOCUMENT_POSITION_CONTAINED_BY = 0x10,
+        DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20,
+    };
+
     static bool isSupported(const String& feature, const String& version);
 
     static void startIgnoringLeaks();
index e15b210..07046d1 100644 (file)
@@ -28,8 +28,7 @@ module core {
         EventTarget,
         GenerateNativeConverter,
         InlineGetOwnPropertySlot,
-        Polymorphic,
-        DontCheckEnums
+        Polymorphic
     ] Node
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
         : Object, EventTarget
index 9fd0ea1..f1cd2f3 100644 (file)
@@ -33,8 +33,8 @@ namespace WebCore {
     class OverflowEvent : public Event {
     public:
         enum orientType {
-            VERTICAL   = 0,
-            HORIZONTAL = 1,
+            HORIZONTAL = 0,
+            VERTICAL   = 1,
             BOTH       = 2
         };
 
index 74cf56b..0c1fd50 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 module events {
-    // FIXME: Converge these consts and OverflowEvent::orientType values and remove DontCheckEnums attribute.
-    interface [DontCheckEnums] OverflowEvent : Event {
+    interface OverflowEvent : Event {
         const unsigned short HORIZONTAL = 0;
         const unsigned short VERTICAL   = 1;
         const unsigned short BOTH       = 2;
index 88f218f..6e568ec 100644 (file)
@@ -240,15 +240,15 @@ FileReader::ReadyState FileReader::readyState() const
     switch (m_state) {
     case None:
     case Starting:
-        return Empty;
+        return EMPTY;
     case Opening:
     case Reading:
-        return Loading;
+        return LOADING;
     case Completed:
-        return Done;
+        return DONE;
     }
     ASSERT_NOT_REACHED();
-    return Empty;
+    return EMPTY;
 }
 
 const ScriptString& FileReader::result()
index a5339a9..7952468 100644 (file)
@@ -63,9 +63,9 @@ public:
     virtual ~FileReader();
 
     enum ReadyState {
-        Empty = 0,
-        Loading = 1,
-        Done = 2
+        EMPTY = 0,
+        LOADING = 1,
+        DONE = 2
     };
 
     void readAsBinaryString(Blob*);
index fb3b979..b36e9d3 100644 (file)
@@ -34,8 +34,7 @@ module html {
         CanBeConstructed,
         CallWith=ScriptExecutionContext,
         EventTarget,
-        NoStaticTables,
-        DontCheckEnums
+        NoStaticTables
     ] FileReader {
         // ready states
         const unsigned short EMPTY = 0;