flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [37/50] git commit: [flex-sdk] [refs/heads/master] - FLEX-35362 CAUSE: the DropDownController signals that the DropDownListBase is open immediately, even before the latter has actually made that change on stage. Since the opening takes one or two frames,
Date Sun, 31 Dec 2017 00:03:28 GMT
FLEX-35362 CAUSE: the DropDownController signals that the DropDownListBase is open immediately,
even before the latter has actually made that change on stage. Since the opening takes one
or two frames, it leaves a few milliseconds in which code which relies on that open/closed
state erroneously assumes that it can use elements that should be on stage or initialized.
In this case it's the layout property, which, due to the skin of the DropDownList, is only
initialized once the drop down is actually open.

SOLUTION: we check whether the layout is not-null, and if it is, we select items in the list
as if it were closed.

NOTES:
-also edited some comments, simplified Array instantiation, and removed an empty constructor.
-now the unit test will pass.


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/4c601832
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/4c601832
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/4c601832

Branch: refs/heads/master
Commit: 4c60183258caf23020d7398f6d2ffdab747d0e56
Parents: 23a306c
Author: Mihai Chira <mihaic@apache.org>
Authored: Wed Oct 18 14:56:22 2017 +0200
Committer: Mihai Chira <mihaic@apache.org>
Committed: Wed Oct 18 14:56:22 2017 +0200

----------------------------------------------------------------------
 .../flatspark/src/flatspark/utils/ColorUtils.as     | 16 ++++------------
 .../components/supportClasses/DropDownListBase.as   |  3 +--
 .../src/spark/components/supportClasses/ListBase.as |  6 +++---
 3 files changed, 8 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/4c601832/frameworks/projects/flatspark/src/flatspark/utils/ColorUtils.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/utils/ColorUtils.as b/frameworks/projects/flatspark/src/flatspark/utils/ColorUtils.as
index 09f9cb2..e9007c3 100644
--- a/frameworks/projects/flatspark/src/flatspark/utils/ColorUtils.as
+++ b/frameworks/projects/flatspark/src/flatspark/utils/ColorUtils.as
@@ -45,15 +45,10 @@ package flatspark.utils
 		public static const Concrete:uint = 0x95A5A6;
 		public static const Asbestos:uint = 0x7F8C8D;
 		
-		public function ColorUtils()
-		{
-			
-		}		
-		
 		public static function ButtonColor(brand:int, estado:State):uint
 		{
 			// All the possible colors
-			var cores:Array = new Array(
+			var cores:Array = [
 				ButtonColorEnum.PrimaryUp, ButtonColorEnum.PrimaryHover, ButtonColorEnum.PrimaryDown,
ButtonColorEnum.PrimaryDisabled,
 				ButtonColorEnum.SuccessUp, ButtonColorEnum.SuccessHover, ButtonColorEnum.SuccessDown,
ButtonColorEnum.SuccessDisabled,
 				ButtonColorEnum.WarningUp, ButtonColorEnum.WarningHover, ButtonColorEnum.WarningDown,
ButtonColorEnum.WarningDisabled,
@@ -61,7 +56,7 @@ package flatspark.utils
 				ButtonColorEnum.DefaultUp, ButtonColorEnum.DefaultHover, ButtonColorEnum.DefaultDown,
ButtonColorEnum.DefaultDisabled,
 				ButtonColorEnum.InfoUp, ButtonColorEnum.InfoHover, ButtonColorEnum.InfoDown, ButtonColorEnum.InfoDisabled,
 				ButtonColorEnum.DangerUp, ButtonColorEnum.DangerHover, ButtonColorEnum.DangerDown, ButtonColorEnum.DangerDisabled
-				);
+				];
 			
 			// Map all the allowed states
 			var numeroEstado:int = 1;
@@ -80,11 +75,8 @@ package flatspark.utils
 					numeroEstado = 3;
 					break;
 			}
-			
-			var posicao:int = 1;
-			posicao = 4 * (brand - 1) + (numeroEstado - 1); 
-			
-			return cores[posicao];
+
+			return cores[4 * (brand - 1) + (numeroEstado - 1)];
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/4c601832/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as
b/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as
index aaba442..c80c2b4 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as
@@ -900,7 +900,7 @@ public class DropDownListBase extends List
             var proposedNewIndex:int = NO_SELECTION;
             var currentIndex:int;
                         
-            if (isDropDownOpen)
+            if (isDropDownOpen && layout)
             {   
                 // Normalize the proposed index for getNavigationDestinationIndex
                 currentIndex = userProposedSelectedIndex < NO_SELECTION ? NO_SELECTION
: userProposedSelectedIndex;
@@ -992,7 +992,6 @@ public class DropDownListBase extends List
         {
             event.preventDefault();
         }
-        
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/4c601832/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as b/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
index e700d0d..fbe1050 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
@@ -1877,9 +1877,9 @@ public class ListBase extends SkinnableDataContainer implements IDataProviderEnh
         
         // We want to wait one frame after validation has occured before turning off 
         // selection transitions again.  We tried using dataGroup's updateComplete event
listener, 
-        // but because some validateNows() occur (before all of the event handling code has
finished), 
-        // this was occuring too early.  We also tried just using callLater or ENTER_FRAME,
but that 
-        // occurs before the LayoutManager has run, so we add an ENTER_FRAME handler with
a 
+        // but because some validateNow() calls occur (before all of the event handling code
has
+        // finished), this was occurring too early.  We also tried just using callLater or
ENTER_FRAME,
+        // but that occurs before the LayoutManager has run, so we add an ENTER_FRAME handler
with a
         // low priority to make sure it occurs after the LayoutManager pass.
         systemManager.addEventListener(Event.ENTER_FRAME, allowSelectionTransitions_enterFrameHandler,
false, -100);
     }


Mime
View raw message