[Webkit-unassigned] [Bug 16401] [GTK] GObject/C DOM binding
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Apr 22 14:36:11 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=16401
------- Comment #194 from sam at webkit.org 2009-04-22 14:36 PDT -------
(From update of attachment 29670)
I concur with Mark's review, this is not ready to be landed. I have gone
through the CodeGenerator and picked out a bunch of issues that really stick
out, but in general, I can't really review this as is. I believe the best way
forward is for you to pick one file (say Node.idl) and get code generation
working for it or a subset of it. The stripped down version of the code
generator that can generate this one file will be a great jumping off point. I
know this seems like a step backwards, but the current state of the patch is
really not reviewable as is due to a lack of clarity in the code. The single
patch is trying to do too many things at once.
Here are some comments:
> + if ($attribute->signature->extendedAttributes->{"Custom"} ||
> + $attribute->signature->extendedAttributes->{"CustomGetter"} ||
> + $attribute->signature->extendedAttributes->{"CustomSetter"}) {
> + return 1;
> + }
[Custom] and related attributes are only used for implementing JS specific
quirks and should not be needed for GObject bindings.
> + if ($prop_type eq "stylesheets::MediaList" or
> + $prop_type eq "CSSStyleDeclaration" or
> + $prop_type eq "CSSVariablesDeclaration" or
> + $prop_type eq "EventListener" or
> + $prop_type =~ /Constructor$/ or
Constructors are a JS only idiom.
> +
> +sub UsesManualToJSImplementation {
??? How is this related to GObject support?
> + my $type = shift;
> +
> + # skipped out CanvasPixelArray - see JSCanvasPixelArrayCustom.cpp for why.
> + return 1 if $type eq "Node" or $type eq "Document" or $type eq "HTMLCollection" or
> + $type eq "SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue" or
> + $type eq "Event" or $type eq "Element" or $type eq "Text";
> + return 0;
> +}
> +
> +sub WritePrivateHeader {
> + my $object = shift;
> + my $class = shift;
> +
> + my $interfaceName = $class->name;
> + my $className = GetClassName($interfaceName);
> + my $filename = "$outputDir/" . $className . "Private.h";
> + my $guard = uc(decamelize($className)) . "_PRIVATE_H";
> + my $parentClassName = GetParentClassName($class);
> +
> + my $hasLegacyParent = $class->extendedAttributes->{"LegacyParent"};
LegacyParent is a JS only idiom.
> + my $hasRealParent = @{$class->parents} > 0;
> + my $hasParent = $hasLegacyParent || $hasRealParent;
> +
> + open(PRIVHEADER, ">$filename") or die "Couldn't open file $filename for writing";
> +
> + print PRIVHEADER split("\r", $licenceTemplate);
> + print PRIVHEADER "\n";
> +
> + my $text = << "EOF";
> +#ifndef $guard
> +#define $guard
> +
> +#include <glib-object.h>
> +#include <webkit/${parentClassName}.h>
> +#include "${interfaceName}.h"
> +EOF
> +
> + print PRIVHEADER $text;
> +
> + print PRIVHEADER map { "#include \"$_\"\n" } sort keys(%hdrPropIncludes);
> + print PRIVHEADER "\n" if keys(%hdrPropIncludes);
> +
> + $text = << "EOF";
> +typedef struct _${className} ${className};
> +
> +namespace WebKit {
> + ${className} *
> + wrap${interfaceName}(WebCore::${interfaceName} *coreObject);
> +
> + WebCore::${interfaceName} *
> + core(${className} *request);
> +
> +EOF
> +
> + print PRIVHEADER $text;
> +
> + if (${interfaceName} eq "DOMWindow" || (!$hasParent or $class->extendedAttributes->{"GenerateToJS"}) and
> + !UsesManualToJSImplementation($interfaceName)) {
> + $text = << "EOF";
What is this trying to do?
> +sub Uniquify {
> + my $name = shift;
> + my $avoid = shift;
> + if ($name eq $avoid) {
> + $name = $name . "2";
> + }
Please explain this.
> + if($attribute->signature->extendedAttributes->{"ConvertFromString"}) {
This is a JS idiom.
> + # TODO: Add other conversion functions for different types. Current
> + # IDLs only list longs.
> + if($gtype eq "long") {
> + $convert_fn = "";
> + $post_convert_fn = ".toInt()";
> + } else {
> + die "Can't convert to type ${gtype}.";
> + }
> + }
> +
> + if ($gtype eq "int") {
> + $txt_install_prop = << "EOF";
> + G_MININT, /* min */
> + G_MAXINT, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "boolean") {
> + $txt_install_prop = << "EOF";
> + FALSE, /* default */
> +EOF
> + } elsif ($gtype eq "float") {
> + $txt_install_prop = << "EOF";
> + G_MINFLOAT, /* min */
> + G_MAXFLOAT, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "double") {
> + $txt_install_prop = << "EOF";
> + G_MINDOUBLE, /* min */
> + G_MAXDOUBLE, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "uint64") {
> + $txt_install_prop = << "EOF";
> + 0, /* min */
> + G_MAXUINT64, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "ulong") {
> + $txt_install_prop = << "EOF";
> + 0, /* min */
> + G_MAXULONG, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "long") {
> + $txt_install_prop = << "EOF";
> + G_MINLONG, /* min */
> + G_MAXLONG, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "uint") {
> + $txt_install_prop = << "EOF";
> + 0, /* min */
> + G_MAXUINT, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "ushort") {
> + $txt_install_prop = << "EOF";
> + 0, /* min */
> + G_MAXUINT16, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "uchar") {
> + $txt_install_prop = << "EOF";
> + G_MININT8, /* min */
> + G_MAXINT8, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "char") {
> + $txt_install_prop = << "EOF";
> + 0, /* min */
> + G_MAXUINT8, /* max */
> + 0, /* default */
> +EOF
> + } elsif ($gtype eq "string") {
> + $txt_install_prop = << "EOF";
> + "", /* default */
> +EOF
> + } elsif ($gtype eq "object") {
> + $txt_install_prop = << "EOF";
> + WEBKIT_TYPE_${propGType}, /* gobject type */
> +EOF
> + }
> + push(@txt_install_props, $txt_install_prop);
> + $txt_install_prop = << "EOF";
> + (GParamFlags)${gparamflag}));
> +
> +EOF
This should probably be done in a more generic way using a hash.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list