This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 5ecccdb39e don't use vector
5ecccdb39e is described below

commit 5ecccdb39e6463f6f51f93884b193d32fd1fc7db
Author: Harbs <[email protected]>
AuthorDate: Wed Mar 18 23:18:26 2026 +0200

    don't use vector
---
 .../main/royale/org/apache/royale/style/StyleUIBase.as  |  2 +-
 .../org/apache/royale/style/stylebeads/LeafStyleBase.as |  8 ++++----
 .../apache/royale/style/stylebeads/states/PeerPseudo.as |  8 +++++---
 .../org/apache/royale/style/util/AnimationManager.as    |  3 ++-
 .../royale/org/apache/royale/style/util/StyleManager.as |  8 ++++----
 .../royale/org/apache/royale/style/util/ThemeManager.as | 17 +++++++++++------
 .../src/test/royale/flexUnitTests/StyleManagerTest.as   |  2 +-
 7 files changed, 28 insertions(+), 20 deletions(-)

diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
index cbac1b6209..6fe7553d9c 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
@@ -111,7 +111,7 @@ package org.apache.royale.style
                 */
                public var styleBeads:Array;
 
-               protected var _styleBeads:Vector.<IStyleBead> = new 
Vector.<IStyleBead>();
+               protected var _styleBeads:Array = [];
                /**
                 * @royaleignorecoercion 
org.apache.royale.style.stylebeads.IStyleBead
                 */
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as
index 697b2c7785..9db0c0ec76 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/LeafStyleBase.as
@@ -177,13 +177,13 @@ package org.apache.royale.style.stylebeads
                        /**
                         * Always add the rule automatically when accessing the 
selector if needed.
                         */
-                       var selectorForRule:String = rulePrefix + 
normalizeSelector(selector) + ruleSuffix;
-                       if (!StyleManager.hasStyle(selectorForRule))
+                       if (!StyleManager.hasStyle(selector))
                        {
+                               var selectorForRule:String = rulePrefix + 
normalizeSelector(selector) + ruleSuffix;
                                if(parentQueryId)
-                                       
StyleManager.addGroupedRule(parentQueryId, selectorForRule, getRule());
+                                       
StyleManager.addGroupedRule(parentQueryId, selector, selectorForRule, 
getRule());
                                else
-                                       StyleManager.addStyle(selectorForRule, 
getRule());
+                                       StyleManager.addStyle(selector, 
selectorForRule, getRule());
                        }
 
                        return selector;
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/PeerPseudo.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/PeerPseudo.as
index 7d8dc00494..7e26899251 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/PeerPseudo.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/states/PeerPseudo.as
@@ -38,9 +38,11 @@ package org.apache.royale.style.stylebeads.states
                        style.selectorPrefix = selectorDecorator + 
style.selectorPrefix;
 
                        //TODO figure out more complex combinations. For now, 
just handle limited nesting.
-                       var decorationStr:String = 
decorations.map(function(decoration:StyleDecoration, index:int, 
arr:Array):String{
-                               return decoration.decoration;
-                       }).join("");
+                       var decorationStr:String = ""
+                       for each(var decoration:StyleDecoration in decorations)
+                       {
+                               decorationStr += decoration.decoration;
+                       }
                        
                        decorations.push(new StyleDecoration(decoratorType, 
ruleDecorator));
                        style.rulePrefix = "." + ruleDecorator + decorationStr 
+ " ~ " + style.rulePrefix;
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/AnimationManager.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/AnimationManager.as
index 7e9d8454b1..c2d4192833 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/AnimationManager.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/AnimationManager.as
@@ -41,7 +41,8 @@ package org.apache.royale.style.util
                                keyframeSet.add(name);
                                // Should we check that it's not being added 
twice?
                                // Shouldn't be necessary unless something went 
wrong...
-                               StyleManager.addStyle("@keyframes " + name, 
keyframes.join("\n"));
+                               var selector:String = "@keyframes " + name;
+                               StyleManager.addStyle(selector, selector, 
keyframes.join("\n"));
                        }
                }
 
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleManager.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleManager.as
index 131f0d46d2..bb3c282c17 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleManager.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/StyleManager.as
@@ -37,13 +37,13 @@ package org.apache.royale.style.util
                        }
                        return false;
                }
-               public static function addStyle(selector:String, 
rule:String):void
+               public static function addStyle(selector:String, 
normalizedSelector:String, rule:String):void
                {
                        COMPILE::JS
                        {
                                assert(!styleList.has(selector), "Style " + 
selector + " already exists");
                                styleList.add(selector);
-                               addRule(selector, rule);
+                               addRule(normalizedSelector, rule);
                        }
                }
 
@@ -121,7 +121,7 @@ package org.apache.royale.style.util
                                }
                        }
                }
-               public static function addGroupedRule(identifier:String, 
selector:String, rule:String):void
+               public static function addGroupedRule(identifier:String, 
selector:String, normalizedSelector:String, rule:String):void
                {
                        COMPILE::JS
                        {
@@ -130,7 +130,7 @@ package org.apache.royale.style.util
                                // TODO remove this once we have 
CSSGroupingRule in the typedefs
                                var fakeType:CSSStyleSheet = toGroup as 
CSSStyleSheet;
                                var len:int = fakeType.cssRules.length;
-                               fakeType.insertRule(selector + "{" + rule + 
"}", len);
+                               fakeType.insertRule(normalizedSelector + "{" + 
rule + "}", len);
                                styleList.add(selector);
                        }
                }
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ThemeManager.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ThemeManager.as
index 2f1b408bd1..5b0df2baa6 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ThemeManager.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/ThemeManager.as
@@ -38,11 +38,16 @@ package org.apache.royale.style.util
                                // Set css preflight defaults. These are the 
same as Tailwind's preflight defaults.
                                // See https://tailwindcss.com/docs/preflight 
for more details.
                                //TODO make this more PAYG
-                               StyleManager.addStyle("img, svg, video, canvas, 
audio, iframe, embed, object", "display: block; vertical-align: middle;")
-                               StyleManager.addStyle("img, video", "max-width: 
100%; height: auto;");
-                               StyleManager.addStyle(":host, html", 
'line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 
4; font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", 
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-feature-settings: 
normal; font-variation-settings: normal; -webkit-tap-highlight-color: 
transparent');
-                               StyleManager.addStyle("body", 'margin: 0; 
line-height: inherit;');
-                               StyleManager.addStyle("code, kbd, pre, samp", 
'font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 
"Liberation Mono", "Courier New", monospace; font-feature-settings: normal; 
font-variation-settings: normal; font-size: 1em');
+                               var sel:String = "img, svg, video, canvas, 
audio, iframe, embed, object";
+                               StyleManager.addStyle(sel, sel, "display: 
block; vertical-align: middle;");
+                               sel = "img, video";
+                               StyleManager.addStyle(sel, sel, "max-width: 
100%; height: auto;");
+                               sel = ":host, html";
+                               StyleManager.addStyle(sel, sel, 'line-height: 
1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; 
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe 
UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-feature-settings: 
normal; font-variation-settings: normal; -webkit-tap-highlight-color: 
transparent');
+                               sel = "body";
+                               StyleManager.addStyle(sel, sel, 'margin: 0; 
line-height: inherit;');
+                               sel = "code, kbd, pre, samp";
+                               StyleManager.addStyle(sel, sel, 'font-family: 
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", 
"Courier New", monospace; font-feature-settings: normal; 
font-variation-settings: normal; font-size: 1em');
 
                        }
 
@@ -59,7 +64,7 @@ package org.apache.royale.style.util
                }
                COMPILE::JS
                private var themeSet:Map = new Map();
-               private var themes:Vector.<StyleTheme> = new 
Vector.<StyleTheme>();
+               private var themes:Array = [];
                public function registerTheme(theme:StyleTheme):void
                {
                        COMPILE::JS
diff --git 
a/frameworks/projects/Style/src/test/royale/flexUnitTests/StyleManagerTest.as 
b/frameworks/projects/Style/src/test/royale/flexUnitTests/StyleManagerTest.as
index ba069063c9..8d33bf0c96 100644
--- 
a/frameworks/projects/Style/src/test/royale/flexUnitTests/StyleManagerTest.as
+++ 
b/frameworks/projects/Style/src/test/royale/flexUnitTests/StyleManagerTest.as
@@ -50,7 +50,7 @@ package flexUnitTests
                        COMPILE::JS
                        {
                                assertFalse(StyleManager.hasStyle(".foo"));
-                               StyleManager.addStyle(".foo", "display:flex;");
+                               StyleManager.addStyle(".foo", ".foo", 
"display:flex;");
                                assertTrue(StyleManager.hasStyle(".foo"));
                        }
                }

Reply via email to