Changeset 82807 in webkit
- Timestamp:
- Apr 4, 2011 2:03:03 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r82806 r82807 1 2011-04-04 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: remove obsolete doc generating code from CodeGenerator. 6 https://bugs.webkit.org/show_bug.cgi?id=57748 7 8 * inspector/CodeGeneratorInspector.pm: 9 1 10 2011-04-04 Andrey Kosyakov <caseq@chromium.org> 2 11 -
trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm
r82804 r82807 106 106 "JSONType" => "Object", 107 107 "JSType" => "object", 108 "DocType" => "%s"109 108 }; 110 109 $typeTransform{"Array"} = { … … 116 115 "JSONType" => "Array", 117 116 "JSType" => "object", 118 "DocType" => "array of %s"119 117 }; 120 118 $typeTransform{"Value"} = { … … 126 124 "JSONType" => "Value", 127 125 "JSType" => "", 128 "DocType" => "value"129 126 }; 130 127 $typeTransform{"String"} = { … … 237 234 my @frontendFooter; 238 235 239 my @documentationToc;240 my @documentationLines;241 242 236 # Default constructor 243 237 sub new … … 347 341 generateBackendFunction($interface, $function); 348 342 } 349 }350 351 push(@documentationToc, "<li><a href='#" . $interface->name . "'>" . $interface->name . "</a></li>");352 push(@documentationLines, "<h2 id='" . $interface->name . "'><a name=" . $interface->name . "></a>" . $interface->name . "</h2>");353 354 push(@documentationLines, "<h3>Events</h3>");355 foreach my $function (grep($_->signature->extendedAttributes->{"event"}, @{$interface->functions}) ) {356 generateDocumentationEvent($interface, $function);357 }358 359 push(@documentationLines, "<h3>Commands</h3>");360 foreach my $function (grep(!$_->signature->extendedAttributes->{"event"}, @{$interface->functions})) {361 generateDocumentationCommand($interface, $function);362 343 } 363 344 … … 400 381 } 401 382 402 sub generateDocumentationEvent403 {404 my $interface = shift;405 my $function = shift;406 407 my $functionName = $function->signature->name;408 my $domain = $interface->name;409 410 my @argsFiltered = grep($_->direction eq "out", @{$function->parameters});411 412 my @lines;413 push(@lines, "<h4>" . $interface->name . "." . ${functionName} . "</h4>");414 my $doc = $function->signature->extendedAttributes->{"doc"};415 if ($doc) {416 push(@lines, $doc);417 }418 419 push(@lines, "<pre style='background: lightGrey; padding: 10px'>");420 push(@lines, "{");421 push(@lines, " type: \"event\",");422 push(@lines, " domain: \"$domain\",");423 if (scalar(@argsFiltered)) {424 push(@lines, " event: \"${functionName}\",");425 push(@lines, " data: {");426 my @parameters;427 foreach my $parameter (@argsFiltered) {428 push(@parameters, " " . parameterDocLine($parameter));429 }430 push(@lines, join(",\n", @parameters));431 push(@lines, " }");432 } else {433 push(@lines, " event: \"${functionName}\"");434 }435 push(@lines, "}");436 push(@lines, "</pre>");437 push(@documentationLines, @lines);438 }439 440 383 sub camelCase 441 384 { … … 541 484 } 542 485 543 sub generateDocumentationCommand544 {545 my $interface = shift;546 my $function = shift;547 548 my $functionName = $function->signature->name;549 my $domain = $interface->name;550 551 my @lines;552 553 push(@lines, "<h4>" . $interface->name . "." . ${functionName} . "</h4>");554 my $doc = $function->signature->extendedAttributes->{"doc"};555 if ($doc) {556 push(@lines, $doc);557 }558 559 my @inArgs = grep($_->direction eq "in" && !($_->name eq "callId") , @{$function->parameters});560 push(@lines, "<pre style='background: lightGrey; padding: 10px'>");561 push(@lines, "request: {");562 push(@lines, " id: <number>,");563 push(@lines, " type: \"request\",");564 push(@lines, " domain: \"" . $interface->name . "\",");565 if (scalar(@inArgs)) {566 push(@lines, " command: \"${functionName}\",");567 push(@lines, " arguments: {");568 my @parameters;569 foreach my $parameter (@inArgs) {570 push(@parameters, " " . parameterDocLine($parameter));571 }572 push(@lines, join(",\n", @parameters));573 push(@lines, " }");574 } else {575 push(@lines, " command: \"${functionName}\"");576 }577 push(@lines, "}");578 579 my @outArgs = grep($_->direction eq "out", @{$function->parameters});580 push(@lines, "");581 push(@lines, "response: {");582 push(@lines, " requestId: <number>,");583 if (scalar(@outArgs)) {584 push(@lines, " type: \"response\",");585 push(@lines, " body: {");586 my @parameters;587 foreach my $parameter (@outArgs) {588 push(@parameters, " " . parameterDocLine($parameter));589 }590 push(@lines, join(",\n", @parameters));591 push(@lines, " }");592 } else {593 push(@lines, " type: \"response\"");594 }595 push(@lines, "}");596 push(@lines, "</pre>");597 598 push(@documentationLines, @lines);599 }600 601 486 sub generateBackendReportProtocolError 602 487 { … … 1041 926 } 1042 927 1043 sub parameterDocType1044 {1045 my $parameter = shift;1046 my $subtype = $parameter->extendedAttributes->{"type"};1047 if ($subtype) {1048 my $pattern = typeTraits($parameter->type, "DocType");1049 return sprintf($pattern, "<$subtype>");1050 }1051 1052 my $subtypeRef = $parameter->extendedAttributes->{"typeRef"};1053 if ($subtypeRef) {1054 my $pattern = typeTraits($parameter->type, "DocType");1055 return sprintf($pattern, "<<a href='#$subtypeRef'>" . $subtypeRef . "</a>>");1056 }1057 1058 return "<" . typeTraits($parameter->type, "JSType") . ">";1059 }1060 1061 sub parameterDocLine1062 {1063 my $parameter = shift;1064 1065 my $result = $parameter->name . ": " . parameterDocType($parameter);1066 my $doc = $parameter->extendedAttributes->{"doc"};1067 if ($doc) {1068 $result = $result . " // " . $doc;1069 }1070 return $result;1071 }1072 1073 928 sub generateBackendAgentFieldsAndConstructor 1074 929 { … … 1152 1007 close($JS_STUB); 1153 1008 undef($JS_STUB); 1154 1155 open(my $DOCS, ">$outputDir/WebInspectorProtocol.html") || die "Couldn't open file $outputDir/WebInspectorProtocol.html";1156 print $DOCS "<ol class='toc' style='list-style: none; padding: 0'>";1157 print $DOCS join("\n", @documentationToc);1158 print $DOCS "</ol>";1159 print $DOCS join("\n", @documentationLines);1160 close($DOCS);1161 undef($DOCS);1162 1009 } 1163 1010
Note: See TracChangeset
for help on using the changeset viewer.