瀏覽代碼

2004-01-23 Gonzalo Paniagua Javier <[email protected]>

	* TemplateControlCompiler.cs: allow handling subproperties for other
	types than Style and Font. Fixes bug #53217.

svn path=/trunk/mcs/; revision=22418
Gonzalo Paniagua Javier 22 年之前
父節點
當前提交
a7feec3356

+ 5 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,8 @@
+2004-01-23  Gonzalo Paniagua Javier <[email protected]>
+
+	* TemplateControlCompiler.cs: allow handling subproperties for other
+	types than Style and Font. Fixes bug #53217.
+
 2004-01-16  Jackson Harper <[email protected]>
 
 	* TagAttribute.cs: attributes can be stored as encoded html so we

+ 28 - 26
mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs

@@ -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;