flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-33897 MediaQueryParser memory use improvements
Date Sun, 29 Dec 2013 00:42:43 GMT
Updated Branches:
  refs/heads/develop 8704b7774 -> 03680f5b0


FLEX-33897 MediaQueryParser memory use improvements


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/03680f5b
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/03680f5b
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/03680f5b

Branch: refs/heads/develop
Commit: 03680f5b0034c324f6014b1af724e35afb98506d
Parents: 8704b77
Author: Justin Mclean <jmclean@apache.org>
Authored: Sun Dec 29 11:38:47 2013 +1100
Committer: Justin Mclean <jmclean@apache.org>
Committed: Sun Dec 29 11:38:47 2013 +1100

----------------------------------------------------------------------
 .../framework/src/mx/utils/MediaQueryParser.as  | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/03680f5b/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as b/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
index 9308e69..3b6832b 100644
--- a/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
+++ b/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
@@ -132,15 +132,20 @@ public class MediaQueryParser
     {
         // remove whitespace
         expression = StringUtil.trim(expression);
-        // force to lower case cuz case-insensitive
-        expression = expression.toLowerCase();
-        
+       
         // degenerate expressions
         if (expression == "") return true;
-        if (expression == "all") return true;
-
+        
+        // known queries
         if (goodQueries[expression]) return true;
         if (badQueries[expression]) return false;
+                
+        // force to lower case cuz case-insensitive
+        var originalExpression:String = expression;
+        expression = expression.toLowerCase();
+        
+        //TODO : be smart and do not do a lowercase to do this test
+        if (expression == "all") return true;
         
         // get a list of queries.  If any pass then
         // we're good
@@ -170,7 +175,7 @@ public class MediaQueryParser
             {
                 if (numExpressions == 1 && !notFlag)
                 {
-                    goodQueries[expression] = true;
+                    goodQueries[originalExpression] = true;
                     return true;                                            
                 }
                 // bail if "and" and no media features (invalid query)
@@ -183,7 +188,7 @@ public class MediaQueryParser
                 // early exit if it returned true;
                 if ((result && !notFlag) || (!result && notFlag))
                 {
-                    goodQueries[expression] = true;
+                    goodQueries[originalExpression] = true;
                     return true;                    
                 }
             }
@@ -191,11 +196,11 @@ public class MediaQueryParser
             // then we match
             else if (notFlag)
             {
-                goodQueries[expression] = true;                
+                goodQueries[originalExpression] = true;                
                 return true;
             }
         }
-        badQueries[expression] = true;
+        badQueries[originalExpression] = true;
         return false;
     }
     


Mime
View raw message