You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/10/31 22:27:38 UTC
[royale-asjs] 03/09: get styles to work with ValuesManager
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 451d2ac616912f2c2f4d6292fad5318cceb6e1d4
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Oct 31 15:23:13 2018 -0700
get styles to work with ValuesManager
---
.../main/royale/mx/styles/CSSStyleDeclaration.as | 30 +++++++++++++++++++++-
.../src/main/royale/mx/styles/StyleManagerImpl.as | 17 ++++++------
2 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/styles/CSSStyleDeclaration.as b/frameworks/projects/MXRoyale/src/main/royale/mx/styles/CSSStyleDeclaration.as
index 470358e..d332c83 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/styles/CSSStyleDeclaration.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/styles/CSSStyleDeclaration.as
@@ -34,6 +34,7 @@ import mx.utils.ObjectUtil;
use namespace mx_internal;
*/
import org.apache.royale.events.EventDispatcher;
+import org.apache.royale.core.ValuesManager;
/**
* The CSSStyleDeclaration class represents a set of CSS style rules.
@@ -248,7 +249,14 @@ public class CSSStyleDeclaration extends EventDispatcher
o = new defaultFactory();
}
}
- v = o[styleProp];
+ if (o != null)
+ {
+ v = o[styleProp];
+ if (v !== undefined)
+ return v;
+ }
+ var values:Object = ValuesManager.valuesImpl["values"]; // assume AllCSSValuesImpl
+
return v;
}
@@ -285,6 +293,26 @@ public class CSSStyleDeclaration extends EventDispatcher
o[styleProp] = newValue;
}
+ private var _name:String;
+
+ public function set name(value:String):void
+ {
+ _name = value;
+ o = ValuesManager.valuesImpl["values"][value]; // assume AllCSSValuesImpl
+ if (o == null)
+ {
+ if (defaultFactory != null)
+ {
+ defaultFactory.prototype = {};
+ o = new defaultFactory();
+ }
+ else
+ o = {};
+
+ ValuesManager.valuesImpl["values"][value] = o;
+ }
+ }
+
}
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/styles/StyleManagerImpl.as b/frameworks/projects/MXRoyale/src/main/royale/mx/styles/StyleManagerImpl.as
index fb549c7..583ab8b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/styles/StyleManagerImpl.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/styles/StyleManagerImpl.as
@@ -36,16 +36,11 @@ import flash.utils.describeType;
import mx.core.FlexVersion;
import mx.core.IFlexModuleFactory;
import mx.core.mx_internal;
-//import mx.events.FlexChangeEvent;
import mx.events.ModuleEvent;
-//import mx.events.Request;
-//import mx.events.StyleEvent;
import mx.managers.ISystemManager;
import mx.managers.SystemManagerGlobals;
import mx.modules.IModuleInfo;
import mx.modules.ModuleManager;
-//import mx.resources.IResourceManager;
-//import mx.resources.ResourceManager;
import mx.styles.IStyleManager2;
//import mx.styles.IStyleModule;
//import mx.utils.MediaQueryParser;
@@ -954,7 +949,6 @@ public class StyleManagerImpl extends EventDispatcher implements IStyleManager2
*/
public function getStyleDeclaration(selector:String):CSSStyleDeclaration
{
- trace("getStyleDeclaration not implemented");
/*
// For Flex 3 and earlier, if we were passed a selector with a package
// name, such as "mx.controls.Button", strip off the package name
@@ -971,7 +965,13 @@ public class StyleManagerImpl extends EventDispatcher implements IStyleManager2
return _selectors[selector];
*/
- return null;
+ if (_selectors[selector] == null)
+ {
+ var styles:CSSStyleDeclaration = new CSSStyleDeclaration();
+ styles.name = selector;
+ _selectors[selector] = styles;
+ }
+ return _selectors[selector];
}
/**
@@ -1079,8 +1079,6 @@ public class StyleManagerImpl extends EventDispatcher implements IStyleManager2
styleDeclaration:CSSStyleDeclaration,
update:Boolean):void
{
- trace("setStyleDeclaration not implemented");
-
/*
// For Flex 3 and earlier, if we were passed a selector with a package
// name, such as "mx.controls.Button", strip off the package name
@@ -1183,6 +1181,7 @@ public class StyleManagerImpl extends EventDispatcher implements IStyleManager2
if (update)
styleDeclarationsChanged();
*/
+ _selectors[selector] = styleDeclaration;
}
/**