From adffaces-commits-return-2009-apmail-incubator-adffaces-commits-archive=incubator.apache.org@incubator.apache.org Fri Feb 09 16:24:16 2007 Return-Path: Delivered-To: apmail-incubator-adffaces-commits-archive@locus.apache.org Received: (qmail 443 invoked from network); 9 Feb 2007 16:24:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2007 16:24:16 -0000 Received: (qmail 85666 invoked by uid 500); 9 Feb 2007 16:24:23 -0000 Delivered-To: apmail-incubator-adffaces-commits-archive@incubator.apache.org Received: (qmail 85654 invoked by uid 500); 9 Feb 2007 16:24:23 -0000 Mailing-List: contact adffaces-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: adffaces-dev@incubator.apache.org Delivered-To: mailing list adffaces-commits@incubator.apache.org Received: (qmail 85645 invoked by uid 99); 9 Feb 2007 16:24:23 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 08:24:23 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 08:24:15 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AE02A1A981A; Fri, 9 Feb 2007 08:23:55 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r505349 - in /incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/StyleContextImpl.java style/StyleContext.java style/cache/FileSystemStyleCache.java Date: Fri, 09 Feb 2007 16:23:55 -0000 To: adffaces-commits@incubator.apache.org From: jwaldman@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070209162355.AE02A1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jwaldman Date: Fri Feb 9 08:23:54 2007 New Revision: 505349 URL: http://svn.apache.org/viewvc?view=rev&rev=505349 Log: merged in 505034 I changed my implementation for http://issues.apache.org/jira/browse/ADFFACES-370 (Need to avoid IE's number of CSS selectors limitation ) AGAIN In Skin's getStyleClassMap(RenderingContext) we get the StyleContext from the RenderingContext. This is fine, but the problem I found is that from FileSystemStyleCache the StyleContext is not yet set up on the RenderingContext, so calling getStyleContext caused it to run through all the code that processes all the skin files again (they are cached, so it doesn't get stuck in a loop). Still, this is obviously not good. If we could pass StyleContext to getStyleClassMap, then that would be good, but StyleContext is not in the public api. That's why we pass in RenderingContext. The change I made was to go back to looking to see if the skin's renderKitId is portlet. We don't compress if portlet. Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?view=diff&rev=505349&r1=505348&r2=505349 ============================================================================== --- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java (original) +++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java Fri Feb 9 08:23:54 2007 @@ -80,11 +80,6 @@ return ((CoreRenderingContext) _arc).getTrinidadAgent(); } - public Skin getSkin() - { - return ((CoreRenderingContext) _arc).getSkin(); - } - public boolean checkStylesModified() { // =-=AEW Expose a configuration option if this Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java?view=diff&rev=505349&r1=505348&r2=505349 ============================================================================== --- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java (original) +++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java Fri Feb 9 08:23:54 2007 @@ -41,7 +41,6 @@ * Returns the end user's Agent. */ public TrinidadAgent getAgent(); - public Skin getSkin(); public String getGeneratedFilesPath(); public boolean checkStylesModified(); Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?view=diff&rev=505349&r1=505348&r2=505349 ============================================================================== --- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java (original) +++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java Fri Feb 9 08:23:54 2007 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -50,6 +50,8 @@ import org.apache.myfaces.trinidadinternal.share.io.NameResolver; import org.apache.myfaces.trinidad.context.LocaleContext; import org.apache.myfaces.trinidad.context.RenderingContext; +import org.apache.myfaces.trinidad.skin.Skin; +import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit; import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.StyleSheetRenderer; import org.apache.myfaces.trinidadinternal.share.xml.JaxpXMLProvider; import org.apache.myfaces.trinidadinternal.share.xml.XMLProvider; @@ -438,6 +440,7 @@ return entry; // If we didn't find an entry in the cache, create a new entry + // This generates the CSS file. return _createEntry(context, document, cache, @@ -706,15 +709,18 @@ // Write out the style sheet // First figure out whether or not we need to compress the style classes. // We don't compress the style classes if the content compression flag is disabled or - // if the skin's styleClassMap does not match our shortStyleClassMap. - - Map skinsStyleClassMap = context.getSkin().getStyleClassMap( - RenderingContext.getCurrentInstance()); - String disableContentCompression = - FacesContext.getCurrentInstance().getExternalContext(). - getInitParameter(StyleSheetRenderer.DISABLE_CONTENT_COMPRESSION); - boolean compressStyles = (skinsStyleClassMap == shortStyleClassMap) && - !"true".equals(disableContentCompression); + // if the skin is a portlet skin. + String disableContentCompression = + FacesContext.getCurrentInstance().getExternalContext(). + getInitParameter(StyleSheetRenderer.DISABLE_CONTENT_COMPRESSION); + // we do not compress if it is a portlet skin + Skin skin = RenderingContext.getCurrentInstance().getSkin(); + boolean isPortletSkin = + CoreRenderKit.OUTPUT_MODE_PORTLET.equals(skin.getRenderKitId()); + + boolean compressStyles = (!"true".equals(disableContentCompression)) && + !isPortletSkin; + CSSGenerationUtils.writeCSS(context, styles, @@ -942,7 +948,7 @@ String styleClass = selector.substring(1); if (!map.containsKey(styleClass)) map.put(styleClass, _getShortStyleClass(map.size())); - + if (style.isEmpty()) emptySelectors.add(styleClass); else @@ -958,17 +964,17 @@ while (styleClasses.hasNext()) { String styleClass = styleClasses.next(); - + if (!map.containsKey(styleClass)) map.put(styleClass, _getShortStyleClass(map.size())); - + // Don't remove any styleclass that is referred to nonEmptySelectors.add(styleClass); } } - + int length = namespacePrefixes.length; - + for (int i=0; i < length; i++) { String nsPrefix = namespacePrefixes[i]; @@ -982,7 +988,7 @@ while (afSelectors.hasNext()) { String styleClass = afSelectors.next(); - + if (!map.containsKey(styleClass)) map.put(styleClass, _getShortStyleClass(map.size())); if (isFirst && !afSelectors.hasNext() && style.isEmpty()) @@ -993,7 +999,7 @@ { nonEmptySelectors.add(styleClass); } - + isFirst = false; } }