Author: spouliot
Date: 2007-11-20 11:02:52 -0500 (Tue, 20 Nov 2007)
New Revision: 89986

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/uielement.cpp
Log:
uielement.cpp: Ensure the default value for VisibilityProperty is 
VisibilityCollapsed even if the value is invalid (for Javascript compatibility, 
since 1.1 should throw an exception). See #340799

Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-11-20 15:48:20 UTC (rev 89985)
+++ trunk/moon/src/ChangeLog    2007-11-20 16:02:52 UTC (rev 89986)
@@ -1,3 +1,9 @@
+2007-11-20  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * uielement.cpp: Ensure the default value for VisibilityProperty
+       is VisibilityCollapsed even if the value is invalid (for Javascript
+       compatibility, since 1.1 should throw an exception). See #340799
+
 2007-11-20  Stephane Delcroix  <[EMAIL PROTECTED]>
 
        * uielement.cpp: FullInvalidate on setting Viibility to Visible.

Modified: trunk/moon/src/uielement.cpp
===================================================================
--- trunk/moon/src/uielement.cpp        2007-11-20 15:48:20 UTC (rev 89985)
+++ trunk/moon/src/uielement.cpp        2007-11-20 16:02:52 UTC (rev 89986)
@@ -129,20 +129,15 @@
                UpdateTotalOpacity ();
        }
        else if (prop == UIElement::VisibilityProperty) {
-               int v = GetValue (prop)->AsInt32();
-               switch (v) {
-               default:
-                       /* note: invalid values should be trapped in SetValue 
(see bug #340799) */
-                       g_warning ("Invalid value (%d) specified for 
UIElement::VisibilityProperty.", v);
-                       /* continue as default (VisibilityVisible) */
-               case VisibilityVisible:
+               // note: invalid enum values are only validated in 1.1 (managed 
code),
+               // the default value for VisibilityProperty is 
VisibilityCollapsed
+               // (see bug #340799 for more details)
+               if (GetValue (prop)->AsInt32() == VisibilityVisible) {
                        flags |= UIElement::RENDER_VISIBLE;
                        FullInvalidate (false);
-                       break;
-               case VisibilityCollapsed:
+               } else {
                        FullInvalidate (true);
                        flags &= ~UIElement::RENDER_VISIBLE;
-                       break;
                }
        }
        else if (prop == UIElement::IsHitTestVisibleProperty) {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to