You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2026/02/24 19:49:37 UTC

(royale-asjs) branch develop updated: border and outline

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 63d7f28dda border and outline
63d7f28dda is described below

commit 63d7f28dda8c906a895108768b5e0efff4d23ac8
Author: Harbs <ha...@in-tools.com>
AuthorDate: Tue Feb 24 21:49:31 2026 +0200

    border and outline
---
 .../royale/style/stylebeads/border/BorderColor.as  | 21 ++++++++++---
 .../border/{BorderColor.as => BorderStyle.as}      | 17 +++-------
 .../border/{BorderColor.as => OutlineColor.as}     | 27 +++++++++++-----
 .../border/{BorderColor.as => OutlineOffset.as}    | 24 +++++++--------
 .../border/{BorderColor.as => OutlineStyle.as}     | 26 ++++++++--------
 .../border/{BorderColor.as => OutlineWidth.as}     | 36 ++++++++++++++--------
 6 files changed, 90 insertions(+), 61 deletions(-)

diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
index edc6832057..dc74afe203 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
@@ -33,11 +33,22 @@ package org.apache.royale.style.stylebeads.background
 		 */
 		override public function set value(value:*):void
 		{
-			assert(value is ColorPair, "The value must be a ColorPair: " + value);
-			_value = value;
-			var pair:ColorPair = value as ColorPair;
-			calculatedRuleValue = pair.value;
-			calculatedSelector = pair.name;
+			calculatedSelector = calculatedRuleValue = _value = value;
+			switch(value)
+			{
+				case "inherit":
+				case "transparent":
+					return;
+				case "currentColor":
+					calculatedSelector = "current";
+					return;
+				default:
+					assert(value is ColorPair, "The value must be a ColorPair: " + value);
+					var pair:ColorPair = value as ColorPair;
+					calculatedRuleValue = pair.value;
+					calculatedSelector = pair.name;
+					return;
+			}
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderStyle.as
similarity index 72%
copy from frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
copy to frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderStyle.as
index edc6832057..46575bc752 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderStyle.as
@@ -20,24 +20,17 @@ package org.apache.royale.style.stylebeads.background
 {
 	import org.apache.royale.style.stylebeads.SingleStyleBase;
 	import org.apache.royale.debugging.assert;
-	import org.apache.royale.style.colors.ColorPair;
 
-	public class BorderColor extends SingleStyleBase
+	public class BorderStyle extends SingleStyleBase
 	{
-		public function BorderColor()
+		public function BorderStyle()
 		{
-			super("border", "border-color");
+			super("border", "border-style");
 		}
-		/**
-		 * @royaleignorecoercion org.apache.royale.style.colors.ColorPair
-		 */
 		override public function set value(value:*):void
 		{
-			assert(value is ColorPair, "The value must be a ColorPair: " + value);
-			_value = value;
-			var pair:ColorPair = value as ColorPair;
-			calculatedRuleValue = pair.value;
-			calculatedSelector = pair.name;
+			assert(["solid","dashed","dotted","double","hidden","none"].indexOf(value) >= 0, "The value must be a valid border style: " + value);
+			calculatedSelector = calculatedRuleValue = _value = value;
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
similarity index 70%
copy from frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
copy to frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
index edc6832057..e70e09bebb 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineColor.as
@@ -22,22 +22,33 @@ package org.apache.royale.style.stylebeads.background
 	import org.apache.royale.debugging.assert;
 	import org.apache.royale.style.colors.ColorPair;
 
-	public class BorderColor extends SingleStyleBase
+	public class OutlineColor extends SingleStyleBase
 	{
-		public function BorderColor()
+		public function OutlineColor()
 		{
-			super("border", "border-color");
+			super("outline", "outline-color");
 		}
 		/**
 		 * @royaleignorecoercion org.apache.royale.style.colors.ColorPair
 		 */
 		override public function set value(value:*):void
 		{
-			assert(value is ColorPair, "The value must be a ColorPair: " + value);
-			_value = value;
-			var pair:ColorPair = value as ColorPair;
-			calculatedRuleValue = pair.value;
-			calculatedSelector = pair.name;
+			calculatedSelector = calculatedRuleValue = _value = value;
+			switch(value)
+			{
+				case "inherit":
+				case "transparent":
+					return;
+				case "currentColor":
+					calculatedSelector = "current";
+					return;
+				default:
+					assert(value is ColorPair, "The value must be a ColorPair: " + value);
+					var pair:ColorPair = value as ColorPair;
+					calculatedRuleValue = pair.value;
+					calculatedSelector = pair.name;
+					return;
+			}
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineOffset.as
similarity index 71%
copy from frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
copy to frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineOffset.as
index edc6832057..4beac54407 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineOffset.as
@@ -18,26 +18,26 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.style.stylebeads.background
 {
+
 	import org.apache.royale.style.stylebeads.SingleStyleBase;
-	import org.apache.royale.debugging.assert;
-	import org.apache.royale.style.colors.ColorPair;
 
-	public class BorderColor extends SingleStyleBase
+	public class OutlineOffset extends SingleStyleBase
 	{
-		public function BorderColor()
+		public function OutlineOffset()
 		{
-			super("border", "border-color");
+			super("outline-offset", "outline-offset");
 		}
-		/**
-		 * @royaleignorecoercion org.apache.royale.style.colors.ColorPair
-		 */
+		private var savedPrefix:String;
 		override public function set value(value:*):void
 		{
-			assert(value is ColorPair, "The value must be a ColorPair: " + value);
+			var numVal:Number = parseFloat(value);
+			var negative:Boolean = numVal < 0;
+			if(!savedPrefix)
+				savedPrefix = selectorPrefix;
+			_selectorPrefix = negative ? "-" + savedPrefix : savedPrefix;
 			_value = value;
-			var pair:ColorPair = value as ColorPair;
-			calculatedRuleValue = pair.value;
-			calculatedSelector = pair.name;
+			calculatedRuleValue = value;
+			calculatedSelector = sanitizeSelector(value);
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineStyle.as
similarity index 68%
copy from frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
copy to frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineStyle.as
index edc6832057..b1e5b22d4a 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineStyle.as
@@ -20,24 +20,26 @@ package org.apache.royale.style.stylebeads.background
 {
 	import org.apache.royale.style.stylebeads.SingleStyleBase;
 	import org.apache.royale.debugging.assert;
-	import org.apache.royale.style.colors.ColorPair;
 
-	public class BorderColor extends SingleStyleBase
+	public class OutlineStyle extends SingleStyleBase
 	{
-		public function BorderColor()
+		public function OutlineStyle()
 		{
-			super("border", "border-color");
+			super("outline", "outline-style");
 		}
-		/**
-		 * @royaleignorecoercion org.apache.royale.style.colors.ColorPair
-		 */
 		override public function set value(value:*):void
 		{
-			assert(value is ColorPair, "The value must be a ColorPair: " + value);
-			_value = value;
-			var pair:ColorPair = value as ColorPair;
-			calculatedRuleValue = pair.value;
-			calculatedSelector = pair.name;
+			assert(["solid","dashed","dotted","double","hidden","none"].indexOf(value) >= 0, "The value must be a valid outline style: " + value);
+			calculatedSelector = calculatedRuleValue = _value = value;
+		}
+		override public function get rule():String
+		{
+			// enable outline in in forced colors mode
+			if(calculatedSelector == "hidden")
+			{
+				return "outline: 2px solid transparent; outline-offset: 2px;";
+			}
+			return super.rule;
 		}
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineWidth.as
similarity index 67%
copy from frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
copy to frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineWidth.as
index edc6832057..8ccad908d4 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/BorderColor.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/border/OutlineWidth.as
@@ -20,24 +20,36 @@ package org.apache.royale.style.stylebeads.background
 {
 	import org.apache.royale.style.stylebeads.SingleStyleBase;
 	import org.apache.royale.debugging.assert;
-	import org.apache.royale.style.colors.ColorPair;
-
-	public class BorderColor extends SingleStyleBase
+	import org.apache.royale.style.util.ThemeManager;
+	import org.apache.royale.style.util.StyleTheme;
+	/**
+	 * Defaults to 1px.
+	 */
+	public class OutlineWidth extends SingleStyleBase
 	{
-		public function BorderColor()
+		public function OutlineWidth()
 		{
-			super("border", "border-color");
+			super("outline", "outline-width");
 		}
-		/**
-		 * @royaleignorecoercion org.apache.royale.style.colors.ColorPair
-		 */
 		override public function set value(value:*):void
 		{
-			assert(value is ColorPair, "The value must be a ColorPair: " + value);
 			_value = value;
-			var pair:ColorPair = value as ColorPair;
-			calculatedRuleValue = pair.value;
-			calculatedSelector = pair.name;
+			calculatedRuleValue = value;
+			calculatedSelector = sanitizeSelector(value);
+		}
+		override public function get selector():String
+		{
+			if(!calculatedSelector)
+				return selectorPrefix;
+			
+			return super.selector;
+		}
+		override public function get rule():String
+		{
+			if(!calculatedRuleValue)
+				return "1px";
+			
+			return super.rule;
 		}
 	}
 }
\ No newline at end of file