Title: [90558] trunk/Source/WebCore
Revision
90558
Author
loi...@chromium.org
Date
2011-07-07 06:44:55 -0700 (Thu, 07 Jul 2011)

Log Message

2011-07-07  Ilya Tikhonovsky  <loi...@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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90557 => 90558)


--- trunk/Source/WebCore/ChangeLog	2011-07-07 13:12:26 UTC (rev 90557)
+++ trunk/Source/WebCore/ChangeLog	2011-07-07 13:44:55 UTC (rev 90558)
@@ -1,5 +1,19 @@
 2011-07-07  Ilya Tikhonovsky  <loi...@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):
+
+2011-07-07  Ilya Tikhonovsky  <loi...@chromium.org>
+
         Web Inspector: Searching on the Network panel doesn't do anything?
         https://bugs.webkit.org/show_bug.cgi?id=55489
 

Modified: trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm (90557 => 90558)


--- trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm	2011-07-07 13:12:26 UTC (rev 90557)
+++ trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm	2011-07-07 13:44:55 UTC (rev 90558)
@@ -464,17 +464,22 @@
             my $name = $parameter->name;
             my $type = $parameter->type;
             my $typeString = camelCase($parameter->type);
-            my $optional = $parameter->extendedAttributes->{"optional"} ? "true" : "false";
-            push(@function, "        " . typeTraits($type, "variable") . " in_$name = get$typeString(paramsContainerPtr, \"$name\", $optional, protocolErrorsPtr);");
+            my $optionalFlagArgument = "0";
+            if ($parameter->extendedAttributes->{"optional"}) {
+                push(@function, "        bool ${name}_valueFound = false;");
+                $optionalFlagArgument = "&${name}_valueFound";
+            }
+            push(@function, "        " . typeTraits($type, "variable") . " in_$name = get$typeString(paramsContainerPtr, \"$name\", $optionalFlagArgument, protocolErrorsPtr);");
         }
         push(@function, "");
         $indent = "    ";
     }
 
-
     my $args = join(", ",
                     ("&error",
-                     map(($_->extendedAttributes->{"optional"} ? "&" : "") . "in_" . $_->name, @inArgs),
+                     map(($_->extendedAttributes->{"optional"} ?
+                          $_->name . "_valueFound ? &in_" . $_->name . " : 0" :
+                          "in_" . $_->name), @inArgs),
                      map("&out_" . $_->name, @outArgs)));
 
     push(@function, "$indent    if (!protocolErrors->length())");
@@ -580,26 +585,32 @@
     my $return  = typeTraits($type, "return") ? typeTraits($type, "return") : typeTraits($type, "param");
 
     my $typeString = camelCase($type);
-    push(@backendConstantDeclarations, "    static $return get$typeString(InspectorObject* object, const String& name, bool optional, InspectorArray* protocolErrors);");
+    push(@backendConstantDeclarations, "    static $return get$typeString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors);");
     my $getterBody = << "EOF";
 
-$return InspectorBackendDispatcher::get$typeString(InspectorObject* object, const String& name, bool optional, InspectorArray* protocolErrors)
+$return InspectorBackendDispatcher::get$typeString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
 {
     ASSERT(object);
     ASSERT(protocolErrors);
 
+    if (valueFound)
+        *valueFound = false;
+
     $variable value = $defaultValue;
     InspectorObject::const_iterator end = object->end();
     InspectorObject::const_iterator valueIterator = object->find(name);
 
     if (valueIterator == end) {
-        if (!optional)
+        if (!valueFound)
             protocolErrors->pushString(String::format("Parameter '\%s' with type '$json' was not found.", name.utf8().data()));
         return value;
     }
 
     if (!valueIterator->second->as$json(&value))
         protocolErrors->pushString(String::format("Parameter '\%s' has wrong type. It should be '$json'.", name.utf8().data()));
+    else
+        if (valueFound)
+            *valueFound = true;
     return value;
 }
 EOF

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (90557 => 90558)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2011-07-07 13:12:26 UTC (rev 90557)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2011-07-07 13:44:55 UTC (rev 90558)
@@ -227,7 +227,7 @@
     RefPtr<InspectorStyle> computedInspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo, 0);
     resultObject->setObject("computedStyle", computedInspectorStyle->buildObjectForStyle());
 
-    unsigned forcePseudoClassMask = computePseudoClassMask(forcedPseudoClasses->get());
+    unsigned forcePseudoClassMask = computePseudoClassMask(forcedPseudoClasses ? forcedPseudoClasses->get() : 0);
     CSSStyleSelector* selector = element->ownerDocument()->styleSelector();
     RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, CSSStyleSelector::AllCSSRules, forcePseudoClassMask);
     resultObject->setArray("matchedCSSRules", buildArrayForRuleList(matchedRules.get()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to