Changeset 200037 in webkit


Ignore:
Timestamp:
Apr 25, 2016 11:38:56 AM (8 years ago)
Author:
Chris Dumez
Message:

[Web IDL] Specify default values for parameters of type 'unsigned short'
https://bugs.webkit.org/show_bug.cgi?id=156967

Reviewed by Darin Adler.

Specify default values for parameters of type 'unsigned short' and let
the bindings generator use WTF::Optional<> for the ones without a
default value.

  • bindings/scripts/CodeGeneratorJS.pm:

(CanUseWTFOptionalForParameter):
(GenerateParametersCheck):

  • testing/Internals.cpp:

(WebCore::Internals::layerTreeAsText): Deleted.
(WebCore::Internals::displayListForElement): Deleted.
(WebCore::Internals::replayDisplayListForElement): Deleted.

  • testing/Internals.h:
  • testing/Internals.idl:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r200036 r200037  
     12016-04-25  Chris Dumez  <cdumez@apple.com>
     2
     3        [Web IDL] Specify default values for parameters of type 'unsigned short'
     4        https://bugs.webkit.org/show_bug.cgi?id=156967
     5
     6        Reviewed by Darin Adler.
     7
     8        Specify default values for parameters of type 'unsigned short' and let
     9        the bindings generator use WTF::Optional<> for the ones without a
     10        default value.
     11
     12        * bindings/scripts/CodeGeneratorJS.pm:
     13        (CanUseWTFOptionalForParameter):
     14        (GenerateParametersCheck):
     15        * testing/Internals.cpp:
     16        (WebCore::Internals::layerTreeAsText): Deleted.
     17        (WebCore::Internals::displayListForElement): Deleted.
     18        (WebCore::Internals::replayDisplayListForElement): Deleted.
     19        * testing/Internals.h:
     20        * testing/Internals.idl:
     21
    1222016-04-25  Per Arne Vollan  <peavo@outlook.com>
    223
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r199976 r200037  
    33713371}
    33723372
    3373 sub CanUseWTFOptionalForParameterType
    3374 {
    3375     my $type  = shift;
     3373sub CanUseWTFOptionalForParameter
     3374{
     3375    my $parameter = shift;
     3376    my $type = $parameter->type;
    33763377
    33773378    # FIXME: We should progressively stop blacklisting each type below
    33783379    # and eventually get rid of this function entirely.
     3380    return 0 if $parameter->extendedAttributes->{"Clamp"};
     3381    return 0 if $parameter->isVariadic;
     3382    return 0 if $codeGenerator->IsCallbackInterface($type);
    33793383    return 0 if $codeGenerator->IsEnumType($type);
    33803384    return 0 if $codeGenerator->IsTypedArrayType($type);
     
    33883392    return 0 if $type eq "unrestricted double";
    33893393    return 0 if $type eq "unsigned long";
    3390     return 0 if $type eq "unsigned short";
    33913394
    33923395    return 1;
     
    34423445        # Optional Dictionary arguments always considered to have default of empty dictionary.
    34433446        my $optional = $parameter->isOptional;
    3444         if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameterType($parameter->type) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) {
     3447        if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameter($parameter) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) {
    34453448            # Generate early call if there are enough parameters.
    34463449            if (!$hasOptionalArguments) {
     
    36223625                    $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : ";
    36233626                    $inner = "state->uncheckedArgument($argsIndex)";
    3624                 } elsif ($optional && !defined($parameter->default) && CanUseWTFOptionalForParameterType($parameter->type)) {
     3627                } elsif ($optional && !defined($parameter->default) && CanUseWTFOptionalForParameter($parameter)) {
    36253628                    # Use WTF::Optional<>() for optional parameters that are missing or undefined and that do not have
    36263629                    # a default value in the IDL.
  • trunk/Source/WebCore/testing/Internals.cpp

    r199798 r200037  
    18271827// different document, and could just make the call through another Internals
    18281828// instance instead.
    1829 String Internals::layerTreeAsText(Document& document, ExceptionCode& ec) const
    1830 {
    1831     return layerTreeAsText(document, 0, ec);
    1832 }
    1833 
    1834 String Internals::layerTreeAsText(Document& document, unsigned flags, ExceptionCode& ec) const
     1829String Internals::layerTreeAsText(Document& document, unsigned short flags, ExceptionCode& ec) const
    18351830{
    18361831    if (!document.frame()) {
     
    19741969}
    19751970
    1976 String Internals::displayListForElement(Element& element, ExceptionCode& ec)
    1977 {
    1978     return displayListForElement(element, 0, ec);
    1979 }
    1980 
    1981 String Internals::displayListForElement(Element& element, unsigned flags, ExceptionCode& ec)
     1971String Internals::displayListForElement(Element& element, unsigned short flags, ExceptionCode& ec)
    19821972{
    19831973    Document* document = contextDocument();
     
    20132003}
    20142004
    2015 String Internals::replayDisplayListForElement(Element& element, ExceptionCode& ec)
    2016 {
    2017     return replayDisplayListForElement(element, 0, ec);
    2018 }
    2019 
    2020 String Internals::replayDisplayListForElement(Element& element, unsigned flags, ExceptionCode& ec)
     2005String Internals::replayDisplayListForElement(Element& element, unsigned short flags, ExceptionCode& ec)
    20212006{
    20222007    Document* document = contextDocument();
  • trunk/Source/WebCore/testing/Internals.h

    r199650 r200037  
    244244        LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16
    245245    };
    246     String layerTreeAsText(Document&, unsigned flags, ExceptionCode&) const;
    247     String layerTreeAsText(Document&, ExceptionCode&) const;
     246    String layerTreeAsText(Document&, unsigned short flags, ExceptionCode&) const;
    248247    String repaintRectsAsText(ExceptionCode&) const;
    249248    String scrollingStateTreeAsText(ExceptionCode&) const;
     
    258257        DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1,
    259258    };
    260     String displayListForElement(Element&, unsigned flags, ExceptionCode&);
    261     String displayListForElement(Element&, ExceptionCode&);
    262 
    263     String replayDisplayListForElement(Element&, unsigned flags, ExceptionCode&);
    264     String replayDisplayListForElement(Element&, ExceptionCode&);
     259    String displayListForElement(Element&, unsigned short flags, ExceptionCode&);
     260
     261    String replayDisplayListForElement(Element&, unsigned short flags, ExceptionCode&);
    265262
    266263    void garbageCollectDocumentResources(ExceptionCode&) const;
  • trunk/Source/WebCore/testing/Internals.idl

    r199650 r200037  
    227227    const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 8;
    228228    const unsigned short LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16;
    229     [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags);
     229    [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);
    230230
    231231    [RaisesException] DOMString scrollingStateTreeAsText();
     
    242242    const unsigned short DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1;
    243243    // Returns the recorded display list.
    244     [RaisesException] DOMString displayListForElement(Element element, optional unsigned short flags);
     244    [RaisesException] DOMString displayListForElement(Element element, optional unsigned short flags = 0);
    245245    // Returns the display list that was actually painted.
    246     [RaisesException] DOMString replayDisplayListForElement(Element element, optional unsigned short flags);
     246    [RaisesException] DOMString replayDisplayListForElement(Element element, optional unsigned short flags = 0);
    247247
    248248    [RaisesException] void garbageCollectDocumentResources();
Note: See TracChangeset for help on using the changeset viewer.