[Webkit-unassigned] [Bug 117543] [GTK] Merge decamelizations fix ups in the GObject DOM bindings code generator

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 2 11:10:57 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=117543





--- Comment #8 from Diego Pino <dpino at igalia.com>  2013-07-02 11:12:55 PST ---
(From update of attachment 205912)
>Subversion Revision: 152267
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
>index f82d3f32bbc7d9dedd0656ab18ab746363fbceaa..e30525e640b5ab899858c707d8c692be4ac90fca 100644
>--- a/Source/WebCore/ChangeLog
>+++ b/Source/WebCore/ChangeLog
>@@ -1,3 +1,28 @@
>+2013-07-02  Diego Pino Garcia  <dpino at igalia.com>
>+
>+        [GTK] Merge decamelizations fix ups in the GObject DOM bindings code generator
>+        https://bugs.webkit.org/show_bug.cgi?id=117543
>+
>+        Reviewed by NOBODY (OOPS!).
>+
>+        Ensure that all the code that calls to decamelization() applies the
>+        same fix ups.
>+
>+        Now all functions that need to decamelize a string should simply
>+        call to decamelize(). This function calls to FixUpDecamelize to
>+        apply some fix ups.
>+
>+        * bindings/scripts/CodeGeneratorGObject.pm:
>+        (decamelize): decamelizes a string and applies fix ups
>+        (FixUpDecamelize): applies a series of fix ups to a decamelized string
>+        (GetParentGObjType): moved fix ups to FixUpDecamelize()
>+        (GenerateProperties): simply call to decamelize
>+        (GenerateHeader): simply call to decamelize
>+        (GetGReturnMacro): simply call to decamelize
>+        (GenerateFunction): simply call to decamelize
>+        (GenerateCFile): simply call to decamelize
>+        (GenerateEventTargetIface): simply call to decamelize
>+
> 2013-07-01  Tim Horton  <timothy_horton at apple.com>
> 
>         Maximum scroll position can be negative in some cases
>diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
>index a52d47cc09c1370c4f4bbe721e40d604464b1959..061b13a27373bd54519b337349184dd20d7c7147 100644
>--- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
>+++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
>@@ -134,18 +134,19 @@ sub decamelize
>                 $t .= $p3 ? $p1 ? "${p1}_$p2$p3" : "$p2$p3" : "$p1$p2";
>                 $t;
>         }ge;
>-        $s;
>-}
>-
>-sub FixUpDecamelizedName {
>-    my $classname = shift;
> 
>-    # FIXME: try to merge this somehow with the fixes in ClassNameToGobjectType
>-    $classname =~ s/x_path/xpath/;
>-    $classname =~ s/web_kit/webkit/;
>-    $classname =~ s/htmli_frame/html_iframe/;
>-
>-    return $classname;
>+        # Some strings are not correctly decamelized, apply fix ups
>+        for ($s) {
>+            s/domcss/dom_css/;
>+            s/domhtml/dom_html/;
>+            s/domdom/dom_dom/;
>+            s/domcdata/dom_cdata/;
>+            s/domui/dom_ui/;
>+            s/x_path/xpath/;
>+            s/web_kit/webkit/;
>+            s/htmli_frame/html_iframe/;
>+        }
>+        return $s;
> }
> 
> sub HumanReadableConditional {
>@@ -163,28 +164,11 @@ sub HumanReadableConditional {
>     return join(' ', @humanReadable);
> }
> 
>-sub ClassNameToGObjectType {
>-    my $className = shift;
>-    my $CLASS_NAME = uc(decamelize($className));
>-    # Fixup: with our prefix being 'WebKitDOM' decamelize can't get
>-    # WebKitDOMCSS and similar names right, so we have to fix it
>-    # manually.
>-    $CLASS_NAME =~ s/DOMCSS/DOM_CSS/;
>-    $CLASS_NAME =~ s/DOMHTML/DOM_HTML/;
>-    $CLASS_NAME =~ s/DOMDOM/DOM_DOM/;
>-    $CLASS_NAME =~ s/DOMCDATA/DOM_CDATA/;
>-    $CLASS_NAME =~ s/DOMX_PATH/DOM_XPATH/;
>-    $CLASS_NAME =~ s/DOM_WEB_KIT/DOM_WEBKIT/;
>-    $CLASS_NAME =~ s/DOMUI/DOM_UI/;
>-    $CLASS_NAME =~ s/HTMLI_FRAME/HTML_IFRAME/;
>-    return $CLASS_NAME;
>-}
>-
> sub GetParentGObjType {
>     my $interface = shift;
> 
>     return "WEBKIT_TYPE_DOM_OBJECT" if @{$interface->parents} eq 0;
>-    return "WEBKIT_TYPE_DOM_" . ClassNameToGObjectType($interface->parents(0));
>+    return "WEBKIT_TYPE_DOM_" . uc(decamelize($interface->parents(0)));
> }
> 
> sub GetClassName {
>@@ -604,8 +588,9 @@ EOF
> sub GenerateProperties {
>     my ($object, $interfaceName, $interface) = @_;
> 
>-    my $clsCaps = substr(ClassNameToGObjectType($className), 12);
>-    my $lowerCaseIfaceName = "webkit_dom_" . (FixUpDecamelizedName(decamelize($interfaceName)));
>+    my $decamelize = decamelize($interfaceName);
>+    my $clsCaps = uc($decamelize);
>+    my $lowerCaseIfaceName = "webkit_dom_$decamelize";
>     my $parentImplClassName = GetParentImplClassName($interface);
> 
>     my $conditionGuardStart = "";
>@@ -832,9 +817,9 @@ EOF
> 
>     push(@hBodyPre, $implContent);
> 
>-    my $decamelize = FixUpDecamelizedName(decamelize($interfaceName));
>+    my $decamelize = decamelize($interfaceName);
>     my $clsCaps = uc($decamelize);
>-    my $lowerCaseIfaceName = "webkit_dom_" . ($decamelize);
>+    my $lowerCaseIfaceName = "webkit_dom_$decamelize";
> 
>     $implContent = << "EOF";
> #define WEBKIT_TYPE_DOM_${clsCaps}            (${lowerCaseIfaceName}_get_type())
>@@ -867,7 +852,7 @@ sub GetGReturnMacro {
>     if ($paramIDLType eq "GError") {
>         $condition = "!$paramName || !*$paramName";
>     } elsif (IsGDOMClassType($paramIDLType)) {
>-        my $paramTypeCaps = uc(FixUpDecamelizedName(decamelize($paramIDLType)));
>+        my $paramTypeCaps = uc(decamelize($paramIDLType));
>         $condition = "WEBKIT_DOM_IS_${paramTypeCaps}($paramName)";
>         if (ParamCanBeNull($functionName, $paramName)) {
>             $condition = "!$paramName || $condition";
>@@ -902,7 +887,7 @@ sub ParamCanBeNull {
> sub GenerateFunction {
>     my ($object, $interfaceName, $function, $prefix, $parentNode) = @_;
> 
>-    my $decamelize = FixUpDecamelizedName(decamelize($interfaceName));
>+    my $decamelize = decamelize($interfaceName);
> 
>     if ($object eq "MediaQueryListListener") {
>         return;
>@@ -1299,8 +1284,9 @@ sub GenerateCFile {
> 
>     my $implContent = "";
> 
>-    my $clsCaps = uc(FixUpDecamelizedName(decamelize($interfaceName)));
>-    my $lowerCaseIfaceName = "webkit_dom_" . FixUpDecamelizedName(decamelize($interfaceName));
>+    my $decamelize = decamelize($interfaceName);
>+    my $clsCaps = uc($decamelize);
>+    my $lowerCaseIfaceName = "webkit_dom_$decamelize";
>     my $parentImplClassName = GetParentImplClassName($interface);
>     my $baseClassName = GetBaseClass($parentImplClassName);
> 
>@@ -1390,7 +1376,7 @@ sub GenerateEventTargetIface {
>     my $interface = shift;
> 
>     my $interfaceName = $interface->name;
>-    my $decamelize = FixUpDecamelizedName(decamelize($interfaceName));
>+    my $decamelize = decamelize($interfaceName);
>     my $conditionalString = $codeGenerator->GenerateConditionalString($interface);
>     my @conditionalWarn = GenerateConditionalWarning($interface);
>

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list