Bug 734653 - Scrollbox should filter out hidden elements, since they are unscrollable.
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 13 Mar 2012 12:05:23 +0100
changeset 88943 c16f72c6237418540a1d8421f4b760f60aceb0d6
parent 88942 1ffea9163a9d40b1802acea1cff71078efe5d0bd
child 88944 d87ad51531b5c701fe5cefe04d58c6e11b27fb0e
push id22233
push usermak77@bonardo.net
push dateTue, 13 Mar 2012 13:50:06 +0000
treeherdermozilla-central@d87ad51531b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs734653
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 734653 - Scrollbox should filter out hidden elements, since they are unscrollable. r=mano
toolkit/content/tests/chrome/test_mousescroll.xul
toolkit/content/widgets/scrollbox.xml
--- a/toolkit/content/tests/chrome/test_mousescroll.xul
+++ b/toolkit/content/tests/chrome/test_mousescroll.xul
@@ -14,53 +14,57 @@ https://bugzilla.mozilla.org/show_bug.cg
   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378028"
      target="_blank">Mozilla Bug 378028</a>
   </body>
 
   <!-- richlistbox currently has no way of giving us a defined number of
        rows, so we just choose an arbitrary height limit that should give
        us plenty of vertical scrollability -->
   <richlistbox id="richlistbox" style="height:50px;">
+    <richlistitem id="richlistbox_item0" hidden="true"><label value="Item 0"/></richlistitem>
     <richlistitem id="richlistbox_item1"><label value="Item 1"/></richlistitem>
     <richlistitem id="richlistbox_item2"><label value="Item 2"/></richlistitem>
     <richlistitem id="richlistbox_item3"><label value="Item 3"/></richlistitem>
     <richlistitem id="richlistbox_item4"><label value="Item 4"/></richlistitem>
     <richlistitem id="richlistbox_item5"><label value="Item 5"/></richlistitem>
     <richlistitem id="richlistbox_item6"><label value="Item 6"/></richlistitem>
     <richlistitem id="richlistbox_item7"><label value="Item 7"/></richlistitem>
     <richlistitem id="richlistbox_item8"><label value="Item 8"/></richlistitem>
   </richlistbox>
 
   <listbox id="listbox" rows="2">
+    <listitem id="listbox_item0" label="Item 0" hidden="true"/>
     <listitem id="listbox_item1" label="Item 1"/>
     <listitem id="listbox_item2" label="Item 2"/>
     <listitem id="listbox_item3" label="Item 3"/>
     <listitem id="listbox_item4" label="Item 4"/>
     <listitem id="listbox_item5" label="Item 5"/>
     <listitem id="listbox_item6" label="Item 6"/>
     <listitem id="listbox_item7" label="Item 7"/>
     <listitem id="listbox_item8" label="Item 8"/>
   </listbox>
 
   <box orient="horizontal">
     <arrowscrollbox id="hscrollbox" clicktoscroll="true" orient="horizontal"
      smoothscroll="false" style="max-width:80px;" flex="1">
+      <hbox style="width:40px; height:20px; background:black;" hidden="true"/>
       <hbox style="width:40px; height:20px; background:white;"/>
       <hbox style="width:40px; height:20px; background:black;"/>
       <hbox style="width:40px; height:20px; background:white;"/>
       <hbox style="width:40px; height:20px; background:black;"/>
       <hbox style="width:40px; height:20px; background:white;"/>
       <hbox style="width:40px; height:20px; background:black;"/>
       <hbox style="width:40px; height:20px; background:white;"/>
       <hbox style="width:40px; height:20px; background:black;"/>
     </arrowscrollbox>
   </box>
 
   <arrowscrollbox id="vscrollbox" clicktoscroll="true" orient="vertical"
    smoothscroll="false" style="max-height:80px;" flex="1">
+      <vbox style="width:100px; height:40px; background:black;" hidden="true"/>
       <vbox style="width:100px; height:40px; background:white;"/>
       <vbox style="width:100px; height:40px; background:black;"/>
       <vbox style="width:100px; height:40px; background:white;"/>
       <vbox style="width:100px; height:40px; background:black;"/>
       <vbox style="width:100px; height:40px; background:white;"/>
       <vbox style="width:100px; height:40px; background:black;"/>
       <vbox style="width:100px; height:40px; background:white;"/>
       <vbox style="width:100px; height:40px; background:black;"/>
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -185,17 +185,17 @@
         document.defaultView.getComputedStyle(this._scrollbox, "").direction == "rtl";
       ]]></field>
 
       <field name="_scrollTarget">null</field>
 
       <method name="_canScrollToElement">
         <parameter name="element"/>
         <body>
-          return true;
+          return !element.hidden;
         </body>
       </method>
 
       <method name="ensureElementIsVisible">
         <parameter name="element"/>
         <parameter name="aSmoothScroll"/>
         <body><![CDATA[
           if (!this._canScrollToElement(element))