2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 23 Jan 2004 07:00:13 +0000 (07:00 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 23 Jan 2004 07:00:13 +0000 (07:00 -0000)
* TemplateControlCompiler.cs: allow handling subproperties for other
types than Style and Font. Fixes bug #53217.

svn path=/trunk/mcs/; revision=22418

mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs

index 02ff525b3453f4ca0688d8e483df7ea7b737f450..e9ec14a51a7e441dbd0a8db87db5de3e17a58e77 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-23  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TemplateControlCompiler.cs: allow handling subproperties for other
+       types than Style and Font. Fixes bug #53217.
+
 2004-01-16  Jackson Harper <jackson@ximian.com>
 
        * TagAttribute.cs: attributes can be stored as encoded html so we
index e31eaaeb894b71274ede8be34c8498b8ea85235f..9e6b7529ea6eadfe27cb4a386824a53a5ca628d3 100644 (file)
@@ -284,37 +284,39 @@ namespace System.Web.Compilation
 
                        if (0 == String.Compare (member.Name, id, true)){
                                AddCodeForPropertyOrField (builder, type, member.Name, attValue, isDataBound);
-                               is_processed = true;
-                       } else if (hyphen != -1 && (type == fontinfoType || type == styleType || type.IsSubclassOf (styleType))){
-                               //FIXME: x-y should not be limited to style and font
-                               string prop_field = id.Replace ("-", ".");
-                               string [] parts = prop_field.Split (new char [] {'.'});
-                               if (parts.Length != 2 || 0 != String.Compare (member.Name, parts [0], true))
-                                       return false;
+                               return true;
+                       }
+                       
+                       if (hyphen == -1)
+                               return false;
 
-                               PropertyInfo [] subprops = type.GetProperties ();
-                               foreach (PropertyInfo subprop in subprops) {
-                                       if (0 != String.Compare (subprop.Name, parts [1], true))
-                                               continue;
+                       string prop_field = id.Replace ("-", ".");
+                       string [] parts = prop_field.Split (new char [] {'.'});
+                       if (parts.Length != 2 || 0 != String.Compare (member.Name, parts [0], true))
+                               return false;
 
-                                       if (subprop.CanWrite == false)
-                                               return false;
+                       PropertyInfo [] subprops = type.GetProperties ();
+                       foreach (PropertyInfo subprop in subprops) {
+                               if (0 != String.Compare (subprop.Name, parts [1], true))
+                                       continue;
 
-                                       bool is_bool = subprop.PropertyType == typeof (bool);
-                                       if (!is_bool && attValue == null)
-                                               return false; // Font-Size -> Font-Size="" as html
+                               if (subprop.CanWrite == false)
+                                       return false;
 
-                                       string value;
-                                       if (attValue == null && is_bool)
-                                               value = "true"; // Font-Bold <=> Font-Bold="true"
-                                       else
-                                               value = attValue;
+                               bool is_bool = subprop.PropertyType == typeof (bool);
+                               if (!is_bool && attValue == null)
+                                       return false; // Font-Size -> Font-Size="" as html
 
-                                       AddCodeForPropertyOrField (builder, subprop.PropertyType,
-                                                        member.Name + "." + subprop.Name,
-                                                        value, isDataBound);
-                                       is_processed = true;
-                               }
+                               string value;
+                               if (attValue == null && is_bool)
+                                       value = "true"; // Font-Bold <=> Font-Bold="true"
+                               else
+                                       value = attValue;
+
+                               AddCodeForPropertyOrField (builder, subprop.PropertyType,
+                                                member.Name + "." + subprop.Name,
+                                                value, isDataBound);
+                               is_processed = true;
                        }
 
                        return is_processed;