[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

tkent at chromium.org tkent at chromium.org
Thu Feb 4 21:28:47 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 7c3e166d90843b4d57a898c73cc0acbae1bf46e3
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 27 04:17:18 2010 +0000

    2010-01-26  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Add Date type support for Objective-C binding.
            https://bugs.webkit.org/show_bug.cgi?id=32810
    
            The Date type in IDLs is mapped to NSTimeInterval in Objective-C.
    
            * bindings/objc/DOMInternal.h: Add kit() and core() for NSTimeInterval.
            * bindings/scripts/CodeGenerator.pm: Make Date a primitive type.
            * bindings/scripts/CodeGeneratorJS.pm: Move some code for the CodeGeenrator.pm change.
            * bindings/scripts/CodeGeneratorObjC.pm:
            * bindings/scripts/CodeGeneratorV8.pm: Move some code for the CodeGeenrator.pm change.
            * html/HTMLInputElement.idl: Remove Objective-C exclusion for valueAsDate.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53890 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9d6d665..77f0076 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-01-26  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add Date type support for Objective-C binding.
+        https://bugs.webkit.org/show_bug.cgi?id=32810
+
+        The Date type in IDLs is mapped to NSTimeInterval in Objective-C.
+
+        * bindings/objc/DOMInternal.h: Add kit() and core() for NSTimeInterval.
+        * bindings/scripts/CodeGenerator.pm: Make Date a primitive type.
+        * bindings/scripts/CodeGeneratorJS.pm: Move some code for the CodeGeenrator.pm change.
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        * bindings/scripts/CodeGeneratorV8.pm: Move some code for the CodeGeenrator.pm change.
+        * html/HTMLInputElement.idl: Remove Objective-C exclusion for valueAsDate.
+
 2010-01-26  Dmitry Titov  <dimich at chromium.org>
 
         Not reviewed, attempt to fix Tiger build.
diff --git a/WebCore/bindings/objc/DOMInternal.h b/WebCore/bindings/objc/DOMInternal.h
index 72f63d2..6d2442b 100644
--- a/WebCore/bindings/objc/DOMInternal.h
+++ b/WebCore/bindings/objc/DOMInternal.h
@@ -87,3 +87,13 @@ WebCore::NodeFilter* core(DOMNodeFilter *);
 DOMNativeXPathNSResolver *kit(WebCore::XPathNSResolver*);
 WebCore::XPathNSResolver* core(DOMNativeXPathNSResolver *);
 #endif // ENABLE(XPATH)
+
+inline NSTimeInterval kit(double msSinceEpoch)
+{
+    return msSinceEpoch / 1000.0 - NSTimeIntervalSince1970;
+}
+
+inline double core(NSTimeInterval sec)
+{
+    return sec * 1000.0 + NSTimeIntervalSince1970;
+}
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index 54c39d5..dc3c7c0 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -43,7 +43,8 @@ my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1
                          "unsigned int" => 1, "unsigned short" => 1,
                          "unsigned long" => 1, "unsigned long long" => 1, 
                          "float" => 1, "double" => 1, 
-                         "boolean" => 1, "void" => 1);
+                         "boolean" => 1, "void" => 1,
+                         "Date" => 1);
 
 my %podTypeHash = ("SVGNumber" => 1, "SVGTransform" => 1);
 my %podTypesWithWritablePropertiesHash = ("SVGAngle" => 1, "SVGLength" => 1, "SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1, "SVGRect" => 1);
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 9937167..151edf1 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -169,8 +169,6 @@ sub AddIncludesForType
     # reorganization, we won't need these special cases.
     if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type)
         or $type eq "DOMString" or $type eq "DOMObject" or $type eq "Array") {
-    } elsif ($type eq "Date") {
-        $implIncludes{"<runtime/DateInstance.h>"} = 1;
     } elsif ($type =~ /SVGPathSeg/) {
         $joinedName = $type;
         $joinedName =~ s/Abs|Rel//;
@@ -1876,7 +1874,11 @@ sub NativeToJSValue
     my $type = $codeGenerator->StripModule($signature->type);
 
     return "jsBoolean($value)" if $type eq "boolean";
-    
+
+    # Need to check Date type before IsPrimitiveType().
+    if ($type eq "Date") {
+        return "jsDateOrNull(exec, $value)";
+    }
     if ($codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType" or $type eq "DOMTimeStamp") {
         $implIncludes{"<runtime/JSNumberCell.h>"} = 1;
         return "jsNumber(exec, $value)";
@@ -1952,9 +1954,6 @@ sub NativeToJSValue
     } elsif ($type eq "SerializedScriptValue") {
         $implIncludes{"$type.h"} = 1;
         return "$value->deserialize(exec)";
-    } elsif ($type eq "Date") {
-        $implIncludes{"<runtime/DateInstance.h>"} = 1;
-        return "jsDateOrNull(exec, $value)";
     } else {
         # Default, include header with same name.
         $implIncludes{"JS$type.h"} = 1;
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index aa09715..698b4f5 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -316,6 +316,7 @@ sub GetClassName
     return "BOOL" if $name eq "boolean";
     return "unsigned" if $name eq "unsigned long";
     return "int" if $name eq "long";
+    return "NSTimeInterval" if $name eq "Date";
     return "DOMAbstractView" if $name eq "DOMWindow";
     return $name if $codeGenerator->IsPrimitiveType($name) or $name eq "DOMImplementation" or $name eq "DOMTimeStamp";
 
@@ -1222,7 +1223,7 @@ sub GenerateImplementation
                 $getterContentTail .= ")";
             } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) {
                 $getterContentTail .= ".toInt()";
-            } elsif ($codeGenerator->IsPodType($idlType)) {
+            } elsif ($codeGenerator->IsPodType($idlType) or $idlType eq "Date") {
                 $getterContentHead = "kit($getterContentHead";
                 $getterContentTail .= ")";
             } elsif (IsProtocolType($idlType) and $idlType ne "EventTarget") {
@@ -1293,6 +1294,10 @@ sub GenerateImplementation
                     push(@implContent, "    ASSERT($argName);\n\n");
                 }
 
+                if ($idlType eq "Date") {
+                    $arg = "core(" . $arg . ")";
+                }
+
                 if ($podType) {
                     # Special case for DOMSVGNumber
                     if ($podType eq "float") {
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 29a41d9..eda0497 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -156,7 +156,7 @@ sub AddIncludesForType
 
     # When we're finished with the one-file-per-class
     # reorganization, we won't need these special cases.
-    if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type) or $type eq "Date") {
+    if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type)) {
     } elsif ($type =~ /SVGPathSeg/) {
         $joinedName = $type;
         $joinedName =~ s/Abs|Rel//;
@@ -2530,6 +2530,7 @@ sub ReturnNativeToJSValue
     return "return v8::Integer::New($value)" if $nativeType eq "int";
     return "return v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned";
 
+    return "return v8DateOrNull($value);" if $type eq "Date";
     return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";
 
     if ($codeGenerator->IsStringType($type)) {
@@ -2586,10 +2587,6 @@ sub ReturnNativeToJSValue
         return "return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::$classIndex, $value)";
     }
 
-    if ($type eq "Date") {
-        return "return v8DateOrNull($value);";
-    }
-
     else {
         $implIncludes{"wtf/RefCounted.h"} = 1;
         $implIncludes{"wtf/RefPtr.h"} = 1;
diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl
index c1d8936..e528208 100644
--- a/WebCore/html/HTMLInputElement.idl
+++ b/WebCore/html/HTMLInputElement.idl
@@ -57,10 +57,7 @@ module html {
                  attribute [ConvertNullToNullString, JSCCustomGetter] DOMString type; // readonly dropped as part of DOM level 2
                  attribute [ConvertNullToNullString] DOMString useMap;
                  attribute [ConvertNullToNullString] DOMString value;
-#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-                 // FIXME: Add Date support for Objective-C and COM.
                  attribute Date            valueAsDate setter raises(DOMException);
-#endif
 #if defined(ENABLE_DATALIST) && ENABLE_DATALIST
         readonly attribute HTMLOptionElement selectedOption;
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list