Title: [149679] trunk
Revision
149679
Author
rn...@webkit.org
Date
2013-05-07 10:42:17 -0700 (Tue, 07 May 2013)

Log Message

Add an 'isReadOnly' member to IDL parse tree structure
https://bugs.webkit.org/show_bug.cgi?id=115704

Reviewed by Kentaro Hara.

Source/WebCore: 

Add an 'isReadOnly' member to IDL parse tree structure by merging
https://chromium.googlesource.com/chromium/blink/+/d6add80ecd08bcd88a6ae0e1698d929830b3bd8b
and update Objective-C, C++, and GObject binding generators to use isReadOnly.

* bindings/scripts/CodeGeneratorCPP.pm:
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/CodeGeneratorGObject.pm:
(GetWriteableProperties):
(GenerateProperty):
(GenerateFunctions):
* bindings/scripts/CodeGeneratorJS.pm:
(IsReadonly):
* bindings/scripts/CodeGeneratorObjC.pm:
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/IDLParser.pm:
(parseAttributeRest):
(parseExceptionField):
(parseAttributeRestOld):

Tools: 

Use newly added isReadOnly attribute.

* WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
(_generateHeaderFile):
(_generateImplementationFile):
(_staticValuesGetterImplementation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149678 => 149679)


--- trunk/Source/WebCore/ChangeLog	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Source/WebCore/ChangeLog	2013-05-07 17:42:17 UTC (rev 149679)
@@ -1,3 +1,31 @@
+2013-05-06  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add an 'isReadOnly' member to IDL parse tree structure
+        https://bugs.webkit.org/show_bug.cgi?id=115704
+
+        Reviewed by Kentaro Hara.
+
+        Add an 'isReadOnly' member to IDL parse tree structure by merging
+        https://chromium.googlesource.com/chromium/blink/+/d6add80ecd08bcd88a6ae0e1698d929830b3bd8b
+        and update Objective-C, C++, and GObject binding generators to use isReadOnly.
+
+        * bindings/scripts/CodeGeneratorCPP.pm:
+        (GenerateHeader):
+        (GenerateImplementation):
+        * bindings/scripts/CodeGeneratorGObject.pm:
+        (GetWriteableProperties):
+        (GenerateProperty):
+        (GenerateFunctions):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (IsReadonly):
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        (GenerateHeader):
+        (GenerateImplementation):
+        * bindings/scripts/IDLParser.pm:
+        (parseAttributeRest):
+        (parseExceptionField):
+        (parseAttributeRestOld):
+
 2013-05-07  Darin Adler  <da...@apple.com>
 
         Use OwnPtr instead of deleteAllValues in SMILTimeContainer

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm (149678 => 149679)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm	2013-05-07 17:42:17 UTC (rev 149679)
@@ -439,7 +439,6 @@
             my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
             my $attributeName = $attribute->signature->name;
             my $attributeType = GetCPPType($attribute->signature->type, 0);
-            my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
             my $property = "";
             
             $property .= "#if ${attributeConditionalString}\n" if $attributeConditionalString;
@@ -455,7 +454,7 @@
 
             $property .= $declarationSuffix;
             push(@headerAttributes, $property);
-            if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) {
+            if (!$attribute->isReadOnly and !$attribute->signature->extendedAttributes->{"Replaceable"}) {
                 $property = "    void $setterName($attributeType)";
                 $property .= $declarationSuffix;
                 push(@headerAttributes, $property); 
@@ -696,7 +695,6 @@
 
             my $attributeName = $attribute->signature->name;
             my $attributeType = GetCPPType($attribute->signature->type, 0);
-            my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
             my $attributeIsNullable = $attribute->signature->isNullable;
 
             $attributeNames{$attributeName} = 1;
@@ -763,7 +761,7 @@
             push(@implContent, "}\n\n");
 
             # - SETTER
-            if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) {
+            if (!$attribute->isReadOnly and !$attribute->signature->extendedAttributes->{"Replaceable"}) {
                 # Exception handling
                 my $hasSetterException = @{$attribute->setterExceptions};
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (149678 => 149679)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2013-05-07 17:42:17 UTC (rev 149679)
@@ -386,7 +386,6 @@
     my @result = ();
 
     foreach my $property (@{$properties}) {
-        my $writeable = $property->type !~ /^readonly/;
         my $gtype = GetGValueTypeName($property->signature->type);
         my $hasGtypeSignature = ($gtype eq "boolean" || $gtype eq "float" || $gtype eq "double" ||
                                  $gtype eq "uint64" || $gtype eq "ulong" || $gtype eq "long" || 
@@ -395,7 +394,7 @@
         # FIXME: We are not generating setters for 'Replaceable'
         # attributes now, but we should somehow.
         my $replaceable = $property->signature->extendedAttributes->{"Replaceable"};
-        if ($writeable && $hasGtypeSignature && !$replaceable) {
+        if (!$property->isReadOnly && $hasGtypeSignature && !$replaceable) {
             push(@result, $property);
         }
     }
@@ -460,7 +459,7 @@
 
     my $gtype = GetGValueTypeName($propType);
     my $gparamflag = "WEBKIT_PARAM_READABLE";
-    my $writeable = $attribute->type !~ /^readonly/;
+    my $writeable = !$attribute->isReadOnly;
     my $const = "read-only ";
     my $custom = $attribute->signature->extendedAttributes->{"Custom"};
     if ($writeable && $custom) {
@@ -1233,8 +1232,7 @@
 
         # FIXME: We are not generating setters for 'Replaceable'
         # attributes now, but we should somehow.
-        if ($attribute->type =~ /^readonly/ ||
-            $attribute->signature->extendedAttributes->{"Replaceable"}) {
+        if ($attribute->isReadOnly || $attribute->signature->extendedAttributes->{"Replaceable"}) {
             next TOP;
         }
         

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (149678 => 149679)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-05-07 17:42:17 UTC (rev 149679)
@@ -265,7 +265,7 @@
 sub IsReadonly
 {
     my $attribute = shift;
-    return $attribute->type =~ /readonly/ && !$attribute->signature->extendedAttributes->{"Replaceable"};
+    return $attribute->isReadOnly && !$attribute->signature->extendedAttributes->{"Replaceable"};
 }
 
 sub AddTypedefForScriptProfileType

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (149678 => 149679)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2013-05-07 17:42:17 UTC (rev 149679)
@@ -788,9 +788,7 @@
             }
 
             my $attributeType = GetObjCType($attribute->signature->type);
-            my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
-
-            my $property = "\@property" . GetPropertyAttributes($attribute->signature->type, $attributeIsReadonly);
+            my $property = "\@property" . GetPropertyAttributes($attribute->signature->type, $attribute->isReadOnly);
             # Some SVGFE*Element.idl use 'operator' as attribute name, rewrite as '_operator' to avoid clashes with C/C++
             $attributeName =~ s/operator/_operator/ if ($attributeName =~ /operator/);
             $property .= " " . $attributeType . ($attributeType =~ /\*$/ ? "" : " ") . $attributeName;
@@ -1166,7 +1164,6 @@
 
             my $attributeName = $attribute->signature->name;
             my $attributeType = GetObjCType($attribute->signature->type);
-            my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
             my $attributeClassName = GetClassName($attribute->signature->type);
 
             my $attributeInterfaceName = $attributeName;
@@ -1381,7 +1378,7 @@
             push(@implContent, "}\n");
 
             # - SETTER
-            if (!$attributeIsReadonly) {
+            if (!$attribute->isReadOnly) {
                 # Exception handling
                 my $hasSetterException = @{$attribute->setterExceptions};
 

Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (149678 => 149679)


--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2013-05-07 17:42:17 UTC (rev 149679)
@@ -66,6 +66,7 @@
 struct( domAttribute => {
     type => '$',              # Attribute type (including namespace)
     isStatic => '$',
+    isReadOnly => '$',
     signature => '$',         # Attribute signature
     getterExceptions => '@',  # Possibly raised exceptions.
     setterExceptions => '@',  # Possibly raised exceptions.
@@ -1141,7 +1142,8 @@
     if ($next->value() =~ /$nextAttributeRest_1/) {
         my $newDataNode = domAttribute->new();
         if ($self->parseReadOnly()) {
-            $newDataNode->type("readonly attribute");
+            $newDataNode->type("attribute");
+            $newDataNode->isReadOnly(1);
         } else {
             $newDataNode->type("attribute");
         }
@@ -1498,7 +1500,8 @@
     my $next = $self->nextToken();
     if ($next->type() == IdentifierToken || $next->value() =~ /$nextExceptionField_1/) {
         my $newDataNode = domAttribute->new();
-        $newDataNode->type("readonly attribute");
+        $newDataNode->type("attribute");
+        $newDataNode->isReadOnly(1);
         $newDataNode->signature(domSignature->new());
         $newDataNode->signature->type($self->parseType());
         my $token = $self->getToken();
@@ -2414,7 +2417,8 @@
     if ($next->value() =~ /$nextAttributeRest_1/) {
         my $newDataNode = domAttribute->new();
         if ($self->parseReadOnly()) {
-            $newDataNode->type("readonly attribute");
+            $newDataNode->type("attribute");
+            $newDataNode->isReadOnly(1);
         } else {
             $newDataNode->type("attribute");
         }

Modified: trunk/Tools/ChangeLog (149678 => 149679)


--- trunk/Tools/ChangeLog	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Tools/ChangeLog	2013-05-07 17:42:17 UTC (rev 149679)
@@ -1,3 +1,17 @@
+2013-05-06  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add an 'isReadOnly' member to IDL parse tree structure
+        https://bugs.webkit.org/show_bug.cgi?id=115704
+
+        Reviewed by Kentaro Hara.
+
+        Use newly added isReadOnly attribute.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
+        (_generateHeaderFile):
+        (_generateImplementationFile):
+        (_staticValuesGetterImplementation):
+
 2013-05-07  Anders Carlsson  <ander...@apple.com>
 
         Remove AlwaysInline.h from WTF

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm (149678 => 149679)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm	2013-05-07 17:10:26 UTC (rev 149678)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm	2013-05-07 17:42:17 UTC (rev 149679)
@@ -186,7 +186,7 @@
         push(@contents, "\n    // Attributes\n\n");
         foreach my $attribute (@attributes) {
             push(@contents, "    static JSValueRef @{[$self->_getterName($attribute)]}(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*);\n");
-            push(@contents, "    static bool @{[$self->_setterName($attribute)]}(JSContextRef, JSObjectRef, JSStringRef, JSValueRef, JSValueRef*);\n") unless $attribute->type =~ /^readonly/;
+            push(@contents, "    static bool @{[$self->_setterName($attribute)]}(JSContextRef, JSObjectRef, JSStringRef, JSValueRef, JSValueRef*);\n") unless $attribute->isReadOnly;
         }
     }
 
@@ -330,7 +330,7 @@
 }
 EOF
 
-            unless ($attribute->type =~ /^readonly/) {
+            unless ($attribute->isReadOnly) {
                 push(@contents, <<EOF);
 
 bool ${className}::@{[$self->_setterName($attribute)]}(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef value, JSValueRef* exception)
@@ -555,11 +555,10 @@
         return if $_->signature->extendedAttributes->{"NoImplementation"};
 
         my $attributeName = $_->signature->name;
-        my $attributeIsReadonly = $_->type =~ /^readonly/;
         my $getterName = $self->_getterName($_);
-        my $setterName = $attributeIsReadonly ? "0" : $self->_setterName($_);
+        my $setterName = $_->isReadOnly ? "0" : $self->_setterName($_);
         my @attributes = qw(kJSPropertyAttributeDontDelete);
-        push(@attributes, "kJSPropertyAttributeReadOnly") if $attributeIsReadonly;
+        push(@attributes, "kJSPropertyAttributeReadOnly") if $_->isReadOnly;
         push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
 
         return "{ \"$attributeName\", $getterName, $setterName, " . join(" | ", @attributes) . " }";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to