Changeset 90558 in webkit


Ignore:
Timestamp:
Jul 7, 2011 6:44:55 AM (13 years ago)
Author:
loislo@chromium.org
Message:

2011-07-07 Ilya Tikhonovsky <loislo@chromium.org>

Web Inspector: Protocol: pointers to optional "in" parameters passing to the
backend methods should be NULL if they are not specified in the message.
https://bugs.webkit.org/show_bug.cgi?id=64083

Reviewed by Pavel Feldman.

  • inspector/CodeGeneratorInspector.pm: (generateBackendFunction): (generateArgumentGetters):
  • inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getStylesForNode):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90556 r90558  
     12011-07-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: Protocol: pointers to optional "in" parameters passing to the
     4        backend methods should be NULL if they are not specified in the message.
     5        https://bugs.webkit.org/show_bug.cgi?id=64083
     6
     7        Reviewed by Pavel Feldman.
     8
     9        * inspector/CodeGeneratorInspector.pm:
     10        (generateBackendFunction):
     11        (generateArgumentGetters):
     12        * inspector/InspectorCSSAgent.cpp:
     13        (WebCore::InspectorCSSAgent::getStylesForNode):
     14
    1152011-07-07  Ilya Tikhonovsky  <loislo@chromium.org>
    216
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm

    r90394 r90558  
    465465            my $type = $parameter->type;
    466466            my $typeString = camelCase($parameter->type);
    467             my $optional = $parameter->extendedAttributes->{"optional"} ? "true" : "false";
    468             push(@function, "        " . typeTraits($type, "variable") . " in_$name = get$typeString(paramsContainerPtr, \"$name\", $optional, protocolErrorsPtr);");
     467            my $optionalFlagArgument = "0";
     468            if ($parameter->extendedAttributes->{"optional"}) {
     469                push(@function, "        bool ${name}_valueFound = false;");
     470                $optionalFlagArgument = "&${name}_valueFound";
     471            }
     472            push(@function, "        " . typeTraits($type, "variable") . " in_$name = get$typeString(paramsContainerPtr, \"$name\", $optionalFlagArgument, protocolErrorsPtr);");
    469473        }
    470474        push(@function, "");
     
    472476    }
    473477
    474 
    475478    my $args = join(", ",
    476479                    ("&error",
    477                      map(($_->extendedAttributes->{"optional"} ? "&" : "") . "in_" . $_->name, @inArgs),
     480                     map(($_->extendedAttributes->{"optional"} ?
     481                          $_->name . "_valueFound ? &in_" . $_->name . " : 0" :
     482                          "in_" . $_->name), @inArgs),
    478483                     map("&out_" . $_->name, @outArgs)));
    479484
     
    581586
    582587    my $typeString = camelCase($type);
    583     push(@backendConstantDeclarations, "    static $return get$typeString(InspectorObject* object, const String& name, bool optional, InspectorArray* protocolErrors);");
     588    push(@backendConstantDeclarations, "    static $return get$typeString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors);");
    584589    my $getterBody = << "EOF";
    585590
    586 $return InspectorBackendDispatcher::get$typeString(InspectorObject* object, const String& name, bool optional, InspectorArray* protocolErrors)
     591$return InspectorBackendDispatcher::get$typeString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
    587592{
    588593    ASSERT(object);
    589594    ASSERT(protocolErrors);
     595
     596    if (valueFound)
     597        *valueFound = false;
    590598
    591599    $variable value = $defaultValue;
     
    594602
    595603    if (valueIterator == end) {
    596         if (!optional)
     604        if (!valueFound)
    597605            protocolErrors->pushString(String::format("Parameter '\%s' with type '$json' was not found.", name.utf8().data()));
    598606        return value;
     
    601609    if (!valueIterator->second->as$json(&value))
    602610        protocolErrors->pushString(String::format("Parameter '\%s' has wrong type. It should be '$json'.", name.utf8().data()));
     611    else
     612        if (valueFound)
     613            *valueFound = true;
    603614    return value;
    604615}
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r89922 r90558  
    228228    resultObject->setObject("computedStyle", computedInspectorStyle->buildObjectForStyle());
    229229
    230     unsigned forcePseudoClassMask = computePseudoClassMask(forcedPseudoClasses->get());
     230    unsigned forcePseudoClassMask = computePseudoClassMask(forcedPseudoClasses ? forcedPseudoClasses->get() : 0);
    231231    CSSStyleSelector* selector = element->ownerDocument()->styleSelector();
    232232    RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, CSSStyleSelector::AllCSSRules, forcePseudoClassMask);
Note: See TracChangeset for help on using the changeset viewer.