You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2013/11/25 07:59:20 UTC
[10/18] git commit: [flex-asjs] [refs/heads/develop] - add limited
media query check for -flex-flash. More MQ processing needed eventually
add limited media query check for -flex-flash. More MQ processing needed eventually
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d63b447b
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d63b447b
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d63b447b
Branch: refs/heads/develop
Commit: d63b447b614c8ac83aebccf34150e1fafb7c2d07
Parents: 6f00f48
Author: Alex Harui <ah...@apache.org>
Authored: Fri Nov 22 09:37:39 2013 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Nov 22 09:37:39 2013 -0800
----------------------------------------------------------------------
.../org/apache/flex/core/SimpleCSSValuesImpl.as | 44 ++++++++++++++++----
1 file changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d63b447b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
index 6f9ad06..ce14fb3 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -19,12 +19,12 @@
package org.apache.flex.core
{
import flash.system.ApplicationDomain;
+ import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;
import flash.utils.getQualifiedSuperclassName;
- import flash.utils.getDefinitionByName;
- import org.apache.flex.events.ValueChangeEvent;
import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.ValueChangeEvent;
public class SimpleCSSValuesImpl extends EventDispatcher implements IValuesImpl
{
@@ -113,6 +113,18 @@ package org.apache.flex.core
}
}
*/
+ var mq:String = null;
+ var o:Object;
+ if (i < n - 2)
+ {
+ // peek ahead to see if there is a media query
+ if (arr[i + 1] == CSSClass.CSSMediaQuery)
+ {
+ mq = arr[i + 2];
+ i += 2;
+ declarationName = mq + "_" + declarationName;
+ }
+ }
var finalName:String;
var valuesFunction:Function;
var valuesObject:Object;
@@ -120,15 +132,16 @@ package org.apache.flex.core
{
valuesFunction = factoryFunctions[declarationName];
valuesObject = new valuesFunction();
- finalName = fixNames(declarationName);
- values[finalName] = valuesObject;
}
else
{
valuesFunction = factoryFunctions[declarationName];
valuesObject = new valuesFunction();
- var o:Object = values[declarationName];
- finalName = fixNames(declarationName);
+ }
+ if (isValidStaticMediaQuery(mq))
+ {
+ finalName = fixNames(declarationName, mq);
+ o = values[finalName];
if (o == null)
values[finalName] = valuesObject;
else
@@ -143,8 +156,24 @@ package org.apache.flex.core
}
- private function fixNames(s:String):String
+ private function isValidStaticMediaQuery(mq:String):Boolean
+ {
+ if (mq == null)
+ return true;
+
+ if (mq == "-flex-flash")
+ return true;
+
+ // TODO: (aharui) other media query
+
+ return false;
+ }
+
+ private function fixNames(s:String, mq:String):String
{
+ if (mq != null)
+ s = s.substr(mq.length + 1); // 1 more for the hyphen
+
if (s == "")
return "*";
@@ -285,6 +314,7 @@ class CSSClass
public static const CSSSelector:int = 0;
public static const CSSCondition:int = 1;
public static const CSSStyleDeclaration:int = 2;
+ public static const CSSMediaQuery:int = 3;
}
class CSSFactory