myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r809783 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
Date Tue, 01 Sep 2009 00:18:55 GMT
Author: jwaldman
Date: Tue Sep  1 00:18:54 2009
New Revision: 809783

URL: http://svn.apache.org/viewvc?rev=809783&view=rev
Log:
TRINIDAD-1561 compressed style class map can yield corrupted css file

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?rev=809783&r1=809782&r2=809783&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
Tue Sep  1 00:18:54 2009
@@ -627,7 +627,8 @@
   }
 
   /**
-   * Returns the StyleSheetDocument, parsing the source file if necessary
+   * Returns the StyleSheetDocument, parsing the source file if necessary.
+   * This does not use the StyleContext
    */
   private StyleSheetDocument _getStyleSheetDocument(StyleContext context)
   {
@@ -638,6 +639,10 @@
       return document;
 
     // Otherwise, we create the StyleSheetDocument now
+    // Note, it does not use the StyleContext. This is the StyleSheetDocument
+    // for the entire skin document, so it includes all the specific rules
+    // like @agent ie and @agent gecko, etc. It's later that we output
+    // the css based on the StyleContext.
     document = createStyleSheetDocument(context);
 
     // If we weren't able to create the StyleSheetDocument,
@@ -1063,8 +1068,14 @@
     Map<String, String> map = new HashMap<String, String>();
 
     assert (document != null);
-
-    Iterator<StyleSheetNode> styleSheets = document.getStyleSheets(context);
+    // get all the styleSheets to create the shortened style class map
+    // if we only got the ones based on the StyleContext, then we'd have
+    // to create a shortened map for each StyleContext we receive and cache it.
+    // it's more straightforward, faster, and requires less memory to get
+    // all the styleSheets and create the shortened style class map. There might
+    // be some styles in the map that have no properties in another StyleContext,
+    // but that's ok. It doesn't hurt.
+    Iterator<StyleSheetNode> styleSheets = document.getStyleSheets();
     assert (styleSheets != null);
 
     Set<String> emptySelectors = new HashSet<String>();



Mime
View raw message