Title: [151896] trunk/Source/WebCore
Revision
151896
Author
[email protected]
Date
2013-06-24 00:58:35 -0700 (Mon, 24 Jun 2013)

Log Message

Move IDL implements statements to IDL files that implement the interface
https://bugs.webkit.org/show_bug.cgi?id=117921

Reviewed by Kentaro Hara.

Move IDL implements statements to IDL files that implement the interface
so that we can more easily know that a given IDL interface implements
another.

The generator now enforces this as well for consistency.

No new tests, covered by TestImplements.idl.

* bindings/scripts/preprocess-idls.pl:
(getImplementedInterfacesFromIDL):
* bindings/scripts/test/TestImplements.idl:
* bindings/scripts/test/TestInterface.idl:
* dom/CharacterData.idl:
* dom/ChildNode.idl:
* dom/DocumentType.idl:
* dom/Element.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151895 => 151896)


--- trunk/Source/WebCore/ChangeLog	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/ChangeLog	2013-06-24 07:58:35 UTC (rev 151896)
@@ -1,3 +1,27 @@
+2013-06-24  Christophe Dumez  <[email protected]>
+
+        Move IDL implements statements to IDL files that implement the interface
+        https://bugs.webkit.org/show_bug.cgi?id=117921
+
+        Reviewed by Kentaro Hara.
+
+        Move IDL implements statements to IDL files that implement the interface
+        so that we can more easily know that a given IDL interface implements
+        another.
+
+        The generator now enforces this as well for consistency.
+
+        No new tests, covered by TestImplements.idl.
+
+        * bindings/scripts/preprocess-idls.pl:
+        (getImplementedInterfacesFromIDL):
+        * bindings/scripts/test/TestImplements.idl:
+        * bindings/scripts/test/TestInterface.idl:
+        * dom/CharacterData.idl:
+        * dom/ChildNode.idl:
+        * dom/DocumentType.idl:
+        * dom/Element.idl:
+
 2013-06-24  Zalan Bujtas  <[email protected]>
 
         Hittest finds the truncated text instead of the floating input, when the input is clicked.

Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (151895 => 151896)


--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -51,15 +51,25 @@
 chomp(@idlFiles);
 close FH;
 
-# Parse all IDL files.
 my %interfaceNameToIdlFile;
 my %idlFileToInterfaceName;
 my %supplementalDependencies;
 my %supplementals;
 my $windowConstructorsCode = "";
 my $workerContextConstructorsCode = "";
+
 # Get rid of duplicates in idlFiles array.
 my %idlFileHash = map { $_, 1 } @idlFiles;
+
+# Populate $idlFileToInterfaceName and $interfaceNameToIdlFile.
+foreach my $idlFile (keys %idlFileHash) {
+    my $fullPath = Cwd::realpath($idlFile);
+    my $interfaceName = fileparse(basename($idlFile), ".idl");
+    $idlFileToInterfaceName{$fullPath} = $interfaceName;
+    $interfaceNameToIdlFile{$interfaceName} = $fullPath;
+}
+
+# Parse all IDL files.
 foreach my $idlFile (sort keys %idlFileHash) {
     my $fullPath = Cwd::realpath($idlFile);
     my $idlFileContents = getFileContents($fullPath);
@@ -71,12 +81,14 @@
     }
     my $interfaceName = fileparse(basename($idlFile), ".idl");
     # Handle implements statements.
-    my $implementers = getImplementersFromIDL($idlFileContents, $interfaceName);
-    foreach my $implementer (@{$implementers}) {
-        if ($supplementalDependencies{$fullPath}) {
-            push(@{$supplementalDependencies{$fullPath}}, $implementer);
+    my $implementedInterfaces = getImplementedInterfacesFromIDL($idlFileContents, $interfaceName);
+    foreach my $implementedInterface (@{$implementedInterfaces}) {
+        my $implementedIdlFile = $interfaceNameToIdlFile{$implementedInterface};
+        die "Could not find a the IDL file where the following implemented interface is defined: $implementedInterface" unless $implementedIdlFile;
+        if ($supplementalDependencies{$implementedIdlFile}) {
+            push(@{$supplementalDependencies{$implementedIdlFile}}, $interfaceName);
         } else {
-            $supplementalDependencies{$fullPath} = [$implementer];
+            $supplementalDependencies{$implementedIdlFile} = [$interfaceName];
         }
     }
     # Handle [NoInterfaceObject].
@@ -89,8 +101,6 @@
             $workerContextConstructorsCode .= $attributeCode unless $globalContext eq "WindowOnly"
         }
     }
-    $interfaceNameToIdlFile{$interfaceName} = $fullPath;
-    $idlFileToInterfaceName{$fullPath} = $interfaceName;
     $supplementals{$fullPath} = [];
 }
 
@@ -231,17 +241,17 @@
 
 # identifier-A implements identifier-B;
 # http://www.w3.org/TR/WebIDL/#idl-implements-statements
-sub getImplementersFromIDL
+sub getImplementedInterfacesFromIDL
 {
     my $fileContents = shift;
     my $interfaceName = shift;
 
-    my @implementers = ();
+    my @implementedInterfaces = ();
     while ($fileContents =~ /(\w+)\s+implements\s+(\w+)\s*;/gs) {
-        die "The identifier on the right side of the implements statement must be the current interface" if $2 ne $interfaceName;
-        push(@implementers, $1);
+        die "Identifier on the left of the 'implements' statement should be $interfaceName in $interfaceName.idl, but found $1" if $1 ne $interfaceName;
+        push(@implementedInterfaces, $2);
     }
-    return \@implementers
+    return \@implementedInterfaces
 }
 
 sub isCallbackInterfaceFromIDL

Modified: trunk/Source/WebCore/bindings/scripts/test/TestImplements.idl (151895 => 151896)


--- trunk/Source/WebCore/bindings/scripts/test/TestImplements.idl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/bindings/scripts/test/TestImplements.idl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -49,4 +49,3 @@
     [Reflect=CONST_IMPL] const unsigned short IMPLEMENTSCONSTANT2 = 2;
 };
 
-TestInterface implements TestImplements;

Modified: trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl (151895 => 151896)


--- trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -39,3 +39,6 @@
     ImplementationLacksVTable
 ] interface TestInterface {
 };
+
+TestInterface implements TestImplements;
+

Modified: trunk/Source/WebCore/dom/CharacterData.idl (151895 => 151896)


--- trunk/Source/WebCore/dom/CharacterData.idl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/dom/CharacterData.idl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -39,3 +39,5 @@
                                     [Default=Undefined] optional DOMString data);
 };
 
+CharacterData implements ChildNode;
+

Modified: trunk/Source/WebCore/dom/ChildNode.idl (151895 => 151896)


--- trunk/Source/WebCore/dom/ChildNode.idl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/dom/ChildNode.idl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -31,6 +31,3 @@
     [RaisesException] void remove();
 };
 
-DocumentType implements ChildNode;
-Element implements ChildNode;
-CharacterData implements ChildNode;

Modified: trunk/Source/WebCore/dom/DocumentType.idl (151895 => 151896)


--- trunk/Source/WebCore/dom/DocumentType.idl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/dom/DocumentType.idl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -34,3 +34,5 @@
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString internalSubset;        
 };
 
+DocumentType implements ChildNode;
+

Modified: trunk/Source/WebCore/dom/Element.idl (151895 => 151896)


--- trunk/Source/WebCore/dom/Element.idl	2013-06-24 07:52:11 UTC (rev 151895)
+++ trunk/Source/WebCore/dom/Element.idl	2013-06-24 07:58:35 UTC (rev 151896)
@@ -227,3 +227,5 @@
 #endif
 };
 
+Element implements ChildNode;
+
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to