From adffaces-commits-return-659-apmail-incubator-adffaces-commits-archive=incubator.apache.org@incubator.apache.org Wed Aug 16 20:37:18 2006 Return-Path: Delivered-To: apmail-incubator-adffaces-commits-archive@locus.apache.org Received: (qmail 42040 invoked from network); 16 Aug 2006 20:37:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Aug 2006 20:37:18 -0000 Received: (qmail 77418 invoked by uid 500); 16 Aug 2006 20:37:17 -0000 Delivered-To: apmail-incubator-adffaces-commits-archive@incubator.apache.org Received: (qmail 77401 invoked by uid 500); 16 Aug 2006 20:37:17 -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 77391 invoked by uid 99); 16 Aug 2006 20:37:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2006 13:37:17 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2006 13:37:16 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 6A3BD1A981D; Wed, 16 Aug 2006 13:36:56 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r432026 - /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java Date: Wed, 16 Aug 2006 20:36:56 -0000 To: adffaces-commits@incubator.apache.org From: jwaldman@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060816203656.6A3BD1A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jwaldman Date: Wed Aug 16 13:36:55 2006 New Revision: 432026 URL: http://svn.apache.org/viewvc?rev=432026&view=rev Log: fix for ADFFACES-136 skinning css generator fails to generate "af|foo::pseudo-element.StyleClass" css style correctly Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java?rev=432026&r1=432025&r2=432026&view=diff ============================================================================== --- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java (original) +++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java Wed Aug 16 13:36:55 2006 @@ -834,6 +834,8 @@ * if I see this: af|foo:p-class.StyleClass::element, return this: * 'af|foo:p-class.StyleClass' 'af|foo::element' * af|foo.StyleClass::element -> 'af|foo.StyleClass' 'af|foo::element' + * If I see thiss: af|foo::p-element.StyleClass, return this + * af|foo::p-element.StyleClass (leave alone). */ private static String[] _orderPseudoElementsAndClasses( String[] input, @@ -854,29 +856,34 @@ int indexOfDoubleColon = input[i].indexOf("::"); if (indexOfDoubleColon == -1) { - // no double colon + // no double colon (aka pseudo-element) output.add(input[i]); } else { - // you have a double colon. - int indexOfColon = input[i].indexOf(':'); - if (indexOfColon == indexOfDoubleColon) - indexOfColon = -1; + // you have a double colon index. Now look to see if we need to + // reorder. We have to reorder if the pseudo-element comes after + // the pseudo-class or composite style classes. + int indexOfFirstColon = input[i].indexOf(':'); int indexOfDot = input[i].indexOf('.'); - if ((indexOfColon >= indexOfDoubleColon && - indexOfDot >= indexOfDoubleColon) || - (indexOfColon == -1 && indexOfDot == -1)) + + boolean pseudoClassBeforePseudoElement = + (indexOfFirstColon < indexOfDoubleColon); + boolean styleClassBeforePseudoElement = + (indexOfDot != -1 && indexOfDot < indexOfDoubleColon); + + if (!(pseudoClassBeforePseudoElement || + styleClassBeforePseudoElement)) { - // colon and styleClasses are after double colon - // OR there are no colons and styleClasses. - output.add(input[i]); - } + output.add(input[i]); + } else { - int indexOfClass = Math.min(indexOfColon, indexOfDot); + if (indexOfFirstColon == indexOfDoubleColon) + indexOfFirstColon = -1; + int indexOfClass = Math.min(indexOfFirstColon, indexOfDot); if (indexOfClass == -1) - indexOfClass = Math.max(indexOfColon, indexOfDot); + indexOfClass = Math.max(indexOfFirstColon, indexOfDot); // we have the condition where pseudo-class or styleClass is before // pseudo-element: af|foo:psdo-class::psdo-element