⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 98679 in webkit


Ignore:
Timestamp:
Oct 27, 2011, 7:43:12 PM (15 years ago)
Author:
haraken@chromium.org
Message:

Generate WebKitCSSMatrix constructor for JSC by [Constructor] IDL
https://bugs.webkit.org/show_bug.cgi?id=70215

Reviewed by Adam Barth.

Source/JavaScriptCore:

Added a method that judges if a given JSValue is empty.

Tests: transforms/svg-vs-css.xhtml

transforms/cssmatrix-2d-interface.xhtml
transforms/cssmatrix-3d-interface.xhtml

  • runtime/JSValue.h:
  • runtime/JSValueInlineMethods.h:

(JSC::JSValue::isEmpty):

Source/WebCore:

This patch implements [Optional=CallWithNullValue] IDL for JSC.
While a parameter specified as [Optional=CallWithDefaultValue] is
handled as a string "undefined", a parameter specified as
[Optional=CallWithNullValue] is handled as a null string.
(Note: not a string "null", but a null string).

c.f. [Optional=CallWithNullValue] is implemented in V8 in bug 67458.

Tests: fast/dom/global-constructors.html

transforms/svg-vs-css.xhtml
transforms/cssmatrix-2d-interface.xhtml
transforms/cssmatrix-3d-interface.xhtml

  • GNUmakefile.list.am: Removed JSWebKitCSSMatrixCustom.cpp.
  • UseJSC.cmake: Ditto.
  • WebCore.gypi: Ditto.
  • WebCore.pro: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • bindings/js/JSBindingsAllInOne.cpp: Ditto.
  • bindings/js/JSDOMBinding.h: MAYBE_MISSING_PARAMETER(exec, index, policy) returns the index-th parameter, if the parameter exists. It returns an undefined value, if the index-th parameter is missing and the policy is MissingIsUndefined. It returns an empty value, otherwise (i.e. if the index-th parameter is missing and the policy is MissingIsEmpty).
  • bindings/js/JSWebKitCSSMatrixCustom.cpp: Removed.
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateParametersCheck): Supported [Optional=CallWithNullValue].
(GenerateConstructorDefinition): Supported [Optional=CallWithNullValue].

  • css/WebKitCSSMatrix.idl: Removed [JSCustomConstructor].
Location:
trunk/Source
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r98674 r98679  
     12011-10-27  Kentaro Hara  <haraken@chromium.org>
     2
     3        Generate WebKitCSSMatrix constructor for JSC by [Constructor] IDL
     4        https://bugs.webkit.org/show_bug.cgi?id=70215
     5
     6        Reviewed by Adam Barth.
     7
     8        Added a method that judges if a given JSValue is empty.
     9
     10        Tests: transforms/svg-vs-css.xhtml
     11               transforms/cssmatrix-2d-interface.xhtml
     12               transforms/cssmatrix-3d-interface.xhtml
     13
     14        * runtime/JSValue.h:
     15        * runtime/JSValueInlineMethods.h:
     16        (JSC::JSValue::isEmpty):
     17
    1182011-10-27  Michael Saboff  <msaboff@apple.com>
    219
  • trunk/Source/JavaScriptCore/runtime/JSValue.h

    r97827 r98679  
    163163
    164164        // Querying the type.
     165        bool isEmpty() const;
    165166        bool isUndefined() const;
    166167        bool isNull() const;
  • trunk/Source/JavaScriptCore/runtime/JSValueInlineMethods.h

    r96717 r98679  
    224224    }
    225225
     226    inline bool JSValue::isEmpty() const
     227    {
     228        return tag() == EmptyValueTag;
     229    }
     230
    226231    inline bool JSValue::isUndefined() const
    227232    {
     
    369374    }
    370375
     376    inline bool JSValue::isEmpty() const
     377    {
     378        return u.asInt64 == ValueEmpty;
     379    }
     380
    371381    inline bool JSValue::isUndefined() const
    372382    {
  • trunk/Source/WebCore/ChangeLog

    r98676 r98679  
     12011-10-27  Kentaro Hara  <haraken@chromium.org>
     2
     3        Generate WebKitCSSMatrix constructor for JSC by [Constructor] IDL
     4        https://bugs.webkit.org/show_bug.cgi?id=70215
     5
     6        Reviewed by Adam Barth.
     7
     8        This patch implements [Optional=CallWithNullValue] IDL for JSC.
     9        While a parameter specified as [Optional=CallWithDefaultValue] is
     10        handled as a string "undefined", a parameter specified as
     11        [Optional=CallWithNullValue] is handled as a null string.
     12        (Note: not a string "null", but a null string).
     13
     14        c.f. [Optional=CallWithNullValue] is implemented in V8 in bug 67458.
     15
     16        Tests: fast/dom/global-constructors.html
     17               transforms/svg-vs-css.xhtml
     18               transforms/cssmatrix-2d-interface.xhtml
     19               transforms/cssmatrix-3d-interface.xhtml
     20
     21        * GNUmakefile.list.am: Removed JSWebKitCSSMatrixCustom.cpp.
     22        * UseJSC.cmake: Ditto.
     23        * WebCore.gypi: Ditto.
     24        * WebCore.pro: Ditto.
     25        * WebCore.xcodeproj/project.pbxproj: Ditto.
     26        * bindings/js/JSBindingsAllInOne.cpp: Ditto.
     27        * bindings/js/JSDOMBinding.h: MAYBE_MISSING_PARAMETER(exec, index, policy) returns the index-th parameter, if the parameter exists. It returns an undefined value, if the index-th parameter is missing and the policy is MissingIsUndefined. It returns an empty value, otherwise (i.e. if the index-th parameter is missing and the policy is MissingIsEmpty).
     28        * bindings/js/JSWebKitCSSMatrixCustom.cpp: Removed.
     29        * bindings/scripts/CodeGeneratorJS.pm:
     30        (GenerateParametersCheck): Supported [Optional=CallWithNullValue].
     31        (GenerateConstructorDefinition): Supported [Optional=CallWithNullValue].
     32        * css/WebKitCSSMatrix.idl: Removed [JSCustomConstructor].
     33
    1342011-10-27  Julien Chaffraix  <jchaffraix@webkit.org>
    235
  • trunk/Source/WebCore/GNUmakefile.list.am

    r98656 r98679  
    857857        Source/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp \
    858858        Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp \
    859         Source/WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp \
    860859        Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp \
    861860        Source/WebCore/bindings/js/JSWebKitPointCustom.cpp \
  • trunk/Source/WebCore/UseJSC.cmake

    r98196 r98679  
    122122    bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp
    123123    bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp
    124     bindings/js/JSWebKitCSSMatrixCustom.cpp
    125124    bindings/js/JSWebKitMutationObserverCustom.cpp
    126125    bindings/js/JSWebKitPointCustom.cpp
  • trunk/Source/WebCore/WebCore.gypi

    r98656 r98679  
    19471947            'bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp',
    19481948            'bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp',
    1949             'bindings/js/JSWebKitCSSMatrixCustom.cpp',
    19501949            'bindings/js/JSWebKitMutationObserverCustom.cpp',
    19511950            'bindings/js/JSWebKitPointCustom.cpp',
  • trunk/Source/WebCore/WebCore.pro

    r98656 r98679  
    345345        bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp \
    346346        bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp \
    347         bindings/js/JSWebKitCSSMatrixCustom.cpp \
    348347        bindings/js/JSWebKitMutationObserverCustom.cpp \
    349348        bindings/js/JSWebKitPointCustom.cpp \
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r98656 r98679  
    49184918                BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC274B30140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp */; };
    49194919                BC275B7911C5D1C300C9206C /* JSWebKitPointCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */; };
    4920                 BC275B7D11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */; };
    49214920                BC275CB311C5E85C00C9206C /* JSArrayBufferCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */; };
    49224921                BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2CBF4B140F1A65003879BE /* JSWebGLContextEvent.h */; };
     
    1214212141                BC274B30140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSBorderImageSliceValue.cpp; sourceTree = "<group>"; };
    1214312142                BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitPointCustom.cpp; sourceTree = "<group>"; };
    12144                 BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixCustom.cpp; sourceTree = "<group>"; };
    1214512143                BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferCustom.cpp; sourceTree = "<group>"; };
    1214612144                BC2CBF4B140F1A65003879BE /* JSWebGLContextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextEvent.h; sourceTree = "<group>"; };
     
    1958319581                                E1AD14C41297354900ACA989 /* JSWebKitCSSKeyframeRuleCustom.cpp */,
    1958419582                                E1AD14B4129734CA00ACA989 /* JSWebKitCSSKeyframesRuleCustom.cpp */,
    19585                                 BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */,
    1958619583                                C6F0917E143A2BB900685849 /* JSWebKitMutationObserverCustom.cpp */,
    1958719584                                BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */,
     
    2642226419                                E1AD14B5129734CA00ACA989 /* JSWebKitCSSKeyframesRuleCustom.cpp in Sources */,
    2642326420                                4983913F0F1E767500C23782 /* JSWebKitCSSMatrix.cpp in Sources */,
    26424                                 BC275B7D11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp in Sources */,
    2642526421                                31611E5A0E1C4DE000F6A579 /* JSWebKitCSSTransformValue.cpp in Sources */,
    2642626422                                898785B4122CA2A7003AABDA /* JSWebKitFlags.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r98238 r98679  
    149149#include "JSWebKitCSSKeyframeRuleCustom.cpp"
    150150#include "JSWebKitCSSKeyframesRuleCustom.cpp"
    151 #include "JSWebKitCSSMatrixCustom.cpp"
    152151#include "JSWebKitPointCustom.cpp"
    153152#include "JSWebSocketCustom.cpp"
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.h

    r97985 r98679  
    4141namespace WebCore {
    4242
     43enum ParameterMissingPolicy {
     44    MissingIsUndefined,
     45    MissingIsEmpty
     46};
     47
     48#define MAYBE_MISSING_PARAMETER(exec, index, policy) (((policy) == MissingIsEmpty && (index) >= (exec)->argumentCount()) ? (JSValue()) : ((exec)->argument(index)))
     49
    4350    class Frame;
    4451    class KURL;
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r98617 r98679  
    23092309        # Optional callbacks should be treated differently, because they always have a default value (0),
    23102310        # and we can reduce the number of overloaded functions that take a different number of parameters.
    2311         # Optional arguments with [Optional=CallWithDefaultValue] should not generate an early call.
     2311        # Optional arguments with [Optional=CallWithDefaultValue] or [Optional=CallWithNullValue]
     2312        # should not generate an early call.
    23122313        my $optional = $parameter->extendedAttributes->{"Optional"};
    2313         if ($optional && $optional ne "CallWithDefaultValue" && !$parameter->extendedAttributes->{"Callback"}) {
     2314        if ($optional && $optional ne "CallWithDefaultValue" && $optional ne "CallWithNullValue" && !$parameter->extendedAttributes->{"Callback"}) {
    23142315            # Generate early call if there are enough parameters.
    23152316            if (!$hasOptionalArguments) {
     
    23692370            }
    23702371
    2371             push(@implContent, "    " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, "exec->argument($argsIndex)") . ");\n");
     2372            my $optional = $parameter->extendedAttributes->{"Optional"};
     2373            my $parameterMissingPolicy = "MissingIsUndefined";
     2374            if ($optional && $optional eq "CallWithNullValue") {
     2375                $parameterMissingPolicy = "MissingIsEmpty";
     2376            }
     2377
     2378            push(@$outputArray, "    " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, "MAYBE_MISSING_PARAMETER(exec, $argsIndex, $parameterMissingPolicy)") . ");\n");
    23722379
    23732380            # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception.
     
    27442751        return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"};
    27452752        return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
    2746         return "ustringToString($value.toString(exec))";
     2753        return "ustringToString($value.isEmpty() ? UString() : $value.toString(exec))";
    27472754    }
    27482755
     
    32783285
    32793286                # For now, we do not support SVG constructors.
    3280                 # We do not also support a constructor [Optional] argument without CallWithDefaultValue.
     3287                # We do not also support a constructor [Optional] argument without CallWithDefaultValue
     3288                # nor CallWithNullValue.
    32813289                my $numParameters = @{$function->parameters};
    32823290                my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $dataNode, $numParameters, $interfaceName, "constructorCallback", undef, undef, undef);
  • trunk/Source/WebCore/css/WebKitCSSMatrix.idl

    r96788 r98679  
    2929    interface [
    3030        CanBeConstructed,
    31         JSCustomConstructor,
    3231        ConstructorParameters=1,
    3332        Constructor(in [Optional=CallWithNullValue] DOMString cssValue),
Note: See TracChangeset for help on using the changeset viewer.