Bug 133983

Summary: [GTK] Add support for constants in GObject DOM bindings
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: BindingsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, gustavo
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Updated patch mrobinson: review+

Carlos Garcia Campos
Reported 2014-06-17 08:16:40 PDT
We don't expose any constant.
Attachments
Patch (6.36 KB, patch)
2014-06-17 08:19 PDT, Carlos Garcia Campos
no flags
Updated patch (14.54 KB, patch)
2014-06-20 01:57 PDT, Carlos Garcia Campos
mrobinson: review+
Carlos Garcia Campos
Comment 1 2014-06-17 08:19:17 PDT
Created attachment 233230 [details] Patch The support for constants in .symbols files and the docs is added in bug #93002, I'll update this patch once that bug is fixed.
Carlos Garcia Campos
Comment 2 2014-06-20 01:57:53 PDT
Created attachment 233415 [details] Updated patch Patch updated now that both bug #133726 and #93002 are fixed.
Martin Robinson
Comment 3 2014-06-25 09:29:01 PDT
Comment on attachment 233415 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=233415&action=review > Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:896 > + push(@hBody, $implContent); > + > + if ($isStableClass) { > + push(@symbols, "GType ${lowerCaseIfaceName}_get_type(void)\n"); > + } > + > + if (@{$interface->constants}) { > + my @constants = @{$interface->constants}; > + foreach my $constant (@constants) { > + my $conditionalString = $codeGenerator->GenerateConditionalString($constant); > + my $constantName = "WEBKIT_DOM_${clsCaps}_" . $constant->name; > + my $constantValue = $constant->value; > + my $isStableSymbol = grep {$_ eq $constantName} @stableSymbols; > + if ($isStableSymbol) { > + push(@symbols, "$constantName\n"); > + } > + > + my @constantHeader = (); > + push(@constantHeader, "#if ${conditionalString}") if $conditionalString; > + push(@constantHeader, "/**"); > + push(@constantHeader, " * ${constantName}:"); > + push(@constantHeader, " */"); > + push(@constantHeader, "#define $constantName $constantValue"); > + push(@constantHeader, "#endif /* ${conditionalString} */") if $conditionalString; > + push(@constantHeader, "\n"); > + > + if ($isStableSymbol or !$isStableClass) { > + push(@hBody, join("\n", @constantHeader)); > + } else { > + push(@hBodyUnstable, join("\n", @constantHeader)); > + } > + } > + } > + I think it makes sense to move this to a helper. We don't do that a lot, but these files need serious cleanup.
Carlos Garcia Campos
Comment 4 2014-06-26 00:46:12 PDT
Note You need to log in before you can comment on or make changes to this bug.