Author: mhabersack
Date: 2007-10-17 21:39:42 -0400 (Wed, 17 Oct 2007)
New Revision: 87728

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js
Log:
2007-10-18  Marek Habersack  <[EMAIL PROTECTED]>

        * Menu.js: a workaround for an IE bug. IE recalculates element's
         offsetWidth when the element's _height_ is set - which in case of
         elements with overflowing content results in a value that's just
         slightly smaller than the client window width. In effect, a long
         submenu will also be very wide, which isn't desirable. Fixes bug
         #322809


Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-10-17 23:39:08 UTC (rev 87727)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-10-18 01:39:42 UTC (rev 87728)
@@ -1,3 +1,12 @@
+2007-10-18  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * Menu.js: a workaround for an IE bug. IE recalculates element's
+        offsetWidth when the element's _height_ is set - which in case of
+        elements with overflowing content results in a value that's just
+        slightly smaller than the client window width. In effect, a long
+        submenu will also be very wide, which isn't desirable. Fixes bug
+        #322809
+
 2007-10-15  Marek Habersack  <[EMAIL PROTECTED]>
 
        * ObjectDataSourceView.cs: use HttpApplication.LoadType instead of

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js        
2007-10-17 23:39:08 UTC (rev 87727)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.js        
2007-10-18 01:39:42 UTC (rev 87728)
@@ -7,7 +7,7 @@
        if (subm.parentMenu == null && parentId != null)
                subm.parentMenu = getSubMenu (menuId, parentId);
        
-       if (subm.firstShown != true) {
+       if (subm.firstShown != true) {          
                var item = getMenuItem (menuId, itemId);
                var offx = 0;
                var offy = 0;
@@ -27,6 +27,7 @@
                var submMargin = subm.offsetHeight - subm.clientHeight;
                subm.initialOffsetHeight = subm.offsetHeight - 
subm.scrollButtonsHeight + submMargin;
                subm.firstShown = true;
+               
        }
        
        Menu_SetActive (menu, subm);
@@ -167,6 +168,14 @@
        box.scrollTop = 0;
        var bottom = subm.offsetTop + subm.initialOffsetHeight - 
parent.scrollTop;
        var displayScroll;
+
+       /*
+        * This is a workaround for an IE bug. IE recalculates the box 
offsetWidth when
+        * the box _height_ is set below - which in case of boxes with 
overflowing content
+        * results in a value that's just slightly smaller than the client 
window width.
+        * In effect, a long submenu will also be very wide, which isn't 
desirable.
+        */
+       var newWidth = box.offsetWidth;
        
        if (bottom > parent.clientHeight /* && parent.scrollHeight > 
parent.clientHeight*/) {
                var overflow = bottom - parent.clientHeight;
@@ -181,12 +190,14 @@
                        box.style.overflow = "hidden";
                        box.style.height = bh + "px";
                        displayScroll = "block";
+                       
                }
        } else {
                displayScroll = "none";
                box.style.height = subm.initialContentHeight + "px";
        }
-       subm.style.width = box.offsetWidth + "px";
+       subm.style.width = newWidth + "px";
+
        var btn = getMenuScrollBox (menuId, itemId, "u");
        btn.style.display = displayScroll;
        btn = getMenuScrollBox (menuId, itemId, "d");

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

Reply via email to