[Mono-dev] [Mono-patches] r73707 - in trunk/mcs/class/System.Web:System.Web.Compilation System.Web.Util

Igor Zelmanovich igorz at mainsoft.com
Tue Mar 6 08:57:41 EST 2007


This patch causes 7 regressions in tests
(System.Web.UI.WebControls.ThemeTest.cs).

Please fix or revert.

Igor.


-----Original Message-----
From: mono-patches-bounces at lists.ximian.com
[mailto:mono-patches-bounces at lists.ximian.com] On Behalf Of Marek
Habersack (grendello at gmail.com)
Sent: Monday, March 05, 2007 3:58 PM
To: mono-patches at lists.ximian.com; ximian.monolist at gmail.com;
mono-svn-patches-garchive-20758 at googlegroups.com
Subject: [Mono-patches] r73707 - in
trunk/mcs/class/System.Web:System.Web.Compilation System.Web.Util

Author: mhabersack
Date: 2007-03-05 08:58:16 -0500 (Mon, 05 Mar 2007)
New Revision: 73707

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
 
trunk/mcs/class/System.Web/System.Web.Compilation/PageThemeCompiler.cs
 
trunk/mcs/class/System.Web/System.Web.Compilation/ThemeDirectoryCompiler
.cs
   trunk/mcs/class/System.Web/System.Web.Util/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
Log:
make themes work. Also fixes bug #80953

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
2007-03-05 12:58:16 UTC (rev 73706)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
2007-03-05 13:58:16 UTC (rev 73707)
@@ -1,3 +1,13 @@
+2007-03-05  Marek Habersack  <mhabersack at novell.com>
+
+	* PageThemeCompiler.cs: Use correct theme path for
+	AppRelativeTemplateSourceDirectory.
+	Do not process builders of type CodeRenderBuilder.
+	Make sure builder.ControlType is not null before depending on
it.
+
+	* ThemeDirectoryCompiler.cs: theme parser should be passed the
+	virtual directory of the theme.
+
 2007-03-03  Marek Habersack  <mhabersack at novell.com>
 
 	* PageCompiler.cs: Added support for setting the

Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/PageThemeCompiler.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Compilation/PageThemeCompiler.cs
2007-03-05 12:58:16 UTC (rev 73706)
+++
trunk/mcs/class/System.Web/System.Web.Compilation/PageThemeCompiler.cs
2007-03-05 13:58:16 UTC (rev 73707)
@@ -94,7 +94,9 @@
 			prop.Name =
"AppRelativeTemplateSourceDirectory";
 			prop.Attributes = MemberAttributes.Family |
MemberAttributes.Override;
 			prop.Type = new CodeTypeReference (typeof
(string));
-			prop.GetStatements.Add (new
CodeMethodReturnStatement (new CodePrimitiveExpression
(parser.BaseVirtualDir)));
+			prop.GetStatements.Add (new
CodeMethodReturnStatement (
+							new
CodePrimitiveExpression (
+
VirtualPathUtility.ToAbsolute (parser.BaseVirtualDir))));
 			mainClass.Members.Add (prop);
 
 			ControlBuilder builder = parser.RootBuilder;
@@ -102,7 +104,9 @@
 				foreach (object o in builder.Children) {
 					if (! (o is ControlBuilder))
 						continue;
-
+					if (o is CodeRenderBuilder)
+						continue;
+					
 					ControlBuilder b =
(ControlBuilder) o;
 					CreateControlSkinMethod (b);
 				}
@@ -133,6 +137,9 @@
 
 		void CreateControlSkinMethod (ControlBuilder builder)
 		{
+			if (builder.ControlType == null)
+				return;
+			
 			EnsureID (builder);
 
 			CodeMemberMethod method = new CodeMemberMethod
();
@@ -164,6 +171,9 @@
 						continue;
 
 					ControlBuilder b =
(ControlBuilder) o;
+					if (b.isProperty)
+						continue;
+					
 					if (b is CollectionBuilder) {
 						PropertyInfo itemsProp =
null;
 						
@@ -203,25 +213,29 @@
 				foreach (object o in builder.Children) {
 					if (o is string) /* literal
stuff gets ignored */
 						continue;
-
+					if (o is CodeRenderBuilder)
+						continue;
 					ControlBuilder b =
(ControlBuilder) o;
 
 					EnsureID (b);
-
+					Type controlType =
b.ControlType;
+					if (controlType == null)
+						continue;
+					
 					string id = b.ID;
-					string skinId =
b.attribs["skinid"] as string;
-					Type controlType =
b.ControlType;
+					string skinId = b.attribs !=
null ? b.attribs["skinid"] as string : null;
+					if (skinId == null)
+						skinId = "";
 
-					if (skinId == null) skinId = "";
-
 					// private static object
__BuildControl__$id_skinKey =
System.Web.UI.PageTheme.CreateSkinKey(typeof($controlType), "$skinID")
 					//
 					CodeMemberField fld = new
CodeMemberField (typeof (object), "__BuildControl_" + id + "_skinKey");
 					fld.Attributes =
MemberAttributes.Private | MemberAttributes.Static;
-					fld.InitExpression = new
CodeMethodInvokeExpression (new CodeTypeReferenceExpression (typeof
(PageTheme)),
-
"CreateSkinKey",
-
new CodeTypeOfExpression (controlType),
-
new CodePrimitiveExpression (skinId));
+					fld.InitExpression = new
CodeMethodInvokeExpression (
+						new
CodeTypeReferenceExpression (typeof (PageTheme)),
+						"CreateSkinKey",
+						new CodeTypeOfExpression
(controlType),
+						new
CodePrimitiveExpression (skinId));
 
 					mainClass.Members.Add (fld);
 				}
@@ -229,7 +243,7 @@
 		}
 
 		protected override void CreateConstructor
(CodeStatementCollection localVars,
-
CodeStatementCollection trueStmt)
+
CodeStatementCollection trueStmt)
 		{
 			ControlBuilder builder = parser.RootBuilder;
 
@@ -237,12 +251,16 @@
 				foreach (object o in builder.Children) {
 					if (o is string) /* literal
stuff gets ignored */
 						continue;
-
+					if (o is CodeRenderBuilder)
+						continue;
+					
 					ControlBuilder b =
(ControlBuilder) o;
+					Type controlType =
b.ControlType;
+					if (controlType == null)
+						continue;
 
 					string id = b.ID;
-					Type controlType =
b.ControlType;
-
+					
 					if (localVars == null)
 						localVars = new
CodeStatementCollection ();
 

Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/ThemeDirectoryCompiler
.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Compilation/ThemeDirectoryCompiler
.cs	2007-03-05 12:58:16 UTC (rev 73706)
+++
trunk/mcs/class/System.Web/System.Web.Compilation/ThemeDirectoryCompiler
.cs	2007-03-05 13:58:16 UTC (rev 73707)
@@ -49,7 +49,7 @@
 				throw new HttpException (String.Format
("Theme '{0}' cannot be found in the application or global theme
directories.", theme));
 			string [] skin_files = Directory.GetFiles
(physicalPath, "*.skin");
 
-			PageThemeParser ptp = new PageThemeParser
(physicalPath, context);
+			PageThemeParser ptp = new PageThemeParser
(virtualPath, context);
 			
 			string[] css_files = Directory.GetFiles
(physicalPath, "*.css");
 			string[] css_urls = new
string[css_files.Length];

Modified: trunk/mcs/class/System.Web/System.Web.Util/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Util/ChangeLog
2007-03-05 12:58:16 UTC (rev 73706)
+++ trunk/mcs/class/System.Web/System.Web.Util/ChangeLog
2007-03-05 13:58:16 UTC (rev 73707)
@@ -1,3 +1,8 @@
+2007-03-05  Marek Habersack  <mhabersack at novell.com>
+
+	* UrlUtils.cs: Make sure GetDirectory returns a directory with
the
+	trailing slash.
+
 2007-01-30  Adar Wesley <adarw at mainsoft.com>
 
 	* UrlUtils.cs: fixed GetFile to throw right exception

Modified: trunk/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
2007-03-05 12:58:16 UTC (rev 73706)
+++ trunk/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
2007-03-05 13:58:16 UTC (rev 73707)
@@ -183,6 +183,8 @@
 			int last = url.LastIndexOf ('/');
 
 			if (last > 0) {
+				if (last + 1 == url.Length)
+					last++;
 #if NET_2_0
 				return RemoveDoubleSlashes
(url.Substring (0, last));
 #else

_______________________________________________
Mono-patches maillist  -  Mono-patches at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches



More information about the Mono-devel-list mailing list