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 19bbe8a155 Support shorthand margin and padding as well as specific 
sides
19bbe8a155 is described below

commit 19bbe8a155c194146e465b2e76463b8e114fb219
Author: Harbs <[email protected]>
AuthorDate: Wed Jun 17 12:44:43 2026 +0300

    Support shorthand margin and padding as well as specific sides
---
 .../Style/src/main/resources/style-manifest.xml    |  20 ++
 .../apache/royale/style/stylebeads/spacing/Marg.as |  59 ++++++
 .../royale/style/stylebeads/spacing/Margin.as      | 213 ++++++++-------------
 .../royale/style/stylebeads/spacing/MarginBlock.as |  10 +
 .../style/stylebeads/spacing/MarginBlockEnd.as     |  10 +
 .../style/stylebeads/spacing/MarginBlockStart.as   |  10 +
 .../style/stylebeads/spacing/MarginBottom.as       |  10 +
 .../style/stylebeads/spacing/MarginInline.as       |  10 +
 .../style/stylebeads/spacing/MarginInlineEnd.as    |  10 +
 .../style/stylebeads/spacing/MarginInlineStart.as  |  10 +
 .../royale/style/stylebeads/spacing/MarginLeft.as  |  10 +
 .../royale/style/stylebeads/spacing/MarginRight.as |  10 +
 .../royale/style/stylebeads/spacing/MarginTop.as   |  10 +
 .../apache/royale/style/stylebeads/spacing/Pad.as  |  53 +++++
 .../royale/style/stylebeads/spacing/Padding.as     | 205 ++++++++------------
 .../style/stylebeads/spacing/PaddingBlock.as       |  10 +
 .../style/stylebeads/spacing/PaddingBlockEnd.as    |  10 +
 .../style/stylebeads/spacing/PaddingBlockStart.as  |  10 +
 .../style/stylebeads/spacing/PaddingBottom.as      |  10 +
 .../style/stylebeads/spacing/PaddingInline.as      |  10 +
 .../style/stylebeads/spacing/PaddingInlineEnd.as   |  10 +
 .../style/stylebeads/spacing/PaddingInlineStart.as |  10 +
 .../royale/style/stylebeads/spacing/PaddingLeft.as |  10 +
 .../style/stylebeads/spacing/PaddingRight.as       |  10 +
 .../royale/style/stylebeads/spacing/PaddingTop.as  |  10 +
 .../apache/royale/style/util/parseShorthandCSS.as  |  62 ++++++
 .../src/test/royale/FlexUnitRoyaleApplication.mxml |   4 +-
 .../src/test/royale/flexUnitTests/MarginTest.as    | 109 +++++++++++
 .../src/test/royale/flexUnitTests/PaddingTest.as   | 109 +++++++++++
 29 files changed, 773 insertions(+), 261 deletions(-)

diff --git a/frameworks/projects/Style/src/main/resources/style-manifest.xml 
b/frameworks/projects/Style/src/main/resources/style-manifest.xml
index 1e1e9fd2ac..0c0882cc7d 100644
--- a/frameworks/projects/Style/src/main/resources/style-manifest.xml
+++ b/frameworks/projects/Style/src/main/resources/style-manifest.xml
@@ -307,7 +307,27 @@
   <component id="Visibility" 
class="org.apache.royale.style.stylebeads.layout.Visibility"/>
   <component id="ZIndex" 
class="org.apache.royale.style.stylebeads.layout.ZIndex"/>
   <component id="Margin" 
class="org.apache.royale.style.stylebeads.spacing.Margin"/>
+  <component id="MarginBlock" 
class="org.apache.royale.style.stylebeads.spacing.MarginBlock"/>
+  <component id="MarginBlockEnd" 
class="org.apache.royale.style.stylebeads.spacing.MarginBlockEnd"/>
+  <component id="MarginBlockStart" 
class="org.apache.royale.style.stylebeads.spacing.MarginBlockStart"/>
+  <component id="MarginBottom" 
class="org.apache.royale.style.stylebeads.spacing.MarginBottom"/>
+  <component id="MarginInline" 
class="org.apache.royale.style.stylebeads.spacing.MarginInline"/>
+  <component id="MarginInlineEnd" 
class="org.apache.royale.style.stylebeads.spacing.MarginInlineEnd"/>
+  <component id="MarginInlineStart" 
class="org.apache.royale.style.stylebeads.spacing.MarginInlineStart"/>
+  <component id="MarginLeft" 
class="org.apache.royale.style.stylebeads.spacing.MarginLeft"/>
+  <component id="MarginRight" 
class="org.apache.royale.style.stylebeads.spacing.MarginRight"/>
+  <component id="MarginTop" 
class="org.apache.royale.style.stylebeads.spacing.MarginTop"/>
   <component id="Padding" 
class="org.apache.royale.style.stylebeads.spacing.Padding"/>
+  <component id="PaddingBlock" 
class="org.apache.royale.style.stylebeads.spacing.PaddingBlock"/>
+  <component id="PaddingBlockEnd" 
class="org.apache.royale.style.stylebeads.spacing.PaddingBlockEnd"/>
+  <component id="PaddingBlockStart" 
class="org.apache.royale.style.stylebeads.spacing.PaddingBlockStart"/>
+  <component id="PaddingBottom" 
class="org.apache.royale.style.stylebeads.spacing.PaddingBottom"/>
+  <component id="PaddingInline" 
class="org.apache.royale.style.stylebeads.spacing.PaddingInline"/>
+  <component id="PaddingInlineEnd" 
class="org.apache.royale.style.stylebeads.spacing.PaddingInlineEnd"/>
+  <component id="PaddingInlineStart" 
class="org.apache.royale.style.stylebeads.spacing.PaddingInlineStart"/>
+  <component id="PaddingLeft" 
class="org.apache.royale.style.stylebeads.spacing.PaddingLeft"/>
+  <component id="PaddingRight" 
class="org.apache.royale.style.stylebeads.spacing.PaddingRight"/>
+  <component id="PaddingTop" 
class="org.apache.royale.style.stylebeads.spacing.PaddingTop"/>
   <component id="Fill" class="org.apache.royale.style.stylebeads.svg.Fill"/>
   <component id="BorderCollapse" 
class="org.apache.royale.style.stylebeads.tables.BorderCollapse"/>
   <component id="BorderSpacing" 
class="org.apache.royale.style.stylebeads.tables.BorderSpacing"/>
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Marg.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Marg.as
new file mode 100644
index 0000000000..02fe4df362
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Marg.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.style.stylebeads.spacing
+{
+       import org.apache.royale.debugging.assert;
+       import org.apache.royale.style.stylebeads.LeafStyleBase;
+
+       internal class Marg extends LeafStyleBase
+       {
+               public function Marg(selectorBase:String = "m", ruleBase:String 
= "margin", value:* = null)
+               {
+                       super(selectorBase, ruleBase, value);
+               }
+               private function toSelector(value:String):String
+               {
+                       return value.replace(" ", "-");
+               }
+               private var savedPrefix:String;
+               override public function set value(value:*):void
+               {
+                       COMPILE::JS
+                       {
+                               var selectorValue:String = value;
+                               var ruleValue:String = selectorValue;
+                               assert(selectorValue.indexOf("--") != 0, "css 
variables for grid-template-columns not yet supported: " + value);
+                               if(int(value) == value)
+                               {
+                                       if(value < 0)
+                                       {
+                                               if(!savedPrefix)
+                                                       savedPrefix = 
_selectorBase;
+                                               _selectorBase = "-" + 
savedPrefix;
+                                               selectorValue = "" + (-value);
+                                       }
+                                       ruleValue = computeSpacing(value);
+                               }
+                               _value = value;
+                               calculatedRuleValue = ruleValue.trim();
+                               calculatedSelector = 
toSelector(selectorValue.trim());
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Margin.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Margin.as
index 764a50bec7..8b697b91f5 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Margin.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Margin.as
@@ -19,6 +19,7 @@
 package org.apache.royale.style.stylebeads.spacing
 {
        import org.apache.royale.style.stylebeads.CompositeStyle;
+       import org.apache.royale.style.util.parseShorthandCSS;
 
        /**
         * @royalesuppressexport
@@ -35,16 +36,16 @@ package org.apache.royale.style.stylebeads.spacing
                }
 
                private var marginStyle:Marg;
-               private var topStyle:Top;
-               private var rightStyle:Right;
-               private var bottomStyle:Bottom;
-               private var leftStyle:Left;
-               private var blockStyle:Block;
-               private var blockStartStyle:BlockStart;
-               private var blockEndStyle:BlockEnd;
-               private var inlineStyle:Inline;
-               private var inlineStartStyle:InlineStart;
-               private var inlineEndStyle:InlineEnd;
+               private var topStyle:MarginTop;
+               private var rightStyle:MarginRight;
+               private var bottomStyle:MarginBottom;
+               private var leftStyle:MarginLeft;
+               private var blockStyle:MarginBlock;
+               private var blockStartStyle:MarginBlockStart;
+               private var blockEndStyle:MarginBlockEnd;
+               private var inlineStyle:MarginInline;
+               private var inlineStartStyle:MarginInlineStart;
+               private var inlineEndStyle:MarginInlineEnd;
                private var _margin:*;
 
                public function get margin():*
@@ -53,14 +54,72 @@ package org.apache.royale.style.stylebeads.spacing
                }
                public function set margin(value:*):void
                {
+                       resetMarginStyles();
+                       var shorthand:Array = parseShorthandCSS(value);
+                       if(shorthand)
+                       {
+                               applyShorthand(shorthand);
+                               _margin = value;
+                               return;
+                       }
                        if(!marginStyle)
                        {
                                marginStyle = new Marg();
                                styles.push(marginStyle);
                        }
                        marginStyle.value = value;
+                       _top = value;
+                       _right = value;
+                       _bottom = value;
+                       _left = value;
                        _margin = value;
                }
+
+               private function resetMarginStyles():void
+               {
+                       styles = [];
+                       marginStyle = null;
+                       topStyle = null;
+                       rightStyle = null;
+                       bottomStyle = null;
+                       leftStyle = null;
+                       blockStyle = null;
+                       blockStartStyle = null;
+                       blockEndStyle = null;
+                       inlineStyle = null;
+                       inlineStartStyle = null;
+                       inlineEndStyle = null;
+               }
+
+               private function applyShorthand(values:Array):void
+               {
+                       var topValue:* = values[0];
+                       var rightValue:* = values.length > 1 ? values[1] : 
values[0];
+                       var bottomValue:* = values.length > 2 ? values[2] : 
values[0];
+                       var leftValue:* = values.length > 3 ? values[3] : 
rightValue;
+                       if(values.length <= 2)
+                       {
+                               block = topValue;
+                               inline = rightValue;
+                       }
+                       else if(values.length == 3)
+                       {
+                               blockStart = topValue;
+                               blockEnd = bottomValue;
+                               inline = rightValue;
+                       }
+                       else
+                       {
+                               blockStart = topValue;
+                               blockEnd = bottomValue;
+                               inlineEnd = rightValue;
+                               inlineStart = leftValue;
+                       }
+                       _top = topValue;
+                       _right = rightValue;
+                       _bottom = bottomValue;
+                       _left = leftValue;
+               }
                private var _top:*;
 
                public function get top():*
@@ -72,7 +131,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!topStyle)
                        {
-                               topStyle = new Top();
+                               topStyle = new MarginTop();
                                styles.push(topStyle);
                        }
                        topStyle.value = value;
@@ -89,7 +148,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!rightStyle)
                        {
-                               rightStyle = new Right();
+                               rightStyle = new MarginRight();
                                styles.push(rightStyle);
                        }
                        rightStyle.value = value;
@@ -106,7 +165,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!bottomStyle)
                        {
-                               bottomStyle = new Bottom();
+                               bottomStyle = new MarginBottom();
                                styles.push(bottomStyle);
                        }
                        bottomStyle.value = value;
@@ -123,7 +182,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!leftStyle)
                        {
-                               leftStyle = new Left();
+                               leftStyle = new MarginLeft();
                                styles.push(leftStyle);
                        }
                        leftStyle.value = value;
@@ -140,7 +199,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!blockStyle)
                        {
-                               blockStyle = new Block();
+                               blockStyle = new MarginBlock();
                                styles.push(blockStyle);
                        }
                        blockStyle.value = value;
@@ -157,7 +216,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!blockStartStyle)
                        {
-                               blockStartStyle = new BlockStart();
+                               blockStartStyle = new MarginBlockStart();
                                styles.push(blockStartStyle);
                        }
                        blockStartStyle.value = value;
@@ -174,7 +233,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!blockEndStyle)
                        {
-                               blockEndStyle = new BlockEnd();
+                               blockEndStyle = new MarginBlockEnd();
                                styles.push(blockEndStyle);
                        }
                        blockEndStyle.value = value;
@@ -191,7 +250,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!inlineStyle)
                        {
-                               inlineStyle = new Inline();
+                               inlineStyle = new MarginInline();
                                styles.push(inlineStyle);
                        }
                        inlineStyle.value = value;
@@ -208,7 +267,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!inlineStartStyle)
                        {
-                               inlineStartStyle = new InlineStart();
+                               inlineStartStyle = new MarginInlineStart();
                                styles.push(inlineStartStyle);
                        }
                        inlineStartStyle.value = value;
@@ -225,7 +284,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!inlineEndStyle)
                        {
-                               inlineEndStyle = new InlineEnd();
+                               inlineEndStyle = new MarginInlineEnd();
                                styles.push(inlineEndStyle);
                        }
                        inlineEndStyle.value = value;
@@ -233,117 +292,3 @@ package org.apache.royale.style.stylebeads.spacing
                }
        }
 }
-
-
-import org.apache.royale.style.stylebeads.LeafStyleBase;
-import org.apache.royale.debugging.assert;
-import org.apache.royale.style.util.ThemeManager;
-import org.apache.royale.style.util.CSSUnit;
-
-class Marg extends LeafStyleBase
-{
-       public function Marg(selectorBase:String = "m", ruleBase:String = 
"margin", value:* = null)
-       {
-               super(selectorBase, ruleBase, value);
-       }
-       private function toSelector(value:String):String
-       {
-               return value.replace(" ", "-");
-       }
-       private var savedPrefix:String;
-       override public function set value(value:*):void
-       {
-               COMPILE::JS
-               {
-                       var selectorValue:String = value;
-                       var ruleValue:String = selectorValue;
-                       assert(selectorValue.indexOf("--") != 0, "css variables 
for grid-template-columns not yet supported: " + value);
-                       if(int(value) == value)
-                       {
-                               if(value < 0)
-                               {
-                                       if(!savedPrefix)
-                                               savedPrefix = _selectorBase;
-                                       
-                                       _selectorBase = "-" + savedPrefix;
-                                       selectorValue = "" + (-value);
-                               }
-                               ruleValue = computeSpacing(value);
-                       }
-                       _value = value;
-                       calculatedRuleValue = ruleValue.trim();
-                       calculatedSelector = toSelector(selectorValue.trim());
-               }
-       }
-}
-class Top extends Marg
-{
-       public function Top(value:* = null)
-       {
-               super("mt", "margin-top", value);
-       }
-}
-class Left extends Marg
-{
-       public function Left(value:* = null)
-       {
-               super("ml", "margin-left", value);
-       }
-}
-class Right extends Marg
-{
-       public function Right(value:* = null)
-       {
-               super("mr", "margin-right", value);
-       }
-}
-class Bottom extends Marg
-{
-       public function Bottom(value:* = null)
-       {
-               super("mb", "margin-bottom", value);
-       }
-}
-class Block extends Marg
-{
-       public function Block(value:* = null)
-       {
-               super("my", "margin-block", value);
-       }
-}
-class BlockStart extends Marg
-{
-       public function BlockStart(value:* = null)
-       {
-               super("my-start", "margin-block-start", value);
-       }
-}
-
-class BlockEnd extends Marg
-{
-       public function BlockEnd(value:* = null)
-       {
-               super("my-end", "margin-block-end", value);
-       }
-}
-class Inline extends Marg
-{
-       public function Inline(value:* = null)
-       {
-               super("mx", "margin-inline", value);
-       }
-}
-class InlineEnd extends Marg
-{
-       public function InlineEnd(value:* = null)
-       {
-               super("me", "margin-inline-end", value);
-       }
-}
-class InlineStart extends Marg
-{
-       public function InlineStart(value:* = null)
-       {
-               super("ms", "margin-inline-start", value);
-       }
-}
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlock.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlock.as
new file mode 100644
index 0000000000..3426baddee
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlock.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginBlock extends Marg
+       {
+               public function MarginBlock(value:* = null)
+               {
+                       super("my", "margin-block", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlockEnd.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlockEnd.as
new file mode 100644
index 0000000000..12afa183d8
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlockEnd.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginBlockEnd extends Marg
+       {
+               public function MarginBlockEnd(value:* = null)
+               {
+                       super("my-end", "margin-block-end", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlockStart.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlockStart.as
new file mode 100644
index 0000000000..c1998725d2
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBlockStart.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginBlockStart extends Marg
+       {
+               public function MarginBlockStart(value:* = null)
+               {
+                       super("my-start", "margin-block-start", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBottom.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBottom.as
new file mode 100644
index 0000000000..c448f00586
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginBottom.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginBottom extends Marg
+       {
+               public function MarginBottom(value:* = null)
+               {
+                       super("mb", "margin-bottom", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInline.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInline.as
new file mode 100644
index 0000000000..09b22e660e
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInline.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginInline extends Marg
+       {
+               public function MarginInline(value:* = null)
+               {
+                       super("mx", "margin-inline", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInlineEnd.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInlineEnd.as
new file mode 100644
index 0000000000..57df52a857
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInlineEnd.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginInlineEnd extends Marg
+       {
+               public function MarginInlineEnd(value:* = null)
+               {
+                       super("me", "margin-inline-end", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInlineStart.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInlineStart.as
new file mode 100644
index 0000000000..a50f631857
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginInlineStart.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginInlineStart extends Marg
+       {
+               public function MarginInlineStart(value:* = null)
+               {
+                       super("ms", "margin-inline-start", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginLeft.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginLeft.as
new file mode 100644
index 0000000000..f5ca072c10
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginLeft.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginLeft extends Marg
+       {
+               public function MarginLeft(value:* = null)
+               {
+                       super("ml", "margin-left", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginRight.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginRight.as
new file mode 100644
index 0000000000..ad277c868d
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginRight.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginRight extends Marg
+       {
+               public function MarginRight(value:* = null)
+               {
+                       super("mr", "margin-right", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginTop.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginTop.as
new file mode 100644
index 0000000000..4e1e851902
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/MarginTop.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class MarginTop extends Marg
+       {
+               public function MarginTop(value:* = null)
+               {
+                       super("mt", "margin-top", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Pad.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Pad.as
new file mode 100644
index 0000000000..a32c9d38bd
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Pad.as
@@ -0,0 +1,53 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.style.stylebeads.spacing
+{
+       import org.apache.royale.debugging.assert;
+       import org.apache.royale.style.stylebeads.LeafStyleBase;
+
+       internal class Pad extends LeafStyleBase
+       {
+               public function Pad(selectorBase:String = "p", ruleBase:String 
= "padding", value:* = null)
+               {
+                       super(selectorBase, ruleBase, value);
+               }
+               private function toSelector(value:String):String
+               {
+                       return value.replace(" ", "-");
+               }
+               override public function set value(val:*):void
+               {
+                       _value = val;
+                       var selectorValue:String = "" + val;
+                       var ruleValue:String = selectorValue;
+                       assert(selectorValue.indexOf("--") != 0, "css variables 
for grid-template-columns not yet supported: " + val);
+                       if(isNum(val))
+                       {
+                               assert(val >= 0, "Invalid value for padding: " 
+ val);
+                               ruleValue = computeSpacing(val);
+                       }
+                       else
+                       {
+                               ruleValue = acceptVar(val);
+                       }
+                       calculatedRuleValue = ruleValue;
+                       calculatedSelector = toSelector(selectorValue);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Padding.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Padding.as
index 0a08d860c4..90b72e61f3 100644
--- 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Padding.as
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/Padding.as
@@ -18,8 +18,8 @@
 
////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.style.stylebeads.spacing
 {
-       import org.apache.royale.debugging.assert;
        import org.apache.royale.style.stylebeads.CompositeStyle;
+       import org.apache.royale.style.util.parseShorthandCSS;
        /**
         * @royalesuppressexport
         */
@@ -34,16 +34,16 @@ package org.apache.royale.style.stylebeads.spacing
                                this.padding = value;
                }
                private var paddingStyle:Pad;
-               private var topStyle:Top;
-               private var rightStyle:Right;
-               private var bottomStyle:Bottom;
-               private var leftStyle:Left;
-               private var blockStyle:Block;
-               private var blockStartStyle:BlockStart;
-               private var blockEndStyle:BlockEnd;
-               private var inlineStyle:Inline;
-               private var inlineStartStyle:InlineStart;
-               private var inlineEndStyle:InlineEnd;
+               private var topStyle:PaddingTop;
+               private var rightStyle:PaddingRight;
+               private var bottomStyle:PaddingBottom;
+               private var leftStyle:PaddingLeft;
+               private var blockStyle:PaddingBlock;
+               private var blockStartStyle:PaddingBlockStart;
+               private var blockEndStyle:PaddingBlockEnd;
+               private var inlineStyle:PaddingInline;
+               private var inlineStartStyle:PaddingInlineStart;
+               private var inlineEndStyle:PaddingInlineEnd;
                private var _padding:*;
 
                public function get padding():*
@@ -52,14 +52,72 @@ package org.apache.royale.style.stylebeads.spacing
                }
                public function set padding(value:*):void
                {
+                       resetPaddingStyles();
+                       var shorthand:Array = parseShorthandCSS(value);
+                       if(shorthand)
+                       {
+                               applyShorthand(shorthand);
+                               _padding = value;
+                               return;
+                       }
                        if(!paddingStyle)
                        {
                                paddingStyle = new Pad();
                                styles.push(paddingStyle);
                        }
                        paddingStyle.value = value;
+                       _top = value;
+                       _right = value;
+                       _bottom = value;
+                       _left = value;
                        _padding = value;
                }
+
+               private function resetPaddingStyles():void
+               {
+                       styles = [];
+                       paddingStyle = null;
+                       topStyle = null;
+                       rightStyle = null;
+                       bottomStyle = null;
+                       leftStyle = null;
+                       blockStyle = null;
+                       blockStartStyle = null;
+                       blockEndStyle = null;
+                       inlineStyle = null;
+                       inlineStartStyle = null;
+                       inlineEndStyle = null;
+               }
+
+               private function applyShorthand(values:Array):void
+               {
+                       var topValue:* = values[0];
+                       var rightValue:* = values.length > 1 ? values[1] : 
values[0];
+                       var bottomValue:* = values.length > 2 ? values[2] : 
values[0];
+                       var leftValue:* = values.length > 3 ? values[3] : 
rightValue;
+                       if(values.length <= 2)
+                       {
+                               block = topValue;
+                               inline = rightValue;
+                       }
+                       else if(values.length == 3)
+                       {
+                               blockStart = topValue;
+                               blockEnd = bottomValue;
+                               inline = rightValue;
+                       }
+                       else
+                       {
+                               blockStart = topValue;
+                               blockEnd = bottomValue;
+                               inlineEnd = rightValue;
+                               inlineStart = leftValue;
+                       }
+                       _top = topValue;
+                       _right = rightValue;
+                       _bottom = bottomValue;
+                       _left = leftValue;
+               }
                private var _top:*;
 
                public function get top():*
@@ -71,7 +129,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!topStyle)
                        {
-                               topStyle = new Top();
+                               topStyle = new PaddingTop();
                                styles.push(topStyle);
                        }
                        topStyle.value = value;
@@ -88,7 +146,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!rightStyle)
                        {
-                               rightStyle = new Right();
+                               rightStyle = new PaddingRight();
                                styles.push(rightStyle);
                        }
                        rightStyle.value = value;
@@ -105,7 +163,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!bottomStyle)
                        {
-                               bottomStyle = new Bottom();
+                               bottomStyle = new PaddingBottom();
                                styles.push(bottomStyle);
                        }
                        bottomStyle.value = value;
@@ -122,7 +180,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!leftStyle)
                        {
-                               leftStyle = new Left();
+                               leftStyle = new PaddingLeft();
                                styles.push(leftStyle);
                        }
                        leftStyle.value = value;
@@ -139,7 +197,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!blockStyle)
                        {
-                               blockStyle = new Block();
+                               blockStyle = new PaddingBlock();
                                styles.push(blockStyle);
                        }
                        blockStyle.value = value;
@@ -156,7 +214,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!blockStartStyle)
                        {
-                               blockStartStyle = new BlockStart();
+                               blockStartStyle = new PaddingBlockStart();
                                styles.push(blockStartStyle);
                        }
                        blockStartStyle.value = value;
@@ -173,7 +231,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!blockEndStyle)
                        {
-                               blockEndStyle = new BlockEnd();
+                               blockEndStyle = new PaddingBlockEnd();
                                styles.push(blockEndStyle);
                        }
                        blockEndStyle.value = value;
@@ -190,7 +248,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!inlineStyle)
                        {
-                               inlineStyle = new Inline();
+                               inlineStyle = new PaddingInline();
                                styles.push(inlineStyle);
                        }
                        inlineStyle.value = value;
@@ -207,7 +265,7 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!inlineStartStyle)
                        {
-                               inlineStartStyle = new InlineStart();
+                               inlineStartStyle = new PaddingInlineStart();
                                styles.push(inlineStartStyle);
                        }
                        inlineStartStyle.value = value;
@@ -224,116 +282,11 @@ package org.apache.royale.style.stylebeads.spacing
                {
                        if(!inlineEndStyle)
                        {
-                               inlineEndStyle = new InlineEnd();
+                               inlineEndStyle = new PaddingInlineEnd();
                                styles.push(inlineEndStyle);
                        }
                        inlineEndStyle.value = value;
                        _inlineEnd = value;
                }
        }
-}
-
-import org.apache.royale.debugging.assert;
-import org.apache.royale.style.stylebeads.LeafStyleBase;
-import org.apache.royale.style.util.ThemeManager;
-import org.apache.royale.style.util.CSSUnit;
-
-class Pad extends LeafStyleBase
-{
-       public function Pad(selectorBase:String = "p", ruleBase:String = 
"padding", value:* = null)
-       {
-               super(selectorBase, ruleBase, value);
-       }
-       private function toSelector(value:String):String
-       {
-               return value.replace(" ", "-");
-       }
-       override public function set value(val:*):void
-       {
-               _value = val;
-               var selectorValue:String = "" + val;
-               var ruleValue:String = selectorValue;
-               assert(selectorValue.indexOf("--") != 0, "css variables for 
grid-template-columns not yet supported: " + val);
-               if(isNum(val))
-               {
-                       assert(val >= 0, "Invalid value for padding: " + val);
-                       ruleValue = computeSpacing(val);
-               }
-               else
-               {
-                       ruleValue = acceptVar(val);
-               }
-               calculatedRuleValue = ruleValue;
-               calculatedSelector = toSelector(selectorValue);
-       }
-}
-class Block extends Pad
-{
-       public function Block(value:* = null)
-       {
-               super("py", "padding-block", value);
-       }
-}
-class BlockEnd extends Pad
-{
-       public function BlockEnd(value:* = null)
-       {
-               super("pbe", "padding-block-end", value);
-       }
-}
-class BlockStart extends Pad
-{
-       public function BlockStart(value:* = null)
-       {
-               super("pbs", "padding-block-start", value);
-       }
-}
-class Bottom extends Pad
-{
-       public function Bottom(value:* = null)
-       {
-               super("pb", "padding-bottom", value);
-       }
-}
-class Inline extends Pad
-{
-       public function Inline(value:* = null)
-       {
-               super("px", "padding-inline", value);
-       }
-}
-class InlineEnd extends Pad
-{
-       public function InlineEnd(value:* = null)
-       {
-               super("pe", "padding-inline-end", value);
-       }
-}
-class InlineStart extends Pad
-{
-       public function InlineStart(value:* = null)
-       {
-               super("ps", "padding-inline-start", value);
-       }
-}
-class Left extends Pad
-{
-       public function Left(value:* = null)
-       {
-               super("pl", "padding-left", value);
-       }
-}
-class Right extends Pad
-{
-       public function Right(value:* = null)
-       {
-               super("pr", "padding-right", value);
-       }
-}
-class Top extends Pad
-{
-       public function Top(value:* = null)
-       {
-               super("pt", "padding-top", value);
-       }
 }
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlock.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlock.as
new file mode 100644
index 0000000000..0535157e73
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlock.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingBlock extends Pad
+       {
+               public function PaddingBlock(value:* = null)
+               {
+                       super("py", "padding-block", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlockEnd.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlockEnd.as
new file mode 100644
index 0000000000..11e07a289e
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlockEnd.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingBlockEnd extends Pad
+       {
+               public function PaddingBlockEnd(value:* = null)
+               {
+                       super("pbe", "padding-block-end", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlockStart.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlockStart.as
new file mode 100644
index 0000000000..ba28102d60
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBlockStart.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingBlockStart extends Pad
+       {
+               public function PaddingBlockStart(value:* = null)
+               {
+                       super("pbs", "padding-block-start", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBottom.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBottom.as
new file mode 100644
index 0000000000..60398c5526
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingBottom.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingBottom extends Pad
+       {
+               public function PaddingBottom(value:* = null)
+               {
+                       super("pb", "padding-bottom", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInline.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInline.as
new file mode 100644
index 0000000000..7a2696bbd5
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInline.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingInline extends Pad
+       {
+               public function PaddingInline(value:* = null)
+               {
+                       super("px", "padding-inline", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInlineEnd.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInlineEnd.as
new file mode 100644
index 0000000000..c683cbc636
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInlineEnd.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingInlineEnd extends Pad
+       {
+               public function PaddingInlineEnd(value:* = null)
+               {
+                       super("pe", "padding-inline-end", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInlineStart.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInlineStart.as
new file mode 100644
index 0000000000..1c74e3e97c
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingInlineStart.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingInlineStart extends Pad
+       {
+               public function PaddingInlineStart(value:* = null)
+               {
+                       super("ps", "padding-inline-start", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingLeft.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingLeft.as
new file mode 100644
index 0000000000..1fb8ebf96c
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingLeft.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingLeft extends Pad
+       {
+               public function PaddingLeft(value:* = null)
+               {
+                       super("pl", "padding-left", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingRight.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingRight.as
new file mode 100644
index 0000000000..eb95ca4200
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingRight.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingRight extends Pad
+       {
+               public function PaddingRight(value:* = null)
+               {
+                       super("pr", "padding-right", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingTop.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingTop.as
new file mode 100644
index 0000000000..b7b1723ebb
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/spacing/PaddingTop.as
@@ -0,0 +1,10 @@
+package org.apache.royale.style.stylebeads.spacing
+{
+       public class PaddingTop extends Pad
+       {
+               public function PaddingTop(value:* = null)
+               {
+                       super("pt", "padding-top", value);
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/parseShorthandCSS.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/parseShorthandCSS.as
new file mode 100644
index 0000000000..dae58c3e55
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/util/parseShorthandCSS.as
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.style.util
+{
+       import org.apache.royale.debugging.assert;
+
+       public function parseShorthandCSS(value:*):Array
+       {
+                       if(value is Array)
+                       {
+                               assert(value.length > 0 && value.length <= 4, 
"shorthand accepts one to four values: " + value);
+                               return value;
+                       }
+                       if(!(value is String))
+                               return [value];
+                       var stringValue:String = value;
+                       var values:Array = [];
+                       var token:String = "";
+                       var parenDepth:int = 0;
+                       for(var i:int = 0; i < stringValue.length; i++)
+                       {
+                               var code:int = stringValue.charCodeAt(i);
+                               if(code == 40)
+                                       parenDepth++;
+                               else if(code == 41)
+                                       parenDepth--;
+                               if(parenDepth == 0 && (code == 32 || code == 9 
|| code == 10 || code == 13 || code == 12))
+                               {
+                                       if(token.length > 0)
+                                       {
+                                               values.push(token);
+                                               token = "";
+                                       }
+                               }
+                               else
+                               {
+                                       token += stringValue.charAt(i);
+                               }
+                       }
+                       if(token.length > 0)
+                               values.push(token);
+                       assert(values.length > 0, "padding shorthand accepts 
one to four values: " + value);
+                       assert(values.length <= 4, "padding shorthand accepts 
one to four values: " + value);
+                       return values;
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml 
b/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml
index d71dfd52a8..310ba07fa3 100644
--- a/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -35,6 +35,8 @@ limitations under the License.
             }
 
             import flexUnitTests.StyleManagerTest;
+            import flexUnitTests.PaddingTest;
+            import flexUnitTests.MarginTest;
             import flexUnitTests.ColorUtilsContrastTest;
             import flexUnitTests.ColorUtilsContrastFunctionTest;
             import flexUnitTests.ThemeColorSetTest;
@@ -94,7 +96,7 @@ limitations under the License.
                 {
                     core.addEventListener(Event.COMPLETE, 
core_completeHandler);
                     // Insert test classes here. For example:
-                    
core.runClasses(StyleManagerTest,ColorUtilsContrastFunctionTest,ColorUtilsContrastTest,ThemeColorSetTest);
+                    
core.runClasses(StyleManagerTest,PaddingTest,MarginTest,ColorUtilsContrastFunctionTest,ColorUtilsContrastTest,ThemeColorSetTest);
                 }
             }
 
diff --git 
a/frameworks/projects/Style/src/test/royale/flexUnitTests/MarginTest.as 
b/frameworks/projects/Style/src/test/royale/flexUnitTests/MarginTest.as
new file mode 100644
index 0000000000..1cdc891d36
--- /dev/null
+++ b/frameworks/projects/Style/src/test/royale/flexUnitTests/MarginTest.as
@@ -0,0 +1,109 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests
+{
+       import org.apache.royale.style.stylebeads.spacing.Margin;
+       import org.apache.royale.style.stylebeads.spacing.MarginBlock;
+       import org.apache.royale.style.stylebeads.spacing.MarginInlineEnd;
+       import org.apache.royale.test.asserts.*;
+
+       public class MarginTest
+       {
+               [Test]
+               public function testMarginShorthandSetsLogicalSides():void
+               {
+                       var margin:Margin = new Margin("1px 2px 3px 4px");
+
+                       assertEquals("1px", margin.top);
+                       assertEquals("2px", margin.right);
+                       assertEquals("3px", margin.bottom);
+                       assertEquals("4px", margin.left);
+                       assertEquals("1px", margin.blockStart);
+                       assertEquals("2px", margin.inlineEnd);
+                       assertEquals("3px", margin.blockEnd);
+                       assertEquals("4px", margin.inlineStart);
+                       assertEquals(4, margin.getLeaves().length);
+               }
+
+               [Test]
+               public function 
testMarginFourValuesPreservesLogicalSidesWhenValuesMatch():void
+               {
+                       var margin:Margin = new Margin("1px 1px 1px 1px");
+
+                       assertEquals("1px", margin.blockStart);
+                       assertEquals("1px", margin.inlineEnd);
+                       assertEquals("1px", margin.blockEnd);
+                       assertEquals("1px", margin.inlineStart);
+                       assertEquals(4, margin.getLeaves().length);
+               }
+
+               [Test]
+               public function testMarginSingleValueUsesBlockAndInline():void
+               {
+                       var margin:Margin = new Margin("1px");
+
+                       assertEquals("1px", margin.top);
+                       assertEquals("1px", margin.right);
+                       assertEquals("1px", margin.bottom);
+                       assertEquals("1px", margin.left);
+                       assertEquals("1px", margin.block);
+                       assertEquals("1px", margin.inline);
+                       assertEquals(2, margin.getLeaves().length);
+               }
+
+               [Test]
+               public function testMarginTwoValuesUseBlockAndInline():void
+               {
+                       var margin:Margin = new Margin("1px 2px");
+
+                       assertEquals("1px", margin.top);
+                       assertEquals("2px", margin.right);
+                       assertEquals("1px", margin.bottom);
+                       assertEquals("2px", margin.left);
+                       assertEquals("1px", margin.block);
+                       assertEquals("2px", margin.inline);
+                       assertEquals(2, margin.getLeaves().length);
+               }
+
+               [Test]
+               public function testMarginShorthandRepeatsMissingValues():void
+               {
+                       var margin:Margin = new Margin("1px 2px 3px");
+
+                       assertEquals("1px", margin.top);
+                       assertEquals("2px", margin.right);
+                       assertEquals("3px", margin.bottom);
+                       assertEquals("2px", margin.left);
+                       assertEquals("1px", margin.blockStart);
+                       assertEquals("2px", margin.inline);
+                       assertEquals("3px", margin.blockEnd);
+                       assertEquals(3, margin.getLeaves().length);
+               }
+
+               [Test]
+               public function testMarginLeafClassesCanBeUsedDirectly():void
+               {
+                       var block:MarginBlock = new MarginBlock("1px");
+                       var inlineEnd:MarginInlineEnd = new 
MarginInlineEnd("2px");
+
+                       assertEquals("margin-block:1px;", block.getRule());
+                       assertEquals("margin-inline-end:2px;", 
inlineEnd.getRule());
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Style/src/test/royale/flexUnitTests/PaddingTest.as 
b/frameworks/projects/Style/src/test/royale/flexUnitTests/PaddingTest.as
new file mode 100644
index 0000000000..047cc1dc5f
--- /dev/null
+++ b/frameworks/projects/Style/src/test/royale/flexUnitTests/PaddingTest.as
@@ -0,0 +1,109 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests
+{
+       import org.apache.royale.style.stylebeads.spacing.Padding;
+       import org.apache.royale.style.stylebeads.spacing.PaddingBlock;
+       import org.apache.royale.style.stylebeads.spacing.PaddingInlineEnd;
+       import org.apache.royale.test.asserts.*;
+
+       public class PaddingTest
+       {
+               [Test]
+               public function testPaddingShorthandSetsLogicalSides():void
+               {
+                       var padding:Padding = new Padding("1px 2px 3px 4px");
+
+                       assertEquals("1px", padding.top);
+                       assertEquals("2px", padding.right);
+                       assertEquals("3px", padding.bottom);
+                       assertEquals("4px", padding.left);
+                       assertEquals("1px", padding.blockStart);
+                       assertEquals("2px", padding.inlineEnd);
+                       assertEquals("3px", padding.blockEnd);
+                       assertEquals("4px", padding.inlineStart);
+                       assertEquals(4, padding.getLeaves().length);
+               }
+
+               [Test]
+               public function 
testPaddingFourValuesPreservesLogicalSidesWhenValuesMatch():void
+               {
+                       var padding:Padding = new Padding("1px 1px 1px 1px");
+
+                       assertEquals("1px", padding.blockStart);
+                       assertEquals("1px", padding.inlineEnd);
+                       assertEquals("1px", padding.blockEnd);
+                       assertEquals("1px", padding.inlineStart);
+                       assertEquals(4, padding.getLeaves().length);
+               }
+
+               [Test]
+               public function testPaddingSingleValueUsesBlockAndInline():void
+               {
+                       var padding:Padding = new Padding("1px");
+
+                       assertEquals("1px", padding.top);
+                       assertEquals("1px", padding.right);
+                       assertEquals("1px", padding.bottom);
+                       assertEquals("1px", padding.left);
+                       assertEquals("1px", padding.block);
+                       assertEquals("1px", padding.inline);
+                       assertEquals(2, padding.getLeaves().length);
+               }
+
+               [Test]
+               public function testPaddingTwoValuesUseBlockAndInline():void
+               {
+                       var padding:Padding = new Padding("1px 2px");
+
+                       assertEquals("1px", padding.top);
+                       assertEquals("2px", padding.right);
+                       assertEquals("1px", padding.bottom);
+                       assertEquals("2px", padding.left);
+                       assertEquals("1px", padding.block);
+                       assertEquals("2px", padding.inline);
+                       assertEquals(2, padding.getLeaves().length);
+               }
+
+               [Test]
+               public function testPaddingShorthandRepeatsMissingValues():void
+               {
+                       var padding:Padding = new Padding("1px 2px 3px");
+
+                       assertEquals("1px", padding.top);
+                       assertEquals("2px", padding.right);
+                       assertEquals("3px", padding.bottom);
+                       assertEquals("2px", padding.left);
+                       assertEquals("1px", padding.blockStart);
+                       assertEquals("2px", padding.inline);
+                       assertEquals("3px", padding.blockEnd);
+                       assertEquals(3, padding.getLeaves().length);
+               }
+
+               [Test]
+               public function testPaddingLeafClassesCanBeUsedDirectly():void
+               {
+                       var block:PaddingBlock = new PaddingBlock("1px");
+                       var inlineEnd:PaddingInlineEnd = new 
PaddingInlineEnd("2px");
+
+                       assertEquals("padding-block:1px;", block.getRule());
+                       assertEquals("padding-inline-end:2px;", 
inlineEnd.getRule());
+               }
+       }
+}
\ No newline at end of file

Reply via email to